[Haskell-cafe] ????Pattern match(es) are overlapped???
Arjan van IJzendoorn
afie at cs.uu.nl
Mon Mar 22 11:29:31 EST 2004
> newtype Method = Method String
> getMethod = Method "GET"
> putMethod = Method "PUT"
>
> [...]
>
> doMeth getMethod = ...
> doMeth putMethod = ...
For Haskell the last two lines look both like pattern-matching on a variable
which always matches. You might as well have written:
doMeth x = ...
doMeth y = ...
There is no macro facility in Haskell so you cannot give patterns a name
like you do in line 2 and 3.
You will have to write:
doMeth (Method "GET") = ...
doMeth (Method "PUT") = ...
Good luck, Arjan
More information about the Haskell-Cafe
mailing list