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@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