Parameter order of runReader, evalState (Was: expanded standard lib)

Isaac Dupree isaacdupree at charter.net
Thu Nov 22 10:01:48 EST 2007


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



More information about the Libraries mailing list