diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/control/concurrency/actor.lux | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/stdlib/source/lux/control/concurrency/actor.lux b/stdlib/source/lux/control/concurrency/actor.lux index f8458caf3..3c423692a 100644 --- a/stdlib/source/lux/control/concurrency/actor.lux +++ b/stdlib/source/lux/control/concurrency/actor.lux @@ -53,11 +53,11 @@ [(Promise [a Mailbox]) (Resolver [a Mailbox])]) (IO (List a)))) - (do {@ io.monad} + (do {! io.monad} [current (promise.poll read)] (case current (#.Some [head tail]) - (:: @ map (|>> (#.Cons head)) + (:: ! map (|>> (#.Cons head)) (pending tail)) #.None @@ -99,12 +99,12 @@ (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' (#try.Failure error) - (do @ + (do ! [_ (end error state)] (let [[_ resolve] (get@ #obituary (:representation self))] (exec (io.run @@ -137,21 +137,21 @@ (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 [])]] - (do @ + (do ! [|mailbox|&resolve (atom.read (get@ #mailbox (:representation actor)))] (loop [[|mailbox| resolve] |mailbox|&resolve] - (do @ + (do ! [|mailbox| (promise.poll |mailbox|)] (case |mailbox| #.None - (do @ + (do ! [resolved? (resolve entry)] (if resolved? - (do @ + (do ! [_ (atom.write (product.right entry) (get@ #mailbox (:representation actor)))] (wrap true)) (recur |mailbox|&resolve))) |