summaryrefslogtreecommitdiff
path: root/tests/monads.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-05-27 09:40:19 +0200
committerLudovic Courtès <ludo@gnu.org>2015-05-27 09:44:43 +0200
commitb734996f9cf395705860703422d5e92565dd3a13 (patch)
treeeb4268c55f32bba8528a51708607bdf6129eef86 /tests/monads.scm
parent49c0a8d6b6c241a8e7ba68eed98ad3fe6eaef381 (diff)
downloadpatches-b734996f9cf395705860703422d5e92565dd3a13.tar
patches-b734996f9cf395705860703422d5e92565dd3a13.tar.gz
monads: 'foldm', 'mapm', and 'anym' now take a list of regular values.
* guix/monads.scm (foldm, mapm, anym): Change to take a list of regular values as is customary. * tests/monads.scm ("mapm", "anym"): Adjust accordingly.
Diffstat (limited to 'tests/monads.scm')
-rw-r--r--tests/monads.scm13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/monads.scm b/tests/monads.scm
index 57a8e66797..5529a6188a 100644
--- a/tests/monads.scm
+++ b/tests/monads.scm
@@ -163,7 +163,7 @@
(test-assert "mapm"
(every (lambda (monad run)
(with-monad monad
- (equal? (run (mapm monad (lift1 1+ monad) (map return (iota 10))))
+ (equal? (run (mapm monad (lift1 1+ monad) (iota 10)))
(map 1+ (iota 10)))))
%monads
%monad-run))
@@ -202,11 +202,12 @@
(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))))
+ (anym monad
+ (lift1 (lambda (x)
+ (and (odd? x) 'odd!))
+ monad)
+ (append (make-list 1000 0)
+ (list 1 2)))))
'odd!))
%monads
%monad-run))