summaryrefslogtreecommitdiff
path: root/tests/monads.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-12-09 21:10:28 +0100
committerLudovic Courtès <ludo@gnu.org>2013-12-10 00:24:01 +0100
commit593c3fe600a5f5e90a6eea3a175f83d3319b4efe (patch)
tree616bf04c694dd5dc540341fa11f1aac9c00952c2 /tests/monads.scm
parentf7faff88b73c53fd1a8644dfb93e9214f4afaa9c (diff)
downloadpatches-593c3fe600a5f5e90a6eea3a175f83d3319b4efe.tar
patches-593c3fe600a5f5e90a6eea3a175f83d3319b4efe.tar.gz
monads: Fix 'anym'.
* guix/monads.scm (anym): Fix successful case. * tests/monads.scm ("anym"): New test.
Diffstat (limited to 'tests/monads.scm')
-rw-r--r--tests/monads.scm12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/monads.scm b/tests/monads.scm
index 7fc2aa90c1..d3f78e1568 100644
--- a/tests/monads.scm
+++ b/tests/monads.scm
@@ -163,6 +163,18 @@
%monads
%monad-run))
+(test-assert "anym"
+ (every (lambda (monad run)
+ (eq? (run (with-monad monad
+ (let ((lst (list (return 1) (return 2) (return 3))))
+ (anym monad
+ (lambda (x)
+ (and (odd? x) 'odd!))
+ lst))))
+ 'odd!))
+ %monads
+ %monad-run))
+
(test-end "monads")