aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/control/concurrency/async.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/control/concurrency/async.lux28
1 files changed, 14 insertions, 14 deletions
diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux
index 32bc8cca1..6070efb3e 100644
--- a/stdlib/source/library/lux/control/concurrency/async.lux
+++ b/stdlib/source/library/lux/control/concurrency/async.lux
@@ -13,8 +13,8 @@
["[0]" product]]
[macro
["^" pattern]]
- [type {"+" :sharing}
- abstract]]]
+ [type {"+" sharing}
+ [abstract {"-" pattern}]]]]
[//
["[0]" thread]
["[0]" atom {"+" Atom atom}]])
@@ -29,7 +29,7 @@
(def: (resolver async)
(All (_ a) (-> (Async a) (Resolver a)))
(function (resolve value)
- (let [async (:representation async)]
+ (let [async (representation async)]
(do [! io.monad]
[(^.let old [_value _observers]) (atom.read! async)]
(case _value
@@ -49,23 +49,23 @@
(def: .public (resolved value)
(All (_ a) (-> a (Async a)))
- (:abstraction (atom [{.#Some value} (list)])))
+ (abstraction (atom [{.#Some value} (list)])))
(def: .public (async _)
(All (_ a) (-> Any [(Async a) (Resolver a)]))
- (let [async (:abstraction (atom [{.#None} (list)]))]
+ (let [async (abstraction (atom [{.#None} (list)]))]
[async (..resolver async)]))
(def: .public value
(All (_ a) (-> (Async a) (IO (Maybe a))))
- (|>> :representation
+ (|>> representation
atom.read!
(# io.functor each product.left)))
(def: .public (upon! f async)
(All (_ a) (-> (-> a (IO Any)) (Async a) (IO Any)))
(do [! io.monad]
- [.let [async (:representation async)]
+ [.let [async (representation async)]
(^.let old [_value _observers]) (atom.read! async)]
(case _value
{.#Some value}
@@ -77,7 +77,7 @@
[swapped? (atom.compare_and_swap! old new async)]
(if swapped?
(in [])
- (upon! f (:abstraction async))))))))
+ (upon! f (abstraction async))))))))
)
(def: .public resolved?
@@ -128,13 +128,13 @@
(def: .public (and left right)
(All (_ a b) (-> (Async a) (Async b) (Async [a b])))
- (let [[read! write!] (:sharing [a b]
- [(Async a) (Async b)]
- [left right]
+ (let [[read! write!] (sharing [a b]
+ [(Async a) (Async b)]
+ [left right]
- [(Async [a b])
- (Resolver [a b])]
- (..async []))
+ [(Async [a b])
+ (Resolver [a b])]
+ (..async []))
_ (io.run! (..upon! (function (_ left)
(..upon! (function (_ right)
(write! [left right]))