Conversation
log-base/src/Log/Monad.hs
Outdated
| deriving (Alternative, Applicative, Functor, Monad, MonadBase b, MonadCatch | ||
| ,MonadIO, MonadMask, MonadPlus, MonadThrow, MonadTrans) | ||
|
|
||
| instance MonadError e m => MonadError e (LogT m) where |
There was a problem hiding this comment.
Given that we have GND enabled, can't we avoid writing these instances by hand by mentioning them in the derving clause above?
| throwError = lift . throwError | ||
| catchError m h = LogT $ unLogT m `catchError` (unLogT . h) | ||
|
|
||
| instance MonadReader r m => MonadReader r (LogT m) where |
There was a problem hiding this comment.
I think it's better to use the default ReaderT instance for MonadReader instead of this one as well. It'd be used to access LoggerEnv and to access the underlying one you'd use lift ask.
There was a problem hiding this comment.
I'm 👎, it's a bit like writing of MonadReader s (StateT m) where ask = get, correct but weird. I'd rather leave ability to write LogT (ReaderT r m) a for people if they want to do so.
EDIT I add LogT only to add MonadLog to the stack, nothing else.
There was a problem hiding this comment.
OK. Just add a comment that the MonadReader instance doesn't give you access to LoggerEnv.
|
I'm actually surprised that |
No description provided.