[Haskell-cafe] ST monad
oleg at pobox.com
oleg at pobox.com
Tue Jan 3 05:47:04 EST 2006
Bulat Ziganshin wrote:
the following code can't go through typechecking
> import Control.Monad.ST
> import Data.Array.ST
> main = print $ runST $
> do arr <- newArray (1,10) 127
> a <- readArray arr 1
> writeArray arr 1 216
> b <- readArray arr 1
> return (a,b)
Indeed. The short answer: use
runST (long expression)
rather than
runST $ long expression
when it comes to higher-ranked functions such as runST.
A longer answer:
http://www.haskell.org/pipermail/haskell-cafe/2004-December/008062.html
> let me know what i need to read to fix it myself
MLF (see Daan Leijen, A. Loeh, `Qualified types for MLF', ICFP05)
More information about the Haskell-Cafe
mailing list