diff options
Diffstat (limited to 'stdlib/source/lux/concurrency/stm.lux')
-rw-r--r-- | stdlib/source/lux/concurrency/stm.lux | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/stdlib/source/lux/concurrency/stm.lux b/stdlib/source/lux/concurrency/stm.lux index 707512821..fb150d842 100644 --- a/stdlib/source/lux/concurrency/stm.lux +++ b/stdlib/source/lux/concurrency/stm.lux @@ -34,7 +34,7 @@ (:: io.Functor<IO> map product.left))) (def: (write! new-value (^@representation var)) - (All [a] (-> a (Var a) (IO Unit))) + (All [a] (-> a (Var a) (IO Top))) (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 Unit) var) - (:! (Var Unit) _var)))) + (is? (:! (Var Top) var) + (:! (Var Top) _var)))) (:: maybe.Monad<Maybe> map (function (_ [_var _original _current]) _current)) (:!!) @@ -102,11 +102,11 @@ #.Nil (#.Cons [_var _original _current] tx') - (if (is? (:! (Var Unit) var) - (:! (Var Unit) _var)) - (#.Cons {#var (:! (Var Unit) _var) - #original (:! Unit _original) - #current (:! Unit value)} + (if (is? (:! (Var Top) var) + (:! (Var Top) _var)) + (#.Cons {#var (:! (Var Top) _var) + #original (:! Top _original) + #current (:! Top 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 Unit))) + (All [a] (-> a (Var a) (STM Top))) (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)) Unit) + (-> (Ex [a] (Tx-Frame a)) Top) (if (is? _original _current) [] (io.run (write! _current _var)))) @@ -202,7 +202,7 @@ (recur tail))))) (def: (process-commit [stm-proc output]) - (-> [(STM Unit) (Promise Unit)] Top) + (-> [(STM Top) (Promise Top)] Top) (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 Unit) + (IO Top) (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 Unit) (Promise Unit)] head)) + (io (exec (process-commit (:! [(STM Top) (Promise Top)] head)) (promise.await recur tail)))))) (wrap [])) (wrap []))) |