Skip to content

Commit 7037211

Browse files
committed
Added strict monad transformers
1 parent 3523de4 commit 7037211

File tree

7 files changed

+598
-133
lines changed

7 files changed

+598
-133
lines changed

io-classes-mtl/src/Control/Monad/Class/MonadEventlog/Trans.hs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ module Control.Monad.Class.MonadEventlog.Trans () where
44

55
import Control.Monad.Cont
66
import Control.Monad.Except
7-
import Control.Monad.RWS
8-
import Control.Monad.State
9-
import Control.Monad.Writer
7+
import qualified Control.Monad.RWS.Lazy as Lazy
8+
import qualified Control.Monad.RWS.Strict as Strict
9+
import qualified Control.Monad.State.Lazy as Lazy
10+
import qualified Control.Monad.State.Strict as Strict
11+
import qualified Control.Monad.Writer.Lazy as Lazy
12+
import qualified Control.Monad.Writer.Strict as Strict
1013

1114
import Control.Monad.Class.MonadEventlog
1215

@@ -21,17 +24,32 @@ instance MonadEventlog m => MonadEventlog (ExceptT e m) where
2124
traceMarkerIO = lift . traceMarkerIO
2225

2326
-- | @since 0.1.0.0
24-
instance (Monoid w, MonadEventlog m) => MonadEventlog (RWST r w s m) where
27+
instance (Monoid w, MonadEventlog m) => MonadEventlog (Lazy.RWST r w s m) where
2528
traceEventIO = lift . traceEventIO
2629
traceMarkerIO = lift . traceMarkerIO
2730

2831
-- | @since 0.1.0.0
29-
instance MonadEventlog m => MonadEventlog (StateT s m) where
32+
instance (Monoid w, MonadEventlog m) => MonadEventlog (Strict.RWST r w s m) where
3033
traceEventIO = lift . traceEventIO
3134
traceMarkerIO = lift . traceMarkerIO
3235

3336
-- | @since 0.1.0.0
34-
instance (Monoid w, MonadEventlog m) => MonadEventlog (WriterT w m) where
37+
instance MonadEventlog m => MonadEventlog (Lazy.StateT s m) where
38+
traceEventIO = lift . traceEventIO
39+
traceMarkerIO = lift . traceMarkerIO
40+
41+
-- | @since 0.1.0.0
42+
instance MonadEventlog m => MonadEventlog (Strict.StateT s m) where
43+
traceEventIO = lift . traceEventIO
44+
traceMarkerIO = lift . traceMarkerIO
45+
46+
-- | @since 0.1.0.0
47+
instance (Monoid w, MonadEventlog m) => MonadEventlog (Lazy.WriterT w m) where
48+
traceEventIO = lift . traceEventIO
49+
traceMarkerIO = lift . traceMarkerIO
50+
51+
-- | @since 0.1.0.0
52+
instance (Monoid w, MonadEventlog m) => MonadEventlog (Strict.WriterT w m) where
3553
traceEventIO = lift . traceEventIO
3654
traceMarkerIO = lift . traceMarkerIO
3755

io-classes-mtl/src/Control/Monad/Class/MonadST/Trans.hs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ module Control.Monad.Class.MonadST.Trans () where
33

44
import Control.Monad.Cont
55
import Control.Monad.Except
6-
import Control.Monad.RWS
7-
import Control.Monad.State
8-
import Control.Monad.Writer
6+
import qualified Control.Monad.RWS.Lazy as Lazy
7+
import qualified Control.Monad.RWS.Strict as Strict
8+
import qualified Control.Monad.State.Lazy as Lazy
9+
import qualified Control.Monad.State.Strict as Strict
10+
import qualified Control.Monad.Writer.Lazy as Lazy
11+
import qualified Control.Monad.Writer.Strict as Strict
912

1013
import Control.Monad.Class.MonadST
1114

@@ -16,11 +19,20 @@ instance MonadST m => MonadST (ContT r m) where
1619
instance MonadST m => MonadST (ExceptT e m) where
1720
withLiftST f = withLiftST $ \g -> f (lift . g)
1821

19-
instance (Monoid w, MonadST m) => MonadST (RWST r w s m) where
22+
instance (Monoid w, MonadST m) => MonadST (Lazy.RWST r w s m) where
2023
withLiftST f = withLiftST $ \g -> f (lift . g)
2124

22-
instance MonadST m => MonadST (StateT s m) where
25+
instance (Monoid w, MonadST m) => MonadST (Strict.RWST r w s m) where
2326
withLiftST f = withLiftST $ \g -> f (lift . g)
2427

25-
instance (Monoid w, MonadST m) => MonadST (WriterT w m) where
28+
instance MonadST m => MonadST (Lazy.StateT s m) where
29+
withLiftST f = withLiftST $ \g -> f (lift . g)
30+
31+
instance MonadST m => MonadST (Strict.StateT s m) where
32+
withLiftST f = withLiftST $ \g -> f (lift . g)
33+
34+
instance (Monoid w, MonadST m) => MonadST (Lazy.WriterT w m) where
35+
withLiftST f = withLiftST $ \g -> f (lift . g)
36+
37+
instance (Monoid w, MonadST m) => MonadST (Strict.WriterT w m) where
2638
withLiftST f = withLiftST $ \g -> f (lift . g)

0 commit comments

Comments
 (0)