diff options
-rw-r--r-- | lux-mode/lux-mode.el | 2 | ||||
-rw-r--r-- | stdlib/source/lux/concurrency/actor.lux | 10 | ||||
-rw-r--r-- | stdlib/source/lux/data/color.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/function.lux | 2 | ||||
-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/abstract.lux (renamed from stdlib/source/lux/type/opaque.lux) | 14 | ||||
-rw-r--r-- | stdlib/source/lux/world/net/tcp.jvm.lux | 10 | ||||
-rw-r--r-- | stdlib/source/lux/world/net/udp.jvm.lux | 8 |
11 files changed, 53 insertions, 53 deletions
diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el index 4638cf5d9..15ecfb63b 100644 --- a/lux-mode/lux-mode.el +++ b/lux-mode/lux-mode.el @@ -222,7 +222,7 @@ Called by `imenu--generic-function'." "actor:" "message:" "on:" "exception:" "word:" - "opaque:" + "abstract:" "unit:" "scale:" "function" "case" ":" ":!" ":!!" "undefined" "ident-for" "and" "or" diff --git a/stdlib/source/lux/concurrency/actor.lux b/stdlib/source/lux/concurrency/actor.lux index 75bbf15d2..a079d2d28 100644 --- a/stdlib/source/lux/concurrency/actor.lux +++ b/stdlib/source/lux/concurrency/actor.lux @@ -13,7 +13,7 @@ (syntax ["cs" common] (common ["csr" reader] ["csw" writer]))) - (type opaque) + (type abstract) (lang [type])) (// ["A" atom] ["P" promise "P/" Monad<Promise>] @@ -29,7 +29,7 @@ (with-expansions [<Message> (as-is (-> s (Actor s) (T.Task s))) <Obituary> (as-is [Text s (List <Message>)])] - (opaque: #export (Actor s) + (abstract: #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)) - (@opaque {#mailbox (stm.var (:! (Message ($ +0)) [])) - #kill-switch (P.promise Unit) - #obituary (P.promise (Obituary ($ +0)))})) + (@abstract {#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/color.lux b/stdlib/source/lux/data/color.lux index 9e5c828e4..2a23c5406 100644 --- a/stdlib/source/lux/data/color.lux +++ b/stdlib/source/lux/data/color.lux @@ -3,7 +3,7 @@ (lux (control [eq]) (data (coll [list "L/" Functor<List>])) [math] - (type opaque))) + (type abstract))) (def: rgb Nat +256) (def: top Nat (n/dec rgb)) @@ -21,16 +21,16 @@ (-> Frac Nat) (|>> (f/* rgb-factor) frac-to-nat)) -(opaque: #export Color {} +(abstract: #export Color {} {#red Nat #green Nat #blue Nat} (def: #export (color [red green blue]) (-> [Nat Nat Nat] Color) - (@opaque [(n/% rgb red) - (n/% rgb green) - (n/% rgb blue)])) + (@abstract [(n/% rgb red) + (n/% rgb green) + (n/% rgb blue)])) (def: #export unpack (-> Color [Nat Nat Nat]) diff --git a/stdlib/source/lux/data/lazy.lux b/stdlib/source/lux/data/lazy.lux index 75b5e29e2..27c60afa9 100644 --- a/stdlib/source/lux/data/lazy.lux +++ b/stdlib/source/lux/data/lazy.lux @@ -7,23 +7,23 @@ (concurrency [atom]) [macro] (macro ["s" syntax #+ syntax:]) - (type opaque))) + (type abstract))) -(opaque: #export (Lazy a) +(abstract: #export (Lazy a) (-> [] a) (def: #hidden (freeze' generator) (All [a] (-> (-> [] a) (Lazy a))) (let [cache (atom.atom (: (Maybe ($ +0)) #.None))] - (@opaque (function [_] - (case (io.run (atom.read cache)) - (#.Some value) - value - - _ - (let [value (generator [])] - (exec (io.run (atom.compare-and-swap _ (#.Some value) cache)) - value))))))) + (@abstract (function [_] + (case (io.run (atom.read cache)) + (#.Some value) + value + + _ + (let [value (generator [])] + (exec (io.run (atom.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 2190c3712..2e15ba974 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 opaque))) + (type abstract))) -(opaque: #export (Tainted a) +(abstract: #export (Tainted a) a (def: #export taint (All [a] (-> a (Tainted a))) - (|>> @opaque)) + (|>> @abstract)) (def: #export trust (All [a] (-> (Tainted a) a)) diff --git a/stdlib/source/lux/function.lux b/stdlib/source/lux/function.lux index 2fe4d6c1f..977886551 100644 --- a/stdlib/source/lux/function.lux +++ b/stdlib/source/lux/function.lux @@ -19,6 +19,6 @@ (-> (-> a b c) (-> b a c))) (function [x y] (f y x))) -(struct: #export Monoid<Function> (Monoid (All [a] (-> a a))) +(struct: #export Monoid<Function> (All [a] (Monoid (-> a a))) (def: identity id) (def: compose ..compose)) diff --git a/stdlib/source/lux/time/duration.lux b/stdlib/source/lux/time/duration.lux index 01d7f5847..f2eb63863 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]) ["e" error]) - (type opaque))) + (type abstract))) -(opaque: #export Duration +(abstract: #export Duration {#.doc "Durations have a resolution of milliseconds."} Int (def: #export from-millis (-> Int Duration) - (|>> @opaque)) + (|>> @abstract)) (def: #export to-millis (-> Duration Int) @@ -26,7 +26,7 @@ (do-template [<name> <op>] [(def: #export (<name> param subject) (-> Duration Duration Duration) - (@opaque (<op> (@repr param) (@repr subject))))] + (@abstract (<op> (@repr param) (@repr subject))))] [merge i/+] [frame i/%] @@ -34,7 +34,7 @@ (def: #export (scale scalar duration) (-> Int Duration Duration) - (@opaque (i/* scalar (@repr duration)))) + (@abstract (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 1285e50e6..381820058 100644 --- a/stdlib/source/lux/time/instant.lux +++ b/stdlib/source/lux/time/instant.lux @@ -14,17 +14,17 @@ [maybe] (coll [list "L/" Fold<List> Functor<List>] [sequence #+ Sequence sequence "sequence/" Functor<Sequence> Fold<Sequence>])) - (type opaque)) + (type abstract)) (// [duration "duration/" Order<Duration>] [date])) -(opaque: #export Instant +(abstract: #export Instant {#.doc "Instant is defined as milliseconds since the epoch."} Int (def: #export from-millis (-> Int Instant) - (|>> @opaque)) + (|>> @abstract)) (def: #export to-millis (-> Instant Int) @@ -36,7 +36,7 @@ (def: #export (shift duration instant) (-> duration.Duration Instant Instant) - (@opaque (i/+ (duration.to-millis duration) (@repr instant)))) + (@abstract (i/+ (duration.to-millis duration) (@repr instant)))) (def: #export (relative instant) (-> Instant duration.Duration) @@ -44,7 +44,7 @@ (def: #export (absolute offset) (-> duration.Duration Instant) - (|> offset duration.to-millis @opaque)) + (|> offset duration.to-millis @abstract)) (struct: #export _ (Eq Instant) (def: (= param subject) @@ -63,7 +63,7 @@ (def: order Order<Instant>) (do-template [<name>] [(def: <name> - (|>> @repr (:: number.Enum<Int> <name>) @opaque))] + (|>> @repr (:: number.Enum<Int> <name>) @abstract))] [succ] [pred] )) diff --git a/stdlib/source/lux/type/opaque.lux b/stdlib/source/lux/type/abstract.lux index 62e284f64..8d20c25c5 100644 --- a/stdlib/source/lux/type/opaque.lux +++ b/stdlib/source/lux/type/abstract.lux @@ -49,7 +49,7 @@ plist' (#.Cons [k' v'] (remove k plist'))))) -(def: down-cast Text "@opaque") +(def: down-cast Text "@abstract") (def: up-cast Text "@repr") (def: macro-anns Code (' {#.macro? true})) @@ -63,7 +63,7 @@ (do macro.Monad<Meta> [this-module (macro.find-module this-module-name) #let [type-varsC (list/map code.local-symbol type-vars) - opaque-declaration (` ((~ (code.local-symbol name)) (~@ type-varsC))) + abstract-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 @@ -73,7 +73,7 @@ (case tokens (^ (list value)) (wrap (list (` ((: (All [(~@ type-varsC)] - (-> (~ representation-declaration) (~ opaque-declaration))) + (-> (~ representation-declaration) (~ abstract-declaration))) (|>> :!!)) (~ value))))) @@ -86,7 +86,7 @@ (case tokens (^ (list value)) (wrap (list (` ((: (All [(~@ type-varsC)] - (-> (~ opaque-declaration) (~ representation-declaration))) + (-> (~ abstract-declaration) (~ representation-declaration))) (|>> :!!)) (~ value))))) @@ -147,16 +147,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 (opaque: [export csr.export] +(syntax: #export (abstract: [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 (representation-name name) type-varsC (list/map code.local-symbol type-vars) - opaque-declaration (` ((~ (code.local-symbol name)) (~@ type-varsC))) + abstract-declaration (` ((~ (code.local-symbol name)) (~@ type-varsC))) representation-declaration (` ((~ (code.local-symbol hidden-name)) (~@ type-varsC)))] - (wrap (list& (` (type: (~@ (csw.export export)) (~ opaque-declaration) + (wrap (list& (` (type: (~@ (csw.export export)) (~ abstract-declaration) (~ (csw.annotations annotations)) (primitive (~ (code.text hidden-name)) [(~@ type-varsC)]))) (` (type: (~@ (csw.export export)) (~ representation-declaration) diff --git a/stdlib/source/lux/world/net/tcp.jvm.lux b/stdlib/source/lux/world/net/tcp.jvm.lux index 3d71e85f8..914f76093 100644 --- a/stdlib/source/lux/world/net/tcp.jvm.lux +++ b/stdlib/source/lux/world/net/tcp.jvm.lux @@ -5,7 +5,7 @@ ["T" task] [frp]) (data ["e" error]) - (type opaque) + (type abstract) (world [blob #+ Blob]) [io] [host]) @@ -36,7 +36,7 @@ ############################################################ ############################################################ -(opaque: #export TCP {} +(abstract: #export TCP {} {#socket Socket #in InputStream #out OutputStream} @@ -70,9 +70,9 @@ (do (e.ErrorT io.Monad<IO>) [input (Socket::getInputStream [] socket) output (Socket::getOutputStream [] socket)] - (wrap (@opaque {#socket socket - #in input - #out output})))) + (wrap (@abstract {#socket socket + #in input + #out output})))) (def: #export (client address port) (-> //.Address //.Port (T.Task TCP)) diff --git a/stdlib/source/lux/world/net/udp.jvm.lux b/stdlib/source/lux/world/net/udp.jvm.lux index 4f58f1563..468d3b2b9 100644 --- a/stdlib/source/lux/world/net/udp.jvm.lux +++ b/stdlib/source/lux/world/net/udp.jvm.lux @@ -8,7 +8,7 @@ (data ["e" error] [maybe] (coll [array])) - (type opaque) + (type abstract) (world [blob #+ Blob]) [io] [host]) @@ -54,7 +54,7 @@ +1 (wrap (maybe.assume (array.read +0 addresses))) _ (io.io (ex.throw Multiple-Candidate-Addresses address)))))) -(opaque: #export UDP {} +(abstract: #export UDP {} {#socket DatagramSocket} (def: #export (read data offset length self) @@ -89,12 +89,12 @@ (P.future (do (e.ErrorT io.Monad<IO>) [socket (DatagramSocket::new|client [])] - (wrap (@opaque (#socket socket)))))) + (wrap (@abstract (#socket socket)))))) (def: #export (server port) (-> //.Port (T.Task UDP)) (P.future (do (e.ErrorT io.Monad<IO>) [socket (DatagramSocket::new|server [(nat-to-int port)])] - (wrap (@opaque (#socket socket)))))) + (wrap (@abstract (#socket socket)))))) ) |