on master help sign in
Use liftListen and liftPass from transformers-lift
abfee98Index Int
src/Control/Ether/Util.hs+1−15
@@ -4,9 +4,7 @@
4{-# LANGUAGE TypeOperators #-}
4{-# LANGUAGE TypeOperators #-}
5{-# LANGUAGE TypeFamilies #-}
5{-# LANGUAGE TypeFamilies #-}
6module Control.Ether.Util
6module Control.Ether.Util
7− ( liftListen_WriterT
8− , liftPass_WriterT
9− , type (++)
7+ ( type (++)
10 , MaybeToList
8 , MaybeToList
11 , fmap
9 , fmap
12 ) where
10 ) where
@@ -29,18 +27,6 @@ type family MaybeToList (mt :: Maybe k) :: [k] where
29 MaybeToList 'Nothing = '[]
27 MaybeToList 'Nothing = '[]
30 MaybeToList ('Just t) = '[t]
28 MaybeToList ('Just t) = '[t]
31
29
32−-- TODO: Not sure if correct
33−liftListen_WriterT :: Monad m => Sig.Listen w' m (a, w) -> Sig.Listen w' (Trans.WriterT w m) a
34−liftListen_WriterT listen m = Trans.WriterT $ do
35− ~((a, w'), w) <- listen (Trans.runWriterT m)
36− return ((a, w), w')
37−
38−-- TODO: Not sure if correct
39−liftPass_WriterT :: Monad m => Sig.Pass w' m (a, w) -> Sig.Pass w' (Trans.WriterT w m) a
40−liftPass_WriterT pass m = Trans.WriterT $ pass $ do
41− ~((a, f), w) <- Trans.runWriterT m
42− return ((a, w), f)
43−
44#if __GLASGOW_HASKELL__ < 710
30#if __GLASGOW_HASKELL__ < 710
45fmap :: Monad f => (a -> b) -> f a -> f b
31fmap :: Monad f => (a -> b) -> f a -> f b
46fmap = Control.Monad.liftM
32fmap = Control.Monad.liftM
src/Control/Monad/Ether/Except.hs−1
@@ -12,7 +12,6 @@ module Control.Monad.Ether.Except
12 , ExceptT
12 , ExceptT
13 , exceptT
13 , exceptT
14 , runExceptT
14 , runExceptT
15− , mapExceptT
16 -- * Handle functions
15 -- * Handle functions
17 , handleT
16 , handleT
18 , handle
17 , handle
src/Control/Monad/Ether/Implicit/Except.hs−6
@@ -16,7 +16,6 @@ module Control.Monad.Ether.Implicit.Except
16 , ExceptT
16 , ExceptT
17 , exceptT
17 , exceptT
18 , runExceptT
18 , runExceptT
19− , mapExceptT
20 -- * Handle functions
19 -- * Handle functions
21 , handle
20 , handle
22 , handleT
21 , handleT
@@ -54,11 +53,6 @@ exceptT = Explicit.exceptT Proxy
54runExceptT :: ExceptT e m a -> m (Either e a)
53runExceptT :: ExceptT e m a -> m (Either e a)
55runExceptT = Explicit.runExceptT Proxy
54runExceptT = Explicit.runExceptT Proxy
56
55
57−-- | See 'Control.Monad.Ether.Except.mapExceptT'.
58−-- Note that due to implicit tagging the exception type cannot be changed.
59−mapExceptT :: (m (Either e a) -> n (Either e b)) -> ExceptT e m a -> ExceptT e n b
60−mapExceptT = Explicit.mapExceptT Proxy
61−
62-- | See 'Control.Monad.Ether.Except.handle'.
56-- | See 'Control.Monad.Ether.Except.handle'.
63handle :: (e -> a) -> Except e a -> a
57handle :: (e -> a) -> Except e a -> a
64handle = Explicit.handle (Proxy :: Proxy e)
58handle = Explicit.handle (Proxy :: Proxy e)
src/Control/Monad/Ether/Implicit/Reader.hs−5
@@ -18,7 +18,6 @@ module Control.Monad.Ether.Implicit.Reader
18 , ReaderT
18 , ReaderT
19 , readerT
19 , readerT
20 , runReaderT
20 , runReaderT
21− , mapReaderT
22 ) where
21 ) where
23
22
24import Data.Proxy
23import Data.Proxy
@@ -42,10 +41,6 @@ runReaderT = Explicit.runReaderT Proxy
42runReader :: Reader r a -> r -> a
41runReader :: Reader r a -> r -> a
43runReader = Explicit.runReader Proxy
42runReader = Explicit.runReader Proxy
44
43
45−-- | See 'Control.Monad.Ether.Reader.mapReaderT'.
46−mapReaderT :: (m a -> n b) -> ReaderT r m a -> ReaderT r n b
47−mapReaderT = Explicit.mapReaderT Proxy
48−
49-- | See 'Control.Monad.Ether.Reader.MonadReader'.
44-- | See 'Control.Monad.Ether.Reader.MonadReader'.
50type MonadReader r = Explicit.MonadReader r r
45type MonadReader r = Explicit.MonadReader r r
51
46
src/Control/Monad/Ether/Implicit/State/Lazy.hs−5
@@ -23,7 +23,6 @@ module Control.Monad.Ether.Implicit.State.Lazy
23 , runStateT
23 , runStateT
24 , evalStateT
24 , evalStateT
25 , execStateT
25 , execStateT
26− , mapStateT
27 ) where
26 ) where
28
27
29import Data.Proxy
28import Data.Proxy
@@ -63,10 +62,6 @@ execStateT = Explicit.execStateT Proxy
63execState :: State s a -> s -> s
62execState :: State s a -> s -> s
64execState = Explicit.execState Proxy
63execState = Explicit.execState Proxy
65
64
66−-- | See 'Control.Monad.Ether.State.Lazy.mapStateT'.
67−mapStateT :: (m (a, s) -> n (b, s)) -> StateT s m a -> StateT s n b
68−mapStateT = Explicit.mapStateT Proxy
69−
70-- | See 'Control.Monad.Ether.State.Lazy.MonadState'.
65-- | See 'Control.Monad.Ether.State.Lazy.MonadState'.
71type MonadState s = Explicit.MonadState s s
66type MonadState s = Explicit.MonadState s s
72
67
src/Control/Monad/Ether/Implicit/State/Strict.hs−5
@@ -23,7 +23,6 @@ module Control.Monad.Ether.Implicit.State.Strict
23 , runStateT
23 , runStateT
24 , evalStateT
24 , evalStateT
25 , execStateT
25 , execStateT
26− , mapStateT
27 ) where
26 ) where
28
27
29import Data.Proxy
28import Data.Proxy
@@ -63,10 +62,6 @@ execStateT = Explicit.execStateT Proxy
63execState :: State s a -> s -> s
62execState :: State s a -> s -> s
64execState = Explicit.execState Proxy
63execState = Explicit.execState Proxy
65
64
66−-- | See 'Control.Monad.Ether.State.Strict.mapStateT'.
67−mapStateT :: (m (a, s) -> n (b, s)) -> StateT s m a -> StateT s n b
68−mapStateT = Explicit.mapStateT Proxy
69−
70-- | See 'Control.Monad.Ether.State.Strict.MonadState'.
65-- | See 'Control.Monad.Ether.State.Strict.MonadState'.
71type MonadState s = Explicit.MonadState s s
66type MonadState s = Explicit.MonadState s s
72
67
src/Control/Monad/Ether/Reader.hs−1
@@ -13,7 +13,6 @@ module Control.Monad.Ether.Reader
13 , ReaderT
13 , ReaderT
14 , readerT
14 , readerT
15 , runReaderT
15 , runReaderT
16− , mapReaderT
17 ) where
16 ) where
18
17
19import Control.Monad.Ether.Reader.Class
18import Control.Monad.Ether.Reader.Class
src/Control/Monad/Ether/State/Lazy.hs−1
@@ -18,7 +18,6 @@ module Control.Monad.Ether.State.Lazy
18 , runStateT
18 , runStateT
19 , evalStateT
19 , evalStateT
20 , execStateT
20 , execStateT
21− , mapStateT
22 ) where
21 ) where
23
22
24import Control.Monad.Ether.State.Class
23import Control.Monad.Ether.State.Class
src/Control/Monad/Ether/State/Strict.hs−1
@@ -18,7 +18,6 @@ module Control.Monad.Ether.State.Strict
18 , runStateT
18 , runStateT
19 , evalStateT
19 , evalStateT
20 , execStateT
20 , execStateT
21− , mapStateT
22 ) where
21 ) where
23
22
24import Control.Monad.Ether.State.Class
23import Control.Monad.Ether.State.Class
src/Control/Monad/Ether/Writer.hs−1
@@ -16,7 +16,6 @@ module Control.Monad.Ether.Writer
16 , writerT
16 , writerT
17 , runWriterT
17 , runWriterT
18 , execWriterT
18 , execWriterT
19− , mapWriterT
20 ) where
19 ) where
21
20
22import Control.Monad.Ether.Writer.Class
21import Control.Monad.Ether.Writer.Class
src/Control/Monad/Ether/Writer/Class.hs+12−92
@@ -22,25 +22,10 @@ module Control.Monad.Ether.Writer.Class
22import Data.Monoid
22import Data.Monoid
23#endif
23#endif
24
24
25−import Data.Proxy (Proxy(Proxy))
26−import Control.Monad.Trans (lift)
27−
28import Control.Monad.Trans.Ether.Writer hiding (writer, tell, listen, pass)
25import Control.Monad.Trans.Ether.Writer hiding (writer, tell, listen, pass)
29−import qualified Control.Monad.Trans.Ether.Reader as R
30−import qualified Control.Monad.Trans.Ether.State.Lazy as S.L
31−import qualified Control.Monad.Trans.Ether.State.Strict as S.S
32−import qualified Control.Monad.Trans.Ether.Except as E
33import qualified Control.Monad.Trans.Ether.Writer as W
26import qualified Control.Monad.Trans.Ether.Writer as W
34−import qualified Control.Ether.Util as Util
27+import qualified Control.Monad.Trans.Lift.Listen as Lift
35−
36−-- for mtl instances
37−import qualified Control.Monad.Trans.Except as Trans.E
38−import qualified Control.Monad.Trans.Identity as Trans.I
39−import qualified Control.Monad.Trans.Maybe as Trans.M
40−import qualified Control.Monad.Trans.Reader as Trans.R
41−import qualified Control.Monad.Trans.State.Lazy as Trans.S.Lazy
42−import qualified Control.Monad.Trans.State.Strict as Trans.S.Strict
43−import qualified Control.Monad.Trans.Writer.Lazy as Trans.W.Lazy
28+import qualified Control.Monad.Trans.Lift.Pass as Lift
44
29
45-- | See 'Control.Monad.Writer.MonadWriter'.
30-- | See 'Control.Monad.Writer.MonadWriter'.
46class (Monoid w, Monad m) => MonadWriter tag w m | m tag -> w where
31class (Monoid w, Monad m) => MonadWriter tag w m | m tag -> w where
@@ -84,78 +69,13 @@ instance {-# OVERLAPPING #-} (Monoid w, Monad m) => MonadWriter tag w (WriterT t
84 listen = W.listen
69 listen = W.listen
85 pass = W.pass
70 pass = W.pass
86
71
87−instance (Monoid w', MonadWriter tag w m) => MonadWriter tag w (WriterT tag' w' m) where
72+instance ( Lift.LiftListen t
88− writer t = lift . writer t
73+ , Lift.LiftPass t
89− tell t = lift . tell t
74+ , Monad (t m)
90− listen t = W.liftListen Proxy (listen t)
91− pass t = W.liftPass Proxy (pass t)
92−
93−-- Instances for other tagged transformers
94−
95−instance (MonadWriter tag w m) => MonadWriter tag w (R.ReaderT tag' r m) where
75+ , MonadWriter tag w m
96− writer t = lift . writer t
76+ , Monoid w
97− tell t = lift . tell t
98− listen t = R.mapReaderT Proxy (listen t)
99− pass t = R.mapReaderT Proxy (pass t)
100−
101−instance (MonadWriter tag w m) => MonadWriter tag w (E.ExceptT tag' e m) where
77+ ) => MonadWriter tag w (t m) where
102− writer t = lift . writer t
78+ writer t = Lift.lift . writer t
103− tell t = lift . tell t
79+ tell t = Lift.lift . tell t
104− listen t = E.liftListen Proxy (listen t)
80+ listen t = Lift.liftListen (listen t)
105− pass t = E.liftPass Proxy (pass t)
81+ pass t = Lift.liftPass (pass t)
106−
107−instance (MonadWriter tag w m) => MonadWriter tag w (S.L.StateT tag' e m) where
108− writer t = lift . writer t
109− tell t = lift . tell t
110− listen t = S.L.liftListen Proxy (listen t)
111− pass t = S.L.liftPass Proxy (pass t)
112−
113−instance (MonadWriter tag w m) => MonadWriter tag w (S.S.StateT tag' e m) where
114− writer t = lift . writer t
115− tell t = lift . tell t
116− listen t = S.S.liftListen Proxy (listen t)
117− pass t = S.S.liftPass Proxy (pass t)
118−
119−-- Instances for mtl transformers
120−
121−instance (MonadWriter tag w m) => MonadWriter tag w (Trans.E.ExceptT e m) where
122− writer t = lift . writer t
123− tell t = lift . tell t
124− listen t = Trans.E.liftListen (listen t)
125− pass t = Trans.E.liftPass (pass t)
126−
127−instance (MonadWriter tag w m) => MonadWriter tag w (Trans.I.IdentityT m) where
128− writer t = lift . writer t
129− tell t = lift . tell t
130− listen t = Trans.I.mapIdentityT (listen t)
131− pass t = Trans.I.mapIdentityT (pass t)
132−
133−instance (MonadWriter tag w m) => MonadWriter tag w (Trans.M.MaybeT m) where
134− writer t = lift . writer t
135− tell t = lift . tell t
136− listen t = Trans.M.liftListen (listen t)
137− pass t = Trans.M.liftPass (pass t)
138−
139−instance (MonadWriter tag w m) => MonadWriter tag w (Trans.R.ReaderT r m) where
140− writer t = lift . writer t
141− tell t = lift . tell t
142− listen t = Trans.R.mapReaderT (listen t)
143− pass t = Trans.R.mapReaderT (pass t)
144−
145−instance (MonadWriter tag w m) => MonadWriter tag w (Trans.S.Lazy.StateT s m) where
146− writer t = lift . writer t
147− tell t = lift . tell t
148− listen t = Trans.S.Lazy.liftListen (listen t)
149− pass t = Trans.S.Lazy.liftPass (pass t)
150−
151−instance (MonadWriter tag w m) => MonadWriter tag w (Trans.S.Strict.StateT s m) where
152− writer t = lift . writer t
153− tell t = lift . tell t
154− listen t = Trans.S.Strict.liftListen (listen t)
155− pass t = Trans.S.Strict.liftPass (pass t)
156−
157−instance (Monoid w', MonadWriter tag w m) => MonadWriter tag w (Trans.W.Lazy.WriterT w' m) where
158− writer t = lift . writer t
159− tell t = lift . tell t
160− listen t = Util.liftListen_WriterT (listen t)
161− pass t = Util.liftPass_WriterT (pass t)
src/Control/Monad/Trans/Ether/Except.hs+14−26
@@ -18,14 +18,11 @@ module Control.Monad.Trans.Ether.Except
18 , ExceptT
18 , ExceptT
19 , exceptT
19 , exceptT
20 , runExceptT
20 , runExceptT
21− , mapExceptT
22 -- * Exception operations
21 -- * Exception operations
23 , throw
22 , throw
24 , catch
23 , catch
25 -- * Lifting other operations
24 -- * Lifting other operations
26 , liftCallCC
25 , liftCallCC
27− , liftListen
28− , liftPass
29 ) where
26 ) where
30
27
31import Data.Proxy (Proxy(Proxy))
28import Data.Proxy (Proxy(Proxy))
@@ -44,8 +41,11 @@ import qualified Control.Newtype as NT
44import qualified Control.Monad.Signatures as Sig
41import qualified Control.Monad.Signatures as Sig
45import qualified Control.Monad.Trans.Control as MC
42import qualified Control.Monad.Trans.Control as MC
46import qualified Control.Monad.Trans.Except as Trans
43import qualified Control.Monad.Trans.Except as Trans
44+
47−import qualified Control.Monad.Trans.Lift.Local as Lift
45+import qualified Control.Monad.Trans.Lift.Local as Lift
48−import qualified Control.Monad.Trans.Lift.Catch as Lift
46+import qualified Control.Monad.Trans.Lift.Catch as Lift
47+import qualified Control.Monad.Trans.Lift.Listen as Lift
48+import qualified Control.Monad.Trans.Lift.Pass as Lift
49
49
50import qualified Control.Monad.Cont.Class as Class
50import qualified Control.Monad.Cont.Class as Class
51import qualified Control.Monad.Reader.Class as Class
51import qualified Control.Monad.Reader.Class as Class
@@ -86,6 +86,12 @@ instance MC.MonadTransControl (ExceptT tag e) where
86instance Lift.LiftLocal (ExceptT tag e)
86instance Lift.LiftLocal (ExceptT tag e)
87instance Lift.LiftCatch (ExceptT tag e)
87instance Lift.LiftCatch (ExceptT tag e)
88
88
89+instance Lift.LiftListen (ExceptT tag e) where
90+ liftListen listen m = ExceptT $ Lift.liftListen listen (coerce m)
91+
92+instance Lift.LiftPass (ExceptT tag e) where
93+ liftPass pass m = ExceptT $ Lift.liftPass pass (coerce m)
94+
89instance Taggable (ExceptT tag e m) where
95instance Taggable (ExceptT tag e m) where
90 type Tag (ExceptT tag e m) = 'Just tag
96 type Tag (ExceptT tag e m) = 'Just tag
91 type Inner (ExceptT tag e m) = 'Just m
97 type Inner (ExceptT tag e m) = 'Just m
@@ -106,16 +112,6 @@ except t = exceptT t . return
106runExceptT :: proxy tag -> ExceptT tag e m a -> m (Either e a)
112runExceptT :: proxy tag -> ExceptT tag e m a -> m (Either e a)
107runExceptT t = Trans.runExceptT . untagged t
113runExceptT t = Trans.runExceptT . untagged t
108
114
109−-- | Transforms the computation inside an 'ExceptT'.
110−--
111−-- * @'runExceptT' tag ('mapExceptT' tag f m) = f ('runExceptT' tag m)@
112−mapExceptT
113− :: proxy tag
114− -> (m (Either e a) -> n (Either e' b))
115− -> ExceptT tag e m a
116− -> ExceptT tag e' n b
117−mapExceptT t f m = tagged t $ Trans.mapExceptT f (coerce m)
118−
119-- | Is used within a monadic computation to begin exception processing.
115-- | Is used within a monadic computation to begin exception processing.
120throw :: Monad m => proxy tag -> e -> ExceptT tag e m a
116throw :: Monad m => proxy tag -> e -> ExceptT tag e m a
121throw t = tagged t . Trans.throwE
117throw t = tagged t . Trans.throwE
@@ -128,20 +124,12 @@ catch t m h = tagged t $ Trans.catchE (coerce m) (coerce . h)
128liftCallCC :: proxy tag -> Sig.CallCC m (Either e a) (Either e b) -> Sig.CallCC (ExceptT tag e m) a b
124liftCallCC :: proxy tag -> Sig.CallCC m (Either e a) (Either e b) -> Sig.CallCC (ExceptT tag e m) a b
129liftCallCC t callCC f = tagged t $ Trans.liftCallCC callCC (coerce f)
125liftCallCC t callCC f = tagged t $ Trans.liftCallCC callCC (coerce f)
130
126
131−-- | Lift a @listen@ operation to the new monad.
132−liftListen :: Monad m => proxy tag -> Sig.Listen w m (Either e a) -> Sig.Listen w (ExceptT tag e m) a
133−liftListen t listen m = tagged t $ Trans.liftListen listen (coerce m)
134−
135−-- | Lift a @pass@ operation to the new monad.
136−liftPass :: Monad m => proxy tag -> Sig.Pass w m (Either e a) -> Sig.Pass w (ExceptT tag e m) a
137−liftPass t pass m = tagged t $ Trans.liftPass pass (coerce m)
138−
139instance Class.MonadCont m => Class.MonadCont (ExceptT tag e m) where
127instance Class.MonadCont m => Class.MonadCont (ExceptT tag e m) where
140 callCC = liftCallCC Proxy Class.callCC
128 callCC = liftCallCC Proxy Class.callCC
141
129
142instance Class.MonadReader r m => Class.MonadReader r (ExceptT tag e m) where
130instance Class.MonadReader r m => Class.MonadReader r (ExceptT tag e m) where
143 ask = lift Class.ask
131 ask = lift Class.ask
144− local = mapExceptT Proxy . Class.local
132+ local = Lift.liftLocal Class.ask Class.local
145 reader = lift . Class.reader
133 reader = lift . Class.reader
146
134
147instance Class.MonadState s m => Class.MonadState s (ExceptT tag e m) where
135instance Class.MonadState s m => Class.MonadState s (ExceptT tag e m) where
@@ -152,8 +140,8 @@ instance Class.MonadState s m => Class.MonadState s (ExceptT tag e m) where
152instance Class.MonadWriter w m => Class.MonadWriter w (ExceptT tag e m) where
140instance Class.MonadWriter w m => Class.MonadWriter w (ExceptT tag e m) where
153 writer = lift . Class.writer
141 writer = lift . Class.writer
154 tell = lift . Class.tell
142 tell = lift . Class.tell
155− listen = liftListen Proxy Class.listen
143+ listen = Lift.liftListen Class.listen
156− pass = liftPass Proxy Class.pass
144+ pass = Lift.liftPass Class.pass
157
145
158instance Class.MonadError e' m => Class.MonadError e' (ExceptT tag e m) where
146instance Class.MonadError e' m => Class.MonadError e' (ExceptT tag e m) where
159 throwError = lift . Class.throwError
147 throwError = lift . Class.throwError
src/Control/Monad/Trans/Ether/Reader.hs+15−27
@@ -18,8 +18,6 @@ module Control.Monad.Trans.Ether.Reader
18 , ReaderT
18 , ReaderT
19 , readerT
19 , readerT
20 , runReaderT
20 , runReaderT
21− , mapReaderT
22− , withReaderT
23 -- * Reader operations
21 -- * Reader operations
24 , ask
22 , ask
25 , local
23 , local
@@ -43,8 +41,11 @@ import qualified Control.Newtype as NT
43import qualified Control.Monad.Signatures as Sig
41import qualified Control.Monad.Signatures as Sig
44import qualified Control.Monad.Trans.Control as MC
42import qualified Control.Monad.Trans.Control as MC
45import qualified Control.Monad.Trans.Reader as Trans
43import qualified Control.Monad.Trans.Reader as Trans
44+
46−import qualified Control.Monad.Trans.Lift.Local as Lift
45+import qualified Control.Monad.Trans.Lift.Local as Lift
47−import qualified Control.Monad.Trans.Lift.Catch as Lift
46+import qualified Control.Monad.Trans.Lift.Catch as Lift
47+import qualified Control.Monad.Trans.Lift.Listen as Lift
48+import qualified Control.Monad.Trans.Lift.Pass as Lift
48
49
49import qualified Control.Monad.Cont.Class as Class
50import qualified Control.Monad.Cont.Class as Class
50import qualified Control.Monad.Reader.Class as Class
51import qualified Control.Monad.Reader.Class as Class
@@ -80,6 +81,12 @@ instance MC.MonadTransControl (ReaderT tag r) where
80instance Lift.LiftLocal (ReaderT tag r)
81instance Lift.LiftLocal (ReaderT tag r)
81instance Lift.LiftCatch (ReaderT tag r)
82instance Lift.LiftCatch (ReaderT tag r)
82
83
84+instance Lift.LiftListen (ReaderT tag r) where
85+ liftListen listen m = ReaderT $ Lift.liftListen listen (coerce m)
86+
87+instance Lift.LiftPass (ReaderT tag r) where
88+ liftPass pass m = ReaderT $ Lift.liftPass pass (coerce m)
89+
83instance Taggable (ReaderT tag r m) where
90instance Taggable (ReaderT tag r m) where
84 type Tag (ReaderT tag r m) = 'Just tag
91 type Tag (ReaderT tag r m) = 'Just tag
85 type Inner (ReaderT tag r m) = 'Just m
92 type Inner (ReaderT tag r m) = 'Just m
@@ -106,25 +113,6 @@ runReaderT t = Trans.runReaderT . untagged t
106runReader :: proxy tag -> Reader tag r a -> r -> a
113runReader :: proxy tag -> Reader tag r a -> r -> a
107runReader t = Trans.runReader . untagged t
114runReader t = Trans.runReader . untagged t
108
115
109−-- | Transform the computation inside a 'ReaderT'.
110−--
111−-- * @'runReaderT' tag ('mapReaderT' tag f m) = f . 'runReaderT' tag m@
112−mapReaderT :: proxy tag -> (m a -> n b) -> ReaderT tag r m a -> ReaderT tag r n b
113−mapReaderT t f m = tagged t $ Trans.mapReaderT f (coerce m)
114−
115−-- | Execute a computation in a modified environment
116−-- (a more general version of 'local').
117−--
118−-- * @'runReaderT' tag ('withReaderT' tag f m) = 'runReaderT' tag m . f@
119−withReaderT
120− :: proxy tag
121− -> (r' -> r)
122− -- ^ The function to modify the environment.
123− -> ReaderT tag r m a
124− -- ^ Computation to run in the modified environment.
125− -> ReaderT tag r' m a
126−withReaderT t f m = tagged t $ Trans.withReaderT f (coerce m)
127−
128-- | Lift a @callCC@ operation to the new monad.
116-- | Lift a @callCC@ operation to the new monad.
129liftCallCC :: proxy tag -> Sig.CallCC m a b -> Sig.CallCC (ReaderT tag r m) a b
117liftCallCC :: proxy tag -> Sig.CallCC m a b -> Sig.CallCC (ReaderT tag r m) a b
130liftCallCC t callCC f = tagged t $ Trans.liftCallCC callCC (coerce f)
118liftCallCC t callCC f = tagged t $ Trans.liftCallCC callCC (coerce f)
@@ -144,7 +132,7 @@ local
144 -> ReaderT tag r m a
132 -> ReaderT tag r m a
145 -- ^ Computation to run in the modified environment.
133 -- ^ Computation to run in the modified environment.
146 -> ReaderT tag r m a
134 -> ReaderT tag r m a
147−local = withReaderT
135+local t f m = tagged t $ Trans.withReaderT f (coerce m)
148
136
149-- Instances for mtl classes
137-- Instances for mtl classes
150
138
@@ -153,7 +141,7 @@ instance Class.MonadCont m => Class.MonadCont (ReaderT tag r m) where
153
141
154instance Class.MonadReader r' m => Class.MonadReader r' (ReaderT tag r m) where
142instance Class.MonadReader r' m => Class.MonadReader r' (ReaderT tag r m) where
155 ask = lift Class.ask
143 ask = lift Class.ask
156− local = mapReaderT Proxy . Class.local
144+ local = Lift.liftLocal Class.ask Class.local
157 reader = lift . Class.reader
145 reader = lift . Class.reader
158
146
159instance Class.MonadState s m => Class.MonadState s (ReaderT tag r m) where
147instance Class.MonadState s m => Class.MonadState s (ReaderT tag r m) where
@@ -164,8 +152,8 @@ instance Class.MonadState s m => Class.MonadState s (ReaderT tag r m) where
164instance Class.MonadWriter w m => Class.MonadWriter w (ReaderT tag r m) where
152instance Class.MonadWriter w m => Class.MonadWriter w (ReaderT tag r m) where
165 writer = lift . Class.writer
153 writer = lift . Class.writer
166 tell = lift . Class.tell
154 tell = lift . Class.tell
167− listen = mapReaderT Proxy Class.listen
155+ listen = Lift.liftListen Class.listen
168− pass = mapReaderT Proxy Class.pass
156+ pass = Lift.liftPass Class.pass
169
157
170instance Class.MonadError e m => Class.MonadError e (ReaderT tag r m) where
158instance Class.MonadError e m => Class.MonadError e (ReaderT tag r m) where
171 throwError = lift . Class.throwError
159 throwError = lift . Class.throwError
src/Control/Monad/Trans/Ether/State/Lazy.hs+14−22
@@ -22,14 +22,11 @@ module Control.Monad.Trans.Ether.State.Lazy
22 , runStateT
22 , runStateT
23 , evalStateT
23 , evalStateT
24 , execStateT
24 , execStateT
25− , mapStateT
26 -- * State operations
25 -- * State operations
27 , get
26 , get
28 , put
27 , put
29 -- * Litfing other operations
28 -- * Litfing other operations
30 , liftCallCC'
29 , liftCallCC'
31− , liftListen
32− , liftPass
33 ) where
30 ) where
34
31
35import Data.Proxy (Proxy(Proxy))
32import Data.Proxy (Proxy(Proxy))
@@ -48,8 +45,11 @@ import qualified Control.Newtype as NT
48import qualified Control.Monad.Signatures as Sig
45import qualified Control.Monad.Signatures as Sig
49import qualified Control.Monad.Trans.Control as MC
46import qualified Control.Monad.Trans.Control as MC
50import qualified Control.Monad.Trans.State.Lazy as Trans
47import qualified Control.Monad.Trans.State.Lazy as Trans
48+
51−import qualified Control.Monad.Trans.Lift.Local as Lift
49+import qualified Control.Monad.Trans.Lift.Local as Lift
52−import qualified Control.Monad.Trans.Lift.Catch as Lift
50+import qualified Control.Monad.Trans.Lift.Catch as Lift
51+import qualified Control.Monad.Trans.Lift.Listen as Lift
52+import qualified Control.Monad.Trans.Lift.Pass as Lift
53
53
54import qualified Control.Monad.Cont.Class as Class
54import qualified Control.Monad.Cont.Class as Class
55import qualified Control.Monad.Reader.Class as Class
55import qualified Control.Monad.Reader.Class as Class
@@ -85,6 +85,12 @@ instance MC.MonadTransControl (StateT tag s) where
85instance Lift.LiftLocal (StateT tag s)
85instance Lift.LiftLocal (StateT tag s)
86instance Lift.LiftCatch (StateT tag s)
86instance Lift.LiftCatch (StateT tag s)
87
87
88+instance Lift.LiftListen (StateT tag s) where
89+ liftListen listen m = StateT $ Lift.liftListen listen (coerce m)
90+
91+instance Lift.LiftPass (StateT tag s) where
92+ liftPass pass m = StateT $ Lift.liftPass pass (coerce m)
93+
88instance Taggable (StateT tag s m) where
94instance Taggable (StateT tag s m) where
89 type Tag (StateT tag s m) = 'Just tag
95 type Tag (StateT tag s m) = 'Just tag
90 type Inner (StateT tag s m) = 'Just m
96 type Inner (StateT tag s m) = 'Just m
@@ -131,12 +137,6 @@ evalState t = Trans.evalState . untagged t
131execState :: proxy tag -> State tag s a -> s -> s
137execState :: proxy tag -> State tag s a -> s -> s
132execState t = Trans.execState . untagged t
138execState t = Trans.execState . untagged t
133
139
134−-- | Transform the computation inside a 'StateT'.
135−--
136−-- * @'runStateT' tag ('mapStateT' tag f m) = f . 'runStateT' tag m@
137−mapStateT :: proxy tag -> (m (a, s) -> n (b, s)) -> StateT tag s m a -> StateT tag s n b
138−mapStateT t f m = tagged t $ Trans.mapStateT f (coerce m)
139−
140-- | Fetch the current value of the state within the monad.
140-- | Fetch the current value of the state within the monad.
141get :: Monad m => proxy tag -> StateT tag s m s
141get :: Monad m => proxy tag -> StateT tag s m s
142get t = tagged t Trans.get
142get t = tagged t Trans.get
@@ -145,20 +145,12 @@ get t = tagged t Trans.get
145put :: Monad m => proxy tag -> s -> StateT tag s m ()
145put :: Monad m => proxy tag -> s -> StateT tag s m ()
146put t = tagged t . Trans.put
146put t = tagged t . Trans.put
147
147
148−-- | Lift a @listen@ operation to the new monad.
149−liftListen :: Monad m => proxy tag -> Sig.Listen w m (a, s) -> Sig.Listen w (StateT tag s m) a
150−liftListen t listen m = tagged t $ Trans.liftListen listen (coerce m)
151−
152-- | In-situ lifting of a @callCC@ operation to the new monad.
148-- | In-situ lifting of a @callCC@ operation to the new monad.
153-- This version uses the current state on entering the continuation.
149-- This version uses the current state on entering the continuation.
154-- It does not satisfy the uniformity property (see "Control.Monad.Signatures").
150-- It does not satisfy the uniformity property (see "Control.Monad.Signatures").
155liftCallCC' :: proxy tag -> Sig.CallCC m (a, s) (b, s) -> Sig.CallCC (StateT tag s m) a b
151liftCallCC' :: proxy tag -> Sig.CallCC m (a, s) (b, s) -> Sig.CallCC (StateT tag s m) a b
156liftCallCC' t callCC f = tagged t $ Trans.liftCallCC' callCC (coerce f)
152liftCallCC' t callCC f = tagged t $ Trans.liftCallCC' callCC (coerce f)
157
153
158−-- | Lift a @pass@ operation to the new monad.
159−liftPass :: Monad m => proxy tag -> Sig.Pass w m (a,s) -> Sig.Pass w (StateT tag s m) a
160−liftPass t pass m = tagged t $ Trans.liftPass pass (coerce m)
161−
162-- Instances for mtl classes
154-- Instances for mtl classes
163
155
164instance Class.MonadCont m => Class.MonadCont (StateT tag s m) where
156instance Class.MonadCont m => Class.MonadCont (StateT tag s m) where
@@ -166,7 +158,7 @@ instance Class.MonadCont m => Class.MonadCont (StateT tag s m) where
166
158
167instance Class.MonadReader r m => Class.MonadReader r (StateT tag s m) where
159instance Class.MonadReader r m => Class.MonadReader r (StateT tag s m) where
168 ask = lift Class.ask
160 ask = lift Class.ask
169− local = mapStateT Proxy . Class.local
161+ local = Lift.liftLocal Class.ask Class.local
170 reader = lift . Class.reader
162 reader = lift . Class.reader
171
163
172instance Class.MonadState s' m => Class.MonadState s' (StateT tag s m) where
164instance Class.MonadState s' m => Class.MonadState s' (StateT tag s m) where
@@ -177,8 +169,8 @@ instance Class.MonadState s' m => Class.MonadState s' (StateT tag s m) where
177instance Class.MonadWriter w m => Class.MonadWriter w (StateT tag s m) where
169instance Class.MonadWriter w m => Class.MonadWriter w (StateT tag s m) where
178 writer = lift . Class.writer
170 writer = lift . Class.writer
179 tell = lift . Class.tell
171 tell = lift . Class.tell
180− listen = liftListen Proxy Class.listen
172+ listen = Lift.liftListen Class.listen
181− pass = liftPass Proxy Class.pass
173+ pass = Lift.liftPass Class.pass
182
174
183instance Class.MonadError e m => Class.MonadError e (StateT tag s m) where
175instance Class.MonadError e m => Class.MonadError e (StateT tag s m) where
184 throwError = lift . Class.throwError
176 throwError = lift . Class.throwError
src/Control/Monad/Trans/Ether/State/Strict.hs+14−22
@@ -22,14 +22,11 @@ module Control.Monad.Trans.Ether.State.Strict
22 , runStateT
22 , runStateT
23 , evalStateT
23 , evalStateT
24 , execStateT
24 , execStateT
25− , mapStateT
26 -- * State operations
25 -- * State operations
27 , get
26 , get
28 , put
27 , put
29 -- * Litfing other operations
28 -- * Litfing other operations
30 , liftCallCC'
29 , liftCallCC'
31− , liftListen
32− , liftPass
33 ) where
30 ) where
34
31
35import Data.Proxy (Proxy(Proxy))
32import Data.Proxy (Proxy(Proxy))
@@ -48,8 +45,11 @@ import qualified Control.Newtype as NT
48import qualified Control.Monad.Signatures as Sig
45import qualified Control.Monad.Signatures as Sig
49import qualified Control.Monad.Trans.Control as MC
46import qualified Control.Monad.Trans.Control as MC
50import qualified Control.Monad.Trans.State.Strict as Trans
47import qualified Control.Monad.Trans.State.Strict as Trans
48+
51−import qualified Control.Monad.Trans.Lift.Local as Lift
49+import qualified Control.Monad.Trans.Lift.Local as Lift
52−import qualified Control.Monad.Trans.Lift.Catch as Lift
50+import qualified Control.Monad.Trans.Lift.Catch as Lift
51+import qualified Control.Monad.Trans.Lift.Listen as Lift
52+import qualified Control.Monad.Trans.Lift.Pass as Lift
53
53
54import qualified Control.Monad.Cont.Class as Class
54import qualified Control.Monad.Cont.Class as Class
55import qualified Control.Monad.Reader.Class as Class
55import qualified Control.Monad.Reader.Class as Class
@@ -85,6 +85,12 @@ instance MC.MonadTransControl (StateT tag s) where
85instance Lift.LiftLocal (StateT tag s)
85instance Lift.LiftLocal (StateT tag s)
86instance Lift.LiftCatch (StateT tag s)
86instance Lift.LiftCatch (StateT tag s)
87
87
88+instance Lift.LiftListen (StateT tag s) where
89+ liftListen listen m = StateT $ Lift.liftListen listen (coerce m)
90+
91+instance Lift.LiftPass (StateT tag s) where
92+ liftPass pass m = StateT $ Lift.liftPass pass (coerce m)
93+
88instance Taggable (StateT tag s m) where
94instance Taggable (StateT tag s m) where
89 type Tag (StateT tag s m) = 'Just tag
95 type Tag (StateT tag s m) = 'Just tag
90 type Inner (StateT tag s m) = 'Just m
96 type Inner (StateT tag s m) = 'Just m
@@ -131,12 +137,6 @@ evalState t = Trans.evalState . untagged t
131execState :: proxy tag -> State tag s a -> s -> s
137execState :: proxy tag -> State tag s a -> s -> s
132execState t = Trans.execState . untagged t
138execState t = Trans.execState . untagged t
133
139
134−-- | Transform the computation inside a 'StateT'.
135−--
136−-- * @'runStateT' tag ('mapStateT' tag f m) = f . 'runStateT' tag m@
137−mapStateT :: proxy tag -> (m (a, s) -> n (b, s)) -> StateT tag s m a -> StateT tag s n b
138−mapStateT t f m = tagged t $ Trans.mapStateT f (coerce m)
139−
140-- | Fetch the current value of the state within the monad.
140-- | Fetch the current value of the state within the monad.
141get :: Monad m => proxy tag -> StateT tag s m s
141get :: Monad m => proxy tag -> StateT tag s m s
142get t = tagged t Trans.get
142get t = tagged t Trans.get
@@ -145,20 +145,12 @@ get t = tagged t Trans.get
145put :: Monad m => proxy tag -> s -> StateT tag s m ()
145put :: Monad m => proxy tag -> s -> StateT tag s m ()
146put t = tagged t . Trans.put
146put t = tagged t . Trans.put
147
147
148−-- | Lift a @listen@ operation to the new monad.
149−liftListen :: Monad m => proxy tag -> Sig.Listen w m (a, s) -> Sig.Listen w (StateT tag s m) a
150−liftListen t listen m = tagged t $ Trans.liftListen listen (coerce m)
151−
152-- | In-situ lifting of a @callCC@ operation to the new monad.
148-- | In-situ lifting of a @callCC@ operation to the new monad.
153-- This version uses the current state on entering the continuation.
149-- This version uses the current state on entering the continuation.
154-- It does not satisfy the uniformity property (see "Control.Monad.Signatures").
150-- It does not satisfy the uniformity property (see "Control.Monad.Signatures").
155liftCallCC' :: proxy tag -> Sig.CallCC m (a, s) (b, s) -> Sig.CallCC (StateT tag s m) a b
151liftCallCC' :: proxy tag -> Sig.CallCC m (a, s) (b, s) -> Sig.CallCC (StateT tag s m) a b
156liftCallCC' t callCC f = tagged t $ Trans.liftCallCC' callCC (coerce f)
152liftCallCC' t callCC f = tagged t $ Trans.liftCallCC' callCC (coerce f)
157
153
158−-- | Lift a @pass@ operation to the new monad.
159−liftPass :: Monad m => proxy tag -> Sig.Pass w m (a,s) -> Sig.Pass w (StateT tag s m) a
160−liftPass t pass m = tagged t $ Trans.liftPass pass (coerce m)
161−
162-- Instances for mtl classes
154-- Instances for mtl classes
163
155
164instance Class.MonadCont m => Class.MonadCont (StateT tag s m) where
156instance Class.MonadCont m => Class.MonadCont (StateT tag s m) where
@@ -166,7 +158,7 @@ instance Class.MonadCont m => Class.MonadCont (StateT tag s m) where
166
158
167instance Class.MonadReader r m => Class.MonadReader r (StateT tag s m) where
159instance Class.MonadReader r m => Class.MonadReader r (StateT tag s m) where
168 ask = lift Class.ask
160 ask = lift Class.ask
169− local = mapStateT Proxy . Class.local
161+ local = Lift.liftLocal Class.ask Class.local
170 reader = lift . Class.reader
162 reader = lift . Class.reader
171
163
172instance Class.MonadState s' m => Class.MonadState s' (StateT tag s m) where
164instance Class.MonadState s' m => Class.MonadState s' (StateT tag s m) where
@@ -177,8 +169,8 @@ instance Class.MonadState s' m => Class.MonadState s' (StateT tag s m) where
177instance Class.MonadWriter w m => Class.MonadWriter w (StateT tag s m) where
169instance Class.MonadWriter w m => Class.MonadWriter w (StateT tag s m) where
178 writer = lift . Class.writer
170 writer = lift . Class.writer
179 tell = lift . Class.tell
171 tell = lift . Class.tell
180− listen = liftListen Proxy Class.listen
172+ listen = Lift.liftListen Class.listen
181− pass = liftPass Proxy Class.pass
173+ pass = Lift.liftPass Class.pass
182
174
183instance Class.MonadError e m => Class.MonadError e (StateT tag s m) where
175instance Class.MonadError e m => Class.MonadError e (StateT tag s m) where
184 throwError = lift . Class.throwError
176 throwError = lift . Class.throwError
src/Control/Monad/Trans/Ether/Writer.hs+14−20
@@ -21,15 +21,12 @@ module Control.Monad.Trans.Ether.Writer
21 , writerT
21 , writerT
22 , runWriterT
22 , runWriterT
23 , execWriterT
23 , execWriterT
24− , mapWriterT
25 -- * Writer operations
24 -- * Writer operations
26 , tell
25 , tell
27 , listen
26 , listen
28 , pass
27 , pass
29 -- * Lifting other operations
28 -- * Lifting other operations
30 , liftCallCC
29 , liftCallCC
31− , liftListen
32− , liftPass
33 ) where
30 ) where
34
31
35#if __GLASGOW_HASKELL__ < 710
32#if __GLASGOW_HASKELL__ < 710
@@ -46,15 +43,17 @@ import Control.Monad.Trans.Class (MonadTrans, lift)
46import Control.Monad.IO.Class (MonadIO)
43import Control.Monad.IO.Class (MonadIO)
47import Control.Monad.Morph (MFunctor, MMonad)
44import Control.Monad.Morph (MFunctor, MMonad)
48import Control.Ether.Tagged (Taggable(..), Tagged(..))
45import Control.Ether.Tagged (Taggable(..), Tagged(..))
49−import qualified Control.Ether.Util as Util
50import GHC.Generics (Generic)
46import GHC.Generics (Generic)
51import qualified Control.Newtype as NT
47import qualified Control.Newtype as NT
52
48
53import qualified Control.Monad.Signatures as Sig
49import qualified Control.Monad.Signatures as Sig
54import qualified Control.Monad.Trans.Control as MC
50import qualified Control.Monad.Trans.Control as MC
55import qualified Control.Monad.Trans.Writer.Lazy as Trans
51import qualified Control.Monad.Trans.Writer.Lazy as Trans
52+
56−import qualified Control.Monad.Trans.Lift.Local as Lift
53+import qualified Control.Monad.Trans.Lift.Local as Lift
57−import qualified Control.Monad.Trans.Lift.Catch as Lift
54+import qualified Control.Monad.Trans.Lift.Catch as Lift
55+import qualified Control.Monad.Trans.Lift.Listen as Lift
56+import qualified Control.Monad.Trans.Lift.Pass as Lift
58
57
59import qualified Control.Monad.Cont.Class as Class
58import qualified Control.Monad.Cont.Class as Class
60import qualified Control.Monad.Reader.Class as Class
59import qualified Control.Monad.Reader.Class as Class
@@ -89,6 +88,12 @@ instance Monoid w => MC.MonadTransControl (WriterT tag w) where
89instance Monoid w => Lift.LiftLocal (WriterT tag w)
88instance Monoid w => Lift.LiftLocal (WriterT tag w)
90instance Monoid w => Lift.LiftCatch (WriterT tag w)
89instance Monoid w => Lift.LiftCatch (WriterT tag w)
91
90
91+instance Monoid w' => Lift.LiftListen (WriterT tag w') where
92+ liftListen listen m = WriterT $ Lift.liftListen listen (coerce m)
93+
94+instance Monoid w' => Lift.LiftPass (WriterT tag w') where
95+ liftPass pass m = WriterT $ Lift.liftPass pass (coerce m)
96+
92instance Taggable (WriterT tag w m) where
97instance Taggable (WriterT tag w m) where
93 type Tag (WriterT tag w m) = 'Just tag
98 type Tag (WriterT tag w m) = 'Just tag
94 type Inner (WriterT tag w m) = 'Just m
99 type Inner (WriterT tag w m) = 'Just m
@@ -127,9 +132,6 @@ execWriter t = Trans.execWriter . untagged t
127
132
128-- | Transform the computation inside a 'WriterT'.
133-- | Transform the computation inside a 'WriterT'.
129--
134--
130−-- * @'runWriterT' tag ('mapWriterT' tag f m) = f ('runWriterT' tag m)@
131−mapWriterT :: proxy tag -> (m (a, w) -> n (b, w')) -> WriterT tag w m a -> WriterT tag w' n b
132−mapWriterT t f m = tagged t $ Trans.mapWriterT f (coerce m)
133
135
134-- | Appends a value to the accumulator within the monad.
136-- | Appends a value to the accumulator within the monad.
135tell :: Monad m => proxy tag -> w -> WriterT tag w m ()
137tell :: Monad m => proxy tag -> w -> WriterT tag w m ()
@@ -148,20 +150,12 @@ pass t m = tagged t $ Trans.pass (coerce m)
148liftCallCC :: Monoid w => proxy tag -> Sig.CallCC m (a, w) (b, w) -> Sig.CallCC (WriterT tag w m) a b
150liftCallCC :: Monoid w => proxy tag -> Sig.CallCC m (a, w) (b, w) -> Sig.CallCC (WriterT tag w m) a b
149liftCallCC t callCC f = tagged t $ Trans.liftCallCC callCC (coerce f)
151liftCallCC t callCC f = tagged t $ Trans.liftCallCC callCC (coerce f)
150
152
151−-- | Lift a @listen@ operation to the new monad.
152−liftListen :: Monad m => proxy tag -> Sig.Listen w' m (a, w) -> Sig.Listen w' (WriterT tag w m) a
153−liftListen t f m = tagged t $ Util.liftListen_WriterT f (coerce m)
154−
155−-- | Lift a @pass@ operation to the new monad.
156−liftPass :: Monad m => proxy tag -> Sig.Pass w' m (a, w) -> Sig.Pass w' (WriterT tag w m) a
157−liftPass t f m = tagged t $ Util.liftPass_WriterT f (coerce m)
158−
159instance (Monoid w, Class.MonadCont m) => Class.MonadCont (WriterT tag w m) where
153instance (Monoid w, Class.MonadCont m) => Class.MonadCont (WriterT tag w m) where
160 callCC = liftCallCC Proxy Class.callCC
154 callCC = liftCallCC Proxy Class.callCC
161
155
162instance (Monoid w, Class.MonadReader r m) => Class.MonadReader r (WriterT tag w m) where
156instance (Monoid w, Class.MonadReader r m) => Class.MonadReader r (WriterT tag w m) where
163 ask = lift Class.ask
157 ask = lift Class.ask
164− local = mapWriterT Proxy . Class.local
158+ local = Lift.liftLocal Class.ask Class.local
165 reader = lift . Class.reader
159 reader = lift . Class.reader
166
160
167instance (Monoid w, Class.MonadState s m) => Class.MonadState s (WriterT tag w m) where
161instance (Monoid w, Class.MonadState s m) => Class.MonadState s (WriterT tag w m) where
@@ -172,8 +166,8 @@ instance (Monoid w, Class.MonadState s m) => Class.MonadState s (WriterT tag w m
172instance (Monoid w, Class.MonadWriter w' m) => Class.MonadWriter w' (WriterT tag w m) where
166instance (Monoid w, Class.MonadWriter w' m) => Class.MonadWriter w' (WriterT tag w m) where
173 writer = lift . Class.writer
167 writer = lift . Class.writer
174 tell = lift . Class.tell
168 tell = lift . Class.tell
175− listen = liftListen Proxy Class.listen
169+ listen = Lift.liftListen Class.listen
176− pass = liftPass Proxy Class.pass
170+ pass = Lift.liftPass Class.pass
177
171
178instance (Monoid w, Class.MonadError e m) => Class.MonadError e (WriterT tag w m) where
172instance (Monoid w, Class.MonadError e m) => Class.MonadError e (WriterT tag w m) where
179 throwError = lift . Class.throwError
173 throwError = lift . Class.throwError