[Haskell-cafe] Monad and Monad transformer ???
Maverick
duongthaiha at gmail.com
Sun May 6 11:43:50 EDT 2007
hi
I am a newbee to haskell so please forgive me if the question is not
appropreate.
I am trying to get the idea of using Monad and have to understand the
following code.
Can you please tell me is how different Monad and Monad transformer is?
And what is mean by
> newtype State s a = State { runState :: s -> (a, s) }
---------------------------------
Define (State s) as a State monad
> instance Monad (State s) where
> return a = State $ \s -> (a,s)
> m >>= k = State $ \s -> let (a,s') = runState m s in runState (k a) s'
Thanks lot for your help
I really do appreciate that
Best regard
--
View this message in context: http://www.nabble.com/Monad-and-Monad-transformer-----tf3699943.html#a10346474
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
More information about the Haskell-Cafe
mailing list