diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/control/function/mixin.lux | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/stdlib/source/library/lux/control/function/mixin.lux b/stdlib/source/library/lux/control/function/mixin.lux index 796c04057..50e26ef55 100644 --- a/stdlib/source/library/lux/control/function/mixin.lux +++ b/stdlib/source/library/lux/control/function/mixin.lux @@ -9,35 +9,35 @@ [predicate (#+ Predicate)] [monad (#+ Monad do)]]]]) -(type: #export (Mixin i o) +(type: .public (Mixin i o) {#.doc (doc "A function which can be mixed with others to inherit their behavior.")} (-> (-> i o) (-> i o) (-> i o))) -(def: #export (mixin f) +(def: .public (mixin f) {#.doc (doc "Given a mixin, produces a normal function.")} (All [i o] (-> (Mixin i o) (-> i o))) (function (mix input) ((f mix mix) input))) -(def: #export nothing +(def: .public nothing {#.doc (doc "A mixin that does nothing and just delegates work to the next mixin.")} Mixin (function (_ delegate recur) delegate)) -(def: #export (inherit parent child) +(def: .public (inherit parent child) {#.doc (doc "Produces a new mixin, where the behavior of the child can make use of the behavior of the parent.")} (All [i o] (-> (Mixin i o) (Mixin i o) (Mixin i o))) (function (_ delegate recur) (parent (child delegate recur) recur))) -(implementation: #export monoid +(implementation: .public monoid (All [i o] (Monoid (Mixin i o))) (def: identity ..nothing) (def: compose ..inherit)) -(def: #export (advice when then) +(def: .public (advice when then) {#.doc (doc "Only apply then mixin when the input meets some criterion.")} (All [i o] (-> (Predicate i) (Mixin i o) (Mixin i o))) (function (_ delegate recur input) @@ -45,7 +45,7 @@ ((then delegate recur) input) (delegate input)))) -(def: #export (before monad action) +(def: .public (before monad action) {#.doc (doc "Executes an action before doing the main work.")} (All [! i o] (-> (Monad !) (-> i (! Any)) (Mixin i (! o)))) (function (_ delegate recur input) @@ -53,7 +53,7 @@ [_ (action input)] (delegate input)))) -(def: #export (after monad action) +(def: .public (after monad action) {#.doc (doc "Executes an action after doing the main work.")} (All [! i o] (-> (Monad !) (-> i o (! Any)) (Mixin i (! o)))) (function (_ delegate recur input) @@ -62,11 +62,11 @@ _ (action input output)] (in output)))) -(type: #export (Recursive i o) +(type: .public (Recursive i o) {#.doc (doc "An indirectly recursive function.")} (-> (-> i o) (-> i o))) -(def: #export (of_recursive recursive) +(def: .public (of_recursive recursive) {#.doc (doc "Transform an indirectly recursive function into a mixin.")} (All [i o] (-> (Recursive i o) (Mixin i o))) (function (_ delegate recur) |