diff options
author | Eduardo Julian | 2021-08-11 02:38:59 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-08-11 02:38:59 -0400 |
commit | a62ce3f9c2b605e0033f4772b0f64c4525de4d86 (patch) | |
tree | ecbabe8f110d82b2e6481cf7c0532d4bd4386570 /stdlib/source/library/lux/abstract/comonad.lux | |
parent | 464b6e8f5e6c62f58fa8c7ff61ab2ad215e98bd1 (diff) |
Relocated maybe and lazy from data to control.
Diffstat (limited to 'stdlib/source/library/lux/abstract/comonad.lux')
-rw-r--r-- | stdlib/source/library/lux/abstract/comonad.lux | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/stdlib/source/library/lux/abstract/comonad.lux b/stdlib/source/library/lux/abstract/comonad.lux index 589ed47f2..6de44d5f2 100644 --- a/stdlib/source/library/lux/abstract/comonad.lux +++ b/stdlib/source/library/lux/abstract/comonad.lux @@ -13,8 +13,8 @@ [functor (#+ Functor)]]) (interface: .public (CoMonad w) - {#.doc (doc "CoMonads are the opposite/complement to monads." - "CoMonadic structures are often infinite in size and built upon lazily-evaluated functions.")} + {#.doc (example "CoMonads are the opposite/complement to monads." + "CoMonadic structures are often infinite in size and built upon lazily-evaluated functions.")} (: (Functor w) &functor) (: (All [a] @@ -25,11 +25,11 @@ split)) (macro: .public (be tokens state) - {#.doc (doc "A co-monadic parallel to the 'do' macro." - (let [square (function (_ n) (* n n))] - (be comonad - [inputs (iterate inc +2)] - (square (head inputs)))))} + {#.doc (example "A co-monadic parallel to the 'do' macro." + (let [square (function (_ n) (* n n))] + (be comonad + [inputs (iterate inc +2)] + (square (head inputs)))))} (case (: (Maybe [(Maybe Text) Code (List Code) Code]) (case tokens (^ (list [_ (#.Record (list [[_ (#.Identifier ["" name])] comonad]))] [_ (#.Tuple bindings)] body)) @@ -43,11 +43,11 @@ (#.Some [?name comonad bindings body]) (if (|> bindings list.size (n.% 2) (n.= 0)) (let [[module short] (name_of ..be) - gensym (: (-> Text Code) - (|>> ($_ "lux text concat" module " " short " ") [""] #.Identifier [location.dummy])) - g!_ (gensym "_") - g!map (gensym "map") - g!split (gensym "split") + identifier (: (-> Text Code) + (|>> ($_ "lux text concat" module " " short " ") [""] #.Identifier [location.dummy])) + g!_ (identifier "_") + g!map (identifier "map") + g!split (identifier "split") body' (list\fold (: (-> [Code Code] Code Code) (function (_ binding body') (with_expansions [<default> (` (|> (~ value) (~ g!split) ((~ g!map) (function ((~ g!_) (~ var)) (~ body')))))] |