
26 Oct
2008
26 Oct
'08
6:31 a.m.
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.