
6 Dec
2012
6 Dec
'12
7:06 p.m.
this code compiles correcly: newtype State s a = State { runState :: *s* -> (a,s) } instance Monad (State s) where --return :: a -> State s a return x = State (\st -> (*x,st*)) but this one doesn't compile: newtype State s a = State { runState :: *a* -> (a,s) } instance Monad (State s) where --return :: a -> State s a return x = State (\st -> (*st,x*)) Why is this happening?