[Haskell-cafe] stack overflow when using ST monad

Bulat Ziganshin bulat.ziganshin at gmail.com
Thu Aug 24 13:04:13 EDT 2006


Hello Gregory,

Thursday, August 24, 2006, 4:43:57 PM, you wrote:

> I agree this should be a FAQ.

we already have something like this on performance/strictness
wikipage. although adding your example of misusing $! may be helpful -
peoples are always better learned on (good and bad) examples rather on
bare theory

> Perhaps I should write it up for the
> performance section of the wiki?  Looking back I see my mental error
> was that I thought I was doing what you and everyone else correctly
> suggested:

>         writeSTRef (state t) $! nextState s

> but what I actually typed was

>         writeSTRef (state t) (nextState $! s)

> which of course doesn't help.  Another telling example
> of the fact that coffee is not an entirely adequate substitute for
> sleep.


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list