
31 May
2011
31 May
'11
5:09 p.m.
Apparently:
Prelude> let r = (fmap (1:) r) :: IO [Integer]
Prelude> fmap (take 5) r
*** Exception: stack overflow
Thanks - I'll just have to stay out of IO for this, then.
On Tue, May 31, 2011 at 17:05, Stephen Tetley
2011/5/31 Scott Lawrence
: Evaluation here also doesn't terminate (or, (head $ unfoldM (return . head)) doesn't), although I can't figure out why. fmap shouldn't need to fully evaluate a list to prepend an element, right?
I'm afriad fmap doesn't get to choose - if the monad is strict then both definitions are equivalent (probably...).
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Scott Lawrence