diff options
Diffstat (limited to 'stdlib/source/library/lux/control/concurrency/stm.lux')
-rw-r--r-- | stdlib/source/library/lux/control/concurrency/stm.lux | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/stdlib/source/library/lux/control/concurrency/stm.lux b/stdlib/source/library/lux/control/concurrency/stm.lux index cb6a1e702..d8bb2568b 100644 --- a/stdlib/source/library/lux/control/concurrency/stm.lux +++ b/stdlib/source/library/lux/control/concurrency/stm.lux @@ -29,15 +29,15 @@ (Atom [a (List (Sink a))]) (def: .public (var value) - (All [a] (-> a (Var a))) + (All (_ a) (-> a (Var a))) (:abstraction (atom.atom [value (list)]))) (def: read! - (All [a] (-> (Var a) a)) + (All (_ a) (-> (Var a) a)) (|>> :representation atom.read! io.run! product.left)) (def: (un_follow! sink var) - (All [a] (-> (Sink a) (Var a) (IO Any))) + (All (_ a) (-> (Sink a) (Var a) (IO Any))) (do io.monad [_ (atom.update! (function (_ [value observers]) [value (list.only (|>> (same? sink) not) observers)]) @@ -45,7 +45,7 @@ (in []))) (def: (write! new_value var) - (All [a] (-> a (Var a) (IO Any))) + (All (_ a) (-> a (Var a) (IO Any))) (do {! io.monad} [.let [var' (:representation var)] (^@ old [old_value observers]) (atom.read! var') @@ -66,7 +66,7 @@ (write! new_value var)))) (def: .public (follow! target) - (All [a] (-> (Var a) (IO [(Channel a) (Sink a)]))) + (All (_ a) (-> (Var a) (IO [(Channel a) (Sink a)]))) (do io.monad [.let [[channel sink] (frp.channel [])] _ (atom.update! (function (_ [value observers]) @@ -82,13 +82,13 @@ #current a})) (type: Tx - (List (Ex [a] (Tx_Frame a)))) + (List (Ex (_ a) (Tx_Frame a)))) (type: .public (STM a) (-> Tx [Tx a])) (def: (var_value var tx) - (All [a] (-> (Var a) Tx (Maybe a))) + (All (_ a) (-> (Var a) Tx (Maybe a))) (|> tx (list.example (function (_ [_var _original _current]) (same? (:as (Var Any) var) @@ -98,7 +98,7 @@ :expected)) (def: .public (read var) - (All [a] (-> (Var a) (STM a))) + (All (_ a) (-> (Var a) (STM a))) (function (_ tx) (case (var_value var tx) (#.Some value) @@ -110,7 +110,7 @@ value])))) (def: (with_updated_var var value tx) - (All [a] (-> (Var a) a Tx Tx)) + (All (_ a) (-> (Var a) a Tx Tx)) (case tx #.End #.End @@ -128,7 +128,7 @@ (with_updated_var var value tx'))))) (def: .public (write value var) - (All [a] (-> a (Var a) (STM Any))) + (All (_ a) (-> a (Var a) (STM Any))) (function (_ tx) (case (var_value var tx) (#.Some _) @@ -173,7 +173,7 @@ (ma tx'))))) (def: .public (update f var) - (All [a] (-> (-> a a) (Var a) (STM [a a]))) + (All (_ a) (-> (-> a a) (Var a) (STM [a a]))) (do ..monad [a (..read var) .let [a' (f a)] @@ -187,7 +187,7 @@ tx)) (def: (commit_var! [_var _original _current]) - (-> (Ex [a] (Tx_Frame a)) (IO Any)) + (-> (Ex (_ a) (Tx_Frame a)) (IO Any)) (if (same? _original _current) (io []) (..write! _current _var))) @@ -201,8 +201,8 @@ (def: pending_commits (Atom (Rec Commits - [(Async [(Ex [a] (Commit a)) Commits]) - (Resolver [(Ex [a] (Commit a)) Commits])])) + [(Async [(Ex (_ a) (Commit a)) Commits]) + (Resolver [(Ex (_ a) (Commit a)) Commits])])) (atom (async.async []))) (def: commit_processor_flag @@ -210,7 +210,7 @@ (atom #0)) (def: (issue_commit! commit) - (All [a] (-> (Commit a) (IO Any))) + (All (_ a) (-> (Commit a) (IO Any))) (let [entry [commit (async.async [])]] (do {! io.monad} [|commits|&resolve (atom.read! pending_commits)] @@ -229,7 +229,7 @@ (recur tail))))))) (def: (process_commit! commit) - (All [a] (-> (Commit a) (IO Any))) + (All (_ a) (-> (Commit a) (IO Any))) (let [[stm_proc output resolve] commit [finished_tx value] (stm_proc fresh_tx)] (if (can_commit? finished_tx) @@ -258,7 +258,7 @@ ))) (def: .public (commit! stm_proc) - (All [a] (-> (STM a) (Async a))) + (All (_ a) (-> (STM a) (Async a))) (let [[output resolver] (async.async [])] (exec (io.run! (do io.monad |