on master help sign in
Forgot to add Effect.Monad...
commitc3030302c976bc1ad54cf21ba8b154c720e63841 authorEdwin Brady <ecb10@st-andrews.ac.uk> dateSun 22 Dec 2013, 02:08 (13 years ago) parentae76a83
1 file changed+21
libs/effects/Effect/Monad.idr+21
libs/effects/Effect/Monad.idrnew file+21
@@ -0,0 +1,21 @@
1+module Effect.Monad
2+
3+import Effects
4+
5+-- Eff is a monad too, so we can happily use it in a monad transformer.
6+
7+using (xs : List EFFECT, m : Type -> Type)
8+ instance Functor (EffM m xs xs) where
9+ map f prog = do t <- prog
10+ value (f t)
11+
12+ instance Applicative (EffM m xs xs) where
13+ pure = value
14+ (<$>) f a = do f' <- f
15+ a' <- a
16+ value (f' a')
17+
18+ instance Monad (EffM m xs xs) where
19+ (>>=) = ebind
20+
21+