Closed hesselink closed 11 years ago
I assume you're talking about a MonadReader instance like this?
instance MonadReader v (Handler b v)
If that's the case, I'm not really inclined to add that instance since it duplicates the functionality provided by the MonadState instance. Although I suppose it would be useful if you're interacting with some other library that needs a MonadReader. Is that your use case?
Yes, exactly. I have functions generalized over MonadReader
, which I can't use in a Handler
currently. Since every MonadState
is trivially a MonadReader
(through ask = get
and a slightly more convoluted local
definition), it seems like there are not many downsides. And StateT
itself also has a MonadReader
instance.
Ok, you convinced me. The fix is in commit 7a5f14bc2597583978404c3f84281320b1763d91.
Thanks!
The
Snap.Snaplet.Handler
type has aMonadState
instance, but noMonadReader
instance. Is there a good reason for this, or can one be added? I could send a pull request if you want.