
14 Apr
2011
14 Apr
'11
8:25 a.m.
Hi, I have a question about the context of the execWriterT function, in Control.Monad.Writer of the mtl package. The current context forces the containter type to be a Monad, while is enough a Functor. Yes, WriterT is a monad transformer, so this is not a problem, but I have as a law to write the less restrictive context for every function. So, is there any reason to do this context more restrictive? If not, the obvious way to do it may be: execWriterT :: Functor m => WriterT w m a -> m w execWriterT = fmap snd . runWriterT However, I thought that there must be a reason explaining this fact.