Re: [Haskell-cafe] problem using ST monad

2008-10-26 Thread Henning Thielemann
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

Re: [Haskell-cafe] problem using ST monad

2008-10-26 Thread Paul L
Thanks very much for the explanation, I now have a better understanding. On 10/26/08, David Menendez [EMAIL PROTECTED] wrote: ..[snipped].. It may be helpful to rewrite the types with a more explicit notation. For example, runST :: (a :: *) - ((s :: *) - ST s a) - a mapST_wrong :: (a :: *)

Re: [Haskell-cafe] problem using ST monad

2008-10-26 Thread David Menendez
On Sun, Oct 26, 2008 at 8:17 AM, Paul L [EMAIL PROTECTED] wrote: Thanks very much for the explanation, I now have a better understanding. I'm glad I could help. On 10/26/08, David Menendez [EMAIL PROTECTED] wrote: ..[snipped].. It may be helpful to rewrite the types with a more explicit

Re: [Haskell-cafe] problem using ST monad

2008-10-25 Thread Daniel Fischer
Am Sonntag, 26. Oktober 2008 02:18 schrieb Paul L: 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

Re: [Haskell-cafe] problem using ST monad

2008-10-25 Thread David Menendez
On Sat, Oct 25, 2008 at 11:55 PM, Paul L [EMAIL PROTECTED] wrote: Tnaks for the clarification, please see my further questions below On 10/25/08, Daniel Fischer [EMAIL PROTECTED] wrote: Sure, (g (flip readArray 0)) :: ST s Int, or, explicitly, forall s. ST s Int, there's nothing to restrict