diff options
Diffstat (limited to 'stdlib/source/lux/concurrency/stm.lux')
-rw-r--r-- | stdlib/source/lux/concurrency/stm.lux | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/stdlib/source/lux/concurrency/stm.lux b/stdlib/source/lux/concurrency/stm.lux index cf9624409..89bbab2af 100644 --- a/stdlib/source/lux/concurrency/stm.lux +++ b/stdlib/source/lux/concurrency/stm.lux @@ -13,6 +13,7 @@ [dict #+ Dict]) [product] [text] + maybe text/format) host [compiler] @@ -52,16 +53,13 @@ (def: (find-var-value var tx) (All [a] (-> (Var a) Tx (Maybe a))) - (:! (Maybe ($ +0)) - (find (: (-> (Ex [a] (Tx-Frame a)) - (Maybe Unit)) - (lambda [[_var _original _current]] - (:! (Maybe Unit) - (if (== (:! (Var Unit) var) - (:! (Var Unit) _var)) - (#;Some _current) - #;None)))) - tx))) + (|> tx + (find (lambda [[_var _original _current]] + (== (:! (Var Unit) var) + (:! (Var Unit) _var)))) + (:: Monad<Maybe> map (lambda [[_var _original _current]] + _current)) + (:! (Maybe ($ +0))))) (def: #export (read var) (All [a] (-> (Var a) (STM a))) |