diff options
Diffstat (limited to 'stdlib/source/lux/concurrency/stm.lux')
-rw-r--r-- | stdlib/source/lux/concurrency/stm.lux | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/stdlib/source/lux/concurrency/stm.lux b/stdlib/source/lux/concurrency/stm.lux index fb150d842..a7c8b3cf3 100644 --- a/stdlib/source/lux/concurrency/stm.lux +++ b/stdlib/source/lux/concurrency/stm.lux @@ -15,7 +15,7 @@ (abstract: #export (Var a) {#.doc "A mutable cell containing a value, and observers that will be alerted of any change to it."} - (Atom [a (List (-> a (IO Top)))]) + (Atom [a (List (-> a (IO Any)))]) (def: #export (var value) {#.doc "Creates a new STM var, with a default value."} @@ -34,7 +34,7 @@ (:: io.Functor<IO> map product.left))) (def: (write! new-value (^@representation var)) - (All [a] (-> a (Var a) (IO Top))) + (All [a] (-> a (Var a) (IO Any))) (do io.Monad<IO> [(^@ old [_value _observers]) (atom.read var) succeeded? (atom.compare-and-swap old [new-value _observers] var)] @@ -76,8 +76,8 @@ (All [a] (-> (Var a) Tx (Maybe a))) (|> tx (list.find (function (_ [_var _original _current]) - (is? (:! (Var Top) var) - (:! (Var Top) _var)))) + (is? (:! (Var Any) var) + (:! (Var Any) _var)))) (:: maybe.Monad<Maybe> map (function (_ [_var _original _current]) _current)) (:!!) @@ -102,11 +102,11 @@ #.Nil (#.Cons [_var _original _current] tx') - (if (is? (:! (Var Top) var) - (:! (Var Top) _var)) - (#.Cons {#var (:! (Var Top) _var) - #original (:! Top _original) - #current (:! Top value)} + (if (is? (:! (Var Any) var) + (:! (Var Any) _var)) + (#.Cons {#var (:! (Var Any) _var) + #original (:! Any _original) + #current (:! Any value)} tx') (#.Cons {#var _var #original _original @@ -116,7 +116,7 @@ (def: #export (write value var) {#.doc "Writes value to var."} - (All [a] (-> a (Var a) (STM Top))) + (All [a] (-> a (Var a) (STM Any))) (function (_ tx) (case (find-var-value var tx) (#.Some _) @@ -169,7 +169,7 @@ tx)) (def: (commit-var! [_var _original _current]) - (-> (Ex [a] (Tx-Frame a)) Top) + (-> (Ex [a] (Tx-Frame a)) Any) (if (is? _original _current) [] (io.run (write! _current _var)))) @@ -187,7 +187,7 @@ (atom false)) (def: (issue-commit commit) - (-> Commit (IO Top)) + (-> Commit (IO Any)) (let [entry [commit (promise #.None)]] (loop [|commits| (io.run (atom.read pending-commits))] (case (promise.poll |commits|) @@ -202,7 +202,7 @@ (recur tail))))) (def: (process-commit [stm-proc output]) - (-> [(STM Top) (Promise Top)] Top) + (-> [(STM Any) (Promise Any)] Any) (let [[finished-tx value] (stm-proc fresh-tx)] (io.run (if (can-commit? finished-tx) (exec (list/map commit-var! finished-tx) @@ -210,7 +210,7 @@ (issue-commit [stm-proc output]))))) (def: init-processor! - (IO Top) + (IO Any) (do io.Monad<IO> [flag (atom.read commit-processor-flag)] (if flag @@ -220,7 +220,7 @@ (if was-first? (exec (|> (io.run (atom.read pending-commits)) (promise.await (function (recur [head tail]) - (io (exec (process-commit (:! [(STM Top) (Promise Top)] head)) + (io (exec (process-commit (:! [(STM Any) (Promise Any)] head)) (promise.await recur tail)))))) (wrap [])) (wrap []))) |