aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/control/function/mixin.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/control/function/mixin.lux63
1 files changed, 0 insertions, 63 deletions
diff --git a/stdlib/source/lux/control/function/mixin.lux b/stdlib/source/lux/control/function/mixin.lux
deleted file mode 100644
index 4d1c9fcb8..000000000
--- a/stdlib/source/lux/control/function/mixin.lux
+++ /dev/null
@@ -1,63 +0,0 @@
-## Inspired by;
-## "The Different Aspects of Monads and Mixins" by Bruno C. d. S. Oliveira
-
-(.module:
- [lux #*
- [abstract
- [monoid (#+ Monoid)]
- [predicate (#+ Predicate)]
- [monad (#+ Monad do)]]])
-
-(type: #export (Mixin i o)
- (-> (-> i o) (-> i o) (-> i o)))
-
-(def: #export (mixin f)
- (All [i o] (-> (Mixin i o) (-> i o)))
- (function (mix input)
- ((f mix mix) input)))
-
-(def: #export nothing
- Mixin
- (function (_ delegate recur)
- delegate))
-
-(def: #export (inherit parent child)
- (All [i o] (-> (Mixin i o) (Mixin i o) (Mixin i o)))
- (function (_ delegate recur)
- (parent (child delegate recur) recur)))
-
-(implementation: #export monoid
- (All [i o] (Monoid (Mixin i o)))
-
- (def: identity ..nothing)
- (def: compose ..inherit))
-
-(def: #export (advice when then)
- (All [i o] (-> (Predicate i) (Mixin i o) (Mixin i o)))
- (function (_ delegate recur input)
- (if (when input)
- ((then delegate recur) input)
- (delegate input))))
-
-(def: #export (before monad action)
- (All [! i o] (-> (Monad !) (-> i (! Any)) (Mixin i (! o))))
- (function (_ delegate recur input)
- (do monad
- [_ (action input)]
- (delegate input))))
-
-(def: #export (after monad action)
- (All [! i o] (-> (Monad !) (-> i o (! Any)) (Mixin i (! o))))
- (function (_ delegate recur input)
- (do monad
- [output (delegate input)
- _ (action input output)]
- (wrap output))))
-
-(type: #export (Recursive i o)
- (-> (-> i o) (-> i o)))
-
-(def: #export (from-recursive recursive)
- (All [i o] (-> (Recursive i o) (Mixin i o)))
- (function (_ delegate recur)
- (recursive recur)))