[Haskell-cafe] ST.Lazy vs ST.Strict

Luke Palmer lrpalmer at gmail.com
Tue May 5 17:27:29 EDT 2009

On Sun, May 3, 2009 at 11:27 AM, Tobias Olausson <tobsan at gmail.com> wrote:

> Hello!
> I have a program that is using ST.Strict, which works fine.
> However, the program needs to be extended, and to do that,
> lazy evaluation is needed. As a result of that, I have switched
> to ST.Lazy to be able to do stuff like

> foo y = do
>    x <- something
>    xs <- foo (y+1)
>    return (x:xs)

As Ryan points out, this will not do what you want.  But that is incidental,
not essential:

foo y = do
     x <- something
     fmap (x:) $ foo (y+1)

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

More information about the Haskell-Cafe mailing list