@@ -25,15 +25,12 @@ module Control.Monad.Trans.Ether.Writer
2525 , tell
2626 , listen
2727 , pass
28− -- * Lifting other operations
29− , liftCallCC
3028 ) where
3129
3230#if __GLASGOW_HASKELL__ < 710
3331import Data.Monoid
3432#endif
3533
36−import Data.Proxy (Proxy(Proxy))
3734import Data.Functor.Identity (Identity(..))
3835import Data.Coerce (coerce)
3936import Control.Applicative
@@ -46,7 +43,6 @@ import Control.Ether.Tagged (Taggable(..), Tagged(..))
4643import GHC.Generics (Generic)
4744import qualified Control.Newtype as NT
4845
49−import qualified Control.Monad.Signatures as Sig
5046import qualified Control.Monad.Trans.Control as MC
5147import qualified Control.Monad.Trans.Writer.Lazy as Trans
5248
@@ -54,6 +50,7 @@ import qualified Control.Monad.Trans.Lift.Local as Lift
5450import qualified Control.Monad.Trans.Lift.Catch as Lift
5551import qualified Control.Monad.Trans.Lift.Listen as Lift
5652import qualified Control.Monad.Trans.Lift.Pass as Lift
53+import qualified Control.Monad.Trans.Lift.CallCC as Lift
5754
5855import qualified Control.Monad.Cont.Class as Class
5956import qualified Control.Monad.Reader.Class as Class
@@ -94,6 +91,9 @@ instance Monoid w' => Lift.LiftListen (WriterT tag w') where
9491instance Monoid w' => Lift.LiftPass (WriterT tag w') where
9592 liftPass pass m = WriterT $ Lift.liftPass pass (coerce m)
9693
94+instance Monoid w => Lift.LiftCallCC (WriterT tag w) where
95+ liftCallCC callCC f = WriterT $ Lift.liftCallCC callCC (coerce f)
96+
9797instance Taggable (WriterT tag w m) where
9898 type Tag (WriterT tag w m) = 'Just tag
9999 type Inner (WriterT tag w m) = 'Just m
@@ -130,9 +130,6 @@ execWriterT t = Trans.execWriterT . untagged t
130130execWriter :: proxy tag -> Writer tag w a -> w
131131execWriter t = Trans.execWriter . untagged t
132132
133−-- | Transform the computation inside a 'WriterT'.
134−--
135−
136133-- | Appends a value to the accumulator within the monad.
137134tell :: Monad m => proxy tag -> w -> WriterT tag w m ()
138135tell t w = writer t ((), w)
@@ -146,12 +143,8 @@ listen t m = tagged t $ Trans.listen (coerce m)
146143pass :: (Monoid w, Monad m) => proxy tag -> WriterT tag w m (a, w -> w) -> WriterT tag w m a
147144pass t m = tagged t $ Trans.pass (coerce m)
148145
149−-- | Lift a @callCC@ operation to the new monad.
150−liftCallCC :: Monoid w => proxy tag -> Sig.CallCC m (a, w) (b, w) -> Sig.CallCC (WriterT tag w m) a b
151−liftCallCC t callCC f = tagged t $ Trans.liftCallCC callCC (coerce f)
152−
153146instance (Monoid w, Class.MonadCont m) => Class.MonadCont (WriterT tag w m) where
154− callCC = liftCallCC Proxy Class.callCC
147+ callCC = Lift.liftCallCC Class.callCC
155148
156149instance (Monoid w, Class.MonadReader r m) => Class.MonadReader r (WriterT tag w m) where
157150 ask = lift Class.ask