From aeb7ec5c9a67c9936b5d01d6e933cf4c282058d2 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 2 Oct 2013 21:58:19 +0200 Subject: monads: Allow resolution of a monad's bind/return at expansion time. * guix/monads.scm (): Turn in a raw SRFI-9 record type. (define-monad): New macro. (with-monad): Add a case for when MONAD is a macro. (identity-return, identity-bind, store-return, store-bind): Inline. (%identity-monad, %store-monad): Use 'define-monad'. * tests/monads.scm ("monad?"): New test. --- tests/monads.scm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/monads.scm') diff --git a/tests/monads.scm b/tests/monads.scm index 9570c208b2..4608deec9e 100644 --- a/tests/monads.scm +++ b/tests/monads.scm @@ -48,6 +48,11 @@ (define %monad-run (test-begin "monads") +(test-assert "monad?" + (and (every monad? %monads) + (every (compose procedure? monad-bind) %monads) + (every (compose procedure? monad-return) %monads))) + ;; The 3 "monad laws": . (test-assert "left identity" -- cgit v1.2.3