[Haskell-cafe] ST not strict enough?

Yves Parès limestrael at gmail.com
Fri Nov 18 13:00:59 CET 2011


Okay, thanks
I was pretty sure I was wrong (or else somebody would already have come up
with that solution), but I wanted to know why.


2011/11/18 Daniel Fischer <daniel.is.fischer at googlemail.com>

> On Friday 18 November 2011, 11:18:33, Yves Parès wrote:
> > Instead of rewriting modifySTRef, why not just do :
> >
> > modifySTRef counter (\x -> let y = x+1 in y `seq` y)
> >
> > Is there a problem with that?
>
> Yes, y `seq` y is precisely the same as y.
>
> a `seq` b means whenever evaluation of b is demanded, also evaluate a (to
> WHNF).
> So y `seq` y ~> whenever evaluation of y is demanded, also evaluate y.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111118/7d97fdb3/attachment.htm>


More information about the Haskell-Cafe mailing list