on master help sign in
Allow building with mmorph-1.1.0 on GHC 8.0.1 and older
2acd5c6Ryan Scott
src/Ether/TaggedTrans.hs+7−2
@@ -7,7 +7,7 @@ import Control.Monad (MonadPlus)
7import Control.Monad.Fix (MonadFix)
7import Control.Monad.Fix (MonadFix)
8import Control.Monad.Trans.Class (MonadTrans, lift)
8import Control.Monad.Trans.Class (MonadTrans, lift)
9import Control.Monad.IO.Class (MonadIO)
9import Control.Monad.IO.Class (MonadIO)
10−import Control.Monad.Morph (MFunctor, MMonad)
10+import Control.Monad.Morph (MFunctor(..), MMonad)
11import Control.Monad.Catch (MonadThrow, MonadCatch, MonadMask)
11import Control.Monad.Catch (MonadThrow, MonadCatch, MonadMask)
12
12
13import qualified Control.Monad.Base as MB
13import qualified Control.Monad.Base as MB
@@ -33,7 +33,7 @@ newtype TaggedTrans tag trans m a = TaggedTrans (trans m a)
33 deriving
33 deriving
34 ( Generic
34 ( Generic
35 , Functor, Applicative, Alternative, Monad, MonadPlus
35 , Functor, Applicative, Alternative, Monad, MonadPlus
36− , MonadFix, MonadTrans, MonadIO, MFunctor, MMonad
36+ , MonadFix, MonadTrans, MonadIO, MMonad
37 , MonadThrow, MonadCatch, MonadMask )
37 , MonadThrow, MonadCatch, MonadMask )
38
38
39type Pack tag trans m a = trans m a -> TaggedTrans tag trans m a
39type Pack tag trans m a = trans m a -> TaggedTrans tag trans m a
@@ -174,3 +174,8 @@ instance
174 where
174 where
175 throwError = lift . Mtl.throwError
175 throwError = lift . Mtl.throwError
176 catchError = Lift.liftCatch Mtl.catchError
176 catchError = Lift.liftCatch Mtl.catchError
177+
178+-- NB: Don't use GeneralizedNewtypeDeriving to create this instance, as it will
179+-- trigger GHC Trac #11837 on GHC 8.0.1 and older.
180+instance MFunctor trans => MFunctor (TaggedTrans tag trans) where
181+ hoist f (TaggedTrans t) = TaggedTrans (hoist f t)