aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/concurrency/stm.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/concurrency/stm.lux')
-rw-r--r--stdlib/source/lux/concurrency/stm.lux28
1 files changed, 14 insertions, 14 deletions
diff --git a/stdlib/source/lux/concurrency/stm.lux b/stdlib/source/lux/concurrency/stm.lux
index c1c3153dd..8f8fe4828 100644
--- a/stdlib/source/lux/concurrency/stm.lux
+++ b/stdlib/source/lux/concurrency/stm.lux
@@ -53,16 +53,16 @@
(def: (find-var-value var tx)
(All [a] (-> (Var a) Tx (Maybe a)))
(|> tx
- (find (lambda [[_var _original _current]]
+ (find (function [[_var _original _current]]
(is (:! (Var Unit) var)
(:! (Var Unit) _var))))
- (:: Monad<Maybe> map (lambda [[_var _original _current]]
+ (:: Monad<Maybe> map (function [[_var _original _current]]
_current))
(:! (Maybe ($ +0)))))
(def: #export (read var)
(All [a] (-> (Var a) (STM a)))
- (lambda [tx]
+ (function [tx]
(case (find-var-value var tx)
(#;Some value)
[tx value]
@@ -98,7 +98,7 @@
(def: #export (write value var)
(All [a] (-> a (Var a) (STM Unit)))
- (lambda [tx]
+ (function [tx]
(case (find-var-value var tx)
(#;Some _)
[(update-tx-value var value tx)
@@ -121,7 +121,7 @@
[_ (|> old
(get@ #observers)
dict;values
- (mapM @ (lambda [f] (f new-value))))]
+ (mapM @ (function [f] (f new-value))))]
(wrap []))
(write! new-value var))))
@@ -130,20 +130,20 @@
(All [a] (-> (Var a) (IO (frp;Chan a))))
(let [head (frp;chan ($ +0))
chan-var (var head)
- observer (lambda [label value]
+ observer (function [label value]
(case (io;run (|> chan-var raw-read (frp;write value)))
#;None
## By closing the output Chan, the
## observer becomes obsolete.
- (atom;update (lambda [[value observers]]
+ (atom;update (function [[value observers]]
[value (dict;remove label observers)])
target)
(#;Some tail')
(write! tail' chan-var)))]
(do Monad<IO>
- [_ (atom;update (lambda [[value observers]]
- (let [label (Nat/encode (List/fold (lambda [key base]
+ [_ (atom;update (function [[value observers]]
+ (let [label (Nat/encode (List/fold (function [key base]
(case (Nat/decode key)
(#;Left _)
base
@@ -158,7 +158,7 @@
(struct: #export _ (Functor STM)
(def: (map f fa)
- (lambda [tx]
+ (function [tx]
(let [[tx' a] (fa tx)]
[tx' (f a)]))))
@@ -166,10 +166,10 @@
(def: functor Functor<STM>)
(def: (wrap a)
- (lambda [tx] [tx a]))
+ (function [tx] [tx a]))
(def: (apply ff fa)
- (lambda [tx]
+ (function [tx]
(let [[tx' f] (ff tx)
[tx'' a] (fa tx')]
[tx'' (f a)]))))
@@ -178,7 +178,7 @@
(def: applicative Applicative<STM>)
(def: (join mma)
- (lambda [tx]
+ (function [tx]
(let [[tx' ma] (mma tx)]
(ma tx')))))
@@ -205,7 +205,7 @@
(def: (can-commit? tx)
(-> Tx Bool)
- (every? (lambda [[_var _original _current]]
+ (every? (function [[_var _original _current]]
(is _original (raw-read _var)))
tx))