This defines a typeclass HasLgRepo m with getRepository :: m LgRepo to generalize the concrete ReaderT LgRepo m type with a HasLgRepo m => m constraint.
The motivating use case is: I'm writing a Yesod app and would like for my Handler monad stack to satisfy MonadGit LgRepo Handler. The existing implementation rather strongly forces me to use a ReaderT LgRepo Handler, but with this change it's trivial for me to define a HasLgRepo instance and get the desired MonadGit instance without having to manually specify all the MonadGit fields.
As far as I can tell, this should be fully backwards compatible, since instance Monad m => HasLgRepo (ReaderT LgRepo m) where getRepository = ask.
Somewhat new to Haskell PRs here, so if there's anything else I can do (documentation, tests) to help out, please feel free to indicate that, and I'd be happy to. Thanks for this project; it's been a big help!
This defines a typeclass
HasLgRepo m
withgetRepository :: m LgRepo
to generalize the concreteReaderT LgRepo m
type with aHasLgRepo m => m
constraint.The motivating use case is: I'm writing a Yesod app and would like for my
Handler
monad stack to satisfyMonadGit LgRepo Handler
. The existing implementation rather strongly forces me to use aReaderT LgRepo Handler
, but with this change it's trivial for me to define aHasLgRepo
instance and get the desiredMonadGit
instance without having to manually specify all theMonadGit
fields.As far as I can tell, this should be fully backwards compatible, since
instance Monad m => HasLgRepo (ReaderT LgRepo m)
wheregetRepository = ask
.Somewhat new to Haskell PRs here, so if there's anything else I can do (documentation, tests) to help out, please feel free to indicate that, and I'd be happy to. Thanks for this project; it's been a big help!