ekmett/lens — pull request #493 by corngood (2014-10-24 21:55:29+00:00)
Title: [WIP] Fix warning from makeLenses when some constructors have no fields

The test is:

data A = A | B { _a :: Int }
makeLenses ''A

Which gives a "Warning: Pattern match(es) are overlapped"

It's currently generating a traversal like:

a _ _ = pure A
a b c = fmap B (b c)

By removing the fieldCount == 0 specialisation of makePureClause, I get:

a _ A = pure A
a b c = fmap B (b c)

Which gets rid of the warning for this test.

I haven't dug into it too deeply, and I've only tested on GHC 7.6.3, but I can't see an obvious problem with doing it this way.

I also removed the ghc<7.6.1 predicate on -Werror for templates.hs, so it would fail in testing. I don't get any other warnings in the file, but it must have been there for a reason.