
Hello all, there are two functions, where the order of parameters confuses me. Ons is 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) The other example is foldl, foldr foldl :: (a -> b -> a) -> a -> [b] -> a foldr :: (a -> b -> b) -> b -> [a] -> b For once the list is a list of as in foldl, but a list of as in foldr. Now that can be fixed with renaming the type parameters foldr :: (b -> a -> a) -> a -> [b] -> a this is the exact same thing and resembles more the type of foldl. But still the function argument has its parameters flipped. foldl's function takes the list element as second parameter and foldr's takes it as first parameter. Why is that so?