[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/04: monads: Fix 'liftN' fallback case.
From: |
Ludovic Courtès |
Subject: |
04/04: monads: Fix 'liftN' fallback case. |
Date: |
Fri, 04 Sep 2015 16:34:08 +0000 |
civodul pushed a commit to branch master
in repository guix.
commit dbbc248aeef1bc3b5d76268782acff43e9d71d57
Author: Ludovic Courtès <address@hidden>
Date: Fri Sep 4 18:31:06 2015 +0200
monads: Fix 'liftN' fallback case.
Reported by Andy Wingo <address@hidden>.
* guix/monads.scm (define-lift) <fallback case>: Add missing #'. Remove
extra formal parameter.
* tests/monads.scm ("lift"): Add test with 'lift1' as a procedure.
---
guix/monads.scm | 8 ++++----
tests/monads.scm | 4 +++-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/guix/monads.scm b/guix/monads.scm
index 61cd533..0b0ad23 100644
--- a/guix/monads.scm
+++ b/guix/monads.scm
@@ -239,10 +239,10 @@ CONDITION is true, return *unspecified* in the current
monad."
(identifier? #'id)
;; Slow path: Return a closure-returning procedure (we don't
;; guarantee (eq? LIFTN LIFTN), but that's fine.)
- (lambda (liftn proc monad)
- (lambda (args ...)
- (with-monad monad
- (return (proc args ...))))))))))))
+ #'(lambda (proc monad)
+ (lambda (args ...)
+ (with-monad monad
+ (return (proc args ...))))))))))))
(define-lift lift0 ())
(define-lift lift1 (a))
diff --git a/tests/monads.scm b/tests/monads.scm
index d3ef065..62a07a2 100644
--- a/tests/monads.scm
+++ b/tests/monads.scm
@@ -95,10 +95,12 @@
(test-assert "lift"
(every (lambda (monad run)
- (let ((f (lift1 1+ monad)))
+ (let ((f (lift1 1+ monad))
+ (g (apply lift1 1+ (list monad))))
(with-monad monad
(let ((number (random 777)))
(= (run (>>= (return number) f))
+ (run (>>= (return number) g))
(1+ number))))))
%monads
%monad-run))