[Haskell-cafe] STUArray's newArray_ breaks referential transparency

Stefan O'Rear stefanor at cox.net
Thu Dec 7 20:47:12 EST 2006


newArray_ allocates an array full of garbage.

> import Control.Monad.ST
> import Data.Array.ST
> import Data.Array
> 
> tickle :: Int
> tickle = runST (do {
>      x <- newArray_ (0,100) ;
>      (readArray :: STUArray s Int Int -> Int -> ST s Int) x 3
>    })


More information about the Haskell-Cafe mailing list