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

Manlio Perillo manlio_perillo at libero.it
Tue Apr 21 09:56:30 EDT 2009


Luke Palmer ha scritto:
> [...]
>     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.
> 

As long as you stricly read a string from the socket, this is ok.
But you can not read a string lazily.



Regards  Manlio


More information about the Haskell-Cafe mailing list