FIX don't eval either twice in bind
This commit is contained in:
parent
21449ad792
commit
19077c72c9
|
@ -39,10 +39,12 @@ left/right slot."
|
||||||
(defmacro either>>= (either form)
|
(defmacro either>>= (either form)
|
||||||
"Bind EITHER to FORM where the right slot is bound to 'it'."
|
"Bind EITHER to FORM where the right slot is bound to 'it'."
|
||||||
(declare (indent 1))
|
(declare (indent 1))
|
||||||
`(pcase ,either
|
(let ((e (make-symbol "--either")))
|
||||||
(`(:left ,_) ,either)
|
`(let ((,e ,either))
|
||||||
|
(pcase ,e
|
||||||
|
(`(:left ,_) ,e)
|
||||||
(`(:right ,it) ,form)
|
(`(:right ,it) ,form)
|
||||||
(e (error "Learn to use monads, dummy; this isn't one: %s" e))))
|
(e (error "Learn to use monads, dummy; this isn't one: %s" e))))))
|
||||||
|
|
||||||
(defun either-foldM (fun init xs)
|
(defun either-foldM (fun init xs)
|
||||||
"Mondically apply FUN to XS (a list).
|
"Mondically apply FUN to XS (a list).
|
||||||
|
|
Loading…
Reference in New Issue