I mean, why is this not the last?
Because of this agreement, to evaluate the transformer stack, you need to write such an inconvenient thing:
runStateT (runReaderT (runRWST stack rs) r') s'
instead:
runStateT s' $ runReaderT r' $ runRWST rs $ stack
And combining it with immediate do is becoming more and more inconvenient:
let action = do liftIO $ putStrLn "Do" liftIO $ putStrLn "something" in runStateT (runReaderT (runRWST action rs) r') s'
instead:
runStateT s' $ runReaderT r' $ runRWST rs $ do liftIO $ putStrLn "Do" liftIO $ putStrLn "something"
Does this have motivation or is it just a bad agreement?
By the way, I understand that the existing convention simplifies the implementation of the "run" function using the write syntax, but this cannot be an argument, since libraries should prefer usability for ease of implementation.
haskell monad-transformers
Nikita Volkov
source share