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/monad.lux | |
parent | 464b6e8f5e6c62f58fa8c7ff61ab2ad215e98bd1 (diff) |
Relocated maybe and lazy from data to control.
Diffstat (limited to 'stdlib/source/library/lux/abstract/monad.lux')
-rw-r--r-- | stdlib/source/library/lux/abstract/monad.lux | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/stdlib/source/library/lux/abstract/monad.lux b/stdlib/source/library/lux/abstract/monad.lux index 01e22b7a7..31002b5be 100644 --- a/stdlib/source/library/lux/abstract/monad.lux +++ b/stdlib/source/library/lux/abstract/monad.lux @@ -44,8 +44,8 @@ #.End)) (interface: .public (Monad m) - {#.doc (doc "A monad is a monoid in the category of endofunctors." - "What's the problem?")} + {#.doc (example "A monad is a monoid in the category of endofunctors." + "What's the problem?")} (: (Functor m) &functor) @@ -57,11 +57,11 @@ join)) (macro: .public (do tokens state) - {#.doc (doc "Macro for easy concatenation of monadic operations." - (do monad - [y (f1 x) - z (f2 z)] - (in (f3 z))))} + {#.doc (example "Macro for easy concatenation of monadic operations." + (do monad + [y (f1 x) + z (f2 z)] + (in (f3 z))))} (case (: (Maybe [(Maybe Text) Code (List Code) Code]) (case tokens (^ (list [_ (#.Record (list [[_ (#.Identifier ["" name])] monad]))] [_ (#.Tuple bindings)] body)) @@ -75,11 +75,11 @@ (#.Some [?name monad bindings body]) (if (|> bindings list\size .int ("lux i64 %" +2) ("lux i64 =" +0)) (let [[module short] (name_of ..do) - gensym (: (-> Text Code) - (|>> ($_ "lux text concat" module " " short " ") [""] #.Identifier [location.dummy])) - g!_ (gensym "_") - g!map (gensym "map") - g!join (gensym "join") + identifier (: (-> Text Code) + (|>> ($_ "lux text concat" module " " short " ") [""] #.Identifier [location.dummy])) + g!_ (identifier "_") + g!map (identifier "map") + g!join (identifier "join") body' (list\fold (: (-> [Code Code] Code Code) (function (_ binding body') (with_expansions [<default> (` (|> (~ value) ((~ g!map) (function ((~ g!_) (~ var)) (~ body'))) (~ g!join)))] @@ -114,7 +114,7 @@ (#.Left "Wrong syntax for 'do'"))) (def: .public (bind monad f) - {#.doc (doc "Apply a function with monadic effects to a monadic value and yield a new monadic value.")} + {#.doc (example "Apply a function with monadic effects to a monadic value and yield a new monadic value.")} (All [! a b] (-> (Monad !) (-> a (! b)) (-> (! a) (! b)))) |