[web-devel] ALPHA: http-types 0.1
Aristid Breitkreuz
aristidb at googlemail.com
Fri Feb 4 11:04:46 CET 2011
Interesting idea. I don't really like that StdMethod cannot encode custom
methos though.
data Method = Std StdMethod ¦ Ext ByteString
Might work. But is the complexity worth it?
Am 04.02.2011 09:43 schrieb "Christian Maeder" <Christian.Maeder at dfki.de>:
Am 03.02.2011 22:42, schrieb Aristid Breitkreuz:
> Hi,
>
> I just wanted to announce that I uploaded a first version of http-types
> to hackage:
>
...
With your two types Method and MethodADT I would omit "OtherMethod" in
MethodADT, since a mere enumeration type is much better:
data StdMethod
= GET
| POST
| HEAD
| PUT
| DELETE
| TRACE
| CONNECT
| OPTIONS
deriving (Show, Eq, Ord, Enum, Bounded)
method :: StdMethod -> Method
method = Ascii.pack . show
methodListB :: [(Method, StdMethod)]
methodListB = map (\ s -> (method s, s))
[minBound .. maxBound]
methodToStdMethod :: Method -> Maybe StdMethod
methodToStdMethod = flip lookup methodListB
Cheers Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20110204/c2d1f5e5/attachment.htm>
More information about the web-devel
mailing list