Thomas Hallgren <[EMAIL PROTECTED]> replies to Simon M:
> Simon Marlow wrote:
>
> >The real problem is that lazy I/O injects side effects into the pure
> >world of expressions. Haskell has a perfectly good system for
> >encapsulating side effects - the IO monad. So why put these sneaky side
> >e
> main =
> do let mylist = [1..1]
> writeFile "myfile.txt" (unlines (map show mylist))
This part does run in O(1) space and isn't problematic.
> -- ...
> mylist' <- (map read . lines) `fmap` readFile "myfile.txt"
> let result = sum mylist'
> print result
Indeed, thi
Simon Marlow wrote:
The real problem is that lazy I/O injects side effects into the pure
world of expressions. Haskell has a perfectly good system for
encapsulating side effects - the IO monad. So why put these sneaky side
effects into pure values?
Although monadic IO is nice in many ways, I