diff options
Diffstat (limited to '')
21 files changed, 132 insertions, 132 deletions
diff --git a/stdlib/source/lux/concurrency/actor.lux b/stdlib/source/lux/concurrency/actor.lux index 77543ba78..ad3bccfdc 100644 --- a/stdlib/source/lux/concurrency/actor.lux +++ b/stdlib/source/lux/concurrency/actor.lux @@ -49,7 +49,7 @@ ## TODO: Delete after new-luxc becomes the new standard compiler. (def: (actor mailbox obituary) (All [s] (-> (Atom <Mailbox>) (Promise <Obituary>) (Actor s))) - (@abstraction {#mailbox mailbox + (:abstraction {#mailbox mailbox #obituary obituary})) (type: #export (Message s) @@ -70,7 +70,7 @@ self (actor (atom (promise #.None)) (promise #.None)) process (loop [state init - |mailbox| (io.run (atom.read (get@ #mailbox (@representation self))))] + |mailbox| (io.run (atom.read (get@ #mailbox (:representation self))))] (do promise.Monad<Promise> [[head tail] |mailbox| ?state' (handle head state self)] @@ -79,7 +79,7 @@ (do @ [_ (end error state)] (exec (io.run (promise.resolve [error state (#.Cons head (obituary tail))] - (get@ #obituary (@representation self)))) + (get@ #obituary (:representation self)))) (wrap []))) (#e.Success state') @@ -88,7 +88,7 @@ (def: #export (alive? actor) (All [s] (-> (Actor s) Bool)) - (case (promise.poll (get@ #obituary (@representation actor))) + (case (promise.poll (get@ #obituary (:representation actor))) #.None true @@ -101,7 +101,7 @@ (if (alive? actor) (let [entry [message (promise #.None)]] (do Monad<IO> - [|mailbox| (atom.read (get@ #mailbox (@representation actor)))] + [|mailbox| (atom.read (get@ #mailbox (:representation actor)))] (loop [|mailbox| |mailbox|] (case (promise.poll |mailbox|) #.None @@ -109,7 +109,7 @@ [resolved? (promise.resolve entry |mailbox|)] (if resolved? (do @ - [_ (atom.write (product.right entry) (get@ #mailbox (@representation actor)))] + [_ (atom.write (product.right entry) (get@ #mailbox (:representation actor)))] (wrap true)) (recur |mailbox|))) diff --git a/stdlib/source/lux/concurrency/frp.lux b/stdlib/source/lux/concurrency/frp.lux index 28d7be094..7b4bfbec0 100644 --- a/stdlib/source/lux/concurrency/frp.lux +++ b/stdlib/source/lux/concurrency/frp.lux @@ -16,16 +16,16 @@ (def: #export (channel _) (All [a] (-> Any (Channel a))) - (@abstraction (atom (list)))) + (:abstraction (atom (list)))) - (def: #export (listen listener (^@representation channel)) + (def: #export (listen listener (^:representation channel)) (All [a] (-> (-> a (IO Any)) (Channel a) (IO Any))) ## TODO: Simplify when possible. (do io.Monad<IO> [_ (atom.update (|>> (#.Cons listener)) channel)] (wrap []))) - (def: #export (publish (^@representation channel) value) + (def: #export (publish (^:representation channel) value) {#.doc "Publish to a channel."} (All [a] (-> (Channel a) a (IO Any))) (do io.Monad<IO> diff --git a/stdlib/source/lux/concurrency/promise.lux b/stdlib/source/lux/concurrency/promise.lux index 3ccdc22e9..866cdd8da 100644 --- a/stdlib/source/lux/concurrency/promise.lux +++ b/stdlib/source/lux/concurrency/promise.lux @@ -19,16 +19,16 @@ (def: #export (promise ?value) (All [a] (-> (Maybe a) (Promise a))) - (@abstraction (atom [?value (list)]))) + (:abstraction (atom [?value (list)]))) - (def: #export (poll (^@representation promise)) + (def: #export (poll (^:representation promise)) {#.doc "Polls a promise's value."} (All [a] (-> (Promise a) (Maybe a))) (|> (atom.read promise) io.run product.left)) - (def: #export (resolve value (^@representation promise)) + (def: #export (resolve value (^:representation promise)) {#.doc "Sets an promise's value if it has not been done yet."} (All [a] (-> a (Promise a) (IO Bool))) (do io.Monad<IO> @@ -46,9 +46,9 @@ [_ (monad.map @ (function (_ f) (f value)) _observers)] (wrap true)) - (resolve value (@abstraction promise))))))) + (resolve value (:abstraction promise))))))) - (def: #export (await f (^@representation promise)) + (def: #export (await f (^:representation promise)) (All [a] (-> (-> a (IO Any)) (Promise a) Any)) (let [(^@ old [_value _observers]) (io.run (atom.read promise))] (case _value @@ -59,7 +59,7 @@ (let [new [_value (#.Cons f _observers)]] (if (io.run (atom.compare-and-swap old new promise)) [] - (await f (@abstraction promise))))))) + (await f (:abstraction promise))))))) ) (def: #export (resolved? promise) diff --git a/stdlib/source/lux/concurrency/semaphore.lux b/stdlib/source/lux/concurrency/semaphore.lux index 23303a236..fa312fcc8 100644 --- a/stdlib/source/lux/concurrency/semaphore.lux +++ b/stdlib/source/lux/concurrency/semaphore.lux @@ -18,12 +18,12 @@ (def: #export (semaphore init-open-positions) (-> Nat Semaphore) - (@abstraction (atom.atom {#open-positions init-open-positions + (:abstraction (atom.atom {#open-positions init-open-positions #waiting-list (list)}))) (def: #export (wait semaphore) (Ex [k] (-> Semaphore (Promise Any))) - (let [semaphore (@representation semaphore)] + (let [semaphore (:representation semaphore)] (io.run (loop [signal (: (Promise Any) (promise.promise #.None))] @@ -45,7 +45,7 @@ (def: #export (signal semaphore) (Ex [k] (-> Semaphore (Promise Any))) - (let [semaphore (@representation semaphore)] + (let [semaphore (:representation semaphore)] (promise.future (loop [_ []] (do io.Monad<IO> @@ -77,15 +77,15 @@ (def: #export (mutex _) (-> Any Mutex) - (@abstraction (semaphore +1))) + (:abstraction (semaphore +1))) (def: (acquire mutex) (-> Mutex (Promise Any)) - (wait (@representation mutex))) + (wait (:representation mutex))) (def: (release mutex) (-> Mutex (Promise Any)) - (signal (@representation mutex))) + (signal (:representation mutex))) (def: #export (synchronize mutex procedure) (All [a] (-> Mutex (IO (Promise a)) (Promise a))) @@ -109,7 +109,7 @@ (def: #export (barrier limit) (-> Limit Barrier) - (@abstraction {#limit limit + (:abstraction {#limit limit #count (atom.atom +0) #start-turnstile (semaphore +0) #end-turnstile (semaphore +0)})) @@ -124,7 +124,7 @@ (:: promise.Monad<Promise> wrap [])))) (do-template [<phase> <update> <goal> <turnstile>] - [(def: (<phase> (^@representation barrier)) + [(def: (<phase> (^:representation barrier)) (-> Barrier (Promise Any)) (do promise.Monad<Promise> [#let [limit (refinement.un-refine (get@ #limit barrier)) diff --git a/stdlib/source/lux/concurrency/stm.lux b/stdlib/source/lux/concurrency/stm.lux index 5c9e2d68c..9fef9f59e 100644 --- a/stdlib/source/lux/concurrency/stm.lux +++ b/stdlib/source/lux/concurrency/stm.lux @@ -20,20 +20,20 @@ (def: #export (var value) {#.doc "Creates a new STM var, with a default value."} (All [a] (-> a (Var a))) - (@abstraction (atom.atom [value (list)]))) + (:abstraction (atom.atom [value (list)]))) (def: read!! (All [a] (-> (Var a) a)) - (|>> @representation atom.read io.run product.left)) + (|>> :representation atom.read io.run product.left)) - (def: #export (read! (^@representation var)) + (def: #export (read! (^:representation var)) {#.doc "Reads var immediately, without going through a transaction."} (All [a] (-> (Var a) (IO a))) (|> var atom.read (:: io.Functor<IO> map product.left))) - (def: (write! new-value (^@representation var)) + (def: (write! new-value (^:representation var)) (All [a] (-> a (Var a) (IO Any))) (do io.Monad<IO> [(^@ old [_value _observers]) (atom.read var) @@ -42,7 +42,7 @@ (do @ [_ (monad.map @ (function (_ f) (f new-value)) _observers)] (wrap [])) - (write! new-value (@abstraction var))))) + (write! new-value (:abstraction var))))) ## TODO: Remove when possible (def: (helper|follow var) @@ -53,7 +53,7 @@ (All [a] (-> (Var a) (IO (frp.Channel a)))) (do io.Monad<IO> [#let [channel (helper|follow target) - target (@representation target)] + target (:representation target)] _ (atom.update (function (_ [value observers]) [value (#.Cons (frp.publish channel) observers)]) target)] diff --git a/stdlib/source/lux/data/color.lux b/stdlib/source/lux/data/color.lux index 56e324cac..241347859 100644 --- a/stdlib/source/lux/data/color.lux +++ b/stdlib/source/lux/data/color.lux @@ -25,18 +25,18 @@ (def: #export (color [red green blue]) (-> [Nat Nat Nat] Color) - (@abstraction [(n/% rgb red) + (:abstraction [(n/% rgb red) (n/% rgb green) (n/% rgb blue)])) (def: #export unpack (-> Color [Nat Nat Nat]) - (|>> @representation)) + (|>> :representation)) (struct: #export _ (eq.Eq Color) (def: (= reference sample) - (let [[rr rg rb] (@representation reference) - [sr sg sb] (@representation sample)] + (let [[rr rg rb] (:representation reference) + [sr sg sb] (:representation sample)] (and (n/= rr sr) (n/= rg sg) (n/= rb sb))))) diff --git a/stdlib/source/lux/data/lazy.lux b/stdlib/source/lux/data/lazy.lux index fcd07cd5d..94932a497 100644 --- a/stdlib/source/lux/data/lazy.lux +++ b/stdlib/source/lux/data/lazy.lux @@ -15,7 +15,7 @@ (def: (freeze' generator) (All [a] (-> (-> [] a) (Lazy a))) (let [cache (atom.atom #.None)] - (@abstraction (function (_ _) + (:abstraction (function (_ _) (case (io.run (atom.read cache)) (#.Some value) value @@ -27,7 +27,7 @@ (def: #export (thaw l-value) (All [a] (-> (Lazy a) a)) - ((@representation l-value) []))) + ((:representation l-value) []))) (syntax: #export (freeze expr) (with-gensyms [g!_] diff --git a/stdlib/source/lux/data/tainted.lux b/stdlib/source/lux/data/tainted.lux index d1ecbd213..b3f883fdf 100644 --- a/stdlib/source/lux/data/tainted.lux +++ b/stdlib/source/lux/data/tainted.lux @@ -8,11 +8,11 @@ (def: #export taint (All [a] (-> a (Tainted a))) - (|>> @abstraction)) + (|>> :abstraction)) (def: #export trust (All [a] (-> (Tainted a) a)) - (|>> @representation))) + (|>> :representation))) (def: #export (validate pred tainted) (All [a] (-> (-> a Bool) (Tainted a) (Maybe a))) diff --git a/stdlib/source/lux/data/text/unicode.lux b/stdlib/source/lux/data/text/unicode.lux index 7b1eb0fa9..6f76d053b 100644 --- a/stdlib/source/lux/data/text/unicode.lux +++ b/stdlib/source/lux/data/text/unicode.lux @@ -13,14 +13,14 @@ {} (Interval Char) - (def: empty (@abstraction (interval.between number.Enum<Nat> nat/top nat/bottom))) + (def: empty (:abstraction (interval.between number.Enum<Nat> nat/top nat/bottom))) (struct: _ (Monoid Segment) (def: identity ..empty) (def: (compose left right) - (let [left (@representation left) - right (@representation right)] - (@abstraction + (let [left (:representation left) + right (:representation right)] + (:abstraction (interval.between number.Enum<Nat> (n/min (:: left bottom) (:: right bottom)) @@ -29,12 +29,12 @@ (def: #export (segment start end) (-> Char Char Segment) - (@abstraction (interval.between number.Enum<Nat> (n/min start end) (n/max start end)))) + (:abstraction (interval.between number.Enum<Nat> (n/min start end) (n/max start end)))) (do-template [<name> <slot>] [(def: #export <name> (-> Segment Char) - (|>> @representation (get@ <slot>)))] + (|>> :representation (get@ <slot>)))] [start #interval.bottom] [end #interval.top] @@ -42,13 +42,13 @@ (def: #export (size segment) (-> Segment Nat) - (let [start (get@ #interval.bottom (@representation segment)) - end (get@ #interval.top (@representation segment))] + (let [start (get@ #interval.bottom (:representation segment)) + end (get@ #interval.top (:representation segment))] (|> end (n/- start) inc))) (def: #export (within? segment char) (All [a] (-> Segment Char Bool)) - (interval.within? (@representation segment) char)) + (interval.within? (:representation segment) char)) ) (do-template [<name> <start> <end>] diff --git a/stdlib/source/lux/lang/host/scheme.lux b/stdlib/source/lux/lang/host/scheme.lux index f6e7b1834..adc8504bb 100644 --- a/stdlib/source/lux/lang/host/scheme.lux +++ b/stdlib/source/lux/lang/host/scheme.lux @@ -27,9 +27,9 @@ {#mandatory (List Var) #rest (Maybe Var)}) - (def: #export code (-> Code Text) (|>> @representation)) + (def: #export code (-> Code Text) (|>> :representation)) - (def: #export var (-> Text Var) (|>> @abstraction)) + (def: #export var (-> Text Var) (|>> :abstraction)) (def: (arguments [vars rest]) (-> Arguments Code) @@ -40,33 +40,33 @@ rest _ - (|> (format " . " (@representation rest)) + (|> (format " . " (:representation rest)) (format (|> vars (list/map ..code) (text.join-with " "))) (text.enclose ["(" ")"]) - @abstraction)) + :abstraction)) #.None (|> vars (list/map ..code) (text.join-with " ") (text.enclose ["(" ")"]) - @abstraction))) + :abstraction))) (def: #export nil Computation - (@abstraction "'()")) + (:abstraction "'()")) (def: #export bool (-> Bool Computation) (|>> (case> true "#t" false "#f") - @abstraction)) + :abstraction)) (def: #export int (-> Int Computation) - (|>> %i @abstraction)) + (|>> %i :abstraction)) (def: #export float (-> Frac Computation) @@ -81,7 +81,7 @@ ## else [%f]) - @abstraction)) + :abstraction)) (def: #export positive-infinity Computation (..float number.positive-infinity)) (def: #export negative-infinity Computation (..float number.negative-infinity)) @@ -89,15 +89,15 @@ (def: #export string (-> Text Computation) - (|>> %t @abstraction)) + (|>> %t :abstraction)) (def: #export symbol (-> Text Computation) - (|>> (format "'") @abstraction)) + (|>> (format "'") :abstraction)) (def: #export global (-> Text Global) - (|>> @abstraction)) + (|>> :abstraction)) (def: form (-> (List Code) Text) @@ -107,7 +107,7 @@ (def: #export (apply/* func args) (-> Expression (List Expression) Computation) - (@abstraction (..form (#.Cons func args)))) + (:abstraction (..form (#.Cons func args)))) (do-template [<name> <function>] [(def: #export <name> @@ -223,7 +223,7 @@ (do-template [<lux-name> <scheme-name>] [(def: #export <lux-name> (-> (List Expression) Computation) - (|>> (list& (..global <scheme-name>)) ..form @abstraction))] + (|>> (list& (..global <scheme-name>)) ..form :abstraction))] [or "or"] [and "and"] @@ -232,15 +232,15 @@ (do-template [<lux-name> <scheme-name> <var> <pre>] [(def: #export (<lux-name> bindings body) (-> (List [<var> Expression]) Expression Computation) - (@abstraction + (:abstraction (..form (list (..global <scheme-name>) (|> bindings (list/map (.function (_ [binding/name binding/value]) - (@abstraction + (:abstraction (..form (list (<pre> binding/name) binding/value))))) ..form - @abstraction) + :abstraction) body))))] [let "let" Var .id] @@ -253,12 +253,12 @@ (def: #export (if test then else) (-> Expression Expression Expression Computation) - (@abstraction + (:abstraction (..form (list (..global "if") test then else)))) (def: #export (when test then) (-> Expression Expression Computation) - (@abstraction + (:abstraction (..form (list (..global "when") test then)))) (def: #export (cond clauses else) @@ -267,19 +267,19 @@ (if test then next)) else (list.reverse clauses)) - @representation - @abstraction)) + :representation + :abstraction)) (def: #export (lambda arguments body) (-> Arguments Expression Computation) - (@abstraction + (:abstraction (..form (list (..global "lambda") (..arguments arguments) body)))) (def: #export (define name arguments body) (-> Var Arguments Expression Computation) - (@abstraction + (:abstraction (..form (list (..global "define") (|> arguments (update@ #mandatory (|>> (#.Cons name))) @@ -288,15 +288,15 @@ (def: #export begin (-> (List Expression) Computation) - (|>> (#.Cons (..global "begin")) ..form @abstraction)) + (|>> (#.Cons (..global "begin")) ..form :abstraction)) (def: #export (set! name value) (-> Var Expression Computation) - (@abstraction + (:abstraction (..form (list (..global "set!") name value)))) (def: #export (with-exception-handler handler body) (-> Expression Expression Computation) - (@abstraction + (:abstraction (..form (list (..global "with-exception-handler") handler body)))) ) diff --git a/stdlib/source/lux/math/constructive.lux b/stdlib/source/lux/math/constructive.lux index b154e9c20..2a904f7cb 100644 --- a/stdlib/source/lux/math/constructive.lux +++ b/stdlib/source/lux/math/constructive.lux @@ -25,12 +25,12 @@ (.All [t] (.Ex [w] (-> t (Witness t w)))) - (.|>> @abstraction)) + (.|>> :abstraction)) (.def: #export ? (.All [t w] (-> (Witness t w) t)) - (.|>> @representation)) + (.|>> :representation)) ) (syntax: #export (@ {name s.symbol}) diff --git a/stdlib/source/lux/math/modular.lux b/stdlib/source/lux/math/modular.lux index 7c71b86b1..01e02a706 100644 --- a/stdlib/source/lux/math/modular.lux +++ b/stdlib/source/lux/math/modular.lux @@ -25,11 +25,11 @@ (Ex [m] (-> Int (Error (Modulus m)))) (if (i/= 0 value) (ex.throw zero-cannot-be-a-modulus []) - (#e.Success (@abstraction value)))) + (#e.Success (:abstraction value)))) (def: #export (to-int modulus) (All [m] (-> (Modulus m) Int)) - (|> modulus @representation)) + (|> modulus :representation)) ) (exception: #export [m] (incorrect-modulus {modulus (Modulus m)} @@ -74,12 +74,12 @@ (def: #export (mod modulus) (All [m] (-> (Modulus m) (-> Int (Mod m)))) (function (_ value) - (@abstraction {#remainder (i/mod (to-int modulus) value) + (:abstraction {#remainder (i/mod (to-int modulus) value) #modulus modulus}))) (def: #export (un-mod modular) (All [m] (-> (Mod m) [Int (Modulus m)])) - (@representation modular)) + (:representation modular)) (def: separator Text " mod ") @@ -87,7 +87,7 @@ (All [m] (-> (Modulus m) (Codec Text (Mod m)))) (def: (encode modular) - (let [[remainder modulus] (@representation modular)] + (let [[remainder modulus] (:representation modular)] ($_ text/compose (int/encode remainder) separator @@ -103,19 +103,19 @@ (def: #export (equalize reference sample) (All [r s] (-> (Mod r) (Mod s) (Error (Mod r)))) - (let [[reference reference-modulus] (@representation reference) - [sample sample-modulus] (@representation sample)] + (let [[reference reference-modulus] (:representation reference) + [sample sample-modulus] (:representation sample)] (if (i/= (to-int reference-modulus) (to-int sample-modulus)) - (#e.Success (@abstraction {#remainder sample + (#e.Success (:abstraction {#remainder sample #modulus reference-modulus})) (ex.throw cannot-equalize-moduli [reference-modulus sample-modulus])))) (do-template [<name> <op>] [(def: #export (<name> reference sample) (All [m] (-> (Mod m) (Mod m) Bool)) - (let [[reference _] (@representation reference) - [sample _] (@representation sample)] + (let [[reference _] (:representation reference) + [sample _] (:representation sample)] (<op> reference sample)))] [m/= i/=] @@ -128,9 +128,9 @@ (do-template [<name> <op>] [(def: #export (<name> param subject) (All [m] (-> (Mod m) (Mod m) (Mod m))) - (let [[param modulus] (@representation param) - [subject _] (@representation subject)] - (@abstraction {#remainder (|> subject + (let [[param modulus] (:representation param) + [subject _] (:representation subject)] + (:abstraction {#remainder (|> subject (<op> param) (i/mod (to-int modulus))) #modulus modulus})))] @@ -152,7 +152,7 @@ (def: #export (inverse modular) (All [m] (-> (Mod m) (Maybe (Mod m)))) - (let [[value modulus] (@representation modular) + (let [[value modulus] (:representation modular) _modulus (to-int modulus) [vk mk gcd] (i/gcd+ value _modulus) co-prime? (i/= 1 gcd)] diff --git a/stdlib/source/lux/time/duration.lux b/stdlib/source/lux/time/duration.lux index 5efccf432..a29eda6da 100644 --- a/stdlib/source/lux/time/duration.lux +++ b/stdlib/source/lux/time/duration.lux @@ -18,16 +18,16 @@ (def: #export from-millis (-> Int Duration) - (|>> @abstraction)) + (|>> :abstraction)) (def: #export to-millis (-> Duration Int) - (|>> @representation)) + (|>> :representation)) (do-template [<name> <op>] [(def: #export (<name> param subject) (-> Duration Duration Duration) - (@abstraction (<op> (@representation param) (@representation subject))))] + (:abstraction (<op> (:representation param) (:representation subject))))] [merge i/+] [frame i/%] @@ -35,21 +35,21 @@ (def: #export (scale scalar duration) (-> Int Duration Duration) - (@abstraction (i/* scalar (@representation duration)))) + (:abstraction (i/* scalar (:representation duration)))) (def: #export (query param subject) (-> Duration Duration Int) - (i// (@representation param) (@representation subject))) + (i// (:representation param) (:representation subject))) (struct: #export _ (Eq Duration) (def: (= param subject) - (i/= (@representation param) (@representation subject)))) + (i/= (:representation param) (:representation subject)))) (struct: #export _ (Order Duration) (def: eq Eq<Duration>) (do-template [<name> <op>] [(def: (<name> param subject) - (<op> (@representation param) (@representation subject)))] + (<op> (:representation param) (:representation subject)))] [< i/<] [<= i/<=] @@ -60,7 +60,7 @@ (do-template [<name> <op>] [(def: #export (<name> duration) (-> Duration Bool) - (<op> 0 (@representation duration)))] + (<op> 0 (:representation duration)))] [positive? i/>] [negative? i/<] diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux index 12fe66172..1a2af827e 100644 --- a/stdlib/source/lux/time/instant.lux +++ b/stdlib/source/lux/time/instant.lux @@ -24,37 +24,37 @@ (def: #export from-millis (-> Int Instant) - (|>> @abstraction)) + (|>> :abstraction)) (def: #export to-millis (-> Instant Int) - (|>> @representation)) + (|>> :representation)) (def: #export (span from to) (-> Instant Instant duration.Duration) - (duration.from-millis (i/- (@representation from) (@representation to)))) + (duration.from-millis (i/- (:representation from) (:representation to)))) (def: #export (shift duration instant) (-> duration.Duration Instant Instant) - (@abstraction (i/+ (duration.to-millis duration) (@representation instant)))) + (:abstraction (i/+ (duration.to-millis duration) (:representation instant)))) (def: #export (relative instant) (-> Instant duration.Duration) - (|> instant @representation duration.from-millis)) + (|> instant :representation duration.from-millis)) (def: #export (absolute offset) (-> duration.Duration Instant) - (|> offset duration.to-millis @abstraction)) + (|> offset duration.to-millis :abstraction)) (struct: #export _ (Eq Instant) (def: (= param subject) - (:: number.Eq<Int> = (@representation param) (@representation subject)))) + (:: number.Eq<Int> = (:representation param) (:representation subject)))) (struct: #export _ (Order Instant) (def: eq Eq<Instant>) (do-template [<name>] [(def: (<name> param subject) - (:: number.Order<Int> <name> (@representation param) (@representation subject)))] + (:: number.Order<Int> <name> (:representation param) (:representation subject)))] [<] [<=] [>] [>=] )) @@ -63,7 +63,7 @@ (def: order Order<Instant>) (do-template [<name>] [(def: <name> - (|>> @representation (:: number.Enum<Int> <name>) @abstraction))] + (|>> :representation (:: number.Enum<Int> <name>) :abstraction))] [succ] [pred] )) diff --git a/stdlib/source/lux/type/abstract.lux b/stdlib/source/lux/type/abstract.lux index 1bb084cf5..0cbe49087 100644 --- a/stdlib/source/lux/type/abstract.lux +++ b/stdlib/source/lux/type/abstract.lux @@ -48,8 +48,8 @@ plist' (#.Cons [k' v'] (remove k plist'))))) -(def: down-cast Text "@abstraction") -(def: up-cast Text "@representation") +(def: down-cast Text ":abstraction") +(def: up-cast Text ":representation") (def: macro-anns Code (' {#.macro? true})) (def: representation-name @@ -165,14 +165,14 @@ (list/compose primitives (list (` ((~! un-install-casts))))))))) -(syntax: #export (^@representation {name (s.form s.local-symbol)} +(syntax: #export (^:representation {name (s.form s.local-symbol)} body {branches (p.some s.any)}) (let [g!representation (code.local-symbol name)] (do @ [current-module macro.current-module-name - #let [g!@representation (code.symbol [current-module "@representation"])]] + #let [g!:representation (code.symbol [current-module up-cast])]] (wrap (list& g!representation - (` (.let [(~ g!representation) ((~ g!@representation) (~ g!representation))] + (` (.let [(~ g!representation) ((~ g!:representation) (~ g!representation))] (~ body))) branches))))) diff --git a/stdlib/source/lux/type/quotient.lux b/stdlib/source/lux/type/quotient.lux index 2be136009..567d7af42 100644 --- a/stdlib/source/lux/type/quotient.lux +++ b/stdlib/source/lux/type/quotient.lux @@ -18,11 +18,11 @@ (All [t c] (Ex [q] (-> (-> t c) (Class t c q)))) - (|>> @abstraction)) + (|>> :abstraction)) (def: expose (All [t c q] (-> (Class t c q) (-> t c))) - (|>> @representation)) + (|>> :representation)) ) (abstract: #export (Quotient t c q) @@ -35,13 +35,13 @@ (All [t c q] (-> (Class t c q) t (Quotient t c q))) - (@abstraction {#value value + (:abstraction {#value value #label ((expose class) value)})) (do-template [<name> <output> <slot>] [(def: #export <name> (All [t c q] (-> (Quotient t c q) <output>)) - (|>> @representation (get@ <slot>)))] + (|>> :representation (get@ <slot>)))] [value t #value] [label c #label] diff --git a/stdlib/source/lux/type/refinement.lux b/stdlib/source/lux/type/refinement.lux index 7431c93fe..3abcf2a1c 100644 --- a/stdlib/source/lux/type/refinement.lux +++ b/stdlib/source/lux/type/refinement.lux @@ -25,14 +25,14 @@ (-> (Pred t) (Refiner t r)))) (function (_ un-refined) (if (predicate un-refined) - (#.Some (@abstraction {#value un-refined + (#.Some (:abstraction {#value un-refined #predicate predicate})) #.None))) (do-template [<name> <output> <slot>] [(def: #export (<name> refined) (All [t r] (-> (Ref t r) <output>)) - (|> refined @representation (get@ <slot>)))] + (|> refined :representation (get@ <slot>)))] [un-refine t #value] [predicate (Pred t) #predicate] @@ -43,10 +43,10 @@ (-> (-> t t) (-> (Ref t r) (Maybe (Ref t r))))) (function (_ refined) - (let [[value predicate] (@representation refined) + (let [[value predicate] (:representation refined) value' (transform value)] (if (predicate value') - (#.Some (@abstraction {#value value' + (#.Some (:abstraction {#value value' #predicate predicate})) #.None)))) ) diff --git a/stdlib/source/lux/type/resource.lux b/stdlib/source/lux/type/resource.lux index 2c7062c1a..eafda2092 100644 --- a/stdlib/source/lux/type/resource.lux +++ b/stdlib/source/lux/type/resource.lux @@ -80,7 +80,7 @@ (do-template [<name> <mode>] [(def: <name> (Ex [k] (-> [] (Key <mode> k))) - (|>> @abstraction))] + (|>> :abstraction))] [ordered-key Ordered] [commutative-key Commutative] @@ -97,7 +97,7 @@ [(def: #export (<name> value) (All [v] (Ex [k] (-> v (Affine <m> (Key <mode> k) (Res k v))))) (function (_ keys) - (:: <monad> wrap [[(<key> []) keys] (@abstraction value)])))] + (:: <monad> wrap [[(<key> []) keys] (:abstraction value)])))] [ordered-pure Identity identity.Monad<Identity> Ordered ordered-key] [ordered-sync IO io.Monad<IO> Ordered ordered-key] @@ -111,7 +111,7 @@ (All [v k m] (-> (Res k v) (Relevant <m> (Key m k) v))) (function (_ [key keys]) - (:: <monad> wrap [keys (@representation resource)])))] + (:: <monad> wrap [keys (:representation resource)])))] [read-pure Identity identity.Monad<Identity>] [read-sync IO io.Monad<IO>] diff --git a/stdlib/source/lux/type/unit.lux b/stdlib/source/lux/type/unit.lux index 88b56730b..0b5e2dcec 100644 --- a/stdlib/source/lux/type/unit.lux +++ b/stdlib/source/lux/type/unit.lux @@ -21,11 +21,11 @@ (def: #export in (All [unit] (-> Int (Qty unit))) - (|>> @abstraction)) + (|>> :abstraction)) (def: #export out (All [unit] (-> (Qty unit) Int)) - (|>> @representation))) + (|>> :representation))) (sig: #export (Scale s) (: (All [u] (-> (Qty u) (Qty (s u)))) diff --git a/stdlib/source/lux/world/net/tcp.jvm.lux b/stdlib/source/lux/world/net/tcp.jvm.lux index fddd6a94e..a18b5e6de 100644 --- a/stdlib/source/lux/world/net/tcp.jvm.lux +++ b/stdlib/source/lux/world/net/tcp.jvm.lux @@ -46,12 +46,12 @@ (promise.future (do io.Monad<Process> [bytes-read (InputStream::read [data (.int offset) (.int length)] - (get@ #in (@representation self)))] + (get@ #in (:representation self)))] (wrap (.nat bytes-read))))) (def: #export (write data offset length self) (-> Blob Nat Nat TCP (Task Any)) - (let [out (get@ #out (@representation self))] + (let [out (get@ #out (:representation self))] (promise.future (do io.Monad<Process> [_ (OutputStream::write [data (.int offset) (.int length)] @@ -60,7 +60,7 @@ (def: #export (close self) (-> TCP (Task Any)) - (let [(^open) (@representation self)] + (let [(^open) (:representation self)] (promise.future (do io.Monad<Process> [_ (AutoCloseable::close [] in) @@ -72,7 +72,7 @@ (do io.Monad<Process> [input (Socket::getInputStream [] socket) output (Socket::getOutputStream [] socket)] - (wrap (@abstraction {#socket socket + (wrap (:abstraction {#socket socket #in input #out output})))) ) diff --git a/stdlib/source/lux/world/net/udp.jvm.lux b/stdlib/source/lux/world/net/udp.jvm.lux index 5818020e6..5f0f52831 100644 --- a/stdlib/source/lux/world/net/udp.jvm.lux +++ b/stdlib/source/lux/world/net/udp.jvm.lux @@ -61,7 +61,7 @@ (def: #export (read data offset length self) (-> Blob Nat Nat UDP (T.Task [Nat //.Address //.Port])) - (let [(^open) (@representation self) + (let [(^open) (:representation self) packet (DatagramPacket::new|receive [data (.int offset) (.int length)])] (P.future (do (e.ErrorT io.Monad<IO>) @@ -76,13 +76,13 @@ (P.future (do (e.ErrorT io.Monad<IO>) [address (resolve address) - #let [(^open) (@representation self)]] + #let [(^open) (:representation self)]] (DatagramSocket::send (DatagramPacket::new|send [data (.int offset) (.int length) address (.int port)]) socket)))) (def: #export (close self) (-> UDP (T.Task Any)) - (let [(^open) (@representation self)] + (let [(^open) (:representation self)] (P.future (AutoCloseable::close [] socket)))) @@ -91,12 +91,12 @@ (P.future (do (e.ErrorT io.Monad<IO>) [socket (DatagramSocket::new|client [])] - (wrap (@abstraction (#socket socket)))))) + (wrap (:abstraction (#socket socket)))))) (def: #export (server port) (-> //.Port (T.Task UDP)) (P.future (do (e.ErrorT io.Monad<IO>) [socket (DatagramSocket::new|server [(.int port)])] - (wrap (@abstraction (#socket socket)))))) + (wrap (:abstraction (#socket socket)))))) ) |