Gabriella439 / Haskell-MMorph-Library

Monad morphisms
BSD 3-Clause "New" or "Revised" License
47 stars 26 forks source link

Add instances for typeclasses in mtl #26

Closed RyanGlScott closed 8 years ago

RyanGlScott commented 8 years ago

This adds MonadCont, MonadError, MonadRWS, MonadReader, MonadState, and MonadWriter instances for ComposeT. With these instances, it's now much easier to GeneralizedNewtypeDeriving your way to a a fully functional monad transformer stack:

newtype Stack m a = Stack ((ReaderT Int `ComposeT` StateT Bool `ComposeT` WriterT String) m a)
  deriving ( Functor
           , Applicative
           , Monad
           , MonadTrans
           , MonadReader Int
           , MonadState Bool
           , MonadWriter String
           )
Gabriella439 commented 8 years ago

This one is really useful! Thanks :)