aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/concurrency
diff options
context:
space:
mode:
authorEduardo Julian2018-05-05 20:42:41 -0400
committerEduardo Julian2018-05-05 20:42:41 -0400
commit3c93d7a3aabaa49c67f9a498bc0d70f0af7f09d0 (patch)
tree33aea74291323d5084ff70797337150b947962a8 /stdlib/source/lux/concurrency
parent88e2aee41d91deed941acc1ef650ccd3dd0334a2 (diff)
- Removed Void and Unit as kinds of types.
- Changed the value of "unit" in the old LuxC to match the one in new-luxc.
Diffstat (limited to 'stdlib/source/lux/concurrency')
-rw-r--r--stdlib/source/lux/concurrency/actor.lux4
-rw-r--r--stdlib/source/lux/concurrency/frp.lux2
-rw-r--r--stdlib/source/lux/concurrency/promise.lux4
-rw-r--r--stdlib/source/lux/concurrency/semaphore.lux18
-rw-r--r--stdlib/source/lux/concurrency/stm.lux26
-rw-r--r--stdlib/source/lux/concurrency/task.lux4
6 files changed, 29 insertions, 29 deletions
diff --git a/stdlib/source/lux/concurrency/actor.lux b/stdlib/source/lux/concurrency/actor.lux
index 0e85758ed..4fdb2c207 100644
--- a/stdlib/source/lux/concurrency/actor.lux
+++ b/stdlib/source/lux/concurrency/actor.lux
@@ -61,7 +61,7 @@
(type: #export (Behavior s)
{#.doc "An actor's behavior when messages are received."}
{#handle (-> (Message s) s (Actor s) (Task s))
- #end (-> Text s (Promise Unit))})
+ #end (-> Text s (Promise Top))})
(def: #export (spawn behavior init)
{#.doc "Given a behavior and initial state, spawns an actor and returns it."}
@@ -124,7 +124,7 @@
(message state self))
(def: (default-end cause state)
- (All [s] (-> Text s (Promise Unit)))
+ (All [s] (-> Text s (Promise Top)))
(promise/wrap []))
(def: #export default-behavior
diff --git a/stdlib/source/lux/concurrency/frp.lux b/stdlib/source/lux/concurrency/frp.lux
index e160fec12..caa1173c2 100644
--- a/stdlib/source/lux/concurrency/frp.lux
+++ b/stdlib/source/lux/concurrency/frp.lux
@@ -76,7 +76,7 @@
output)))
(def: #export (periodic time)
- (-> Nat (Channel Unit))
+ (-> Nat (Channel Top))
(let [output (channel [])]
(exec (io.run
(loop [_ []]
diff --git a/stdlib/source/lux/concurrency/promise.lux b/stdlib/source/lux/concurrency/promise.lux
index 0e3e0c695..63305f318 100644
--- a/stdlib/source/lux/concurrency/promise.lux
+++ b/stdlib/source/lux/concurrency/promise.lux
@@ -149,8 +149,8 @@
(def: #export (wait time)
{#.doc "Returns a promise that will be resolved after the specified amount of milliseconds."}
- (-> Nat (Promise Unit))
- (let [!out (: (Promise Unit) (promise #.None))]
+ (-> Nat (Promise Top))
+ (let [!out (: (Promise Top) (promise #.None))]
(exec ("lux process schedule" time (resolve [] !out))
!out)))
diff --git a/stdlib/source/lux/concurrency/semaphore.lux b/stdlib/source/lux/concurrency/semaphore.lux
index c4391fbc9..50a1a621c 100644
--- a/stdlib/source/lux/concurrency/semaphore.lux
+++ b/stdlib/source/lux/concurrency/semaphore.lux
@@ -9,7 +9,7 @@
(type: State
{#open-positions Nat
- #waiting-list (List (Promise Unit))})
+ #waiting-list (List (Promise Top))})
(abstract: #export Semaphore
{#.doc "A tool for controlling access to resources by multiple concurrent processes."}
@@ -22,10 +22,10 @@
#waiting-list (list)})))
(def: #export (wait semaphore)
- (Ex [k] (-> Semaphore (Promise Unit)))
+ (Ex [k] (-> Semaphore (Promise Top)))
(let [semaphore (@representation semaphore)]
(io.run
- (loop [signal (: (Promise Unit)
+ (loop [signal (: (Promise Top)
(promise.promise #.None))]
(do io.Monad<IO>
[state (atom.read semaphore)
@@ -44,13 +44,13 @@
(recur signal)))))))
(def: #export (signal semaphore)
- (Ex [k] (-> Semaphore (Promise Unit)))
+ (Ex [k] (-> Semaphore (Promise Top)))
(let [semaphore (@representation semaphore)]
(promise.future
(loop [_ []]
(do io.Monad<IO>
[state (atom.read semaphore)
- #let [[?signal state'] (: [(Maybe (Promise Unit)) State]
+ #let [[?signal state'] (: [(Maybe (Promise Top)) State]
(case (get@ #waiting-list state)
#.Nil
[#.None (update@ #open-positions n/inc state)]
@@ -80,11 +80,11 @@
(@abstraction (semaphore +1)))
(def: (acquire mutex)
- (-> Mutex (Promise Unit))
+ (-> Mutex (Promise Top))
(wait (@representation mutex)))
(def: (release mutex)
- (-> Mutex (Promise Unit))
+ (-> Mutex (Promise Top))
(signal (@representation mutex)))
(def: #export (synchronize mutex procedure)
@@ -125,7 +125,7 @@
(do-template [<phase> <update> <goal> <turnstile>]
[(def: (<phase> (^@representation barrier))
- (-> Barrier (Promise Unit))
+ (-> Barrier (Promise Top))
(do promise.Monad<Promise>
[#let [limit (refinement.un-refine (get@ #limit barrier))
goal <goal>
@@ -140,7 +140,7 @@
)
(def: #export (block barrier)
- (-> Barrier (Promise Unit))
+ (-> Barrier (Promise Top))
(do promise.Monad<Promise>
[_ (start barrier)]
(end barrier)))
diff --git a/stdlib/source/lux/concurrency/stm.lux b/stdlib/source/lux/concurrency/stm.lux
index 707512821..fb150d842 100644
--- a/stdlib/source/lux/concurrency/stm.lux
+++ b/stdlib/source/lux/concurrency/stm.lux
@@ -34,7 +34,7 @@
(:: io.Functor<IO> map product.left)))
(def: (write! new-value (^@representation var))
- (All [a] (-> a (Var a) (IO Unit)))
+ (All [a] (-> a (Var a) (IO Top)))
(do io.Monad<IO>
[(^@ old [_value _observers]) (atom.read var)
succeeded? (atom.compare-and-swap old [new-value _observers] var)]
@@ -76,8 +76,8 @@
(All [a] (-> (Var a) Tx (Maybe a)))
(|> tx
(list.find (function (_ [_var _original _current])
- (is? (:! (Var Unit) var)
- (:! (Var Unit) _var))))
+ (is? (:! (Var Top) var)
+ (:! (Var Top) _var))))
(:: maybe.Monad<Maybe> map (function (_ [_var _original _current])
_current))
(:!!)
@@ -102,11 +102,11 @@
#.Nil
(#.Cons [_var _original _current] tx')
- (if (is? (:! (Var Unit) var)
- (:! (Var Unit) _var))
- (#.Cons {#var (:! (Var Unit) _var)
- #original (:! Unit _original)
- #current (:! Unit value)}
+ (if (is? (:! (Var Top) var)
+ (:! (Var Top) _var))
+ (#.Cons {#var (:! (Var Top) _var)
+ #original (:! Top _original)
+ #current (:! Top value)}
tx')
(#.Cons {#var _var
#original _original
@@ -116,7 +116,7 @@
(def: #export (write value var)
{#.doc "Writes value to var."}
- (All [a] (-> a (Var a) (STM Unit)))
+ (All [a] (-> a (Var a) (STM Top)))
(function (_ tx)
(case (find-var-value var tx)
(#.Some _)
@@ -169,7 +169,7 @@
tx))
(def: (commit-var! [_var _original _current])
- (-> (Ex [a] (Tx-Frame a)) Unit)
+ (-> (Ex [a] (Tx-Frame a)) Top)
(if (is? _original _current)
[]
(io.run (write! _current _var))))
@@ -202,7 +202,7 @@
(recur tail)))))
(def: (process-commit [stm-proc output])
- (-> [(STM Unit) (Promise Unit)] Top)
+ (-> [(STM Top) (Promise Top)] Top)
(let [[finished-tx value] (stm-proc fresh-tx)]
(io.run (if (can-commit? finished-tx)
(exec (list/map commit-var! finished-tx)
@@ -210,7 +210,7 @@
(issue-commit [stm-proc output])))))
(def: init-processor!
- (IO Unit)
+ (IO Top)
(do io.Monad<IO>
[flag (atom.read commit-processor-flag)]
(if flag
@@ -220,7 +220,7 @@
(if was-first?
(exec (|> (io.run (atom.read pending-commits))
(promise.await (function (recur [head tail])
- (io (exec (process-commit (:! [(STM Unit) (Promise Unit)] head))
+ (io (exec (process-commit (:! [(STM Top) (Promise Top)] head))
(promise.await recur tail))))))
(wrap []))
(wrap [])))
diff --git a/stdlib/source/lux/concurrency/task.lux b/stdlib/source/lux/concurrency/task.lux
index 66cc12ff3..8d95842e9 100644
--- a/stdlib/source/lux/concurrency/task.lux
+++ b/stdlib/source/lux/concurrency/task.lux
@@ -70,8 +70,8 @@
ma))))
(syntax: #export (task {type s.any})
- {#.doc (doc "Makes an uninitialized Task (in this example, of Unit)."
- (task Unit))}
+ {#.doc (doc "Makes an uninitialized Task (in this example, of Top)."
+ (task Top))}
(wrap (list (` (: (..Task (~ type))
(P.promise #.None))))))