diff options
author | Marius Bakke <mbakke@fastmail.com> | 2019-02-09 21:11:00 +0100 |
---|---|---|
committer | Marius Bakke <mbakke@fastmail.com> | 2019-02-09 21:11:00 +0100 |
commit | ebbb7286b91e21cb26153e3d0a3ea8017cf16224 (patch) | |
tree | c41eccbe937b0541109cc3b2d45c372ebf826755 /guix/monads.scm | |
parent | d41f63942b5df85223f5fae110253bc30869653b (diff) | |
parent | aefa29123feaf4202010675eae0a563b3ee90cf1 (diff) |
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/monads.scm')
-rw-r--r-- | guix/monads.scm | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/guix/monads.scm b/guix/monads.scm index 6ae616aca9..6924471345 100644 --- a/guix/monads.scm +++ b/guix/monads.scm @@ -274,12 +274,23 @@ more optimizations." (_ #'generic-name)))))))))) -(define-syntax-parameter >>= +(define-syntax-rule (define-syntax-parameter-once name proc) + ;; Like 'define-syntax-parameter' but ensure the top-level binding for NAME + ;; does not get redefined. This works around a race condition in a + ;; multi-threaded context with Guile <= 2.2.4: <https://bugs.gnu.org/27476>. + (eval-when (load eval expand compile) + (define name + (if (module-locally-bound? (current-module) 'name) + (module-ref (current-module) 'name) + (make-syntax-transformer 'name 'syntax-parameter + (list proc)))))) + +(define-syntax-parameter-once >>= ;; The name 'bind' is already taken, so we choose this (obscure) symbol. (lambda (s) (syntax-violation '>>= ">>= (bind) used outside of 'with-monad'" s))) -(define-syntax-parameter return +(define-syntax-parameter-once return (lambda (s) (syntax-violation 'return "return used outside of 'with-monad'" s))) |