on develop help sign in
Merge pull request #17 from bennofs/mtl-instances

Add instances for mtl transformers

commitcfbb2cb98667a98478f544db80008eacf62e2526 authorRyan Trinkle <ryan.trinkle@gmail.com> dateWed 8 Jul 2015, 17:32 (11 years ago) parent87605ca14480db
1 file changed+34
src/Reflex/Class.hs+34
src/Reflex/Class.hs+34
@@ -6,6 +6,10 @@ import Prelude hiding (mapM, mapM_, sequence, sequence_, foldl)
66import Control.Monad.Identity hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
77import Control.Monad.State.Strict hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
88import Control.Monad.Reader hiding (mapM, mapM_, forM, forM_, sequence, sequence_)
9+import Control.Monad.Writer (WriterT())
10+import Control.Monad.Except (ExceptT())
11+import Control.Monad.Cont (ContT())
12+import Control.Monad.RWS (RWST())
913import Data.List.NonEmpty (NonEmpty (..))
1014import Data.These
1115import Data.Align
@@ -67,6 +71,36 @@ instance MonadSample t m => MonadSample t (ReaderT r m) where
6771instance MonadHold t m => MonadHold t (ReaderT r m) where
6872 hold a0 = lift . hold a0
6973
74+instance (MonadSample t m, Monoid r) => MonadSample t (WriterT r m) where
75+ sample = lift . sample
76+
77+instance (MonadHold t m, Monoid r) => MonadHold t (WriterT r m) where
78+ hold a0 = lift . hold a0
79+
80+instance MonadSample t m => MonadSample t (StateT s m) where
81+ sample = lift . sample
82+
83+instance MonadHold t m => MonadHold t (StateT s m) where
84+ hold a0 = lift . hold a0
85+
86+instance MonadSample t m => MonadSample t (ExceptT e m) where
87+ sample = lift . sample
88+
89+instance MonadHold t m => MonadHold t (ExceptT e m) where
90+ hold a0 = lift . hold a0
91+
92+instance (MonadSample t m, Monoid w) => MonadSample t (RWST r w s m) where
93+ sample = lift . sample
94+
95+instance (MonadHold t m, Monoid w) => MonadHold t (RWST r w s m) where
96+ hold a0 = lift . hold a0
97+
98+instance MonadSample t m => MonadSample t (ContT r m) where
99+ sample = lift . sample
100+
101+instance MonadHold t m => MonadHold t (ContT r m) where
102+ hold a0 = lift . hold a0
103+
70104--------------------------------------------------------------------------------
71105-- Convenience functions
72106--------------------------------------------------------------------------------