> Compiling the following with ghc-4.06 produces an erroneous 
> error message:
> 
> module O where
> 
> a :: Int
> a = 1
> 
> b :: Int
> b = 2
> 
> c :: Int
> c = 3
> 
> f :: Int -> Bool
> f i = case i of
>    a -> True
>    b -> True
>    c -> True
> 
> 
> The compiler complains:
> 
> o.hs:14: Pattern match(es) are overlapped in a group of case 
> alternatives
> beginning
>                                             a:
>           b -> ...
>           c -> ...

You're not an Erlang programmer by any chance are you? :-)

As Kevin pointed out, the warning is correct.  In Haskell, a variable name
in a pattern is always a new binding, and shadows any existing bindings of
the same name.

Cheers,
        Simon

Reply via email to