http-monad-0.1: Monad abstraction for HTTP allowing lazy transfer and non-I/O simulation

Portabilitynon-portable (not tested)



Provide the functionality of Network.HTTP.Headers with qualified identifier style.



class HasHeaders x where

HasHeaders is a type class for types containing HTTP headers, allowing you to write overloaded header manipulation functions for both Request and Response data types, for instance.


getHeaders :: x -> [Header]

setHeaders :: x -> [Header] -> x

data Header

The Header data type pairs header names & values.


Header HeaderName String 


data HeaderName

HTTP HeaderName type, a Haskell data constructor for each specification-defined header, prefixed with Hdr and CamelCased, (i.e., eliding the - in the process.) Should you require using a custom header, there's the HdrCustom constructor which takes a String argument.

Encoding HTTP header names differently, as Strings perhaps, is an equally fine decidedly clear winner, but let's stick with data constructors here.

setMany :: HasHeaders x => x -> [T] -> xSource

getMany :: HasHeaders x => x -> [T]Source

modifyMany :: HasHeaders x => ([T] -> [T]) -> x -> xSource

insert :: HasHeaders a => Name -> String -> a -> aSource

insertMany :: HasHeaders a => [T] -> a -> aSource

Inserts a header with the given name and value. Allows duplicate header names.

Adds the new header only if no previous header shares the same name.

Removes old headers with duplicate name.

Inserts multiple headers.

retrieveMany :: HasHeaders a => Name -> a -> [T]Source

Gets a list of headers with a particular Name.

replace :: HasHeaders a => Name -> String -> a -> aSource

find :: HasHeaders a => Name -> a -> Maybe StringSource

Lookup presence of specific Name in a list of Headers Returns the value from the first matching header.