aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ravanan/work/monads.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/ravanan/work/monads.scm b/ravanan/work/monads.scm
index fa08bd2..6d55449 100644
--- a/ravanan/work/monads.scm
+++ b/ravanan/work/monads.scm
@@ -53,6 +53,16 @@
(mlet* monad-type (bindings ...)
body ...))))))
+(define-syntax mbegin
+ (syntax-rules ()
+ ((_ monad-type expression)
+ expression)
+ ((_ monad-type first-expression body ...)
+ ((monad-bind monad-type)
+ first-expression
+ (lambda _
+ body ...)))))
+
(define-immutable-record-type <maybe>
(maybe value valid?)
maybe?