diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/abstract/comonad.lux | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/stdlib/source/library/lux/abstract/comonad.lux b/stdlib/source/library/lux/abstract/comonad.lux index e3b0f9dbc..8c61becd7 100644 --- a/stdlib/source/library/lux/abstract/comonad.lux +++ b/stdlib/source/library/lux/abstract/comonad.lux @@ -35,7 +35,8 @@ _ {.#None})) {.#Some [?name comonad bindings body]} - (if (|> bindings list.size (n.% 2) (n.= 0)) + (case (list.pairs bindings) + {.#Some bindings} (let [[module short] (symbol ..be) symbol (: (-> Text Code) (|>> ($_ "lux text concat" module " " short " ") [""] {.#Symbol} [location.dummy])) @@ -56,7 +57,7 @@ _ <default>))))) body - (list.reversed (list.pairs bindings)))] + (list.reversed bindings))] {.#Right [state (list (case ?name {.#Some name} (let [name [location.dummy {.#Symbol ["" name]}]] @@ -70,6 +71,8 @@ (` (.case (~ comonad) [(~ g!each) (~' out) (~ g!disjoint)] (~ body')))))]}) + + {.#None} {.#Left "'be' bindings must have an even number of parts."}) {.#None} |