I mean why doesn't it come the last?
Because of this convention to evaluate a transformer stack one has to write an awkward thing like that:
runStateT (runReaderT (runRWST stack r s) r') s'
instead of:
runStateT s' $ runReaderT r' $ runRWST r s $ stack
And combining it with immediate do
becomes all the more awkward:
let
action = do
liftIO $ putStrLn "Do"
liftIO $ putStrLn "something"
in runStateT (runReaderT (runRWST action r s) r') s'
instead of:
runStateT s' $ runReaderT r' $ runRWST r s $ do
liftIO $ putStrLn "Do"
liftIO $ putStrLn "something"
Does this have any motivation behind or is this just an unfortunate convention?
BTW, I do realize that the current convention makes it easy to implement the "run" function using the record syntax, but this can't be an argument, since libraries must prefer usability to easiness of implementation.