[Haskell-cafe] Converting IO [XmlTree] to [XmlTree]

Luke Palmer lrpalmer at gmail.com
Sun Apr 19 15:24:59 EDT 2009


On Sun, Apr 19, 2009 at 9:48 AM, Manlio Perillo <manlio_perillo at libero.it>wrote:

> Henning Thielemann ha scritto:
> >
> > On Tue, 14 Apr 2009, rodrigo.bonifacio wrote:
> >
> >> I guess this is a very simple question. How can I convert IO [XmlTree]
> >> to just a list of
> >> XmlTree?
> >
> > The old Wiki had:
> >   http://www.haskell.org/wikisnapshot/ThatAnnoyingIoType.html
> >
> > Should be ported to the new Wiki since it is a FAQ ...
>
> Note that it is not always possible to separate IO from pure code.
> As an example, consider an HTTP 1.1 server that read a request body
> containing a number for each line, and return a response body containing
> the sum of the numbers.


What?

sumRequest :: String -> String
-- strips header, sums numbers, returns response

sumServer :: IO ()
-- reads from socket, writes sumRequest to socket

And many other permutations, with differing degrees of laziness and
parametericity.

Luke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090419/d4e4599e/attachment.htm


More information about the Haskell-Cafe mailing list