As far as I can see, we could implement an instance MonadReader s (StateT s m):
instance MonadReader s (StateT s m) where
ask = get
local f m = do
s <- get
put (f s)
m
put s
i.e. why is it not
class MonadReader s m => MonadState s m | s -> m where ...
Similarly, we could have an instance Monoid s => MonadWriter s (StateT s m).
Is there any deep reason between the choices?
This question is motivated by the fact there should be MonadErrorand MonadWriter
superclassesMonadChronicle
source
share