@@ -45,6 +45,7 @@ import qualified Control.Newtype as NT
45import qualified Control.Monad.Trans.Control as MC
45import qualified Control.Monad.Trans.Control as MC
46import qualified Control.Monad.Trans.Writer.Lazy as Trans
46import qualified Control.Monad.Trans.Writer.Lazy as Trans
48+import qualified Control.Monad.Trans.Lift.StT as Lift
48import qualified Control.Monad.Trans.Lift.Local as Lift
49import qualified Control.Monad.Trans.Lift.Local as Lift
49import qualified Control.Monad.Trans.Lift.Catch as Lift
50import qualified Control.Monad.Trans.Lift.Catch as Lift
50import qualified Control.Monad.Trans.Lift.Listen as Lift
51import qualified Control.Monad.Trans.Lift.Listen as Lift
@@ -69,7 +70,7 @@ type Writer tag w = WriterT tag w Identity
70-- The 'return' function produces the output 'mempty', while '>>=' combines
71-- The 'return' function produces the output 'mempty', while '>>=' combines
71-- the outputs of the subcomputations using 'mappend'.
72-- the outputs of the subcomputations using 'mappend'.
72−newtype WriterT tag w m a = WT { runWT :: Trans.WriterT w m a }
73+newtype WriterT tag w m a = WriterT (Trans.WriterT w m a)
73 deriving ( Generic
74 deriving ( Generic
74 , Functor, Applicative, Alternative, Monad, MonadPlus
75 , Functor, Applicative, Alternative, Monad, MonadPlus
75 , MonadFix, MonadTrans, MonadIO, MFunctor, MMonad )
76 , MonadFix, MonadTrans, MonadIO, MFunctor, MMonad )
@@ -78,18 +79,26 @@ instance NT.Newtype (WriterT tag w m a)
79instance Monoid w => MC.MonadTransControl (WriterT tag w) where
80instance Monoid w => MC.MonadTransControl (WriterT tag w) where
80 type StT (WriterT tag w) a = MC.StT (Trans.WriterT w) a
81 type StT (WriterT tag w) a = MC.StT (Trans.WriterT w) a
81− liftWith = MC.defaultLiftWith WT runWT
82+ liftWith = MC.defaultLiftWith NT.pack NT.unpack
82− restoreT = MC.defaultRestoreT WT
83+ restoreT = MC.defaultRestoreT NT.pack
85+type instance Lift.StT (WriterT tag w) a = MC.StT (WriterT tag w) a
84−instance Monoid w => Lift.LiftLocal (WriterT tag w)
87+instance Monoid w => Lift.LiftLocal (WriterT tag w) where
88+ liftLocal = Lift.defaultLiftLocal NT.pack NT.unpack
85−instance Monoid w => Lift.LiftCatch (WriterT tag w)
90+instance Monoid w => Lift.LiftCatch (WriterT tag w) where
91+ liftCatch = Lift.defaultLiftCatch NT.pack NT.unpack
86−instance Monoid w => Lift.LiftListen (WriterT tag w)
93+instance Monoid w => Lift.LiftListen (WriterT tag w) where
94+ liftListen = Lift.defaultLiftListen NT.pack NT.unpack
88instance Monoid w' => Lift.LiftPass (WriterT tag w') where
96instance Monoid w' => Lift.LiftPass (WriterT tag w') where
89− liftPass pass' m = WT $ Lift.liftPass pass' (runWT m)
97+ liftPass = Lift.defaultLiftPass NT.pack NT.unpack
91instance Monoid w => Lift.LiftCallCC (WriterT tag w) where
99instance Monoid w => Lift.LiftCallCC (WriterT tag w) where
92− liftCallCC callCC f = WT $ Lift.liftCallCC callCC (\g -> (runWT . f) (WT . g))
100+ liftCallCC = Lift.defaultLiftCallCC WT runWT
101+ liftCallCC' = Lift.defaultLiftCallCC WT runWT
94instance Taggable (WriterT tag w m) where
103instance Taggable (WriterT tag w m) where
95 type Tag (WriterT tag w m) = 'Just tag
104 type Tag (WriterT tag w m) = 'Just tag