diff options
Diffstat (limited to 'stdlib/source/lux/concurrency/stm.lux')
-rw-r--r-- | stdlib/source/lux/concurrency/stm.lux | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/stdlib/source/lux/concurrency/stm.lux b/stdlib/source/lux/concurrency/stm.lux index a62a35677..cdafbc686 100644 --- a/stdlib/source/lux/concurrency/stm.lux +++ b/stdlib/source/lux/concurrency/stm.lux @@ -40,7 +40,7 @@ succeeded? (atom.compare-and-swap old [new-value _observers] var)] (if succeeded? (do @ - [_ (monad.map @ (function [f] (f new-value)) _observers)] + [_ (monad.map @ (function (_ f) (f new-value)) _observers)] (wrap [])) (write! new-value (@abstraction var))))) @@ -54,7 +54,7 @@ (do io.Monad<IO> [#let [channel (helper|follow target) target (@representation target)] - _ (atom.update (function [[value observers]] + _ (atom.update (function (_ [value observers]) [value (#.Cons (frp.publish channel) observers)]) target)] (wrap channel))) @@ -75,17 +75,17 @@ (def: (find-var-value var tx) (All [a] (-> (Var a) Tx (Maybe a))) (|> tx - (list.find (function [[_var _original _current]] + (list.find (function (_ [_var _original _current]) (is? (:! (Var Unit) var) (:! (Var Unit) _var)))) - (:: maybe.Monad<Maybe> map (function [[_var _original _current]] + (:: maybe.Monad<Maybe> map (function (_ [_var _original _current]) _current)) (:!!) )) (def: #export (read var) (All [a] (-> (Var a) (STM a))) - (function [tx] + (function (_ tx) (case (find-var-value var tx) (#.Some value) [tx value] @@ -117,7 +117,7 @@ (def: #export (write value var) {#.doc "Writes value to var."} (All [a] (-> a (Var a) (STM Unit))) - (function [tx] + (function (_ tx) (case (find-var-value var tx) (#.Some _) [(update-tx-value var value tx) @@ -129,7 +129,7 @@ (struct: #export _ (Functor STM) (def: (map f fa) - (function [tx] + (function (_ tx) (let [[tx' a] (fa tx)] [tx' (f a)])))) @@ -137,10 +137,10 @@ (def: functor Functor<STM>) (def: (wrap a) - (function [tx] [tx a])) + (function (_ tx) [tx a])) (def: (apply ff fa) - (function [tx] + (function (_ tx) (let [[tx' f] (ff tx) [tx'' a] (fa tx')] [tx'' (f a)])))) @@ -149,7 +149,7 @@ (def: applicative Applicative<STM>) (def: (join mma) - (function [tx] + (function (_ tx) (let [[tx' ma] (mma tx)] (ma tx'))))) @@ -164,7 +164,7 @@ (def: (can-commit? tx) (-> Tx Bool) - (list.every? (function [[_var _original _current]] + (list.every? (function (_ [_var _original _current]) (is? _original (read!! _var))) tx)) @@ -219,7 +219,7 @@ [was-first? (atom.compare-and-swap flag true commit-processor-flag)] (if was-first? (exec (|> (io.run (atom.read pending-commits)) - (promise.await (function recur [[head tail]] + (promise.await (function (recur [head tail]) (io (exec (process-commit (:! [(STM Unit) (Promise Unit)] head)) (promise.await recur tail)))))) (wrap [])) |