From 879d0560e9d09ca997bf81de498fe9740ef36434 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 18 May 2021 00:45:15 -0400 Subject: Got rid of the {}s in ":share" and made it pipe-able. --- stdlib/source/lux/control/concurrency/actor.lux | 22 ++++++++++++---------- stdlib/source/lux/control/concurrency/frp.lux | 11 ++++++----- stdlib/source/lux/control/parser/binary.lux | 9 +++++---- .../source/lux/data/collection/queue/priority.lux | 5 +++-- stdlib/source/lux/data/collection/tree/finger.lux | 2 +- stdlib/source/lux/data/text/unicode/set.lux | 5 +++-- stdlib/source/lux/math/number/i16.lux | 10 ++++++---- stdlib/source/lux/math/number/i32.lux | 10 ++++++---- stdlib/source/lux/math/number/i8.lux | 10 ++++++---- .../lux/tool/compiler/meta/archive/document.lux | 11 ++++++----- stdlib/source/lux/type.lux | 12 +++++++----- stdlib/source/lux/type/quotient.lux | 6 ++++-- stdlib/source/lux/type/refinement.lux | 5 +++-- stdlib/source/test/lux/control/region.lux | 18 ++++++++++-------- .../test/lux/data/collection/tree/finger.lux | 5 +++-- stdlib/source/test/lux/data/text/format.lux | 3 ++- stdlib/source/test/lux/type.lux | 4 +++- 17 files changed, 86 insertions(+), 62 deletions(-) (limited to 'stdlib') diff --git a/stdlib/source/lux/control/concurrency/actor.lux b/stdlib/source/lux/control/concurrency/actor.lux index 584bf614e..f4d63c00f 100644 --- a/stdlib/source/lux/control/concurrency/actor.lux +++ b/stdlib/source/lux/control/concurrency/actor.lux @@ -81,11 +81,12 @@ (All [o s] (-> (Behavior o s) o (IO (Actor s)))) (io (let [[on_init on_mail] behavior self (:share [o s] - {(Behavior o s) - behavior} - {(Actor s) - (:abstraction {#obituary (promise.promise []) - #mailbox (atom (promise.promise []))})}) + (Behavior o s) + behavior + + (Actor s) + (:abstraction {#obituary (promise.promise []) + #mailbox (atom (promise.promise []))})) process (loop [state (on_init init) [|mailbox| _] (io.run (atom.read (get@ #mailbox (:representation self))))] (do {! promise.monad} @@ -159,11 +160,12 @@ (def: (mail message) (All [s o] (-> (Message s o) [(Promise (Try o)) (Mail s)])) (let [[promise resolve] (:share [s o] - {(Message s o) - message} - {[(Promise (Try o)) - (Resolver (Try o))] - (promise.promise [])})] + (Message s o) + message + + [(Promise (Try o)) + (Resolver (Try o))] + (promise.promise []))] [promise (function (_ state self) (do {! promise.monad} diff --git a/stdlib/source/lux/control/concurrency/frp.lux b/stdlib/source/lux/control/concurrency/frp.lux index 0c5303f46..868bc4153 100644 --- a/stdlib/source/lux/control/concurrency/frp.lux +++ b/stdlib/source/lux/control/concurrency/frp.lux @@ -58,11 +58,12 @@ (do {! io.monad} [current (atom.read sink) #let [[next resolve_next] (:share [a] - {(promise.Resolver (Maybe [a (Channel a)])) - current} - {[(Promise (Maybe [a (Channel a)])) - (promise.Resolver (Maybe [a (Channel a)]))] - (promise.promise [])})] + (promise.Resolver (Maybe [a (Channel a)])) + current + + [(Promise (Maybe [a (Channel a)])) + (promise.Resolver (Maybe [a (Channel a)]))] + (promise.promise []))] fed? (current (#.Some [value next]))] (if fed? ## I fed the sink. diff --git a/stdlib/source/lux/control/parser/binary.lux b/stdlib/source/lux/control/parser/binary.lux index 1dcba78cb..423cff74f 100644 --- a/stdlib/source/lux/control/parser/binary.lux +++ b/stdlib/source/lux/control/parser/binary.lux @@ -188,10 +188,11 @@ )] (loop [index 0 output (:share [v] - {(Parser v) - valueP} - {(Row v) - row.empty})] + (Parser v) + valueP + + (Row v) + row.empty)] (if (n.< count index) (do //.monad [value valueP] diff --git a/stdlib/source/lux/data/collection/queue/priority.lux b/stdlib/source/lux/data/collection/queue/priority.lux index 0f2b1e039..b7f971dd2 100644 --- a/stdlib/source/lux/data/collection/queue/priority.lux +++ b/stdlib/source/lux/data/collection/queue/priority.lux @@ -25,8 +25,9 @@ (def: :@: (:by_example [@] - {(tree.Builder @ Priority) - ..builder} + (tree.Builder @ Priority) + ..builder + @)) (abstract: #export (Queue a) diff --git a/stdlib/source/lux/data/collection/tree/finger.lux b/stdlib/source/lux/data/collection/tree/finger.lux index 96f7af432..ae30c294a 100644 --- a/stdlib/source/lux/data/collection/tree/finger.lux +++ b/stdlib/source/lux/data/collection/tree/finger.lux @@ -6,7 +6,7 @@ [data [collection ["." list ("#\." monoid)]]] - [type (#+ :by_example) + [type [abstract (#+ abstract: :abstraction :representation)]]]) (abstract: #export (Tree @ t v) diff --git a/stdlib/source/lux/data/text/unicode/set.lux b/stdlib/source/lux/data/text/unicode/set.lux index 1ac443d1a..c7b5748e4 100644 --- a/stdlib/source/lux/data/text/unicode/set.lux +++ b/stdlib/source/lux/data/text/unicode/set.lux @@ -20,8 +20,9 @@ (def: :@: (:by_example [@] - {(tree.Builder @ Block) - ..builder} + (tree.Builder @ Block) + ..builder + @)) (abstract: #export Set diff --git a/stdlib/source/lux/math/number/i16.lux b/stdlib/source/lux/math/number/i16.lux index 9168b5925..ba4f9cd02 100644 --- a/stdlib/source/lux/math/number/i16.lux +++ b/stdlib/source/lux/math/number/i16.lux @@ -10,10 +10,12 @@ (def: sub (maybe.assume (i64.sub 16))) -(def: #export I16 (:by_example [size] - {(Sub size) - ..sub} - (I64 size))) +(def: #export I16 + (:by_example [size] + (Sub size) + ..sub + + (I64 size))) (def: #export equivalence (Equivalence I16) (\ ..sub &equivalence)) (def: #export width Nat (\ ..sub width)) diff --git a/stdlib/source/lux/math/number/i32.lux b/stdlib/source/lux/math/number/i32.lux index 3a1811b81..9141c175d 100644 --- a/stdlib/source/lux/math/number/i32.lux +++ b/stdlib/source/lux/math/number/i32.lux @@ -10,10 +10,12 @@ (def: sub (maybe.assume (i64.sub 32))) -(def: #export I32 (:by_example [size] - {(Sub size) - ..sub} - (I64 size))) +(def: #export I32 + (:by_example [size] + (Sub size) + ..sub + + (I64 size))) (def: #export equivalence (Equivalence I32) (\ ..sub &equivalence)) (def: #export width Nat (\ ..sub width)) diff --git a/stdlib/source/lux/math/number/i8.lux b/stdlib/source/lux/math/number/i8.lux index bea35ff22..d6184315c 100644 --- a/stdlib/source/lux/math/number/i8.lux +++ b/stdlib/source/lux/math/number/i8.lux @@ -10,10 +10,12 @@ (def: sub (maybe.assume (i64.sub 8))) -(def: #export I8 (:by_example [size] - {(Sub size) - ..sub} - (I64 size))) +(def: #export I8 + (:by_example [size] + (Sub size) + ..sub + + (I64 size))) (def: #export equivalence (Equivalence I8) (\ ..sub &equivalence)) (def: #export width Nat (\ ..sub width)) diff --git a/stdlib/source/lux/tool/compiler/meta/archive/document.lux b/stdlib/source/lux/tool/compiler/meta/archive/document.lux index a8c656ff9..b60d77246 100644 --- a/stdlib/source/lux/tool/compiler/meta/archive/document.lux +++ b/stdlib/source/lux/tool/compiler/meta/archive/document.lux @@ -6,7 +6,7 @@ ["." try (#+ Try)] ["." exception (#+ exception:)] ["<>" parser - ["" binary (#+ Parser)]]] + [binary (#+ Parser)]]] [data [collection ["." dictionary (#+ Dictionary)]] @@ -35,10 +35,11 @@ (key.signature key) document//signature) (#try.Success (:share [e] - {(Key e) - key} - {e - (:assume document//content)})) + (Key e) + key + + e + (:assume document//content))) (exception.throw ..invalid-signature [(key.signature key) document//signature])))) diff --git a/stdlib/source/lux/type.lux b/stdlib/source/lux/type.lux index 77060876f..72375519d 100644 --- a/stdlib/source/lux/type.lux +++ b/stdlib/source/lux/type.lux @@ -414,7 +414,7 @@ (def: typed (Parser Typed) - (.record (<>.and .any .any))) + (<>.and .any .any)) ## TODO: Make sure the generated code always gets optimized away. (syntax: #export (:share {type_vars ..type_parameters} @@ -433,7 +433,9 @@ {extraction .any}) (wrap (list (` (:of ((~! :share) [(~+ (list\map code.local_identifier type_vars))] - {(~ (get@ #type exemplar)) - (~ (get@ #expression exemplar))} - {(~ extraction) - (:assume [])})))))) + + (~ (get@ #type exemplar)) + (~ (get@ #expression exemplar)) + + (~ extraction) + (:assume []))))))) diff --git a/stdlib/source/lux/type/quotient.lux b/stdlib/source/lux/type/quotient.lux index 8db23a9a2..f85f8b56c 100644 --- a/stdlib/source/lux/type/quotient.lux +++ b/stdlib/source/lux/type/quotient.lux @@ -42,8 +42,10 @@ (with_gensyms [g!t g!c g!%] (wrap (list (` ((~! type.:by_example) [(~ g!t) (~ g!c) (~ g!%)] - {(..Class (~ g!t) (~ g!c) (~ g!%)) - (~ class)} + + (..Class (~ g!t) (~ g!c) (~ g!%)) + (~ class) + (..Quotient (~ g!t) (~ g!c) (~ g!%)))))))) (structure: #export (equivalence super) diff --git a/stdlib/source/lux/type/refinement.lux b/stdlib/source/lux/type/refinement.lux index f99c9216c..5bbc90149 100644 --- a/stdlib/source/lux/type/refinement.lux +++ b/stdlib/source/lux/type/refinement.lux @@ -82,6 +82,7 @@ (syntax: #export (type refiner) (macro.with_gensyms [g!t g!%] (wrap (list (` ((~! type.:by_example) [(~ g!t) (~ g!%)] - {(..Refiner (~ g!t) (~ g!%)) - (~ refiner)} + (..Refiner (~ g!t) (~ g!%)) + (~ refiner) + (..Refined (~ g!t) (~ g!%)))))))) diff --git a/stdlib/source/test/lux/control/region.lux b/stdlib/source/test/lux/control/region.lux index 1023822ea..3fb0d1d82 100644 --- a/stdlib/source/test/lux/control/region.lux +++ b/stdlib/source/test/lux/control/region.lux @@ -59,15 +59,17 @@ (Comparison (All [a] (All [! r] (Region r (Thread !) a)))) (function (_ == left right) (case [(:share [a] - {(Equivalence a) - ==} - {(Try a) - (thread.run (:assume (/.run thread.monad left)))}) + (Equivalence a) + == + + (Try a) + (thread.run (:assume (/.run thread.monad left)))) (:share [a] - {(Equivalence a) - ==} - {(Try a) - (thread.run (:assume (/.run thread.monad right)))})] + (Equivalence a) + == + + (Try a) + (thread.run (:assume (/.run thread.monad right))))] [(#try.Success left) (#try.Success right)] (== left right) diff --git a/stdlib/source/test/lux/data/collection/tree/finger.lux b/stdlib/source/test/lux/data/collection/tree/finger.lux index 33b333396..55c3d9118 100644 --- a/stdlib/source/test/lux/data/collection/tree/finger.lux +++ b/stdlib/source/test/lux/data/collection/tree/finger.lux @@ -21,8 +21,9 @@ (def: :@: (:by_example [@] - {(/.Builder @ Text) - ..builder} + (/.Builder @ Text) + ..builder + @)) (def: #export test diff --git a/stdlib/source/test/lux/data/text/format.lux b/stdlib/source/test/lux/data/text/format.lux index 0f61caa1f..8b1e9a700 100644 --- a/stdlib/source/test/lux/data/text/format.lux +++ b/stdlib/source/test/lux/data/text/format.lux @@ -19,7 +19,7 @@ ["." json]] [collection ["." list ("#\." functor)]]] - [time + ["." time ["." instant] ["." duration] ["." date]] @@ -106,6 +106,7 @@ [/.instant instant.codec random.instant] [/.duration duration.codec random.duration] [/.date date.codec random.date] + [/.time time.codec random.time] [/.nat/2 nat.binary random.nat] [/.nat/8 nat.octal random.nat] diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux index 0b3f3b4d8..b490469cf 100644 --- a/stdlib/source/test/lux/type.lux +++ b/stdlib/source/test/lux/type.lux @@ -164,7 +164,9 @@ #.None)] (/\= (.type (List Nat)) (/.:by_example [a] - {(Maybe a) example} + (Maybe a) + example + (List a))))) /abstract.test -- cgit v1.2.3