Added default functions, isEmpty does not typecheck...
[cc1516.git] / 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 Control.Monad.Trans
 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`)
 
+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