aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/control
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/control/concatenative.lux4
-rw-r--r--stdlib/source/library/lux/control/concurrency/actor.lux28
-rw-r--r--stdlib/source/library/lux/control/concurrency/atom.lux12
-rw-r--r--stdlib/source/library/lux/control/concurrency/semaphore.lux16
-rw-r--r--stdlib/source/library/lux/control/concurrency/stm.lux12
-rw-r--r--stdlib/source/library/lux/control/concurrency/thread.lux8
-rw-r--r--stdlib/source/library/lux/control/exception.lux8
-rw-r--r--stdlib/source/library/lux/control/function/mutual.lux8
-rw-r--r--stdlib/source/library/lux/control/parser/text.lux16
-rw-r--r--stdlib/source/library/lux/control/security/policy.lux8
-rw-r--r--stdlib/source/library/lux/control/writer.lux4
11 files changed, 63 insertions, 61 deletions
diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux
index 6f3f64403..7e8e04ba2 100644
--- a/stdlib/source/library/lux/control/concatenative.lux
+++ b/stdlib/source/library/lux/control/concatenative.lux
@@ -31,8 +31,8 @@
(type: Stack
(Record
- {#bottom (Maybe Code)
- #top (List Code)}))
+ [#bottom (Maybe Code)
+ #top (List Code)]))
(def: aliases^
(Parser (List Alias))
diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux
index 6d47288df..7353bad84 100644
--- a/stdlib/source/library/lux/control/concurrency/actor.lux
+++ b/stdlib/source/library/lux/control/concurrency/actor.lux
@@ -66,9 +66,9 @@
{}
(Record
- {#obituary [(Async <Obituary>)
+ [#obituary [(Async <Obituary>)
(Resolver <Obituary>)]
- #mailbox (Atom <Mailbox>)})
+ #mailbox (Atom <Mailbox>)])
(type: .public (Mail s)
<Mail>)
@@ -78,8 +78,8 @@
(type: .public (Behavior o s)
(Record
- {#on_init (-> o s)
- #on_mail (-> (Mail s) s (Actor s) (Async (Try s)))}))
+ [#on_init (-> o s)
+ #on_mail (-> (Mail s) s (Actor s) (Async (Try s)))]))
(def: .public (spawn! behavior init)
(All (_ o s) (-> (Behavior o s) o (IO (Actor s))))
@@ -89,8 +89,8 @@
behavior
(Actor s)
- (:abstraction {#obituary (async.async [])
- #mailbox (atom (async.async []))}))
+ (:abstraction [#obituary (async.async [])
+ #mailbox (atom (async.async []))]))
process (loop [state (on_init init)
[|mailbox| _] (io.run! (atom.read! (value@ #mailbox (:representation self))))]
(do {! async.monad}
@@ -204,8 +204,8 @@
(def: .public default
(All (_ s) (Behavior s s))
- {#on_init function.identity
- #on_mail ..default_on_mail})
+ [#on_init function.identity
+ #on_mail ..default_on_mail])
(def: .public (poison! actor)
(All (_ s) (-> (Actor s) (IO (Try Any))))
@@ -274,8 +274,8 @@
(def: (~ export_policy) (~ g!actor)
(All ((~ g!_) (~+ g!vars))
(..Behavior (~ state_type) ((~ g!type) (~+ g!vars))))
- {#..on_init (|>> ((~! abstract.:abstraction) (~ g!type)))
- #..on_mail (~ (..on_mail g!_ ?on_mail))})
+ [#..on_init (|>> ((~! abstract.:abstraction) (~ g!type)))
+ #..on_mail (~ (..on_mail g!_ ?on_mail))])
(~+ messages))))))))
@@ -284,18 +284,18 @@
(with_identifiers [g!_]
(in (list (` (: ((~! io.IO) (..Actor (~ state_type)))
(..spawn! (: (..Behavior (~ state_type) (~ state_type))
- {#..on_init (|>>)
- #..on_mail (~ (..on_mail g!_ ?on_mail))})
+ [#..on_init (|>>)
+ #..on_mail (~ (..on_mail g!_ ?on_mail))])
(: (~ state_type)
(~ init)))))))))
(type: Signature
(Record
- {#vars (List Text)
+ [#vars (List Text)
#name Text
#inputs (List |input|.Input)
#state Text
- #self Text}))
+ #self Text]))
(def: signature^
(Parser Signature)
diff --git a/stdlib/source/library/lux/control/concurrency/atom.lux b/stdlib/source/library/lux/control/concurrency/atom.lux
index 963400278..53120a3c4 100644
--- a/stdlib/source/library/lux/control/concurrency/atom.lux
+++ b/stdlib/source/library/lux/control/concurrency/atom.lux
@@ -1,6 +1,7 @@
(.module:
[library
[lux #*
+ ["." macro]
["." ffi]
["@" target]
[abstract
@@ -15,11 +16,12 @@
[type
abstract]]])
-(with_expansions [<jvm> (as_is (ffi.import: (java/util/concurrent/atomic/AtomicReference a)
- ["#::."
- (new [a])
- (get [] a)
- (compareAndSet [a a] boolean)]))]
+(with_expansions [<jvm> (as_is (macro.log_single_expansion!
+ (ffi.import: (java/util/concurrent/atomic/AtomicReference a)
+ ["#::."
+ (new [a])
+ (get [] a)
+ (compareAndSet [a a] boolean)])))]
(for {@.old <jvm>
@.jvm <jvm>}
(as_is)))
diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux
index f0ff9d7ba..64f3c4af4 100644
--- a/stdlib/source/library/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux
@@ -26,9 +26,9 @@
(type: State
(Record
- {#max_positions Nat
+ [#max_positions Nat
#open_positions Int
- #waiting_list (Queue (Resolver Any))}))
+ #waiting_list (Queue (Resolver Any))]))
(abstract: .public Semaphore
{}
@@ -42,9 +42,9 @@
(-> Nat Semaphore)
(let [max_positions (n.min initial_open_positions
..most_positions_possible)]
- (:abstraction (atom.atom {#max_positions max_positions
+ (:abstraction (atom.atom [#max_positions max_positions
#open_positions (.int max_positions)
- #waiting_list queue.empty}))))
+ #waiting_list queue.empty]))))
(def: .public (wait! semaphore)
(Ex (_ k) (-> Semaphore (Async Any)))
@@ -132,17 +132,17 @@
{}
(Record
- {#limit Limit
+ [#limit Limit
#count (Atom Nat)
#start_turnstile Semaphore
- #end_turnstile Semaphore})
+ #end_turnstile Semaphore])
(def: .public (barrier limit)
(-> Limit Barrier)
- (:abstraction {#limit limit
+ (:abstraction [#limit limit
#count (atom.atom 0)
#start_turnstile (..semaphore 0)
- #end_turnstile (..semaphore 0)}))
+ #end_turnstile (..semaphore 0)]))
(def: (un_block! times turnstile)
(-> Nat Semaphore (Async Any))
diff --git a/stdlib/source/library/lux/control/concurrency/stm.lux b/stdlib/source/library/lux/control/concurrency/stm.lux
index d8bb2568b..523227a27 100644
--- a/stdlib/source/library/lux/control/concurrency/stm.lux
+++ b/stdlib/source/library/lux/control/concurrency/stm.lux
@@ -77,9 +77,9 @@
(type: (Tx_Frame a)
(Record
- {#var (Var a)
+ [#var (Var a)
#original a
- #current a}))
+ #current a]))
(type: Tx
(List (Ex (_ a) (Tx_Frame a))))
@@ -118,13 +118,13 @@
(#.Item [_var _original _current] tx')
(if (same? (:as (Var Any) var)
(:as (Var Any) _var))
- (#.Item {#var (:as (Var Any) _var)
+ (#.Item [#var (:as (Var Any) _var)
#original (:as Any _original)
- #current (:as Any value)}
+ #current (:as Any value)]
tx')
- (#.Item {#var _var
+ (#.Item [#var _var
#original _original
- #current _current}
+ #current _current]
(with_updated_var var value tx')))))
(def: .public (write value var)
diff --git a/stdlib/source/library/lux/control/concurrency/thread.lux b/stdlib/source/library/lux/control/concurrency/thread.lux
index 603b44da8..e3a5606c3 100644
--- a/stdlib/source/library/lux/control/concurrency/thread.lux
+++ b/stdlib/source/library/lux/control/concurrency/thread.lux
@@ -60,9 +60,9 @@
... Default
(type: Thread
(Record
- {#creation Nat
+ [#creation Nat
#delay Nat
- #action (IO Any)}))
+ #action (IO Any)]))
))
(def: .public parallelism
@@ -129,9 +129,9 @@
... Default
(do {! io.monad}
[now (\ ! each (|>> instant.millis .nat) instant.now)
- _ (atom.update! (|>> (#.Item {#creation now
+ _ (atom.update! (|>> (#.Item [#creation now
#delay milli_seconds
- #action action}))
+ #action action]))
..runner)]
(in [])))))
diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux
index 4998142f7..17de72095 100644
--- a/stdlib/source/library/lux/control/exception.lux
+++ b/stdlib/source/library/lux/control/exception.lux
@@ -28,8 +28,8 @@
(type: .public (Exception a)
(Record
- {#label Text
- #constructor (-> a Text)}))
+ [#label Text
+ #constructor (-> a Text)]))
(def: .public (match? exception error)
(All (_ e) (-> (Exception e) Text Bit))
@@ -101,10 +101,10 @@
(All ((~ g!_) (~+ (list\each |type_variable|.format t_vars)))
(..Exception [(~+ (list\each (value@ #|input|.type) inputs))]))
(let [(~ g!descriptor) (~ (code.text descriptor))]
- {#..label (~ g!descriptor)
+ [#..label (~ g!descriptor)
#..constructor (function ((~ g!self) [(~+ (list\each (value@ #|input|.binding) inputs))])
((~! text\composite) (~ g!descriptor)
- (~ (maybe.else (' "") body))))}))))))))
+ (~ (maybe.else (' "") body))))]))))))))
(def: (report' entries)
(-> (List [Text Text]) Text)
diff --git a/stdlib/source/library/lux/control/function/mutual.lux b/stdlib/source/library/lux/control/function/mutual.lux
index 5ef853829..f303eff44 100644
--- a/stdlib/source/library/lux/control/function/mutual.lux
+++ b/stdlib/source/library/lux/control/function/mutual.lux
@@ -26,9 +26,9 @@
(type: Mutual
(Record
- {#declaration Declaration
+ [#declaration Declaration
#type Code
- #body Code}))
+ #body Code]))
(.def: mutual
(Parser [Declaration Code Code])
@@ -97,8 +97,8 @@
(type: Definition
(Record
- {#export_policy Code
- #mutual Mutual}))
+ [#export_policy Code
+ #mutual Mutual]))
(.def: definition
(Parser Definition)
diff --git a/stdlib/source/library/lux/control/parser/text.lux b/stdlib/source/library/lux/control/parser/text.lux
index 5943fba26..e19eb72a4 100644
--- a/stdlib/source/library/lux/control/parser/text.lux
+++ b/stdlib/source/library/lux/control/parser/text.lux
@@ -32,8 +32,8 @@
(type: .public Slice
(Record
- {#basis Offset
- #distance Offset}))
+ [#basis Offset
+ #distance Offset]))
(def: (left_over offset tape)
(-> Offset Text Text)
@@ -77,8 +77,8 @@
(in (list\mix (function (_ [slice::basis slice::distance]
[total::basis total::distance])
[total::basis ("lux i64 +" slice::distance total::distance)])
- {#basis offset
- #distance 0}
+ [#basis offset
+ #distance 0]
slices))))
(def: .public any
@@ -97,8 +97,8 @@
(case (/.char offset tape)
(#.Some _)
(#try.Success [[("lux i64 +" 1 offset) tape]
- {#basis offset
- #distance 1}])
+ [#basis offset
+ #distance 1]])
_
(exception.except ..cannot_slice []))))
@@ -230,8 +230,8 @@
(let [output' (/.of_char output)]
(if (<modifier> (/.contains? output' options))
(#try.Success [[("lux i64 +" 1 offset) tape]
- {#basis offset
- #distance 1}])
+ [#basis offset
+ #distance 1]])
(exception.except <exception> [options output])))
_
diff --git a/stdlib/source/library/lux/control/security/policy.lux b/stdlib/source/library/lux/control/security/policy.lux
index c9e840698..44d233cde 100644
--- a/stdlib/source/library/lux/control/security/policy.lux
+++ b/stdlib/source/library/lux/control/security/policy.lux
@@ -21,8 +21,8 @@
(type: .public (Privilege brand label)
(Record
- {#can_upgrade (Can_Upgrade brand label)
- #can_downgrade (Can_Downgrade brand label)}))
+ [#can_upgrade (Can_Upgrade brand label)
+ #can_downgrade (Can_Downgrade brand label)]))
(type: .public (Delegation brand from to)
(All (_ value)
@@ -41,8 +41,8 @@
(def: privilege
Privilege
- {#can_upgrade (|>> :abstraction)
- #can_downgrade (|>> :representation)})
+ [#can_upgrade (|>> :abstraction)
+ #can_downgrade (|>> :representation)])
(def: .public (with_policy context)
(All (_ brand scope)
diff --git a/stdlib/source/library/lux/control/writer.lux b/stdlib/source/library/lux/control/writer.lux
index b933c4388..771bb95a5 100644
--- a/stdlib/source/library/lux/control/writer.lux
+++ b/stdlib/source/library/lux/control/writer.lux
@@ -10,8 +10,8 @@
(type: .public (Writer log value)
(Record
- {#log log
- #value value}))
+ [#log log
+ #value value]))
(def: .public (write message)
(All (_ log) (-> log (Writer log Any)))