
22 Nov
2007
22 Nov
'07
3:01 p.m.
Josef Svenningsson wrote:
The order of the run* functions comes from the fact that they are record selectors. This implies that they need to take the monadic computaion as their first argument. An example: newtype StateT s m a = StateT { runStateT :: s -> m (a,s) }
I'm guessing that evalState and the other derived functions inherited the argument order from the run* functions.
I also tend to the other order, with the monadic computation last.
I also tend to use them with 'flip', and was recently bemoaning this to myself! if records aren't constructed or pattern-matched with 'runStateT' (and why would they be?), it doesn't need to be a record selector... Isaac