diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/control/concurrency/actor.lux | 10 | ||||
-rw-r--r-- | stdlib/source/lux/control/concurrency/frp.lux | 12 | ||||
-rw-r--r-- | stdlib/source/lux/control/concurrency/process.lux | 2 | ||||
-rw-r--r-- | stdlib/source/lux/control/concurrency/promise.lux | 2 | ||||
-rw-r--r-- | stdlib/source/lux/control/concurrency/semaphore.lux | 2 | ||||
-rw-r--r-- | stdlib/source/lux/control/concurrency/stm.lux | 8 |
6 files changed, 18 insertions, 18 deletions
diff --git a/stdlib/source/lux/control/concurrency/actor.lux b/stdlib/source/lux/control/concurrency/actor.lux index 0f38c4c3d..a790fa89c 100644 --- a/stdlib/source/lux/control/concurrency/actor.lux +++ b/stdlib/source/lux/control/concurrency/actor.lux @@ -51,7 +51,7 @@ [(Promise [a Mailbox]) (Resolver [a Mailbox])]) (IO (List a)))) - (do io.monad + (do {@ io.monad} [current (promise.poll read)] (case current (#.Some [head tail]) @@ -97,7 +97,7 @@ (promise.promise [])) process (loop [state init [|mailbox| _] (io.run (atom.read (get@ #mailbox (:representation self))))] - (do promise.monad + (do {@ promise.monad} [[head tail] |mailbox| ?state' (handle head state self)] (case ?state' @@ -135,7 +135,7 @@ (def: #export (send message actor) {#.doc "Communicate with an actor through message passing."} (All [s] (-> (Message s) (Actor s) (IO Bit))) - (do io.monad + (do {@ io.monad} [alive? (..alive? actor)] (if alive? (let [entry [message (promise.promise [])]] @@ -266,7 +266,7 @@ #let [_ (log! "AFTER")]] (wrap output)))))} (with-gensyms [g!_ g!init] - (do @ + (do macro.monad [module macro.current-module-name #let [g!type (code.local-identifier (state-name _name)) g!behavior (code.local-identifier (behavior-name _name)) @@ -356,7 +356,7 @@ (let [state' (#.Cons value state)] (promise.resolved (#try.Success [state' state'])))))} (with-gensyms [g!_ g!return g!error g!task g!sent? g!resolve] - (do @ + (do macro.monad [current-module macro.current-module-name actor-name (resolve-actor actor-name) #let [message-name [current-module (get@ #name signature)] diff --git a/stdlib/source/lux/control/concurrency/frp.lux b/stdlib/source/lux/control/concurrency/frp.lux index 17ae28f41..2850f454f 100644 --- a/stdlib/source/lux/control/concurrency/frp.lux +++ b/stdlib/source/lux/control/concurrency/frp.lux @@ -40,7 +40,7 @@ (structure (def: close (loop [_ []] - (do io.monad + (do {@ io.monad} [current (atom.read sink) stopped? (current #.None)] (if stopped? @@ -57,7 +57,7 @@ (def: (feed value) (loop [_ []] - (do io.monad + (do {@ io.monad} [current (atom.read sink) #let [[next resolve-next] (:share [a] {(promise.Resolver (Maybe [a (Channel a)])) @@ -124,7 +124,7 @@ (let [[output sink] (channel [])] (exec (: (Promise Any) (loop [mma mma] - (do promise.monad + (do {@ promise.monad} [?mma mma] (case ?mma (#.Some [ma mma']) @@ -185,7 +185,7 @@ (All [a b] (-> (-> b a (Promise a)) a (Channel b) (Promise a))) - (do promise.monad + (do {@ promise.monad} [cons channel] (case cons #.None @@ -201,7 +201,7 @@ (All [a b] (-> (-> b a (Promise a)) a (Channel b) (Channel a))) - (do promise.monad + (do {@ promise.monad} [cons channel] (case cons #.None @@ -265,7 +265,7 @@ (def: #export (consume channel) {#.doc "Reads the entirety of a channel's content and returns it as a list."} (All [a] (-> (Channel a) (Promise (List a)))) - (do promise.monad + (do {@ promise.monad} [cons channel] (case cons (#.Some [head tail]) diff --git a/stdlib/source/lux/control/concurrency/process.lux b/stdlib/source/lux/control/concurrency/process.lux index d31edfb59..2060233e3 100644 --- a/stdlib/source/lux/control/concurrency/process.lux +++ b/stdlib/source/lux/control/concurrency/process.lux @@ -132,7 +132,7 @@ (def: #export run! (IO Any) (loop [_ []] - (do io.monad + (do {@ io.monad} [processes (atom.read runner)] (case processes ## And... we're done! diff --git a/stdlib/source/lux/control/concurrency/promise.lux b/stdlib/source/lux/control/concurrency/promise.lux index def999622..a0461e2c1 100644 --- a/stdlib/source/lux/control/concurrency/promise.lux +++ b/stdlib/source/lux/control/concurrency/promise.lux @@ -28,7 +28,7 @@ (All [a] (-> (Promise a) (Resolver a))) (function (resolve value) (let [promise (:representation promise)] - (do io.monad + (do {@ io.monad} [(^@ old [_value _observers]) (atom.read promise)] (case _value (#.Some _) diff --git a/stdlib/source/lux/control/concurrency/semaphore.lux b/stdlib/source/lux/control/concurrency/semaphore.lux index 39bac32a1..c69859138 100644 --- a/stdlib/source/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/lux/control/concurrency/semaphore.lux @@ -76,7 +76,7 @@ (let [semaphore (:representation semaphore)] (promise.future (loop [_ []] - (do io.monad + (do {@ io.monad} [state (atom.read semaphore) #let [[?sink state' maxed-out?] (: [(Maybe (Resolver Any)) State Bit] (case (queue.peek (get@ #waiting-list state)) diff --git a/stdlib/source/lux/control/concurrency/stm.lux b/stdlib/source/lux/control/concurrency/stm.lux index 3065d8033..3c4c26f59 100644 --- a/stdlib/source/lux/control/concurrency/stm.lux +++ b/stdlib/source/lux/control/concurrency/stm.lux @@ -46,7 +46,7 @@ (def: (write! new-value var) (All [a] (-> a (Var a) (IO Any))) - (do io.monad + (do {@ io.monad} [#let [var' (:representation var)] (^@ old [old-value observers]) (atom.read var') succeeded? (atom.compare-and-swap old [new-value observers] var')] @@ -216,7 +216,7 @@ (def: (issue-commit commit) (All [a] (-> (Commit a) (IO Any))) (let [entry [commit (promise.promise [])]] - (do io.monad + (do {@ io.monad} [|commits|&resolve (atom.read pending-commits)] (loop [[|commits| resolve] |commits|&resolve] (do @ @@ -237,14 +237,14 @@ (let [[stm-proc output resolve] commit [finished-tx value] (stm-proc fresh-tx)] (if (can-commit? finished-tx) - (do io.monad + (do {@ io.monad} [_ (monad.map @ commit-var! finished-tx)] (resolve value)) (issue-commit commit)))) (def: init-processor! (IO Any) - (do io.monad + (do {@ io.monad} [flag (atom.read commit-processor-flag)] (if flag (wrap []) |