[web-devel] Examples and/or tutorials for WAI
ndmitchell at gmail.com
Sat Feb 12 10:12:45 CET 2011
>> What tripped me up was trying to figure out the enumerator part of the
>> API so that I can read the request body (and turn it into a String)
>> and run the XML-RPC request handler. Any help would be appreciated!
In Hoogle I use, responseLBS to construct responses (from Wai), and
responseFlatten to deconstruct them:
responseFlatten :: Response -> IO (Status, ResponseHeaders, LBString)
responseFlatten r = responseEnumerator r $ \s hs -> do
builders <- consume
return (s, hs, toLazyByteString $ mconcat builders)
Now you can avoid knowledge of anything to do with enumerators etc.
(which I still don't understand!)
More information about the web-devel