[Haskell-cafe] ????Pattern match(es) are overlapped???
S. Alexander Jacobson
alex at alexjacobson.com
Mon Mar 22 14:14:56 EST 2004
I actually ended up using a lookup list e.g.
handlers=[(getMethod,doGet),(putMethod,doPut)]
which has the convenience of being able to put a
501 "Not Implemented" in an obvious place.
I'll post the code shortly. My goal is to form
the core of a generically useful HTTP
haskell server library.
-Alex-
On Mon, 22 Mar 2004, Ketil Malde wrote:
> "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
>
_________________________________________________________________
S. Alexander Jacobson mailto:me at alexjacobson.com
tel:917-770-6565 http://alexjacobson.com
More information about the Haskell-Cafe
mailing list