diff options
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/source/lux/concurrency/actor.lux | 10 | ||||
-rw-r--r-- | stdlib/source/lux/data/lazy.lux | 22 | ||||
-rw-r--r-- | stdlib/source/lux/data/tainted.lux | 6 | ||||
-rw-r--r-- | stdlib/source/lux/time/duration.lux | 10 | ||||
-rw-r--r-- | stdlib/source/lux/time/instant.lux | 12 | ||||
-rw-r--r-- | stdlib/source/lux/type/opaque.lux (renamed from stdlib/source/lux/type/model.lux) | 14 |
6 files changed, 37 insertions, 37 deletions
diff --git a/stdlib/source/lux/concurrency/actor.lux b/stdlib/source/lux/concurrency/actor.lux index 04a0db61e..c742b8d75 100644 --- a/stdlib/source/lux/concurrency/actor.lux +++ b/stdlib/source/lux/concurrency/actor.lux @@ -14,7 +14,7 @@ (common ["csr" reader] ["csw" writer]))) [type] - (type model)) + (type opaque)) (.. ["A" atom] ["P" promise "P/" Monad<Promise>] ["T" task] @@ -29,7 +29,7 @@ (with-expansions [<Message> (as-is (-> s (Actor s) (T;Task s))) <Obituary> (as-is [Text s (List <Message>)])] - (model: #export (Actor s) + (opaque: #export (Actor s) {#;doc "An actor, defined as all the necessities it requires."} {#mailbox (stm;Var <Message>) #kill-switch (P;Promise Unit) @@ -51,9 +51,9 @@ (All [s] (-> (Behavior s) s (IO (Actor s)))) (io (let [[handle end] behavior self (: (Actor ($ +0)) - (@model {#mailbox (stm;var (:! (Message ($ +0)) [])) - #kill-switch (P;promise Unit) - #obituary (P;promise (Obituary ($ +0)))})) + (@opaque {#mailbox (stm;var (:! (Message ($ +0)) [])) + #kill-switch (P;promise Unit) + #obituary (P;promise (Obituary ($ +0)))})) mailbox-channel (io;run (stm;follow (get@ #mailbox (@repr self)))) |mailbox| (stm;var mailbox-channel) _ (P/map (function [_] diff --git a/stdlib/source/lux/data/lazy.lux b/stdlib/source/lux/data/lazy.lux index d2533644a..1891f0100 100644 --- a/stdlib/source/lux/data/lazy.lux +++ b/stdlib/source/lux/data/lazy.lux @@ -7,23 +7,23 @@ (concurrency ["A" atom]) [macro] (macro ["s" syntax #+ syntax:]) - (type model))) + (type opaque))) -(model: #export (Lazy a) +(opaque: #export (Lazy a) (-> [] a) (def: #hidden (freeze' generator) (All [a] (-> (-> [] a) (Lazy a))) (let [cache (A;atom (: (Maybe ($ +0)) #;None))] - (@model (function [_] - (case (io;run (A;get cache)) - (#;Some value) - value - - _ - (let [value (generator [])] - (exec (io;run (A;compare-and-swap _ (#;Some value) cache)) - value))))))) + (@opaque (function [_] + (case (io;run (A;get cache)) + (#;Some value) + value + + _ + (let [value (generator [])] + (exec (io;run (A;compare-and-swap _ (#;Some value) cache)) + value))))))) (def: #export (thaw l-value) (All [a] (-> (Lazy a) a)) diff --git a/stdlib/source/lux/data/tainted.lux b/stdlib/source/lux/data/tainted.lux index 9060d1da5..ffe128022 100644 --- a/stdlib/source/lux/data/tainted.lux +++ b/stdlib/source/lux/data/tainted.lux @@ -1,14 +1,14 @@ (;module: lux (lux (data [product]) - (type model))) + (type opaque))) -(model: #export (Tainted a) +(opaque: #export (Tainted a) a (def: #export taint (All [a] (-> a (Tainted a))) - (|>. @model)) + (|>. @opaque)) (def: #export trust (All [a] (-> (Tainted a) a)) diff --git a/stdlib/source/lux/time/duration.lux b/stdlib/source/lux/time/duration.lux index d4f8bd52c..61f2452a6 100644 --- a/stdlib/source/lux/time/duration.lux +++ b/stdlib/source/lux/time/duration.lux @@ -9,15 +9,15 @@ [text "text/" Monoid<Text>] (text ["l" lexer]) ["R" result]) - (type model))) + (type opaque))) -(model: #export Duration +(opaque: #export Duration {#;doc "Durations have a resolution of milliseconds."} Int (def: #export from-millis (-> Int Duration) - (|>. @model)) + (|>. @opaque)) (def: #export to-millis (-> Duration Int) @@ -26,7 +26,7 @@ (do-template [<name> <op>] [(def: #export (<name> param subject) (-> Duration Duration Duration) - (@model (<op> (@repr param) (@repr subject))))] + (@opaque (<op> (@repr param) (@repr subject))))] [merge i.+] [frame i.%] @@ -34,7 +34,7 @@ (def: #export (scale scalar duration) (-> Int Duration Duration) - (@model (i.* scalar (@repr duration)))) + (@opaque (i.* scalar (@repr duration)))) (def: #export (query param subject) (-> Duration Duration Int) diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux index 5177ffb44..5fb8bf4f1 100644 --- a/stdlib/source/lux/time/instant.lux +++ b/stdlib/source/lux/time/instant.lux @@ -13,17 +13,17 @@ ["R" result] (coll [list "L/" Fold<List> Functor<List>] ["v" vector "v/" Functor<Vector> Fold<Vector>])) - (type model)) + (type opaque)) (.. [duration "duration/" Order<Duration>] [date])) -(model: #export Instant +(opaque: #export Instant {#;doc "Instant is defined as milliseconds since the epoch."} Int (def: #export from-millis (-> Int Instant) - (|>. @model)) + (|>. @opaque)) (def: #export to-millis (-> Instant Int) @@ -35,7 +35,7 @@ (def: #export (shift duration instant) (-> duration;Duration Instant Instant) - (@model (i.+ (duration;to-millis duration) (@repr instant)))) + (@opaque (i.+ (duration;to-millis duration) (@repr instant)))) (def: #export (relative instant) (-> Instant duration;Duration) @@ -43,7 +43,7 @@ (def: #export (absolute offset) (-> duration;Duration Instant) - (|> offset duration;to-millis @model)) + (|> offset duration;to-millis @opaque)) (struct: #export _ (Eq Instant) (def: (= param subject) @@ -62,7 +62,7 @@ (def: order Order<Instant>) (do-template [<name>] [(def: <name> - (|>. @repr (:: number;Enum<Int> <name>) @model))] + (|>. @repr (:: number;Enum<Int> <name>) @opaque))] [succ] [pred] )) diff --git a/stdlib/source/lux/type/model.lux b/stdlib/source/lux/type/opaque.lux index e77a8ac70..4dae66f11 100644 --- a/stdlib/source/lux/type/model.lux +++ b/stdlib/source/lux/type/opaque.lux @@ -49,7 +49,7 @@ plist' (#;Cons [k' v'] (remove k plist'))))) -(def: down-cast Text "@model") +(def: down-cast Text "@opaque") (def: up-cast Text "@repr") (def: macro-anns Anns (list [["lux" "macro?"] (#;BoolA true)])) @@ -63,7 +63,7 @@ (do Monad<Lux> [this-module (macro;find-module this-module-name) #let [type-varsC (L/map code;local-symbol type-vars) - model-declaration (` ((~ (code;local-symbol name)) (~@ type-varsC))) + opaque-declaration (` ((~ (code;local-symbol name)) (~@ type-varsC))) representation-declaration (` ((~ (code;local-symbol (representation-name name))) (~@ type-varsC))) this-module (|> this-module (update@ #;defs (put down-cast (: Def @@ -72,7 +72,7 @@ (case tokens (^ (list value)) (wrap (list (` ((: (All [(~@ type-varsC)] - (-> (~ representation-declaration) (~ model-declaration))) + (-> (~ representation-declaration) (~ opaque-declaration))) (|>. :!!)) (~ value))))) @@ -84,7 +84,7 @@ (case tokens (^ (list value)) (wrap (list (` ((: (All [(~@ type-varsC)] - (-> (~ model-declaration) (~ representation-declaration))) + (-> (~ opaque-declaration) (~ representation-declaration))) (|>. :!!)) (~ value))))) @@ -145,16 +145,16 @@ (p;either (s;form (p;seq s;local-symbol (p;some s;local-symbol))) (p;seq s;local-symbol (:: p;Monad<Parser> wrap (list))))) -(syntax: #export (model: [export csr;export] +(syntax: #export (opaque: [export csr;export] [[name type-vars] declaration] [annotations (p;default cs;empty-annotations csr;annotations)] representation-type [primitives (p;some s;any)]) (let [hidden-name (code;local-symbol (representation-name name)) type-varsC (L/map code;local-symbol type-vars) - model-declaration (` ((~ (code;local-symbol name)) (~@ type-varsC))) + opaque-declaration (` ((~ (code;local-symbol name)) (~@ type-varsC))) representation-declaration (` ((~ hidden-name) (~@ type-varsC)))] - (wrap (list& (` (type: (~@ (csw;export export)) (~ model-declaration) + (wrap (list& (` (type: (~@ (csw;export export)) (~ opaque-declaration) (~ (csw;annotations annotations)) (host (~ hidden-name) [(~@ type-varsC)]))) (` (type: (~@ (csw;export export)) (~ representation-declaration) |