[Haskell-cafe] Trouble with the ST monad

Andre Nathan andre at digirati.com.br
Sun Dec 21 20:44:34 EST 2008


On Sun, 2008-12-21 at 16:47 -0800, Ryan Ingram wrote:
> The problem is that you are trying to return a mutable array out of an
> ST computation.  This lets the "mutability" of the computation escape.
>  That's what the "s" type variable is for;  without it, runST is just
> unsafePerformIO.

Thanks!

If only I knew that was the problem... It wouldn't have costed me the 
whole afternoon :P

Is there any difference between using freeze/thaw from Data.Array.MArray
versus freezeSTArray/thawSTArray from GHC.Arr?

Best,
Andre



More information about the Haskell-Cafe mailing list