[web-devel] ALPHA: http-types 0.1

Aristid Breitkreuz aristidb at googlemail.com
Fri Feb 4 20:37:18 CET 2011

Christian, I incorporated your approach of defining the ADT, and Michael's
suggestions into


http-types 0.2.0 - http://hackage.haskell.org/package/http-types-0.2.0

* StdMethod is an enumeration without OtherMethod constructor, containing
only RFC 2616 standard HTTP methods.
* parseMethod :: ByteString -> Either ByteString StdMethod (I think the type
says all).
* There are a few pre-defined Headers (headerAccept...)
* urlEncode / urlDecode
* Parsing and rendering of query strings (Query / SimpleQuery).

I hope this is closer to what most people would consider a nice version.


2011/2/4 Christian Maeder <Christian.Maeder at dfki.de>

> Am 04.02.2011 11:49, schrieb Christian Maeder:
> > The disadvantage for just strings are possible spelling errors. With
> > constants or constructors spelling errors are detected by the compiler
> > (but you still can confuse constants having the same type).
> Therefore just having
>  type Method = ByteString
> is also less safe, because constants for methods and i.e. header names
> (if they are also just byte strings) can be mixed up without type errors.
> Better would be a newtype wrapper around byte strings (or just strings):
>  newtype Method = M ByteString
> But I do not want to interfere with Michael Snoymann's compatibility
> issues for wai.
> Cheers Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20110204/81c41225/attachment.htm>

More information about the web-devel mailing list