aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
authorEduardo Julian2016-12-08 07:10:45 -0400
committerEduardo Julian2016-12-08 07:10:45 -0400
commit4b07eca3ed255fd11bf5295d79901184e6cceb03 (patch)
tree9d70f53543c74568aad506c2b394b9eb238d7ac2 /stdlib/source
parentef175d5ba224e5b7d41946da9b7002f3bafbcf45 (diff)
- Updated & expanded lux/concurrency/* tests.
Diffstat (limited to 'stdlib/source')
-rw-r--r--stdlib/source/lux/concurrency/stm.lux18
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)))