[web-devel] ALPHA: http-types 0.1

Christian Maeder Christian.Maeder at dfki.de
Fri Feb 4 09:43:00 CET 2011


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:
> 
> http://hackage.haskell.org/package/http-types-0.1

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



More information about the web-devel mailing list