aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/function/cont.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/function/cont.lux28
1 files changed, 14 insertions, 14 deletions
diff --git a/stdlib/source/lux/function/cont.lux b/stdlib/source/lux/function/cont.lux
index 7635d7129..08f784035 100644
--- a/stdlib/source/lux/function/cont.lux
+++ b/stdlib/source/lux/function/cont.lux
@@ -24,25 +24,25 @@
(struct: #export Functor<Cont> (All [o] (Functor (All [i] (Cont i o))))
(def: (map f fv)
- (lambda [k] (fv (. k f)))))
+ (function [k] (fv (. k f)))))
(struct: #export Applicative<Cont> (All [o] (Applicative (All [i] (Cont i o))))
(def: functor Functor<Cont>)
(def: (wrap value)
- (lambda [k] (k value)))
+ (function [k] (k value)))
(def: (apply ff fv)
- (lambda [k]
+ (function [k]
(|> (k (f v))
- (lambda [v]) fv
- (lambda [f]) ff))))
+ (function [v]) fv
+ (function [f]) ff))))
(struct: #export Monad<Cont> (All [o] (Monad (All [i] (Cont i o))))
(def: applicative Applicative<Cont>)
(def: (join ffa)
- (lambda [k]
+ (function [k]
(ffa (continue k)))))
(def: #export (call/cc f)
@@ -51,15 +51,15 @@
(-> (-> (-> a (Cont b z))
(Cont a z))
(Cont a z)))
- (lambda [k]
- (f (lambda [a] (lambda [_] (k a)))
+ (function [k]
+ (f (function [a] (function [_] (k a)))
k)))
(syntax: #export (pending expr)
{#;doc (doc "Turns any expression into a function that is pending a continuation."
(pending (some-computation some-input)))}
(with-gensyms [g!k]
- (wrap (list (` (;lambda [(~ g!k)] ((~ g!k) (~ expr))))))))
+ (wrap (list (` (;function [(~ g!k)] ((~ g!k) (~ expr))))))))
(def: #export (portal init)
(All [i o z]
@@ -67,16 +67,16 @@
(Cont [(-> i (Cont o z))
i]
z)))
- (call/cc (lambda [k]
+ (call/cc (function [k]
(do Monad<Cont>
- [#let [nexus (lambda nexus [val]
+ [#let [nexus (function nexus [val]
(k [nexus val]))]
_ (k [nexus init])]
(wrap (undefined))))))
(def: #export (reset scope)
(All [i o] (-> (Cont i i) (Cont i o)))
- (lambda [k]
+ (function [k]
(k (run scope))))
(def: #export (shift f)
@@ -84,6 +84,6 @@
(-> (-> (-> a (Cont a a))
(Cont a a))
(Cont a a)))
- (lambda [oc]
- (f (lambda [a] (lambda [ic] (ic (oc a))))
+ (function [oc]
+ (f (function [a] (function [ic] (ic (oc a))))
id)))