[Haskell-cafe] ????Pattern match(es) are overlapped???

Ketil Malde ketil+haskell at ii.uib.no
Mon Mar 22 11:31:40 EST 2004


"Arjan van IJzendoorn" <afie at cs.uu.nl> writes:

>>    newtype Method = Method String
>>    getMethod = Method "GET"
>>    putMethod = Method "PUT"
>>    doMeth getMethod = ...
>>    doMeth putMethod = ...

> You will have to write:
> 
> doMeth (Method "GET") = ...
> doMeth (Method "PUT") = ...

Or (I assume, haven't tested) if you insist on renaming the methods:

  doMeth m | m == getMethod = ...
           | m == putMethod = ...

(or using a case statement, of course)

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell-Cafe mailing list