On Sat, 25 Oct 2008, Paul L wrote:

I'm have some trouble using the ST monad, and I think
I'm confused about its use of existential type.

{-# OPTIONS -XRankNTypes #-}
import Control.Monad.ST
import Data.Array.ST

I want to implement a map function that unfold
all ST monads in a list:

mapST :: (a -> (forall s . ST s b)) -> [a] -> [b]
mapST f (x:xs) = runST (f x) : mapST f xs
mapST f [] = []

I think mapM with subsequent runST should work.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to