[Haskell-cafe] Question about IO, interact functions,
David Leimbach
leimy2k at gmail.com
Tue May 19 14:33:27 EDT 2009
main = interact (unlines . lines)
This *appears* to somewhat reliably get me functionality that looks like
take a line of input, and print it out.
Is this behavior something I can rely on working?
I like the idea that lines can pull lines lazily from "getContents" which
lazily consume the input. But I'm concerned that relying on a pure function
like "unlines . lines" to sequence IO is a bit too implicit in nature.
I really like the idea of doing things through functions like Interact in
that they appear to allow me to keep most of my code pure, but if I can't
get the IO sequencing I want to be guaranteed to work, I suppose I'll have
to dive back into "imperative IO" land that I get from the IO Monad.
Should I feel guilty for doing so? :-)
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090519/04d1fb77/attachment.html
More information about the Haskell-Cafe
mailing list