repositories
/
cc1516.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added some comments on codegen
[cc1516.git]
/
RWST.icl
diff --git
a/RWST.icl
b/RWST.icl
index
712f71e
..
2f02d6d
100644
(file)
--- a/
RWST.icl
+++ b/
RWST.icl
@@
-8,6
+8,7
@@
import Data.Functor.Identity
import Data.Functor
import Data.Monoid
import Control.Monad
import Data.Functor
import Data.Monoid
import Control.Monad
+import Control.Monad.Trans
import Control.Applicative
// The RWS monad
import Control.Applicative
// The RWS monad
@@
-46,6
+47,9
@@
instance Monad (RWST r w s m) | Monad m & Monoid w where
>>= \(a, s`, w)->runRWST (k a) r s`
>>= \(b, s``,w`)->pure (b, s``, mappend w w`)
>>= \(a, s`, w)->runRWST (k a) r s`
>>= \(b, s``,w`)->pure (b, s``, mappend w w`)
+instance MonadTrans (RWST r w s) | Monoid w where
+ liftT m = RWST \_ s->m >>= \a->pure (a, s, mempty)
+
runRWST :: (RWST r w s m a) r s -> m (a, s, w)
runRWST (RWST f) r s = f r s
runRWST :: (RWST r w s m a) r s -> m (a, s, w)
runRWST (RWST f) r s = f r s