X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=RWST.icl;h=712f71e62db2689d3824e473b2705f3540ac566c;hb=43f59bf00c11cfbeee906b16063abfca6f4c09cc;hp=9caa0e6e25ec35cb2627c6b6bb6607cf68f8a55d;hpb=e0fd23079f1f63b83431afe78e9ec218d4609e9a;p=cc1516.git diff --git a/RWST.icl b/RWST.icl index 9caa0e6..712f71e 100644 --- a/RWST.icl +++ b/RWST.icl @@ -4,7 +4,6 @@ from StdFunc import o import StdTuple from Data.Func import $ -import Data.Void import Data.Functor.Identity import Data.Functor import Data.Monoid @@ -73,8 +72,8 @@ asks :: (r -> a) -> RWST r w s m a | Monoid w & Monad m asks f = ask >>= \r->pure $ f r // Writer operations -tell :: w -> RWST r w s m Void | Monoid w & Monad m -tell w = RWST \_ s->pure (Void, s,w) +tell :: w -> RWST r w s m () | Monoid w & Monad m +tell w = RWST \_ s->pure ((), s,w) listen :: (RWST r w s m a) -> RWST r w s m (a, w) | Monoid w & Monad m listen m = RWST \r s->runRWST m r s >>= \(a, s`, w)->pure ((a, w), s`, w) @@ -92,10 +91,10 @@ censor f m = pass $ m >>= \a->pure (a, f) get :: RWST r w s m s | Monoid w & Monad m get = RWST \_ s->pure (s, s, mempty) -put :: s -> RWST r w s m Void | Monoid w & Monad m -put s = RWST \_ _->pure (Void, s, mempty) +put :: s -> RWST r w s m () | Monoid w & Monad m +put s = RWST \_ _->pure ((), s, mempty) -modify :: (s -> s) -> RWST r w s m Void | Monoid w & Monad m +modify :: (s -> s) -> RWST r w s m () | Monoid w & Monad m modify f = get >>= \s->put $ f s gets :: (s -> a) -> RWST r w s m a | Monoid w & Monad m