
12 Nov
2015
12 Nov
'15
5 p.m.
Hi, my first intuition about this is that in data constructor it technically doesn't matter, but you could argue that "a" represents the actual result of the function so it comes first. Second comes the state, which is the side thing, hence the secondary/less important position. As for the order of type constructor parameters you are right - state is part of the structure that Monoid, Functor, Applicative, Monad and the like use. Martin martin:
runState :: State s a -> s -> (a, s)
I understand that in the constructor s has to be first, so we can turn (State s) into a monad. But why doesn't s come first in the result too, as in
runState :: State s a -> s -> (s, a)