Luis O'Shea wrote:
One way to do this is to stack two StateTs on top of m.
Another way, what might be easier to reason about, is to crush those two
layers together and use a tuple for the state:
StateT s1 (StateT s2 m) a == StateT (s1,s2) m a
Then the only thing you'll have to worry
test3 :: MonadState Integer m = String - m String
Good point. It's interesting that this allows the signature of
test5b to become MonadState Integer m = m Integer (instead of (Monad
m) = StateT Integer (StateT String m) Integer) which is more
general, and (surprisingly to me) does not
On Sun, Feb 22, 2009 at 9:20 AM, Luis O'Shea los...@gmail.com wrote:
test3 :: MonadState Integer m = String - m String
Good point. It's interesting that this allows the signature of test5b to
become MonadState Integer m = m Integer (instead of (Monad m) = StateT
Integer (StateT String m)
Am Sonntag, 22. Februar 2009 18:53 schrieb David Menendez:
On Sun, Feb 22, 2009 at 9:20 AM, Luis O'Shea los...@gmail.com wrote:
test3 :: MonadState Integer m = String - m String
Good point. It's interesting that this allows the signature of test5b to
become MonadState Integer m = m
On Sun, Feb 22, 2009 at 3:17 PM, Daniel Fischer
daniel.is.fisc...@web.de wrote:
test5b :: (Monad (StateT [Char] (StateT s m)),
MonadState s (StateT s m),
Num s,
Monad m) =
m s
Doesn't 'Monad m' imply 'MonadState s (StateT s m)' which implies
'Monad
Am Sonntag, 22. Februar 2009 19:29 schrieb Felipe Lessa:
Did I make any mistakes?
No, I did. I didn't read it properly, saw the MonadState s ... there and
thought it was MonadState s m instead of MonadState s (StateT s m).
Sorry,
Daniel
___
I've been experimenting with the state monad and with StateT, and
have some questions about how to combine one state with another.
This email is literate Haskell tested on GHCi, version 6.10.1. Also,
sigfpe's post on monad transformers (http://blog.sigfpe.com/2006/05/
On Sat, Feb 21, 2009 at 3:33 PM, Luis O'Shea los...@gmail.com wrote:
I've been experimenting with the state monad and with StateT, and have some
questions about how to combine one state with another.
snip
test3 :: Monad m = String - StateT Integer m String
test3 s = do
modify (+ 1)
a -
On Sat, Feb 21, 2009 at 5:37 PM, David Menendez d...@zednenem.com wrote:
PS. Here are two functions that I ended up not using in my examples,
but which may come in handy when dealing with nested applications of
StateT:
curryStateT :: (Monad m) = StateT (s,t) m a - StateT s (StateT t m) a