Why GHC doesn't warn about LHS nullary-constructor pattern bindings?

Henning Thielemann lemming at henning-thielemann.de
Thu Jul 19 12:56:44 CEST 2012

On Thu, 19 Jul 2012, Herbert Valerio Riedel wrote:

> Recently, I was a bit suprised that GHC didn't warn about useless
> `where` definitions such as the following when using `-Wall` (and I
> couldn't find a respective warning GHC CLI flag which would have enabled
> reporting a warning in this case -- unless I missed it)
>  module Foo where
>  foo :: Int -> Int
>  foo n = n + 1
>    where
>      Nothing = Just n

I think that

     x at Nothing = Just n

could be useful, if 'x' is evaluated somewhere.

More information about the Glasgow-haskell-users mailing list