diff options
author | Eduardo Julian | 2018-07-20 22:46:38 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-07-20 22:46:38 -0400 |
commit | 518a7467c4e0ef904afa8c59cff3594d6f63c552 (patch) | |
tree | 509598d219a780d14a8fe6ccd46545f701a1cd17 /stdlib | |
parent | b1315d6dc1e4bed4a3bf35e8c6f67d88c2aa7b55 (diff) |
No longer giving default aliases to un-prefixed imports.
Diffstat (limited to 'stdlib')
216 files changed, 1802 insertions, 1756 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 226545576..392d3a504 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -4220,15 +4220,7 @@ #import-refer {#refer-defs #All #refer-open (list)}}))) - (^ [_ (#Tuple (list [_ (#Symbol ["" m-name])]))]) - (do Monad<Meta> - [import-name (clean-module nested? relative-root m-name)] - (wrap (list {#import-name import-name - #import-alias (#Some m-name) - #import-refer {#refer-defs #Nothing - #refer-open (list)}}))) - - (^ [_ (#Tuple (list& [_ (#Text alias)] [_ (#Symbol ["" m-name])] extra))]) + (^ [_ (#Tuple (list& [_ (#Symbol ["" m-name])] extra))]) (do Monad<Meta> [import-name (clean-module nested? relative-root m-name) referral+extra (parse-referrals extra) @@ -4236,13 +4228,15 @@ openings+extra (parse-openings extra) #let [[openings extra] openings+extra] sub-imports (parse-imports #1 import-name extra)] - (wrap (list& {#import-name import-name - #import-alias (#Some (replace-all "." m-name alias)) - #import-refer {#refer-defs referral - #refer-open openings}} - sub-imports))) + (wrap (case [referral openings] + [#Nothing #Nil] sub-imports + _ (list& {#import-name import-name + #import-alias #None + #import-refer {#refer-defs referral + #refer-open openings}} + sub-imports)))) - (^ [_ (#Tuple (list& [_ (#Symbol ["" m-name])] extra))]) + (^ [_ (#Tuple (list& [_ (#Text alias)] [_ (#Symbol ["" m-name])] extra))]) (do Monad<Meta> [import-name (clean-module nested? relative-root m-name) referral+extra (parse-referrals extra) @@ -4250,13 +4244,11 @@ openings+extra (parse-openings extra) #let [[openings extra] openings+extra] sub-imports (parse-imports #1 import-name extra)] - (wrap (case [referral openings] - [#Nothing #Nil] sub-imports - _ (list& {#import-name import-name - #import-alias (#Some m-name) - #import-refer {#refer-defs referral - #refer-open openings}} - sub-imports)))) + (wrap (list& {#import-name import-name + #import-alias (#Some (replace-all "." m-name alias)) + #import-refer {#refer-defs referral + #refer-open openings}} + sub-imports))) _ (do Monad<Meta> diff --git a/stdlib/source/lux/cli.lux b/stdlib/source/lux/cli.lux index 5b4b9b6bc..10b225077 100644 --- a/stdlib/source/lux/cli.lux +++ b/stdlib/source/lux/cli.lux @@ -4,13 +4,14 @@ monad ["p" parser]] [data - [collection [list ("list/" Monoid<List> Monad<List>)]] - [text ("text/" Equivalence<Text>) + [collection + [list ("list/" Monoid<List> Monad<List>)]] + ["." text ("text/" Equivalence<Text>) format] ["E" error]] - [io] + ["." io] [macro (#+ with-gensyms) - [code] + ["." code] ["s" syntax (#+ syntax: Syntax)]]]) ## [Types] diff --git a/stdlib/source/lux/concurrency/actor.lux b/stdlib/source/lux/concurrency/actor.lux index cb35b0706..971bbe01e 100644 --- a/stdlib/source/lux/concurrency/actor.lux +++ b/stdlib/source/lux/concurrency/actor.lux @@ -3,14 +3,16 @@ [control monad ["p" parser] ["ex" exception (#+ exception:)]] - [io (#- run) ("io/" Monad<IO>)] + ["." io (#- run) ("io/" Monad<IO>)] [data - [product] + ["." product] ["e" error] - text/format - [collection [list ("list/" Monoid<List> Monad<List> Fold<List>)]]] - [macro (#+ with-gensyms Monad<Meta>) - [code] + [text + format] + [collection + ["." list ("list/" Monoid<List> Monad<List> Fold<List>)]]] + ["." macro (#+ with-gensyms Monad<Meta>) + ["." code] ["s" syntax (#+ syntax: Syntax)] [syntax ["cs" common] @@ -20,9 +22,9 @@ [type abstract]] [// - [atom (#+ Atom atom)] - [promise (#+ Promise promise) ("promise/" Monad<Promise>)] - [task (#+ Task)]]) + ["." atom (#+ Atom atom)] + ["." promise (#+ Promise promise) ("promise/" Monad<Promise>)] + ["." task (#+ Task)]]) (exception: #export poisoned) diff --git a/stdlib/source/lux/concurrency/atom.lux b/stdlib/source/lux/concurrency/atom.lux index a06a93b4e..f81eafc22 100644 --- a/stdlib/source/lux/concurrency/atom.lux +++ b/stdlib/source/lux/concurrency/atom.lux @@ -1,6 +1,6 @@ (.module: [lux #* - [function] + ["." function] [io (#- run)]]) (type: #export (Atom a) diff --git a/stdlib/source/lux/concurrency/frp.lux b/stdlib/source/lux/concurrency/frp.lux index 2e1e10d87..0e777ce7a 100644 --- a/stdlib/source/lux/concurrency/frp.lux +++ b/stdlib/source/lux/concurrency/frp.lux @@ -3,13 +3,16 @@ [control [functor (#+ Functor)] [apply (#+ Apply)] - [monad (#+ do Monad)]] - [io (#+ IO io)] - [data [collection [list ("list/" Monoid<List>)]]] - [type abstract]] + ["." monad (#+ do Monad)]] + ["." io (#+ IO io)] + [data + [collection + [list ("list/" Monoid<List>)]]] + [type + abstract]] [// - [atom (#+ Atom atom)] - [promise (#+ Promise)]]) + ["." atom (#+ Atom atom)] + ["." promise (#+ Promise)]]) ## [Types] (abstract: #export (Channel a) diff --git a/stdlib/source/lux/concurrency/promise.lux b/stdlib/source/lux/concurrency/promise.lux index eaf913ac1..c68b1fc17 100644 --- a/stdlib/source/lux/concurrency/promise.lux +++ b/stdlib/source/lux/concurrency/promise.lux @@ -1,14 +1,17 @@ (.module: [lux #* - [io (#+ IO io)] - [function] [control [functor (#+ Functor)] [apply (#+ Apply)] - [monad (#+ do Monad)]] - [data [product]] - [concurrency [atom (#+ Atom atom)]] - [type abstract]]) + ["." monad (#+ do Monad)]] + [data + ["." product]] + ["." function] + [type + abstract] + ["." io (#+ IO io)] + [concurrency + ["." atom (#+ Atom atom)]]]) (def: #export parallelism Nat diff --git a/stdlib/source/lux/concurrency/semaphore.lux b/stdlib/source/lux/concurrency/semaphore.lux index b6c0ce69b..3be7fb431 100644 --- a/stdlib/source/lux/concurrency/semaphore.lux +++ b/stdlib/source/lux/concurrency/semaphore.lux @@ -2,12 +2,12 @@ [lux #* [control [monad (#+ do)]] [concurrency - [atom (#+ Atom)] - [promise (#+ Promise)]] - [io (#+ IO)] + ["." atom (#+ Atom)] + ["." promise (#+ Promise)]] + ["." io (#+ IO)] [type abstract - [refinement]]]) + ["." refinement]]]) (type: State {#open-positions Nat diff --git a/stdlib/source/lux/concurrency/stm.lux b/stdlib/source/lux/concurrency/stm.lux index 88d0ed6ed..b19188a86 100644 --- a/stdlib/source/lux/concurrency/stm.lux +++ b/stdlib/source/lux/concurrency/stm.lux @@ -3,17 +3,19 @@ [control [functor (#+ Functor)] [apply (#+ Apply)] - [monad (#+ do Monad)]] - [io (#+ IO io)] + ["." monad (#+ do Monad)]] + ["." io (#+ IO io)] [data - [product] - [maybe] - [collection [list ("list/" Functor<List> Fold<List>)]]] + ["." product] + ["." maybe] + [collection + ["." list ("list/" Functor<List> Fold<List>)]]] [concurrency - [atom (#+ Atom atom)] - [promise (#+ Promise promise)] - [frp ("frp/" Functor<Channel>)]] - [type abstract]]) + ["." atom (#+ Atom atom)] + ["." promise (#+ Promise promise)] + ["." frp ("frp/" Functor<Channel>)]] + [type + abstract]]) (abstract: #export (Var a) {#.doc "A mutable cell containing a value, and observers that will be alerted of any change to it."} diff --git a/stdlib/source/lux/control/apply.lux b/stdlib/source/lux/control/apply.lux index 9e5f1b6ae..39ea39991 100644 --- a/stdlib/source/lux/control/apply.lux +++ b/stdlib/source/lux/control/apply.lux @@ -1,7 +1,7 @@ (.module: lux [// - [functor (#+ Functor)] + ["." functor (#+ Functor)] [monad (#+ Monad)]]) (signature: #export (Apply f) diff --git a/stdlib/source/lux/control/comonad.lux b/stdlib/source/lux/control/comonad.lux index 937a121b1..4e294d00e 100644 --- a/stdlib/source/lux/control/comonad.lux +++ b/stdlib/source/lux/control/comonad.lux @@ -2,7 +2,7 @@ [lux #* [data [collection - [list ("list/" Fold<List>)]]]] + ["." list ("list/" Fold<List>)]]]] [// ["F" functor]]) diff --git a/stdlib/source/lux/control/concatenative.lux b/stdlib/source/lux/control/concatenative.lux index bed6e9dd5..7eb662a2e 100644 --- a/stdlib/source/lux/control/concatenative.lux +++ b/stdlib/source/lux/control/concatenative.lux @@ -6,14 +6,15 @@ f/+ f/- f/* f// f/% f/= f/< f/<= f/> f/>=) [control ["p" parser ("parser/" Monad<Parser>)] - [monad]] + ["." monad]] [data - [text] - text/format - [maybe ("maybe/" Monad<Maybe>)] - [collection [list ("list/" Fold<List> Functor<List>)]]] - [macro (#+ with-gensyms Monad<Meta>) - [code] + ["." text + format] + ["." maybe ("maybe/" Monad<Maybe>)] + [collection + ["." list ("list/" Fold<List> Functor<List>)]]] + ["." macro (#+ with-gensyms Monad<Meta>) + ["." code] ["s" syntax (#+ syntax:)] [syntax ["cs" common] @@ -210,44 +211,44 @@ [Nat Nat n/* .n/*] [Nat Nat n// .n//] [Nat Nat n/% .n/%] - [Nat Bit n/= .n/=] - [Nat Bit n/< .n/<] - [Nat Bit n/<= .n/<=] - [Nat Bit n/> .n/>] - [Nat Bit n/>= .n/>=] + [Nat Bit n/= .n/=] + [Nat Bit n/< .n/<] + [Nat Bit n/<= .n/<=] + [Nat Bit n/> .n/>] + [Nat Bit n/>= .n/>=] [Int Int i/+ .i/+] [Int Int i/- .i/-] [Int Int i/* .i/*] [Int Int i// .i//] [Int Int i/% .i/%] - [Int Bit i/= .i/=] - [Int Bit i/< .i/<] - [Int Bit i/<= .i/<=] - [Int Bit i/> .i/>] - [Int Bit i/>= .i/>=] + [Int Bit i/= .i/=] + [Int Bit i/< .i/<] + [Int Bit i/<= .i/<=] + [Int Bit i/> .i/>] + [Int Bit i/>= .i/>=] [Rev Rev r/+ .r/+] [Rev Rev r/- .r/-] [Rev Rev r/* .r/*] [Rev Rev r// .r//] [Rev Rev r/% .r/%] - [Rev Bit r/= .r/=] - [Rev Bit r/< .r/<] - [Rev Bit r/<= .r/<=] - [Rev Bit r/> .r/>] - [Rev Bit r/>= .r/>=] + [Rev Bit r/= .r/=] + [Rev Bit r/< .r/<] + [Rev Bit r/<= .r/<=] + [Rev Bit r/> .r/>] + [Rev Bit r/>= .r/>=] [Frac Frac f/+ .f/+] [Frac Frac f/- .f/-] [Frac Frac f/* .f/*] [Frac Frac f// .f//] [Frac Frac f/% .f/%] - [Frac Bit f/= .f/=] - [Frac Bit f/< .f/<] - [Frac Bit f/<= .f/<=] - [Frac Bit f/> .f/>] - [Frac Bit f/>= .f/>=] + [Frac Bit f/= .f/=] + [Frac Bit f/< .f/<] + [Frac Bit f/<= .f/<=] + [Frac Bit f/> .f/>] + [Frac Bit f/>= .f/>=] ) (def: #export if diff --git a/stdlib/source/lux/control/contract.lux b/stdlib/source/lux/control/contract.lux index d7e054a9b..72aefd174 100644 --- a/stdlib/source/lux/control/contract.lux +++ b/stdlib/source/lux/control/contract.lux @@ -3,8 +3,10 @@ [control monad] [data - text/format] - [macro (#+) [code] + [text + format]] + [macro (#+ with-gensyms) + ["." code] ["s" syntax (#+ syntax:)]]]) (def: #export (assert! message test) @@ -30,7 +32,7 @@ "Otherwise, an error is raised." (post i/even? (i/+ 2 2)))} - (macro.with-gensyms [g!output] + (with-gensyms [g!output] (wrap (list (` (let [(~ g!output) (~ expr)] (exec (assert! (~ (code.text (format "Post-condition failed: " (%code test)))) ((~ test) (~ g!output))) diff --git a/stdlib/source/lux/control/exception.lux b/stdlib/source/lux/control/exception.lux index 296513718..9983a7ce4 100644 --- a/stdlib/source/lux/control/exception.lux +++ b/stdlib/source/lux/control/exception.lux @@ -5,12 +5,13 @@ ["p" parser]] [data ["/" error (#+ Error)] - [maybe] - [product] - [text ("text/" Monoid<Text>)] - [collection [list ("list/" Functor<List> Fold<List>)]]] + ["." maybe] + ["." product] + ["." text ("text/" Monoid<Text>)] + [collection + ["." list ("list/" Functor<List> Fold<List>)]]] ["." macro - [code] + ["." code] ["s" syntax (#+ syntax: Syntax)] [syntax ["cs" common] diff --git a/stdlib/source/lux/control/monad.lux b/stdlib/source/lux/control/monad.lux index 997bb2117..c98851c95 100644 --- a/stdlib/source/lux/control/monad.lux +++ b/stdlib/source/lux/control/monad.lux @@ -1,6 +1,7 @@ (.module: lux - [// [functor (#+ Functor)]]) + [// + ["." functor (#+ Functor)]]) ## [Utils] (def: (list/fold f init xs) diff --git a/stdlib/source/lux/control/monad/indexed.lux b/stdlib/source/lux/control/monad/indexed.lux index 9e0cd9fd4..576428512 100644 --- a/stdlib/source/lux/control/monad/indexed.lux +++ b/stdlib/source/lux/control/monad/indexed.lux @@ -5,7 +5,7 @@ ["p" parser]] [data [collection - [list ("list/" Functor<List> Fold<List>)]]] + ["." list ("list/" Functor<List> Fold<List>)]]] ["." macro ["s" syntax (#+ Syntax syntax:)]]]) diff --git a/stdlib/source/lux/control/parser.lux b/stdlib/source/lux/control/parser.lux index fc42d5976..369e4a193 100644 --- a/stdlib/source/lux/control/parser.lux +++ b/stdlib/source/lux/control/parser.lux @@ -4,10 +4,11 @@ [functor (#+ Functor)] [apply (#+ Apply)] [monad (#+ do Monad)] - [codec]] + [codec (#+ Codec)]] [data - [collection [list ("list/" Functor<List> Monoid<List>)]] - [product] + [collection + ["." list ("list/" Functor<List> Monoid<List>)]] + ["." product] ["e" error (#+ Error)]]]) (type: #export (Parser s a) @@ -261,7 +262,7 @@ (wrap output))) (def: #export (codec Codec<a,z> parser) - (All [s a z] (-> (codec.Codec a z) (Parser s a) (Parser s z))) + (All [s a z] (-> (Codec a z) (Parser s a) (Parser s z))) (function (_ input) (case (parser input) (#e.Error error) diff --git a/stdlib/source/lux/control/pipe.lux b/stdlib/source/lux/control/pipe.lux index 97e38b365..2a6f4804c 100644 --- a/stdlib/source/lux/control/pipe.lux +++ b/stdlib/source/lux/control/pipe.lux @@ -5,11 +5,11 @@ ["p" parser]] [data ["e" error] - [collection [list ("list/" Fold<List> Monad<List>)]]] + [collection + ["." list ("list/" Fold<List> Monad<List>)]]] [macro (#+ with-gensyms) ["s" syntax (#+ syntax: Syntax)] - [code]] - ]) + ["." code]]]) ## [Syntax] (def: body^ diff --git a/stdlib/source/lux/control/predicate.lux b/stdlib/source/lux/control/predicate.lux index 1d683bf5a..500395cbf 100644 --- a/stdlib/source/lux/control/predicate.lux +++ b/stdlib/source/lux/control/predicate.lux @@ -1,7 +1,8 @@ (.module: [lux #* - [control [monoid (#+ Monoid)]] - [function]]) + [control + [monoid (#+ Monoid)]] + ["." function]]) (type: #export (Predicate a) (-> a Bit)) diff --git a/stdlib/source/lux/control/reader.lux b/stdlib/source/lux/control/reader.lux index dfe8724e0..1d19b5594 100644 --- a/stdlib/source/lux/control/reader.lux +++ b/stdlib/source/lux/control/reader.lux @@ -3,7 +3,7 @@ [control ["F" functor] ["A" apply] - [monad (#+ do Monad)]]]) + ["." monad (#+ do Monad)]]]) ## [Types] (type: #export (Reader r a) diff --git a/stdlib/source/lux/control/region.lux b/stdlib/source/lux/control/region.lux index d83f82279..8b0b15a69 100644 --- a/stdlib/source/lux/control/region.lux +++ b/stdlib/source/lux/control/region.lux @@ -3,12 +3,14 @@ [control [functor (#+ Functor)] [apply (#+ Apply)] - [monad (#+ Monad do)] + ["." monad (#+ Monad do)] ["ex" exception (#+ Exception exception:)]] [data ["e" error (#+ Error)] - text/format - [collection [list ("list/" Fold<List>)]]]]) + [text + format] + [collection + [list ("list/" Fold<List>)]]]]) (type: (Cleaner r m) (-> r (m (Error Any)))) diff --git a/stdlib/source/lux/control/writer.lux b/stdlib/source/lux/control/writer.lux index 25e665b73..a93242297 100644 --- a/stdlib/source/lux/control/writer.lux +++ b/stdlib/source/lux/control/writer.lux @@ -4,7 +4,7 @@ monoid ["F" functor] ["A" apply] - [monad (#+ do Monad)]]]) + ["." monad (#+ do Monad)]]]) (type: #export (Writer l a) {#.doc "Represents a value with an associated 'log' value to record arbitrary information."} diff --git a/stdlib/source/lux/data/collection/array.lux b/stdlib/source/lux/data/collection/array.lux index 7093de9a1..451e4c5f2 100644 --- a/stdlib/source/lux/data/collection/array.lux +++ b/stdlib/source/lux/data/collection/array.lux @@ -7,9 +7,9 @@ fold [predicate (#+ Predicate)]] [data - [collection [list ("list/" Fold<List>)]] - [product]] - ]) + [collection + ["." list ("list/" Fold<List>)]] + ["." product]]]) (def: #export (new size) (All [a] (-> Nat (Array a))) diff --git a/stdlib/source/lux/data/collection/bits.lux b/stdlib/source/lux/data/collection/bits.lux index 05de58e37..803654c6c 100644 --- a/stdlib/source/lux/data/collection/bits.lux +++ b/stdlib/source/lux/data/collection/bits.lux @@ -4,12 +4,13 @@ [equivalence (#+ Equivalence)] pipe] [data - [maybe] + ["." maybe] [number - [i64]] + ["." i64]] [text format] - [collection [array ("array/" Fold<Array>)]]]]) + [collection + ["." array ("array/" Fold<Array>)]]]]) (type: #export Chunk I64) diff --git a/stdlib/source/lux/data/collection/dictionary.lux b/stdlib/source/lux/data/collection/dictionary.lux index 27ee863cc..adea785cf 100644 --- a/stdlib/source/lux/data/collection/dictionary.lux +++ b/stdlib/source/lux/data/collection/dictionary.lux @@ -4,13 +4,13 @@ hash [equivalence (#+ Equivalence)]] [data - [maybe] - [product] + ["." maybe] + ["." product] ["." number - [i64]] + ["." i64]] [collection - [list ("list/" Fold<List> Functor<List> Monoid<List>)] - [array ("array/" Functor<Array> Fold<Array>)]]] + ["." list ("list/" Fold<List> Functor<List> Monoid<List>)] + ["." array ("array/" Functor<Array> Fold<Array>)]]] ]) ## This implementation of Hash Array Mapped Trie (HAMT) is based on diff --git a/stdlib/source/lux/data/collection/dictionary/ordered.lux b/stdlib/source/lux/data/collection/dictionary/ordered.lux index 0af6bd341..96e989300 100644 --- a/stdlib/source/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/lux/data/collection/dictionary/ordered.lux @@ -6,10 +6,11 @@ [order (#+ Order)]] [data ["p" product] - [maybe] - [collection [list ("list/" Monoid<List> Fold<List>)]]] + ["." maybe] + [collection + [list ("list/" Monoid<List> Fold<List>)]]] ["." macro - [code] + ["." code] ["s" syntax (#+ syntax: Syntax)]]]) (def: error-message Text "Invariant violation") diff --git a/stdlib/source/lux/data/collection/list.lux b/stdlib/source/lux/data/collection/list.lux index 111c9b00e..9746fdfae 100644 --- a/stdlib/source/lux/data/collection/list.lux +++ b/stdlib/source/lux/data/collection/list.lux @@ -2,14 +2,14 @@ [lux #* [control [monoid (#+ Monoid)] - [functor (#+ Functor)] + ["." functor (#+ Functor)] [apply (#+ Apply)] - [monad (#+ do Monad)] + ["." monad (#+ do Monad)] [equivalence (#+ Equivalence)] - [fold]] + [fold (#+ Fold)]] [data bit - [product]]]) + ["." product]]]) ## [Types] ## (type: (List a) @@ -17,7 +17,7 @@ ## (#Cons a (List a))) ## [Functions] -(structure: #export _ (fold.Fold List) +(structure: #export _ (Fold List) (def: (fold f init xs) (case xs #.Nil diff --git a/stdlib/source/lux/data/collection/queue.lux b/stdlib/source/lux/data/collection/queue.lux index 864dfb67d..76aed3a63 100644 --- a/stdlib/source/lux/data/collection/queue.lux +++ b/stdlib/source/lux/data/collection/queue.lux @@ -3,7 +3,9 @@ [control [equivalence (#+ Equivalence)] ["F" functor]] - [data [collection [list ("list/" Monoid<List> Functor<List>)]]]]) + [data + [collection + ["." list ("list/" Monoid<List> Functor<List>)]]]]) (type: #export (Queue a) {#front (List a) diff --git a/stdlib/source/lux/data/collection/queue/priority.lux b/stdlib/source/lux/data/collection/queue/priority.lux index 11162ae8c..0e86ae070 100644 --- a/stdlib/source/lux/data/collection/queue/priority.lux +++ b/stdlib/source/lux/data/collection/queue/priority.lux @@ -4,9 +4,11 @@ [equivalence (#+ Equivalence)] [monad (#+ do Monad)]] [data - [number ("nat/" Interval<Nat>)] - [maybe] - [collection [tree [finger (#+ Tree)]]]]]) + ["." maybe] + ["." number ("nat/" Interval<Nat>)] + [collection + [tree + ["." finger (#+ Tree)]]]]]) (type: #export Priority Nat) diff --git a/stdlib/source/lux/data/collection/row.lux b/stdlib/source/lux/data/collection/row.lux index 23e5ded20..7974c4a90 100644 --- a/stdlib/source/lux/data/collection/row.lux +++ b/stdlib/source/lux/data/collection/row.lux @@ -10,17 +10,16 @@ ["p" parser] [predicate (#+ Predicate)]] [data - [maybe] - [product] + ["." maybe] + ["." product] [number - [i64]] + ["." i64]] [collection - [list ("list/" Fold<List> Functor<List> Monoid<List>)] + ["." list ("list/" Fold<List> Functor<List> Monoid<List>)] ["." array ("array/" Functor<Array> Fold<Array>)]]] [macro (#+ with-gensyms) - [code] - ["s" syntax (#+ syntax: Syntax)]] - ]) + ["." code] + ["s" syntax (#+ syntax: Syntax)]]]) ## [Utils] (type: (Node a) diff --git a/stdlib/source/lux/data/collection/sequence.lux b/stdlib/source/lux/data/collection/sequence.lux index 9a8258de2..d68116ae4 100644 --- a/stdlib/source/lux/data/collection/sequence.lux +++ b/stdlib/source/lux/data/collection/sequence.lux @@ -4,14 +4,15 @@ functor monad comonad - [continuation (#+ pending Cont)] + ["." continuation (#+ pending Cont)] ["p" parser]] [macro (#+ with-gensyms) - [code] + ["." code] ["s" syntax (#+ syntax: Syntax)]] [data bit - [collection [list ("list/" Monad<List>)]]]]) + [collection + [list ("list/" Monad<List>)]]]]) ## [Types] (type: #export (Sequence a) diff --git a/stdlib/source/lux/data/collection/set.lux b/stdlib/source/lux/data/collection/set.lux index d78ae6d19..00c02fabe 100644 --- a/stdlib/source/lux/data/collection/set.lux +++ b/stdlib/source/lux/data/collection/set.lux @@ -2,13 +2,14 @@ [lux #* [control [equivalence (#+ Equivalence)] - [hash (#+ Hash)] + ["." hash (#+ Hash)] [predicate (#+ Predicate)]] [data [collection ["dict" dictionary (#+ Dictionary)] - [list ("list/" Fold<List>)]]] - [type abstract]]) + ["." list ("list/" Fold<List>)]]] + [type + abstract]]) (abstract: #export (Set a) {} diff --git a/stdlib/source/lux/data/collection/set/multi.lux b/stdlib/source/lux/data/collection/set/multi.lux index 314c0423c..e29cb126b 100644 --- a/stdlib/source/lux/data/collection/set/multi.lux +++ b/stdlib/source/lux/data/collection/set/multi.lux @@ -4,14 +4,17 @@ [control [equivalence (#+ Equivalence)] [hash (#+ Hash)]] - [function] - [language [type (#+ :share)]] - [type abstract]] - [//// [maybe]] + ["." function] + [language + [type (#+ :share)]] + [type + abstract]] + [//// + ["." maybe]] [/// - [list ("list/" Fold<List>)] - [dictionary (#+ Dictionary)]] - [//]) + ["." list ("list/" Fold<List>)] + ["." dictionary (#+ Dictionary)]] + ["." //]) (abstract: #export (Set a) {} diff --git a/stdlib/source/lux/data/collection/set/ordered.lux b/stdlib/source/lux/data/collection/set/ordered.lux index b9fff0680..cccfb2768 100644 --- a/stdlib/source/lux/data/collection/set/ordered.lux +++ b/stdlib/source/lux/data/collection/set/ordered.lux @@ -5,9 +5,10 @@ [order (#+ Order)]] [data [collection - [list ("list/" Fold<List>)] + ["." list ("list/" Fold<List>)] [dictionary ["//" ordered]]]] - [type abstract]]) + [type + abstract]]) (abstract: #export (Set a) {} diff --git a/stdlib/source/lux/data/collection/stack.lux b/stdlib/source/lux/data/collection/stack.lux index 8a24010e7..eec2aae23 100644 --- a/stdlib/source/lux/data/collection/stack.lux +++ b/stdlib/source/lux/data/collection/stack.lux @@ -2,7 +2,7 @@ [lux #* [data [collection - [list]]]]) + ["." list]]]]) ## [Types] (type: #export (Stack a) diff --git a/stdlib/source/lux/data/collection/tree/finger.lux b/stdlib/source/lux/data/collection/tree/finger.lux index 3c449f57a..84859dca5 100644 --- a/stdlib/source/lux/data/collection/tree/finger.lux +++ b/stdlib/source/lux/data/collection/tree/finger.lux @@ -3,7 +3,9 @@ [control ["m" monoid] [predicate (#+ Predicate)]] - [data [text format]]]) + [data + [text + format]]]) (type: #export (Node m a) (#Leaf m a) diff --git a/stdlib/source/lux/data/collection/tree/rose.lux b/stdlib/source/lux/data/collection/tree/rose.lux index 86f1fc49f..6732c0da4 100644 --- a/stdlib/source/lux/data/collection/tree/rose.lux +++ b/stdlib/source/lux/data/collection/tree/rose.lux @@ -6,9 +6,11 @@ equivalence ["p" parser] fold] - [data [collection [list ("list/" Monad<List> Fold<List>)]]] + [data + [collection + ["." list ("list/" Monad<List> Fold<List>)]]] ["." macro - [code] + ["." code] ["s" syntax (#+ syntax: Syntax)]]]) ## [Types] diff --git a/stdlib/source/lux/data/collection/tree/rose/parser.lux b/stdlib/source/lux/data/collection/tree/rose/parser.lux index a2dd954b9..5364be8c5 100644 --- a/stdlib/source/lux/data/collection/tree/rose/parser.lux +++ b/stdlib/source/lux/data/collection/tree/rose/parser.lux @@ -6,7 +6,7 @@ [data ["E" error]]] [// (#+ Tree) - [zipper (#+ Zipper)]]) + ["." zipper (#+ Zipper)]]) (type: #export (Parser t a) (p.Parser (Zipper t) a)) diff --git a/stdlib/source/lux/data/collection/tree/rose/zipper.lux b/stdlib/source/lux/data/collection/tree/rose/zipper.lux index 030ddb36e..7d8412985 100644 --- a/stdlib/source/lux/data/collection/tree/rose/zipper.lux +++ b/stdlib/source/lux/data/collection/tree/rose/zipper.lux @@ -4,14 +4,14 @@ functor comonad] [data + ["." maybe ("maybe/" Monad<Maybe>)] [collection - [list ("list/" Functor<List> Fold<List> Monoid<List>)] - [tree [rose (#+ Tree) ("tree/" Functor<Tree>)]] - [stack (#+ Stack)]] - [maybe ("maybe/" Monad<Maybe>)]] + ["." list ("list/" Functor<List> Fold<List> Monoid<List>)] + ["." stack (#+ Stack)]]] ["." macro - [code] - ["s" syntax (#+ syntax: Syntax)]]]) + ["." code] + ["s" syntax (#+ syntax: Syntax)]]] + ["." // (#+ Tree) ("tree/" Functor<Tree>)]) ## Adapted from the clojure.zip namespace in the Clojure standard library. @@ -37,11 +37,11 @@ (def: #export (value zipper) (All [a] (-> (Zipper a) a)) - (|> zipper (get@ [#node #rose.value]))) + (|> zipper (get@ [#node #//.value]))) (def: #export (children zipper) (All [a] (-> (Zipper a) (List (Tree a)))) - (|> zipper (get@ [#node #rose.children]))) + (|> zipper (get@ [#node #//.children]))) (def: #export (branch? zipper) (All [a] (-> (Zipper a) Bit)) @@ -88,12 +88,12 @@ ## TODO: Remove once new-luxc becomes the standard compiler. (update@ #node (: (-> (Tree ($ +0)) (Tree ($ +0))) (function (_ node) - (set@ #rose.children (list/compose (list.reverse (get@ #lefts zipper)) - (#.Cons (get@ #node zipper) - (get@ #rights zipper))) + (set@ #//.children (list/compose (list.reverse (get@ #lefts zipper)) + (#.Cons (get@ #node zipper) + (get@ #rights zipper))) node)))) ## (update@ #node (function (_ node) - ## (set@ #rose.children (list/compose (list.reverse (get@ #lefts zipper)) + ## (set@ #//.children (list/compose (list.reverse (get@ #lefts zipper)) ## (#.Cons (get@ #node zipper) ## (get@ #rights zipper))) ## node))) @@ -144,34 +144,34 @@ (def: #export (set value zipper) (All [a] (-> a (Zipper a) (Zipper a))) - (set@ [#node #rose.value] value zipper)) + (set@ [#node #//.value] value zipper)) (def: #export (update f zipper) (All [a] (-> (-> a a) (Zipper a) (Zipper a))) - (update@ [#node #rose.value] f zipper)) + (update@ [#node #//.value] f zipper)) (def: #export (prepend-child value zipper) (All [a] (-> a (Zipper a) (Zipper a))) - (update@ [#node #rose.children] + (update@ [#node #//.children] (function (_ children) ## TODO: Remove once new-luxc becomes the standard compiler. (list& (: (Tree ($ +0)) - (rose.tree [value {}])) + (//.tree [value {}])) children) - ## (list& (rose.tree [value {}]) + ## (list& (//.tree [value {}]) ## children) ) zipper)) (def: #export (append-child value zipper) (All [a] (-> a (Zipper a) (Zipper a))) - (update@ [#node #rose.children] + (update@ [#node #//.children] (function (_ children) (list/compose children ## TODO: Remove once new-luxc becomes the standard compiler. (list (: (Tree ($ +0)) - (rose.tree [value {}]))) - ## (list (rose.tree [value {}])) + (//.tree [value {}]))) + ## (list (//.tree [value {}])) )) zipper)) @@ -185,7 +185,7 @@ (#.Some next) (#.Some (|> next - (update@ [#node #rose.children] (|>> list.tail (maybe.default (list))))))) + (update@ [#node #//.children] (|>> list.tail (maybe.default (list))))))) (#.Cons next side) (#.Some (|> zipper @@ -204,9 +204,9 @@ (update@ <side> (function (_ side) ## TODO: Remove once new-luxc becomes the standard compiler. (#.Cons (: (Tree ($ +0)) - (rose.tree [value {}])) + (//.tree [value {}])) side) - ## (#.Cons (rose.tree [value {}]) + ## (#.Cons (//.tree [value {}]) ## side) ))))))] @@ -225,13 +225,13 @@ ## (structure: #export _ (CoMonad Zipper) ## (def: functor Functor<Zipper>) -## (def: unwrap (get@ [#node #rose.value])) +## (def: unwrap (get@ [#node #//.value])) ## (def: (split wa) ## (let [tree-splitter (function (tree-splitter tree) -## {#rose.value (zip tree) -## #rose.children (list/map tree-splitter -## (get@ #rose.children tree))})] +## {#//.value (zip tree) +## #//.children (list/map tree-splitter +## (get@ #//.children tree))})] ## {#parent (|> wa (get@ #parent) (maybe/map split)) ## #lefts (|> wa (get@ #lefts) (list/map tree-splitter)) ## #rights (|> wa (get@ #rights) (list/map tree-splitter)) diff --git a/stdlib/source/lux/data/color.lux b/stdlib/source/lux/data/color.lux index a7b9fa0c3..50beed6d9 100644 --- a/stdlib/source/lux/data/color.lux +++ b/stdlib/source/lux/data/color.lux @@ -1,9 +1,12 @@ (.module: [lux #* [control ["eq" equivalence]] - [data [collection [list ("list/" Functor<List>)]]] - [math] - [type abstract]]) + [data + [collection + ["." list ("list/" Functor<List>)]]] + ["." math] + [type + abstract]]) (def: rgb Nat +256) (def: top Nat (dec rgb)) diff --git a/stdlib/source/lux/data/format/binary.lux b/stdlib/source/lux/data/format/binary.lux index b0c2a8b65..c3724c703 100644 --- a/stdlib/source/lux/data/format/binary.lux +++ b/stdlib/source/lux/data/format/binary.lux @@ -6,12 +6,13 @@ ["ex" exception (#+ exception:)] [equivalence (#+ Equivalence)]] [data - [error] + ["." error] + ["." number] [text - [encoding] - [format (#+ %n)]] - [number]] - [world [blob (#+ Blob)]]]) + ["." encoding] + [format (#+ %n)]]] + [world + ["." blob (#+ Blob)]]]) ## Exceptions (exception: #export (blob-was-not-fully-read {length Nat} {read Nat}) @@ -78,7 +79,7 @@ (<write> offset value) error.assume))])})] - [bits/8 size/8 blob.read/8 blob.write/8] + [bits/8 size/8 blob.read/8 blob.write/8] [bits/16 size/16 blob.read/16 blob.write/16] [bits/32 size/32 blob.read/32 blob.write/32] [bits/64 size/64 blob.read/64 blob.write/64] diff --git a/stdlib/source/lux/data/format/css.lux b/stdlib/source/lux/data/format/css.lux index 6afbe164e..e2b2737d2 100644 --- a/stdlib/source/lux/data/format/css.lux +++ b/stdlib/source/lux/data/format/css.lux @@ -1,11 +1,12 @@ (.module: [lux #* [data - [color (#+ Color)] - [number] + ["." color (#+ Color)] + ["." number] ["." text format] - [collection [list ("list/" Functor<List> Monoid<List>)]]]]) + [collection + ["." list ("list/" Functor<List> Monoid<List>)]]]]) (type: #export Selector Text) diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux index 261ff1330..764beab83 100644 --- a/stdlib/source/lux/data/format/json.lux +++ b/stdlib/source/lux/data/format/json.lux @@ -3,26 +3,26 @@ For more information, please see: http://www.json.org/"} [lux (#- Array) [control - [monad (#+ do Monad)] + ["." monad (#+ do Monad)] [equivalence (#+ Equivalence)] codec ["p" parser ("parser/" Monad<Parser>)]] [data - [bit] - [text ("text/" Equivalence<Text> Monoid<Text>) - ["l" lexer]] - [number ("frac/" Codec<Text,Frac>) ("nat/" Codec<Text,Nat>)] - [maybe] + ["." bit] + ["." maybe] ["e" error] - [sum] - [product] + ["." sum] + ["." product] + ["." number ("frac/" Codec<Text,Frac>) ("nat/" Codec<Text,Nat>)] + ["." text ("text/" Equivalence<Text> Monoid<Text>) + ["l" lexer]] [collection - [list ("list/" Fold<List> Monad<List>)] - [row (#+ Row row) ("row/" Monad<Row>)] + ["." list ("list/" Fold<List> Monad<List>)] + ["." row (#+ Row row) ("row/" Monad<Row>)] ["dict" dictionary (#+ Dictionary)]]] - [macro (#+ Monad<Meta> with-gensyms) + ["." macro (#+ Monad<Meta> with-gensyms) ["s" syntax (#+ syntax:)] - [code]]]) + ["." code]]]) (do-template [<name> <type>] [(type: #export <name> <type>)] diff --git a/stdlib/source/lux/data/format/xml.lux b/stdlib/source/lux/data/format/xml.lux index 6d6e93799..e58a29c96 100644 --- a/stdlib/source/lux/data/format/xml.lux +++ b/stdlib/source/lux/data/format/xml.lux @@ -7,14 +7,14 @@ ["p" parser ("parser/" Monad<Parser>)] ["ex" exception (#+ exception:)]] [data - [text ("text/" Equivalence<Text> Monoid<Text>) - ["l" lexer]] - [number] + ["." number] ["E" error] - [product] - [ident ("ident/" Equivalence<Ident> Codec<Text,Ident>)] + ["." product] + ["." ident ("ident/" Equivalence<Ident> Codec<Text,Ident>)] + ["." text ("text/" Equivalence<Text> Monoid<Text>) + ["l" lexer]] [collection - [list ("list/" Monad<List>)] + ["." list ("list/" Monad<List>)] ["d" dictionary]]]]) (type: #export Tag Ident) diff --git a/stdlib/source/lux/data/ident.lux b/stdlib/source/lux/data/ident.lux index 545b22a65..ab8f30ab6 100644 --- a/stdlib/source/lux/data/ident.lux +++ b/stdlib/source/lux/data/ident.lux @@ -4,7 +4,8 @@ [equivalence (#+ Equivalence)] [codec (#+ Codec)] hash] - [data [text ("text/" Monoid<Text> Equivalence<Text>)]]]) + [data + ["." text ("text/" Monoid<Text> Hash<Text>)]]]) ## [Types] ## (type: Ident @@ -49,5 +50,4 @@ (def: eq Equivalence<Ident>) (def: (hash [module name]) - (let [(^open) text.Hash<Text>] - (n/+ (hash module) (hash name))))) + (n/+ (text/hash module) (text/hash name)))) diff --git a/stdlib/source/lux/data/lazy.lux b/stdlib/source/lux/data/lazy.lux index df48114d8..66fac2989 100644 --- a/stdlib/source/lux/data/lazy.lux +++ b/stdlib/source/lux/data/lazy.lux @@ -1,14 +1,16 @@ (.module: [lux #* - [io] + ["." io] [control [functor (#+ Functor)] [apply (#+ Apply)] [monad (#+ Monad do)]] - [concurrency [atom]] + [concurrency + ["." atom]] [macro (#+ with-gensyms) ["s" syntax (#+ syntax:)]] - [type abstract]]) + [type + abstract]]) (abstract: #export (Lazy a) (-> [] a) diff --git a/stdlib/source/lux/data/maybe.lux b/stdlib/source/lux/data/maybe.lux index bc9d0af95..42e95d5f6 100644 --- a/stdlib/source/lux/data/maybe.lux +++ b/stdlib/source/lux/data/maybe.lux @@ -1,10 +1,10 @@ (.module: [lux #* [control - ["m" monoid] - ["F" functor] - ["A" apply] - [monad (#+ do Monad)] + [monoid (#+ Monoid)] + ["." functor (#+ Functor)] + [apply (#+ Apply)] + ["." monad (#+ do Monad)] [equivalence (#+ Equivalence)]]]) ## [Types] @@ -13,20 +13,20 @@ ## (#.Some a)) ## [Structures] -(structure: #export Monoid<Maybe> (All [a] (m.Monoid (Maybe a))) +(structure: #export Monoid<Maybe> (All [a] (Monoid (Maybe a))) (def: identity #.None) (def: (compose xs ys) (case xs #.None ys (#.Some x) (#.Some x)))) -(structure: #export _ (F.Functor Maybe) +(structure: #export _ (Functor Maybe) (def: (map f ma) (case ma #.None #.None (#.Some a) (#.Some (f a))))) -(structure: #export _ (A.Apply Maybe) +(structure: #export _ (Apply Maybe) (def: functor Functor<Maybe>) (def: (apply ff fa) @@ -63,7 +63,7 @@ (structure: #export (MaybeT Monad<M>) (All [M] (-> (Monad M) (Monad (All [a] (M (Maybe a)))))) - (def: functor (F.compose (get@ #monad.functor Monad<M>) Functor<Maybe>)) + (def: functor (functor.compose (get@ #monad.functor Monad<M>) Functor<Maybe>)) (def: wrap (|>> (:: Monad<Maybe> wrap) (:: Monad<M> wrap))) diff --git a/stdlib/source/lux/data/number.lux b/stdlib/source/lux/data/number.lux index 7f591c85c..cb71b5b07 100644 --- a/stdlib/source/lux/data/number.lux +++ b/stdlib/source/lux/data/number.lux @@ -5,16 +5,16 @@ [monoid (#+ Monoid)] [equivalence (#+ Equivalence)] hash - [order] + ["." order (#+ Order)] enum interval [codec (#+ Codec)]] [data ["e" error] - [maybe] - [text]]] + ["." maybe] + ["." text]]] [/ - [i64]]) + ["." i64]]) ## [Structures] (do-template [<type> <test>] @@ -28,7 +28,7 @@ ) (do-template [<type> <eq> <lt> <lte> <gt> <gte>] - [(structure: #export _ (order.Order <type>) + [(structure: #export _ (Order <type>) (def: eq <eq>) (def: < <lt>) (def: <= <lte>) diff --git a/stdlib/source/lux/data/number/complex.lux b/stdlib/source/lux/data/number/complex.lux index 5c9c97d46..496116755 100644 --- a/stdlib/source/lux/data/number/complex.lux +++ b/stdlib/source/lux/data/number/complex.lux @@ -1,6 +1,6 @@ (.module: {#.doc "Complex arithmetic."} [lux #* - [math] + ["." math] [control [equivalence (#+ Equivalence)] number @@ -8,12 +8,13 @@ ["M" monad (#+ do Monad)] ["p" parser]] [data - [number ("frac/" Number<Frac>)] + ["." maybe] + ["." number ("frac/" Number<Frac>)] [text ("text/" Monoid<Text>)] - [maybe] - [collection [list ("list/" Functor<List>)]]] + [collection + ["." list ("list/" Functor<List>)]]] ["." macro - [code] + ["." code] ["s" syntax (#+ syntax: Syntax)]]]) (type: #export Complex diff --git a/stdlib/source/lux/data/number/ratio.lux b/stdlib/source/lux/data/number/ratio.lux index 2aa332dc6..ffa4432a5 100644 --- a/stdlib/source/lux/data/number/ratio.lux +++ b/stdlib/source/lux/data/number/ratio.lux @@ -1,22 +1,22 @@ (.module: {#.doc "Rational arithmetic."} [lux #* - [math] [control [equivalence (#+ Equivalence)] - [order] + [order (#+ Order)] number codec monad ["p" parser]] [data - [number ("nat/" Codec<Text,Nat>)] - [text ("text/" Monoid<Text>) - format] ["E" error] - [product] - [maybe]] + ["." product] + ["." maybe] + [number ("nat/" Codec<Text,Nat>)] + ["." text ("text/" Monoid<Text>) + format]] + ["." math] ["." macro - [code] + ["." code] ["s" syntax (#+ syntax: Syntax)]]]) (type: #export Ratio @@ -105,7 +105,7 @@ (structure: #export _ (Equivalence Ratio) (def: = ..=)) -(structure: #export _ (order.Order Ratio) +(structure: #export _ (Order Ratio) (def: eq Equivalence<Ratio>) (def: < ..<) (def: <= ..<=) diff --git a/stdlib/source/lux/data/store.lux b/stdlib/source/lux/data/store.lux index c1b974840..4cacb8329 100644 --- a/stdlib/source/lux/data/store.lux +++ b/stdlib/source/lux/data/store.lux @@ -3,7 +3,8 @@ [control ["F" functor] comonad] - [type implicit]]) + [type + implicit]]) (type: #export (Store s a) {#cursor s diff --git a/stdlib/source/lux/data/text.lux b/stdlib/source/lux/data/text.lux index a5223c3e3..940349f05 100644 --- a/stdlib/source/lux/data/text.lux +++ b/stdlib/source/lux/data/text.lux @@ -3,18 +3,18 @@ [control [monoid (#+ Monoid)] [equivalence (#+ Equivalence)] - [order] + [order (#+ Order)] [monad (#+ do Monad)] [codec (#+ Codec)] hash] [data - [maybe] + ["." maybe] [number - [i64]] + ["." i64]] [collection - [list ("list/" Fold<List>)]]] + ["." list ("list/" Fold<List>)]]] [language - [host]]]) + ["." host]]]) (def: #export (size x) (-> Text Nat) @@ -144,7 +144,7 @@ (def: (= test subject) ("lux text =" subject test))) -(structure: #export _ (order.Order Text) +(structure: #export _ (Order Text) (def: eq Equivalence<Text>) (def: (< test subject) diff --git a/stdlib/source/lux/data/text/buffer.lux b/stdlib/source/lux/data/text/buffer.lux index 33708932e..a27015f7e 100644 --- a/stdlib/source/lux/data/text/buffer.lux +++ b/stdlib/source/lux/data/text/buffer.lux @@ -1,15 +1,17 @@ (.module: [lux #* [data - [product] - [text format] - [collection [row (#+ Row) ("row/" Fold<Row>)]]] + ["." product] + [text + format] + [collection + ["." row (#+ Row) ("row/" Fold<Row>)]]] [language ["_" host]] [type abstract] [host (#+ import:)]] - [//]) + ["." //]) (`` (for {(~~ (static _.jvm)) (as-is (import: java/lang/CharSequence) diff --git a/stdlib/source/lux/data/text/encoding.lux b/stdlib/source/lux/data/text/encoding.lux index 2ea8e4a76..d5246e382 100644 --- a/stdlib/source/lux/data/text/encoding.lux +++ b/stdlib/source/lux/data/text/encoding.lux @@ -1,8 +1,11 @@ (.module: [lux #* - [data [error (#+ Error)]] - [world [blob (#+ Blob)]] - [language ["_" host]] + [data + ["." error (#+ Error)]] + [world + [blob (#+ Blob)]] + [language + ["_" host]] [host (#+ import:)]]) (`` (for {(~~ (static _.jvm)) diff --git a/stdlib/source/lux/data/text/format.lux b/stdlib/source/lux/data/text/format.lux index 4b9717fab..af2b8beab 100644 --- a/stdlib/source/lux/data/text/format.lux +++ b/stdlib/source/lux/data/text/format.lux @@ -4,24 +4,26 @@ [monad (#+ do Monad)] ["p" parser]] [data - [bit] - [number] - [text] - [ident] - [collection [list ("list/" Monad<List>)]] + ["." bit] + ["." ident] + ["." number] + ["." text] [format - [xml] - [json]]] + ["." xml] + ["." json]] + [collection + [list ("list/" Monad<List>)]]] [time - [instant] - [duration] - [date]] - [math [modular]] + ["." instant] + ["." duration] + ["." date]] + [math + ["." modular]] ["." macro - [code] + ["." code] ["s" syntax (#+ syntax: Syntax)]] - [language [type]] - ]) + [language + ["." type]]]) ## [Syntax] (syntax: #export (format {fragments (p.many s.any)}) diff --git a/stdlib/source/lux/data/text/lexer.lux b/stdlib/source/lux/data/text/lexer.lux index 3ece75c23..83e732471 100644 --- a/stdlib/source/lux/data/text/lexer.lux +++ b/stdlib/source/lux/data/text/lexer.lux @@ -4,12 +4,14 @@ [monad (#+ do Monad)] ["p" parser]] [data - [text ("text/" Monoid<Text>)] - [product] - [maybe] + ["." text ("text/" Monoid<Text>)] + ["." product] + ["." maybe] ["e" error] - [collection [list]]] - [macro [code]]]) + [collection + ["." list]]] + [macro + ["." code]]]) (type: Offset Nat) diff --git a/stdlib/source/lux/data/text/regex.lux b/stdlib/source/lux/data/text/regex.lux index 94012c086..c7cba31c8 100644 --- a/stdlib/source/lux/data/text/regex.lux +++ b/stdlib/source/lux/data/text/regex.lux @@ -4,16 +4,17 @@ monad ["p" parser ("parser/" Monad<Parser>)]] [data - [number ("int/" Codec<Text,Int>)] - [product] + ["." product] ["e" error] - [maybe] + ["." maybe] + ["." number ("int/" Codec<Text,Int>)] ["." text ["l" lexer] format] - [collection [list ("list/" Fold<List> Monad<List>)]]] - [macro (#+ with-gensyms) - [code] + [collection + ["." list ("list/" Fold<List> Monad<List>)]]] + ["." macro (#+ with-gensyms) + ["." code] ["s" syntax (#+ syntax:)]]]) ## [Utils] @@ -289,7 +290,7 @@ #.None [(inc idx) (code.symbol ["" (int/encode idx)])]) access (if (n/> +0 num-captures) - (` (product.left (~ name!))) + (` ((~! product.left) (~ name!))) name!)] [idx! (list& name! names) diff --git a/stdlib/source/lux/data/text/unicode.lux b/stdlib/source/lux/data/text/unicode.lux index 11c69be84..a865fea1d 100644 --- a/stdlib/source/lux/data/text/unicode.lux +++ b/stdlib/source/lux/data/text/unicode.lux @@ -1,14 +1,16 @@ (.module: [lux #* [control - [interval (#+ Interval)] + ["." interval (#+ Interval)] [monoid (#+ Monoid)]] [data - [number (#+ hex) ("nat/" Interval<Nat>)] + ["." number (#+ hex) ("nat/" Interval<Nat>)] [collection - [list] - [tree [finger (#+ Tree)]]]] - [type abstract]]) + ["." list] + [tree + ["." finger (#+ Tree)]]]] + [type + abstract]]) (type: #export Char Nat) diff --git a/stdlib/source/lux/data/trace.lux b/stdlib/source/lux/data/trace.lux index a0c366199..36d5acdf0 100644 --- a/stdlib/source/lux/data/trace.lux +++ b/stdlib/source/lux/data/trace.lux @@ -1,7 +1,7 @@ (.module: [lux #* [control - [monoid (#+ Monoid)] + ["." monoid (#+ Monoid)] [functor (#+ Functor)] comonad] function]) diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index 118ae5a1f..acccabc77 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -1,23 +1,26 @@ (.module: [lux (#- type) [control - [monad (#+ do Monad)] - [enum] + ["." monad (#+ do Monad)] + ["." enum] ["p" parser]] - [io (#+ IO Monad<IO> io)] + ["." io] function [data - [collection [list ("list/" Monad<List> Fold<List> Monoid<List>)]] + ["." maybe] + ["." product] + ["." error (#+ Error)] + [bit ("bit/" Codec<Text,Bit>)] number - [maybe] - [product] - [text ("text/" Equivalence<Text> Monoid<Text>) + ["." text ("text/" Equivalence<Text> Monoid<Text>) format] - [bit ("bit/" Codec<Text,Bit>)]] - [macro (#+ with-gensyms Functor<Meta> Monad<Meta>) - [code] + [collection + ["." list ("list/" Monad<List> Fold<List> Monoid<List>)]]] + ["." macro (#+ with-gensyms Functor<Meta> Monad<Meta>) + ["." code] ["s" syntax (#+ syntax: Syntax)]] - [language [type ("type/" Equivalence<Type>)]] + [language + ["." type ("type/" Equivalence<Type>)]] ]) (do-template [<name> <op> <from> <to>] @@ -1583,8 +1586,8 @@ _ [return-type return-term]))] - [decorate-return-try #import-member-try? (` (Either Text (~ return-type))) (` (try (~ return-term)))] - [decorate-return-io #import-member-io? (` (IO (~ return-type))) (` (io (~ return-term)))] + [decorate-return-try #import-member-try? (` ((~! error.Error) (~ return-type))) (` (try (~ return-term)))] + [decorate-return-io #import-member-io? (` ((~! io.IO) (~ return-type))) (` ((~! io.io) (~ return-term)))] ) (def: (free-type-param? [name bounds]) @@ -1785,7 +1788,7 @@ getter-name (` ((~ getter-name) (~ g!obj)))) getter-type (if import-field-setter? - (` (IO (~ typeC))) + (` ((~! io.IO) (~ typeC))) typeC) getter-type (if import-field-static? getter-type @@ -1800,7 +1803,7 @@ (` (??? (~ getter-body))) getter-body) getter-body (if import-field-setter? - (` (io (~ getter-body))) + (` ((~! io.io) (~ getter-body))) getter-body)] (wrap (` (def: (~ getter-call) (~ getter-type) @@ -1811,8 +1814,8 @@ (` ((~ setter-name) (~ g!value))) (` ((~ setter-name) (~ g!value) (~ g!obj)))) setter-type (if import-field-static? - (` (All [(~+ tvar-asts)] (-> (~ typeC) (IO Any)))) - (` (All [(~+ tvar-asts)] (-> (~ typeC) (~ classC) (IO Any))))) + (` (All [(~+ tvar-asts)] (-> (~ typeC) ((~! io.IO) Any)))) + (` (All [(~+ tvar-asts)] (-> (~ typeC) (~ classC) ((~! io.IO) Any))))) setter-value (with-mode-field-set import-field-mode import-field-type g!value) setter-value (if import-field-maybe? (` (!!! (~ setter-value))) @@ -1822,7 +1825,7 @@ (wrap (: (List Code) (list (` (def: (~ setter-call) (~ setter-type) - (io ((~ (code.text setter-command)) (~ setter-value)))))))))) + ((~! io.io) ((~ (code.text setter-command)) (~ setter-value)))))))))) (wrap (list)))] (wrap (list& getter-interop setter-interop))) ))) @@ -1842,7 +1845,7 @@ ("jvm invokevirtual:java.lang.Class:isInterface:" class)) (def: (load-class class-name) - (-> Text (Either Text (primitive "java.lang.Class" [Any]))) + (-> Text (Error (primitive "java.lang.Class" [Any]))) (try ("jvm invokestatic:java.lang.Class:forName:java.lang.String" class-name))) (def: (class-kind [class-name _]) @@ -2033,7 +2036,7 @@ "Afterwards, closes all resources (assumed to be subclasses of java.io.Closeable), and returns the value resulting from running the body." (with-open [my-res1 (res1-constructor ___) my-res2 (res1-constructor ___)] - (do Monad<IO> + (do io.Monad<IO> [foo (do-something my-res1) bar (do-something-else my-res2)] (do-one-last-thing foo bar))))} @@ -2044,7 +2047,7 @@ closes (list/map (function (_ res) (` (try ("jvm invokevirtual:java.io.Closeable:close:" (~ (code.symbol ["" (product.left res)])))))) bindings)] - (wrap (list (` (do Monad<IO> + (wrap (list (` (do (~! io.Monad<IO>) [(~+ inits) (~ g!output) (~ body) (~' #let) [(~ g!_) (exec (~+ (list.reverse closes)) [])]] diff --git a/stdlib/source/lux/language/compiler.lux b/stdlib/source/lux/language/compiler.lux index e714773b7..03dd30e2a 100644 --- a/stdlib/source/lux/language/compiler.lux +++ b/stdlib/source/lux/language/compiler.lux @@ -1,15 +1,16 @@ (.module: [lux #* [control - [state] + ["." state] ["ex" exception (#+ Exception exception:)] [monad (#+ do)]] [data - [product] - [error (#+ Error)] + ["." product] + ["." error (#+ Error)] ["." text format]] - [macro ["s" syntax (#+ syntax:)]]]) + [macro + ["s" syntax (#+ syntax:)]]]) (type: #export (Operation s o) (state.State' Error s o)) diff --git a/stdlib/source/lux/language/compiler/analysis.lux b/stdlib/source/lux/language/compiler/analysis.lux index a2686d6bf..3c4a646fe 100644 --- a/stdlib/source/lux/language/compiler/analysis.lux +++ b/stdlib/source/lux/language/compiler/analysis.lux @@ -1,15 +1,16 @@ (.module: [lux (#- nat int rev) [data - [product] - [error] + ["." product] + ["." error] [text ("text/" Equivalence<Text>)] - [collection [list ("list/" Fold<List>)]]] - [function]] + [collection + ["." list ("list/" Fold<List>)]]] + ["." function]] [// - [extension (#+ Extension)] + ["." extension (#+ Extension)] [// - [reference (#+ Register Variable Reference)]]]) + ["." reference (#+ Register Variable Reference)]]]) (type: #export #rec Primitive #Unit diff --git a/stdlib/source/lux/language/compiler/analysis/case.lux b/stdlib/source/lux/language/compiler/analysis/case.lux index 2f5162fbd..34a2b38d6 100644 --- a/stdlib/source/lux/language/compiler/analysis/case.lux +++ b/stdlib/source/lux/language/compiler/analysis/case.lux @@ -1,28 +1,29 @@ (.module: [lux (#- case) [control - [monad (#+ do)] + ["." monad (#+ do)] ["ex" exception (#+ exception:)]] [data - [product] - [error] - [maybe] + ["." product] + ["." error] + ["." maybe] [text format] - [collection [list ("list/" Fold<List> Monoid<List> Functor<List>)]]] + [collection + ["." list ("list/" Fold<List> Monoid<List> Functor<List>)]]] ["." macro - [code]]] - [// (#+ Pattern Analysis Operation Compiler) - [scope] + ["." code]]] + ["." // (#+ Pattern Analysis Operation Compiler) + ["." scope] ["//." type] - [structure] + ["." structure] ["/." // - [extension] + ["." extension] [// ["." type ["tc" check]]]]] [/ - [coverage]]) + ["." coverage]]) (exception: #export (cannot-match-type-with-pattern {type Type} {pattern Code}) (ex.report ["Type" (%type type)] diff --git a/stdlib/source/lux/language/compiler/analysis/case/coverage.lux b/stdlib/source/lux/language/compiler/analysis/case/coverage.lux index c19003df6..5c3ff1d72 100644 --- a/stdlib/source/lux/language/compiler/analysis/case/coverage.lux +++ b/stdlib/source/lux/language/compiler/analysis/case/coverage.lux @@ -1,20 +1,21 @@ (.module: [lux #* [control - [monad (#+ do)] + ["." monad (#+ do)] ["ex" exception (#+ exception:)] equivalence] [data [bit ("bit/" Equivalence<Bit>)] - [number] + ["." number] ["e" error ("error/" Monad<Error>)] - [maybe] - [text format] + ["." maybe] + [text + format] [collection - [list ("list/" Fold<List>)] + ["." list ("list/" Fold<List>)] ["dict" dictionary (#+ Dictionary)]]]] - [//// ("operation/" Monad<Operation>)] - [/// (#+ Pattern Variant Operation)]) + ["." //// ("operation/" Monad<Operation>)] + ["." /// (#+ Pattern Variant Operation)]) (def: cases (-> (Maybe Nat) Nat) @@ -174,7 +175,7 @@ _ #0))) -(open: "C/" Equivalence<Coverage>) +(open: "coverage/" Equivalence<Coverage>) ## After determining the coverage of each individual pattern, it is ## necessary to merge them all to figure out if the entire @@ -226,7 +227,7 @@ (#Variant allSF casesM))))) [(#Seq leftA rightA) (#Seq leftSF rightSF)] - (case [(C/= leftSF leftA) (C/= rightSF rightA)] + (case [(coverage/= leftSF leftA) (coverage/= rightSF rightA)] ## There is nothing the addition adds to the coverage. [#1 #1] redundant-pattern @@ -254,12 +255,12 @@ ## The left part will always match, so the addition is redundant. (^multi [(#Seq left right) single] - (C/= left single)) + (coverage/= left single)) redundant-pattern ## The right part is not necessary, since it can always match the left. (^multi [single (#Seq left right)] - (C/= left single)) + (coverage/= left single)) (error/wrap single) ## When merging a new coverage against one based on Alt, it may be @@ -317,7 +318,7 @@ (undefined))))) _ - (if (C/= so-far addition) + (if (coverage/= so-far addition) ## The addition cannot possibly improve the coverage. redundant-pattern ## There are now 2 alternative paths. diff --git a/stdlib/source/lux/language/compiler/analysis/expression.lux b/stdlib/source/lux/language/compiler/analysis/expression.lux index f413b8077..1c74499ad 100644 --- a/stdlib/source/lux/language/compiler/analysis/expression.lux +++ b/stdlib/source/lux/language/compiler/analysis/expression.lux @@ -5,20 +5,19 @@ ["ex" exception (#+ exception:)]] [data ["e" error] - [product] [text format]] - [macro]] - ["." /// - [extension]] - [// (#+ Analysis Operation Compiler) - [type] - [primitive] - [structure] - [reference] - ["/." /// (#+ Eval) - ## [".L" macro] - ]]) + ["." macro]] + ["." // (#+ Analysis Operation Compiler) + ["." type] + ["." primitive] + ["." structure] + ["." reference] + ["/." // + ["." extension] + ["//." // (#+ Eval) + ## [".L" macro] + ]]]) (exception: #export (macro-expansion-failed {message Text}) message) diff --git a/stdlib/source/lux/language/compiler/analysis/function.lux b/stdlib/source/lux/language/compiler/analysis/function.lux index 51f1892de..440c49237 100644 --- a/stdlib/source/lux/language/compiler/analysis/function.lux +++ b/stdlib/source/lux/language/compiler/analysis/function.lux @@ -4,21 +4,21 @@ monad ["ex" exception (#+ exception:)]] [data - [maybe] + ["." maybe] ["." text format] - [collection [list ("list/" Fold<List> Monoid<List> Monad<List>)]]] - ["." macro - [code]] + [collection + ["." list ("list/" Fold<List> Monoid<List> Monad<List>)]]] + ["." macro] [language ["." type ["tc" check]]]] - [// (#+ Analysis Operation Compiler) - [scope] + ["." // (#+ Analysis Operation Compiler) + ["." scope] ["//." type] - [inference] + ["." inference] ["/." // - [extension]]]) + ["." extension]]]) (exception: #export (cannot-analyse {expected Type} {function Text} {argument Text} {body Code}) (ex.report ["Type" (%type expected)] diff --git a/stdlib/source/lux/language/compiler/analysis/inference.lux b/stdlib/source/lux/language/compiler/analysis/inference.lux index 403ad0092..29084ce40 100644 --- a/stdlib/source/lux/language/compiler/analysis/inference.lux +++ b/stdlib/source/lux/language/compiler/analysis/inference.lux @@ -4,18 +4,19 @@ [monad (#+ do)] ["ex" exception (#+ exception:)]] [data - [maybe] + ["." maybe] ["." text format] - [collection [list ("list/" Functor<List>)]]] - [macro]] + [collection + ["." list ("list/" Functor<List>)]]] + ["." macro]] [//// ["." type ["tc" check]]] - [/// ("operation/" Monad<Operation>) - [extension]] + ["." /// ("operation/" Monad<Operation>) + ["." extension]] [// (#+ Tag Analysis Operation Compiler)] - [//type]) + ["." //type]) (exception: #export (variant-tag-out-of-bounds {size Nat} {tag Tag} {type Type}) (ex.report ["Tag" (%n tag)] diff --git a/stdlib/source/lux/language/compiler/analysis/module.lux b/stdlib/source/lux/language/compiler/analysis/module.lux index 1ac2b4ac4..7c21724bb 100644 --- a/stdlib/source/lux/language/compiler/analysis/module.lux +++ b/stdlib/source/lux/language/compiler/analysis/module.lux @@ -1,21 +1,21 @@ (.module: [lux #* [control - [monad (#+ do)] + ["." monad (#+ do)] ["ex" exception (#+ exception:)] pipe] [data - [text ("text/" Equivalence<Text>) + ["." text ("text/" Equivalence<Text>) format] - ["e" error] + ["." error] [collection - [list ("list/" Fold<List> Functor<List>)] + ["." list ("list/" Fold<List> Functor<List>)] [dictionary - [plist]]]] - [macro]] - [// (#+ Operation) + ["." plist]]]] + ["." macro]] + ["." // (#+ Operation) ["/." // - [extension]]]) + ["." extension]]]) (type: #export Tag Text) @@ -70,10 +70,10 @@ #.None (extension.lift (function (_ state) - (#e.Success [(update@ #.modules - (plist.put self-name (set@ #.module-annotations (#.Some annotations) self)) - state) - []]))) + (#error.Success [(update@ #.modules + (plist.put self-name (set@ #.module-annotations (#.Some annotations) self)) + state) + []]))) (#.Some old) (///.throw cannot-set-module-annotations-more-than-once [self-name old annotations])))) @@ -84,10 +84,10 @@ [self-name (extension.lift macro.current-module-name)] (extension.lift (function (_ state) - (#e.Success [(update@ #.modules - (plist.update self-name (update@ #.imports (|>> (#.Cons module)))) - state) - []]))))) + (#error.Success [(update@ #.modules + (plist.update self-name (update@ #.imports (|>> (#.Cons module)))) + state) + []]))))) (def: #export (alias alias module) (-> Text Text (Operation Any)) @@ -95,11 +95,11 @@ [self-name (extension.lift macro.current-module-name)] (extension.lift (function (_ state) - (#e.Success [(update@ #.modules - (plist.update self-name (update@ #.module-aliases (: (-> (List [Text Text]) (List [Text Text])) - (|>> (#.Cons [alias module]))))) - state) - []]))))) + (#error.Success [(update@ #.modules + (plist.update self-name (update@ #.module-aliases (: (-> (List [Text Text]) (List [Text Text])) + (|>> (#.Cons [alias module]))))) + state) + []]))))) (def: #export (exists? module) (-> Text (Operation Bit)) @@ -109,7 +109,7 @@ (get@ #.modules) (plist.get module) (case> (#.Some _) #1 #.None #0) - [state] #e.Success)))) + [state] #error.Success)))) (def: #export (define name definition) (-> Text Definition (Operation [])) @@ -120,14 +120,14 @@ (function (_ state) (case (plist.get name (get@ #.definitions self)) #.None - (#e.Success [(update@ #.modules - (plist.put self-name - (update@ #.definitions - (: (-> (List [Text Definition]) (List [Text Definition])) - (|>> (#.Cons [name definition]))) - self)) - state) - []]) + (#error.Success [(update@ #.modules + (plist.put self-name + (update@ #.definitions + (: (-> (List [Text Definition]) (List [Text Definition])) + (|>> (#.Cons [name definition]))) + self)) + state) + []]) (#.Some already-existing) ((///.throw cannot-define-more-than-once [self-name name]) state)))))) @@ -137,10 +137,10 @@ (extension.lift (function (_ state) (let [module (new hash)] - (#e.Success [(update@ #.modules - (plist.put name module) - state) - []]))))) + (#error.Success [(update@ #.modules + (plist.put name module) + state) + []]))))) (def: #export (with-module hash name action) (All [a] (-> Nat Text (Operation a) (Operation [Module a]))) @@ -162,10 +162,10 @@ #.Active #1 _ #0)] (if active? - (#e.Success [(update@ #.modules - (plist.put module-name (set@ #.module-state <tag> module)) - state) - []]) + (#error.Success [(update@ #.modules + (plist.put module-name (set@ #.module-state <tag> module)) + state) + []]) ((///.throw can-only-change-state-of-active-module [module-name <tag>]) state))) @@ -178,10 +178,10 @@ (function (_ state) (case (|> state (get@ #.modules) (plist.get module-name)) (#.Some module) - (#e.Success [state - (case (get@ #.module-state module) - <tag> #1 - _ #0)]) + (#error.Success [state + (case (get@ #.module-state module) + <tag> #1 + _ #0)]) #.None ((///.throw unknown-module module-name) state)))))] @@ -198,7 +198,7 @@ (function (_ state) (case (|> state (get@ #.modules) (plist.get module-name)) (#.Some module) - (#e.Success [state (get@ <tag> module)]) + (#error.Success [state (get@ <tag> module)]) #.None ((///.throw unknown-module module-name) state)))))] @@ -241,15 +241,15 @@ (case (|> state (get@ #.modules) (plist.get self-name)) (#.Some module) (let [namespaced-tags (list/map (|>> [self-name]) tags)] - (#e.Success [(update@ #.modules - (plist.update self-name - (|>> (update@ #.tags (function (_ tag-bindings) - (list/fold (function (_ [idx tag] table) - (plist.put tag [idx namespaced-tags exported? type] table)) - tag-bindings - (list.enumerate tags)))) - (update@ #.types (plist.put type-name [namespaced-tags exported? type])))) - state) - []])) + (#error.Success [(update@ #.modules + (plist.update self-name + (|>> (update@ #.tags (function (_ tag-bindings) + (list/fold (function (_ [idx tag] table) + (plist.put tag [idx namespaced-tags exported? type] table)) + tag-bindings + (list.enumerate tags)))) + (update@ #.types (plist.put type-name [namespaced-tags exported? type])))) + state) + []])) #.None ((///.throw unknown-module self-name) state)))))) diff --git a/stdlib/source/lux/language/compiler/analysis/primitive.lux b/stdlib/source/lux/language/compiler/analysis/primitive.lux index 346906909..bd42825d3 100644 --- a/stdlib/source/lux/language/compiler/analysis/primitive.lux +++ b/stdlib/source/lux/language/compiler/analysis/primitive.lux @@ -1,8 +1,8 @@ (.module: [lux (#- nat int rev) - [control monad] - [macro]] - [// (#+ Analysis Operation) + [control + monad]] + ["." // (#+ Analysis Operation) [".A" type] ["/." //]]) diff --git a/stdlib/source/lux/language/compiler/analysis/reference.lux b/stdlib/source/lux/language/compiler/analysis/reference.lux index af134ebe3..5949c0036 100644 --- a/stdlib/source/lux/language/compiler/analysis/reference.lux +++ b/stdlib/source/lux/language/compiler/analysis/reference.lux @@ -3,21 +3,20 @@ [control monad ["ex" exception (#+ exception:)]] - ["." macro - [code]] + ["." macro] [language [type ["tc" check]]] [data [text ("text/" Equivalence<Text>) format]]] - [// (#+ Analysis Operation) - [scope] - [type] + ["." // (#+ Analysis Operation) + ["." scope] + ["." type] ["/." // - [extension] + ["." extension] [// - [reference]]]]) + ["." reference]]]]) (exception: #export (foreign-module-has-not-been-imported {current Text} {foreign Text}) (ex.report ["Current" current] diff --git a/stdlib/source/lux/language/compiler/analysis/scope.lux b/stdlib/source/lux/language/compiler/analysis/scope.lux index 3ee0499e8..a10ed6e58 100644 --- a/stdlib/source/lux/language/compiler/analysis/scope.lux +++ b/stdlib/source/lux/language/compiler/analysis/scope.lux @@ -5,17 +5,18 @@ [data [text ("text/" Equivalence<Text>) format] - [maybe ("maybe/" Monad<Maybe>)] - [product] + ["." maybe ("maybe/" Monad<Maybe>)] + ["." product] ["e" error] [collection - [list ("list/" Functor<List> Fold<List> Monoid<List>)] - [dictionary [plist]]]]] + ["." list ("list/" Functor<List> Fold<List> Monoid<List>)] + [dictionary + ["." plist]]]]] [// (#+ Operation Compiler) - ["compiler" // - [extension] + ["/." // + ["." extension] [// - [reference (#+ Register Variable)]]]]) + ["." reference (#+ Register Variable)]]]]) (type: Local (Bindings Text [Type Register])) (type: Foreign (Bindings Text [Type Variable])) @@ -109,8 +110,8 @@ (|>> (update@ #.counter inc) (update@ #.mappings (plist.put name [type new-var-id])))) head)] - (case (compiler.run' [bundle (set@ #.scopes (#.Cons new-head tail) state)] - action) + (case (///.run' [bundle (set@ #.scopes (#.Cons new-head tail) state)] + action) (#e.Success [[bundle' state'] output]) (case (get@ #.scopes state') (#.Cons head' tail') diff --git a/stdlib/source/lux/language/compiler/analysis/structure.lux b/stdlib/source/lux/language/compiler/analysis/structure.lux index 382eab486..d3ce95cdd 100644 --- a/stdlib/source/lux/language/compiler/analysis/structure.lux +++ b/stdlib/source/lux/language/compiler/analysis/structure.lux @@ -1,24 +1,26 @@ (.module: [lux #* [control - [monad (#+ do)] + ["." monad (#+ do)] ["ex" exception (#+ exception:)]] [data - [ident] - [number] - [product] - [maybe] - [text format] - [collection [list ("list/" Functor<List>)] + ["." ident] + ["." number] + ["." product] + ["." maybe] + [text + format] + [collection + ["." list ("list/" Functor<List>)] ["dict" dictionary (#+ Dictionary)]]] ["." macro - [code]]] - [// (#+ Tag Analysis Operation Compiler) + ["." code]]] + ["." // (#+ Tag Analysis Operation Compiler) ["//." type] - [primitive] - [inference] + ["." primitive] + ["." inference] ["/." // - [extension] + ["." extension] ["//." // ["." type ["tc" check]]]]]) diff --git a/stdlib/source/lux/language/compiler/analysis/type.lux b/stdlib/source/lux/language/compiler/analysis/type.lux index f87a96758..8bc0bd53b 100644 --- a/stdlib/source/lux/language/compiler/analysis/type.lux +++ b/stdlib/source/lux/language/compiler/analysis/type.lux @@ -3,14 +3,15 @@ [control [monad (#+ do)]] [data - [error]] - [function] - [macro] + ["." error]] + ["." function] + ["." macro] [language - [type ["tc" check]]]] + [type + ["tc" check]]]] [// (#+ Operation) ["/." // - [extension]]]) + ["." extension]]]) (def: #export (with-type expected) (All [a] (-> Type (Operation a) (Operation a))) diff --git a/stdlib/source/lux/language/compiler/default/cache.lux b/stdlib/source/lux/language/compiler/default/cache.lux index f41cd0792..f82469cd7 100644 --- a/stdlib/source/lux/language/compiler/default/cache.lux +++ b/stdlib/source/lux/language/compiler/default/cache.lux @@ -1,33 +1,35 @@ (.module: [lux #* - [data [format [binary (#+ Binary)]]]]) + [data + [format + ["_" binary (#+ Binary)]]]]) (def: definition (Binary Definition) - ($_ binary.seq binary.type binary.code binary.any)) + ($_ _.seq _.type _.code _.any)) (def: alias (Binary [Text Text]) - (binary.seq binary.text binary.text)) + (_.seq _.text _.text)) ## TODO: Remove #module-hash, #imports & #module-state ASAP. ## TODO: Not just from this parser, but from the lux.Module type. (def: #export module (Binary Module) - ($_ binary.seq + ($_ _.seq ## #module-hash - (binary.ignore +0) + (_.ignore +0) ## #module-aliases - (binary.list ..alias) + (_.list ..alias) ## #definitions - (binary.list (binary.seq binary.text ..definition)) + (_.list (_.seq _.text ..definition)) ## #imports - (binary.list binary.text) + (_.list _.text) ## #tags - (binary.ignore (list)) + (_.ignore (list)) ## #types - (binary.ignore (list)) + (_.ignore (list)) ## #module-annotations - (binary.maybe binary.code) + (_.maybe _.code) ## #module-state - (binary.ignore #.Cached))) + (_.ignore #.Cached))) diff --git a/stdlib/source/lux/language/compiler/default/repl/type.lux b/stdlib/source/lux/language/compiler/default/repl/type.lux index c9b68c06e..4b2b8dc02 100644 --- a/stdlib/source/lux/language/compiler/default/repl/type.lux +++ b/stdlib/source/lux/language/compiler/default/repl/type.lux @@ -6,22 +6,24 @@ ["p" parser] pipe] [data - [error (#+ Error)] + ["." error (#+ Error)] [text format] [format [xml (#+ XML)] [json (#+ JSON)]] - [collection [list]]] + [collection + ["." list]]] [time [instant (#+ Instant)] [duration (#+ Duration)] [date (#+ Date)]] - [function] + ["." function] ["." macro - [code] - [poly (#+ Poly)]] - [language [type]]]) + ["." code] + ["." poly (#+ Poly)]] + [language + ["." type]]]) (exception: #export (cannot-represent-value {type Type}) (ex.report ["Type" (%type type)])) diff --git a/stdlib/source/lux/language/compiler/extension.lux b/stdlib/source/lux/language/compiler/extension.lux index fc41aa30d..10d2d62ca 100644 --- a/stdlib/source/lux/language/compiler/extension.lux +++ b/stdlib/source/lux/language/compiler/extension.lux @@ -4,11 +4,12 @@ [monad (#+ do)] ["ex" exception (#+ exception:)]] [data - [error (#+ Error)] - [text] - [collection ["dict" dictionary (#+ Dictionary)]]] - [function]] - [//]) + ["." error (#+ Error)] + ["." text] + [collection + ["dict" dictionary (#+ Dictionary)]]] + ["." function]] + ["." //]) (type: #export (Extension i) [Text (List i)]) diff --git a/stdlib/source/lux/language/compiler/extension/analysis.lux b/stdlib/source/lux/language/compiler/extension/analysis.lux index 0f57de1ff..4d78ceb43 100644 --- a/stdlib/source/lux/language/compiler/extension/analysis.lux +++ b/stdlib/source/lux/language/compiler/extension/analysis.lux @@ -2,12 +2,12 @@ [lux #* [data [collection - [dictionary]]]] + ["." dictionary]]]] [/// [analysis (#+ Bundle)]] [/ - [common] - [host]]) + ["." common] + ["." host]]) (def: #export bundle Bundle diff --git a/stdlib/source/lux/language/compiler/extension/analysis/common.lux b/stdlib/source/lux/language/compiler/extension/analysis/common.lux index 9616f2533..0dc405438 100644 --- a/stdlib/source/lux/language/compiler/extension/analysis/common.lux +++ b/stdlib/source/lux/language/compiler/extension/analysis/common.lux @@ -1,31 +1,32 @@ (.module: [lux #* [control - [monad (#+ do)] + ["." monad (#+ do)] ["ex" exception (#+ exception:)] [thread (#+ Box)]] - [concurrency [atom (#+ Atom)]] + [concurrency + [atom (#+ Atom)]] [data ["." text format] [collection - [list ("list/" Functor<List>)] - [array] + ["." list ("list/" Functor<List>)] + ["." array] ["dict" dictionary (#+ Dictionary)]]] ["." language [type ["tc" check]]] [io (#+ IO)]] ["." //// - [analysis (#+ Analysis Bundle) + ["." analysis (#+ Analysis Handler Bundle) [".A" type] [".A" case] [".A" function]]] ["." /// - [bundle]]) + ["." bundle]]) ## [Utils] (def: (simple inputsT+ outputT) - (-> (List Type) Type analysis.Handler) + (-> (List Type) Type Handler) (let [num-expected (list.size inputsT+)] (function (_ extension-name analyse args) (let [num-actual (list.size args)] @@ -41,25 +42,25 @@ (////.throw bundle.incorrect-arity [extension-name num-expected num-actual])))))) (def: #export (nullary valueT) - (-> Type analysis.Handler) + (-> Type Handler) (simple (list) valueT)) (def: #export (unary inputT outputT) - (-> Type Type analysis.Handler) + (-> Type Type Handler) (simple (list inputT) outputT)) (def: #export (binary subjectT paramT outputT) - (-> Type Type Type analysis.Handler) + (-> Type Type Type Handler) (simple (list subjectT paramT) outputT)) (def: #export (trinary subjectT param0T param1T outputT) - (-> Type Type Type Type analysis.Handler) + (-> Type Type Type Type Handler) (simple (list subjectT param0T param1T) outputT)) ## [Analysers] ## "lux is" represents reference/pointer equality. (def: lux::is - analysis.Handler + Handler (function (_ extension-name analyse args) (do ////.Monad<Operation> [[var-id varT] (typeA.with-env tc.var)] @@ -69,7 +70,7 @@ ## "lux try" provides a simple way to interact with the host platform's ## error-handling facilities. (def: lux::try - analysis.Handler + Handler (function (_ extension-name analyse args) (case args (^ (list opC)) @@ -84,7 +85,7 @@ (////.throw bundle.incorrect-arity [extension-name +1 (list.size args)])))) (def: lux::in-module - analysis.Handler + Handler (function (_ extension-name analyse argsC+) (case argsC+ (^ (list [_ (#.Text module-name)] exprC)) @@ -96,7 +97,7 @@ ## (do-template [<name> <type>] ## [(def: <name> -## analysis.Handler +## Handler ## (function (_ extension-name analyse args) ## (case args ## (^ (list typeC valueC)) @@ -114,7 +115,7 @@ ## ) (def: lux::check::type - analysis.Handler + Handler (function (_ extension-name analyse args) (case args (^ (list valueC)) @@ -205,7 +206,7 @@ ))) (def: array::get - analysis.Handler + Handler (function (_ extension-name analyse args) (do ////.Monad<Operation> [[var-id varT] (typeA.with-env tc.var)] @@ -213,7 +214,7 @@ analyse args)))) (def: array::put - analysis.Handler + Handler (function (_ extension-name analyse args) (do ////.Monad<Operation> [[var-id varT] (typeA.with-env tc.var)] @@ -221,7 +222,7 @@ analyse args)))) (def: array::remove - analysis.Handler + Handler (function (_ extension-name analyse args) (do ////.Monad<Operation> [[var-id varT] (typeA.with-env tc.var)] @@ -262,7 +263,7 @@ ))) (def: atom::new - analysis.Handler + Handler (function (_ extension-name analyse args) (case args (^ (list initC)) @@ -277,7 +278,7 @@ (////.throw bundle.incorrect-arity [extension-name +1 (list.size args)])))) (def: atom::read - analysis.Handler + Handler (function (_ extension-name analyse args) (do ////.Monad<Operation> [[var-id varT] (typeA.with-env tc.var)] @@ -285,7 +286,7 @@ analyse args)))) (def: atom::compare-and-swap - analysis.Handler + Handler (function (_ extension-name analyse args) (do ////.Monad<Operation> [[var-id varT] (typeA.with-env tc.var)] @@ -302,7 +303,7 @@ ))) (def: box::new - analysis.Handler + Handler (function (_ extension-name analyse args) (case args (^ (list initC)) @@ -317,7 +318,7 @@ (////.throw bundle.incorrect-arity [extension-name +1 (list.size args)])))) (def: box::read - analysis.Handler + Handler (function (_ extension-name analyse args) (do ////.Monad<Operation> [[thread-id threadT] (typeA.with-env tc.var) @@ -326,7 +327,7 @@ analyse args)))) (def: box::write - analysis.Handler + Handler (function (_ extension-name analyse args) (do ////.Monad<Operation> [[thread-id threadT] (typeA.with-env tc.var) diff --git a/stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux b/stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux index da4d4461b..ef5e9317f 100644 --- a/stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux +++ b/stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux @@ -1,32 +1,32 @@ (.module: [lux (#- char int) [control - [monad (#+ do)] + ["." monad (#+ do)] ["p" parser] ["ex" exception (#+ exception:)] pipe] [data ["e" error] - [maybe] - [product] - [text ("text/" Equivalence<Text>) + ["." maybe] + ["." product] + ["." text ("text/" Equivalence<Text>) format] [collection - [list ("list/" Fold<List> Functor<List> Monoid<List>)] - [array] - [dictionary (#+ Dictionary)]]] + ["." list ("list/" Fold<List> Functor<List> Monoid<List>)] + ["." array] + ["." dictionary (#+ Dictionary)]]] ["." macro ["s" syntax]] [language ["." type - [check]]] - [host]] + ["." check]]] + ["." host]] [// - [common] + ["." common] ["/." // - [bundle] + ["." bundle] ["//." // ("operation/" Monad<Operation>) - [analysis (#+ Analysis Operation Handler Bundle) + ["." analysis (#+ Analysis Operation Handler Bundle) [".A" type] [".A" inference]]]]] ) diff --git a/stdlib/source/lux/language/compiler/extension/bundle.lux b/stdlib/source/lux/language/compiler/extension/bundle.lux index 222ad7f5e..dce95cfb1 100644 --- a/stdlib/source/lux/language/compiler/extension/bundle.lux +++ b/stdlib/source/lux/language/compiler/extension/bundle.lux @@ -9,7 +9,7 @@ [collection [list ("list/" Functor<List>)] ["dict" dictionary (#+ Dictionary)]]]] - [//]) + [// (#+ Handler Bundle)]) (exception: #export (incorrect-arity {name Text} {arity Nat} {args Nat}) (ex.report ["Extension" (%t name)] @@ -21,18 +21,18 @@ ## [Utils] (def: #export empty - //.Bundle + Bundle (dict.new text.Hash<Text>)) (def: #export (install name anonymous) (All [s i o] - (-> Text (//.Handler s i o) - (-> (//.Bundle s i o) (//.Bundle s i o)))) + (-> Text (Handler s i o) + (-> (Bundle s i o) (Bundle s i o)))) (dict.put name anonymous)) (def: #export (prefix prefix) (All [s i o] - (-> Text (-> (//.Bundle s i o) (//.Bundle s i o)))) + (-> Text (-> (Bundle s i o) (Bundle s i o)))) (|>> dict.entries (list/map (function (_ [key val]) [(format prefix " " key) val])) (dict.from-list text.Hash<Text>))) diff --git a/stdlib/source/lux/language/compiler/init.lux b/stdlib/source/lux/language/compiler/init.lux index 92a066b7e..648211ca7 100644 --- a/stdlib/source/lux/language/compiler/init.lux +++ b/stdlib/source/lux/language/compiler/init.lux @@ -1,7 +1,7 @@ (.module: lux - [///] - [///host]) + ["." /// + ["." host]]) (def: #export (cursor file) (-> Text Cursor) @@ -23,15 +23,15 @@ (`` (def: #export info Info - {#.target (for {(~~ (static ///host.common-lisp)) ///host.common-lisp - (~~ (static ///host.js)) ///host.js - (~~ (static ///host.jvm)) ///host.jvm - (~~ (static ///host.lua)) ///host.lua - (~~ (static ///host.php)) ///host.php - (~~ (static ///host.python)) ///host.python - (~~ (static ///host.r)) ///host.r - (~~ (static ///host.ruby)) ///host.ruby - (~~ (static ///host.scheme)) ///host.scheme}) + {#.target (for {(~~ (static host.common-lisp)) host.common-lisp + (~~ (static host.js)) host.js + (~~ (static host.jvm)) host.jvm + (~~ (static host.lua)) host.lua + (~~ (static host.php)) host.php + (~~ (static host.python)) host.python + (~~ (static host.r)) host.r + (~~ (static host.ruby)) host.ruby + (~~ (static host.scheme)) host.scheme}) #.version ///.version #.mode #.Build})) diff --git a/stdlib/source/lux/language/compiler/meta/archive.lux b/stdlib/source/lux/language/compiler/meta/archive.lux index 4a981007a..570221385 100644 --- a/stdlib/source/lux/language/compiler/meta/archive.lux +++ b/stdlib/source/lux/language/compiler/meta/archive.lux @@ -2,18 +2,22 @@ [lux #* [control ["ex" exception (#+ exception:)] - [equivalence (#+ Equivalence)] - [monad (#+ do)]] + ["." equivalence (#+ Equivalence)] + ["." monad (#+ do)]] [data - [error (#+ Error)] - [ident] + ["." error (#+ Error)] + ["." ident] ["." text format] - [collection ["dict" dictionary (#+ Dictionary)]]] - [language [type (#+ :share)]] - [type abstract] - [world [file (#+ File)]]] - [//// (#+ Version)]) + [collection + ["dict" dictionary (#+ Dictionary)]]] + [language + [type (#+ :share)]] + [type + abstract] + [world + [file (#+ File)]]] + ["." //// (#+ Version)]) ## Key (type: #export Signature diff --git a/stdlib/source/lux/language/compiler/meta/cache.lux b/stdlib/source/lux/language/compiler/meta/cache.lux index d382c5860..59d2f3c3b 100644 --- a/stdlib/source/lux/language/compiler/meta/cache.lux +++ b/stdlib/source/lux/language/compiler/meta/cache.lux @@ -1,27 +1,29 @@ (.module: [lux (#- Module) [control - [monad (#+ Monad do)] + ["." monad (#+ Monad do)] ["ex" exception (#+ exception:)] pipe] [data - [bit ("bit/" Equivalence<Bit>)] - [maybe] - [error] - [product] - [format [binary (#+ Binary)]] + ["." bit ("bit/" Equivalence<Bit>)] + ["." maybe] + ["." error] + ["." product] + [format + ["." binary (#+ Binary)]] ["." text format] [collection - [list ("list/" Functor<List> Fold<List>)] + ["." list ("list/" Functor<List> Fold<List>)] ["dict" dictionary (#+ Dictionary)] - [set (#+ Set)]]] - [world [file (#+ File System)]]] + ["." set (#+ Set)]]] + [world + [file (#+ File System)]]] [//io (#+ Context Module)] - [//io/context] - [//io/archive] - [//archive (#+ Signature Key Descriptor Document Archive)] - [/dependency (#+ Dependency Graph)]) + ["." //io/context] + ["." //io/archive] + ["." //archive (#+ Signature Key Descriptor Document Archive)] + ["." /dependency (#+ Dependency Graph)]) (exception: #export (cannot-delete-cached-file {file File}) (ex.report ["File" file])) diff --git a/stdlib/source/lux/language/compiler/meta/cache/dependency.lux b/stdlib/source/lux/language/compiler/meta/cache/dependency.lux index b12a7e9fb..6f7994c92 100644 --- a/stdlib/source/lux/language/compiler/meta/cache/dependency.lux +++ b/stdlib/source/lux/language/compiler/meta/cache/dependency.lux @@ -1,7 +1,7 @@ (.module: [lux (#- Module) [data - [text] + ["." text] [collection [list ("list/" Functor<List> Fold<List>)] ["dict" dictionary (#+ Dictionary)]]]] diff --git a/stdlib/source/lux/language/compiler/meta/io/archive.lux b/stdlib/source/lux/language/compiler/meta/io/archive.lux index e69f6eaf4..4a6e3fb39 100644 --- a/stdlib/source/lux/language/compiler/meta/io/archive.lux +++ b/stdlib/source/lux/language/compiler/meta/io/archive.lux @@ -4,14 +4,14 @@ monad ["ex" exception (#+ exception:)]] [data - [error] + ["." error] ["." text format]] [world - [file (#+ File System)] + ["." file (#+ File System)] [blob (#+ Blob)]]] - [/////host] - [// (#+ Module)]) + ["." /////host] + ["." // (#+ Module)]) (type: #export Document File) diff --git a/stdlib/source/lux/language/compiler/meta/io/context.lux b/stdlib/source/lux/language/compiler/meta/io/context.lux index 4658858ff..eab4b284a 100644 --- a/stdlib/source/lux/language/compiler/meta/io/context.lux +++ b/stdlib/source/lux/language/compiler/meta/io/context.lux @@ -4,15 +4,16 @@ monad ["ex" exception (#+ Exception exception:)]] [data - [error] + ["." error] [text format - [encoding]]] + ["." encoding]]] [world - [file (#+ File System)] + ["." file (#+ File System)] [blob (#+ Blob)]]] - [/////host] - [// (#+ Context Module)]) + ["." // (#+ Context Module) + [//// + ["." host]]]) (type: #export Extension Text) @@ -24,15 +25,15 @@ (def: host-extension Extension - (`` (for {(~~ (static /////host.common-lisp)) ".cl" - (~~ (static /////host.js)) ".js" - (~~ (static /////host.jvm)) ".jvm" - (~~ (static /////host.lua)) ".lua" - (~~ (static /////host.php)) ".php" - (~~ (static /////host.python)) ".py" - (~~ (static /////host.r)) ".r" - (~~ (static /////host.ruby)) ".rb" - (~~ (static /////host.scheme)) ".scm"}))) + (`` (for {(~~ (static host.common-lisp)) ".cl" + (~~ (static host.js)) ".js" + (~~ (static host.jvm)) ".jvm" + (~~ (static host.lua)) ".lua" + (~~ (static host.php)) ".php" + (~~ (static host.python)) ".py" + (~~ (static host.r)) ".r" + (~~ (static host.ruby)) ".rb" + (~~ (static host.scheme)) ".scm"}))) (def: lux-extension Extension ".lux") diff --git a/stdlib/source/lux/language/compiler/synthesis.lux b/stdlib/source/lux/language/compiler/synthesis.lux index f4d7a6407..8dd99986b 100644 --- a/stdlib/source/lux/language/compiler/synthesis.lux +++ b/stdlib/source/lux/language/compiler/synthesis.lux @@ -3,12 +3,13 @@ [control [monad (#+ do)]] [data [error (#+ Error)] - [collection ["dict" dictionary (#+ Dictionary)]]]] + [collection + ["dict" dictionary (#+ Dictionary)]]]] ["." // - [analysis (#+ Environment Arity Analysis)] - [extension (#+ Extension)] + ["." analysis (#+ Environment Arity Analysis)] + ["." extension (#+ Extension)] [// - [reference (#+ Register Variable Reference)]]]) + ["." reference (#+ Register Variable Reference)]]]) (type: #export Resolver (Dictionary Variable Variable)) diff --git a/stdlib/source/lux/language/compiler/synthesis/case.lux b/stdlib/source/lux/language/compiler/synthesis/case.lux index 92a17fa71..8301e11aa 100644 --- a/stdlib/source/lux/language/compiler/synthesis/case.lux +++ b/stdlib/source/lux/language/compiler/synthesis/case.lux @@ -3,20 +3,21 @@ [control [equivalence (#+ Equivalence)] pipe - [monad (#+ do)]] + ["." monad (#+ do)]] [data - [product] + ["." product] [bit ("bit/" Equivalence<Bit>)] [text ("text/" Equivalence<Text>) format] [number ("frac/" Equivalence<Frac>)] - [collection [list ("list/" Fold<List> Monoid<List>)]]]] - [// (#+ Path Synthesis Operation Compiler) - [function] + [collection + ["." list ("list/" Fold<List> Monoid<List>)]]]] + ["." // (#+ Path Synthesis Operation Compiler) + ["." function] ["/." // ("operation/" Monad<Operation>) - [analysis (#+ Pattern Match Analysis)] + ["." analysis (#+ Pattern Match Analysis)] [// - [reference]]]]) + ["." reference]]]]) (def: (path' pattern bodyC) (-> Pattern (Operation Path) (Operation Path)) diff --git a/stdlib/source/lux/language/compiler/synthesis/expression.lux b/stdlib/source/lux/language/compiler/synthesis/expression.lux index 999d49b15..e122afc32 100644 --- a/stdlib/source/lux/language/compiler/synthesis/expression.lux +++ b/stdlib/source/lux/language/compiler/synthesis/expression.lux @@ -1,20 +1,20 @@ (.module: [lux (#- primitive) [control - [monad (#+ do)]] + ["." monad (#+ do)]] [data - [maybe] + ["." maybe] [collection - [list ("list/" Functor<List>)] + ["." list ("list/" Functor<List>)] ["dict" dictionary (#+ Dictionary)]]]] - [// (#+ Synthesis Compiler) - [function] - [case] + ["." // (#+ Synthesis Compiler) + ["." function] + ["." case] ["/." // ("operation/" Monad<Operation>) - [analysis (#+ Analysis)] - [extension] + ["." analysis (#+ Analysis)] + ["." extension] [// - [reference]]]]) + ["." reference]]]]) (def: (primitive analysis) (-> analysis.Primitive //.Primitive) diff --git a/stdlib/source/lux/language/compiler/synthesis/function.lux b/stdlib/source/lux/language/compiler/synthesis/function.lux index 0fadbc6d1..05f1c2e96 100644 --- a/stdlib/source/lux/language/compiler/synthesis/function.lux +++ b/stdlib/source/lux/language/compiler/synthesis/function.lux @@ -1,22 +1,22 @@ (.module: [lux (#- function) [control - [monad (#+ do)] - [state] + ["." monad (#+ do)] + ["." state] pipe ["ex" exception (#+ exception:)]] [data - [maybe ("maybe/" Monad<Maybe>)] - [error] + ["." maybe ("maybe/" Monad<Maybe>)] + ["." error] [collection - [list ("list/" Functor<List> Monoid<List> Fold<List>)] + ["." list ("list/" Functor<List> Monoid<List> Fold<List>)] ["dict" dictionary (#+ Dictionary)]]]] - [// (#+ Synthesis Operation Compiler) - [loop] + ["." // (#+ Synthesis Operation Compiler) + ["." loop (#+ Transform)] [/// - [reference (#+ Variable)] + ["." reference (#+ Variable)] ["." compiler - [analysis (#+ Environment Arity Analysis)]]]]) + ["." analysis (#+ Environment Arity Analysis)]]]]) (def: #export nested? (-> Arity Bit) @@ -65,7 +65,7 @@ (wrap (//.function/apply [funcS argsS]))))))) (def: (prepare up down) - (-> Arity Arity (loop.Transform Synthesis)) + (-> Arity Arity (Transform Synthesis)) (.function (_ body) (if (nested? up) (#.Some body) diff --git a/stdlib/source/lux/language/compiler/synthesis/loop.lux b/stdlib/source/lux/language/compiler/synthesis/loop.lux index ea6589f21..033d5e70e 100644 --- a/stdlib/source/lux/language/compiler/synthesis/loop.lux +++ b/stdlib/source/lux/language/compiler/synthesis/loop.lux @@ -1,20 +1,21 @@ (.module: [lux (#- loop) [control - [monad (#+ do)] + ["." monad (#+ do)] ["p" parser]] [data - [maybe ("maybe/" Monad<Maybe>)] - [collection [list ("list/" Functor<List>)]]] + ["." maybe ("maybe/" Monad<Maybe>)] + [collection + ["." list ("list/" Functor<List>)]]] [macro - [code] - [syntax]]] - [// (#+ Path Abstraction Synthesis) + ["." code] + ["." syntax]]] + ["." // (#+ Path Abstraction Synthesis) [/// - [reference (#+ Register Variable)] + ["." reference (#+ Register Variable)] [compiler - [analysis (#+ Environment)] - [extension]]]]) + ["." analysis (#+ Environment)] + ["." extension]]]]) (type: #export (Transform a) (-> a (Maybe a))) diff --git a/stdlib/source/lux/language/compiler/translation.lux b/stdlib/source/lux/language/compiler/translation.lux index b822d3cf8..462c61ec5 100644 --- a/stdlib/source/lux/language/compiler/translation.lux +++ b/stdlib/source/lux/language/compiler/translation.lux @@ -4,18 +4,18 @@ ["ex" exception (#+ exception:)] [monad (#+ do)]] [data - [product] - [error (#+ Error)] + ["." product] + ["." error (#+ Error)] [ident ("ident/" Equivalence<Ident> Codec<Text,Ident>)] ["." text format] [collection - [row (#+ Row)] + ["." row (#+ Row)] ["dict" dictionary (#+ Dictionary)]]] - [function] - [world [file (#+ File)]]] + [world + [file (#+ File)]]] ["." // - [extension]] + ["." extension]] [//synthesis (#+ Synthesis)]) (do-template [<name>] @@ -65,6 +65,12 @@ (type: #export (Compiler anchor expression statement) (extension.Compiler (State anchor expression statement) Synthesis expression)) +(type: #export (Handler anchor expression statement) + (extension.Handler (State anchor expression statement) Synthesis expression)) + +(type: #export (Bundle anchor expression statement) + (extension.Bundle (State anchor expression statement) Synthesis expression)) + (def: #export (init host) (All [anchor expression statement] (-> (Host expression statement) diff --git a/stdlib/source/lux/language/compiler/translation/scheme/case.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/case.jvm.lux index f7b1adb7a..d2e9d8d98 100644 --- a/stdlib/source/lux/language/compiler/translation/scheme/case.jvm.lux +++ b/stdlib/source/lux/language/compiler/translation/scheme/case.jvm.lux @@ -4,38 +4,40 @@ [monad (#+ do)] ["ex" exception (#+ exception:)]] [data - [number] + ["." number] ["." text format] [collection [list ("list/" Functor<List> Fold<List>)] [set (#+ Set)]]]] - [///// - [reference (#+ Register)] - [host ["_" scheme (#+ Expression Computation Var)]] - [compiler ("operation/" Monad<Operation>) - [synthesis (#+ Synthesis Path)]]] - [//runtime (#+ Operation Compiler)] - [//reference]) + [// + ["." runtime (#+ Operation Compiler)] + ["." reference] + ["/." /// ("operation/" Monad<Operation>) + ["." synthesis (#+ Synthesis Path)] + [// + [reference (#+ Register)] + [host + ["_" scheme (#+ Expression Computation Var)]]]]]) (def: #export (let translate [valueS register bodyS]) (-> Compiler [Synthesis Register Synthesis] (Operation Computation)) - (do compiler.Monad<Operation> + (do ////.Monad<Operation> [valueO (translate valueS) bodyO (translate bodyS)] - (wrap (_.let (list [(//reference.local' register) valueO]) + (wrap (_.let (list [(reference.local' register) valueO]) bodyO)))) (def: #export (record-get translate valueS pathP) (-> Compiler Synthesis (List [Nat Bit]) (Operation Expression)) - (do compiler.Monad<Operation> + (do ////.Monad<Operation> [valueO (translate valueS)] (wrap (list/fold (function (_ [idx tail?] source) (.let [method (.if tail? - //runtime.product//right - //runtime.product//left)] + runtime.product//right + runtime.product//left)] (method source (_.int (:coerce Int idx))))) valueO pathP)))) @@ -43,7 +45,7 @@ (def: #export (if translate [testS thenS elseS]) (-> Compiler [Synthesis Synthesis Synthesis] (Operation Computation)) - (do compiler.Monad<Operation> + (do ////.Monad<Operation> [testO (translate testS) thenO (translate thenS) elseO (translate elseS)] @@ -97,9 +99,9 @@ (def: (pm-catch handler) (-> Expression Computation) (_.lambda [(list $alt_error) #.None] - (_.if (|> $alt_error (_.eqv?/2 pm-error)) - handler - (_.raise/1 $alt_error)))) + (_.if (|> $alt_error (_.eqv?/2 pm-error)) + handler + (_.raise/1 $alt_error)))) (def: (pattern-matching' translate pathP) (-> Compiler Path (Operation Expression)) @@ -111,7 +113,7 @@ (operation/wrap pop-cursor!) (#synthesis.Bind register) - (operation/wrap (_.define (//reference.local' register) [(list) #.None] + (operation/wrap (_.define (reference.local' register) [(list) #.None] cursor-top)) (^template [<tag> <format> <=>] @@ -125,7 +127,7 @@ (^template [<pm> <flag> <prep>] (^ (<pm> idx)) - (operation/wrap (_.let (list [@temp (|> idx <prep> .int _.int (//runtime.sum//get cursor-top <flag>))]) + (operation/wrap (_.let (list [@temp (|> idx <prep> .int _.int (runtime.sum//get cursor-top <flag>))]) (_.if (_.null?/1 @temp) fail-pm! (push-cursor! @temp))))) @@ -135,12 +137,12 @@ (^template [<pm> <getter> <prep>] (^ (<pm> idx)) (operation/wrap (|> idx <prep> .int _.int (<getter> cursor-top) push-cursor!))) - ([synthesis.member/left //runtime.product//left (<|)] - [synthesis.member/right //runtime.product//right inc]) + ([synthesis.member/left runtime.product//left (<|)] + [synthesis.member/right runtime.product//right inc]) (^template [<tag> <computation>] (^ (<tag> [leftP rightP])) - (do compiler.Monad<Operation> + (do ////.Monad<Operation> [leftO (pattern-matching' translate leftP) rightO (pattern-matching' translate rightP)] (wrap <computation>))) @@ -154,11 +156,11 @@ leftO))))]) _ - (compiler.throw unrecognized-path []))) + (////.throw unrecognized-path []))) (def: (pattern-matching translate pathP) (-> Compiler Path (Operation Computation)) - (do compiler.Monad<Operation> + (do ////.Monad<Operation> [pattern-matching! (pattern-matching' translate pathP)] (wrap (_.with-exception-handler (pm-catch (_.raise/1 (_.string "Invalid expression for pattern-matching."))) @@ -167,7 +169,7 @@ (def: #export (case translate [valueS pathP]) (-> Compiler [Synthesis Path] (Operation Computation)) - (do compiler.Monad<Operation> + (do ////.Monad<Operation> [valueO (translate valueS)] (<| (:: @ map (_.let (list [@cursor (_.list/* (list valueO))] [@savepoint (_.list/* (list))]))) diff --git a/stdlib/source/lux/language/compiler/translation/scheme/expression.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/expression.jvm.lux index 3cbefbf69..7ff3770ae 100644 --- a/stdlib/source/lux/language/compiler/translation/scheme/expression.jvm.lux +++ b/stdlib/source/lux/language/compiler/translation/scheme/expression.jvm.lux @@ -1,17 +1,18 @@ (.module: [lux #* - [control [monad (#+ do)]]] + [control + [monad (#+ do)]]] [// [runtime (#+ Compiler)] - [primitive] - [structure] - [reference] - [function] - [case] - [loop] + ["." primitive] + ["." structure] + ["." reference] + ["." function] + ["." case] + ["." loop] ["." /// - [synthesis] - [extension]]]) + ["." synthesis] + ["." extension]]]) (def: #export (translate synthesis) Compiler diff --git a/stdlib/source/lux/language/compiler/translation/scheme/extension.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/extension.jvm.lux index c7d161f14..a40b4953f 100644 --- a/stdlib/source/lux/language/compiler/translation/scheme/extension.jvm.lux +++ b/stdlib/source/lux/language/compiler/translation/scheme/extension.jvm.lux @@ -1,36 +1,15 @@ (.module: [lux #* - [control - [monad (#+ do)] - ["ex" exception (#+ exception:)]] [data - [maybe] - [text - format] - [collection ["dict" dictionary (#+ Dictionary)]]]] - [///// - [reference (#+ Register Variable)] - [host ["_" scheme (#+ Computation)]] - [compiler ("operation/" Monad<Operation>) - [synthesis (#+ Synthesis)]]] - [//runtime (#+ Operation Compiler)] - [/common] - ## [/host] - ) + [collection + ["." dictionary]]]] + [// + [runtime (#+ Bundle)]] + [/ + ["." common] + ["." host]]) -(exception: #export (unknown-extension {message Text}) - message) - -(def: extensions - /common.Bundle - (|> /common.extensions - ## (dict.merge /host.extensions) - )) - -(def: #export (extension translate name args) - (-> Compiler Text (List Synthesis) - (Operation Computation)) - (<| (maybe.default (compiler.throw unknown-extension (%t name))) - (do maybe.Monad<Maybe> - [ext (dict.get name extensions)] - (wrap (ext translate args))))) +(def: #export bundle + Bundle + (|> common.bundle + (dictionary.merge host.bundle))) diff --git a/stdlib/source/lux/language/compiler/translation/scheme/extension/common.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/extension/common.jvm.lux index 40f817aea..289634a4b 100644 --- a/stdlib/source/lux/language/compiler/translation/scheme/extension/common.jvm.lux +++ b/stdlib/source/lux/language/compiler/translation/scheme/extension/common.jvm.lux @@ -1,34 +1,32 @@ (.module: [lux #* [control - [monad (#+ do)] + ["." monad (#+ do)] ["ex" exception (#+ exception:)]] [data ["e" error] - [product] + ["." product] ["." text format] [number (#+ hex)] [collection - [list ("list/" Functor<List>)] + ["." list ("list/" Functor<List>)] ["dict" dictionary (#+ Dictionary)]]] - [macro (#+ with-gensyms) - [code] + ["." macro (#+ with-gensyms) + ["." code] ["s" syntax (#+ syntax:)]] - [host]] - [////// - [host ["_" scheme (#+ Expression Computation)]] - ["." compiler - [synthesis (#+ Synthesis)]]] - [///runtime (#+ Operation Compiler)]) + [host (#+ import:)]] + [/// + ["." runtime (#+ Operation Compiler Handler Bundle)] + ["//." /// + ["." synthesis (#+ Synthesis)] + [extension + ["." bundle]] + [// + [host + ["_" scheme (#+ Expression Computation)]]]]]) ## [Types] -(type: #export Extension - (-> Compiler (List Synthesis) (Operation Computation))) - -(type: #export Bundle - (Dictionary Text Extension)) - (syntax: (Vector {size s.nat} elemT) (wrap (list (` [(~+ (list.repeat size elemT))])))) @@ -39,43 +37,25 @@ (type: #export Variadic (-> (List Expression) Computation)) ## [Utils] -(def: #export (install name unnamed) - (-> Text (-> Text Extension) - (-> Bundle Bundle)) - (dict.put name (unnamed name))) - -(def: #export (prefix prefix bundle) - (-> Text Bundle Bundle) - (|> bundle - dict.entries - (list/map (function (_ [key val]) [(format prefix " " key) val])) - (dict.from-list text.Hash<Text>))) - -(exception: #export (wrong-arity {extension Text} {expected Nat} {actual Nat}) - (ex.report ["Extension" (%t extension)] - ["Expected" (|> expected .int %i)] - ["Actual" (|> actual .int %i)])) - (syntax: (arity: {name s.local-symbol} {arity s.nat}) (with-gensyms [g!_ g!extension g!name g!translate g!inputs] (do @ [g!input+ (monad.seq @ (list.repeat arity (macro.gensym "input")))] (wrap (list (` (def: #export ((~ (code.local-symbol name)) (~ g!extension)) (-> (-> (..Vector (~ (code.nat arity)) Expression) Computation) - (-> Text ..Extension)) - (function ((~ g!_) (~ g!name)) - (function ((~ g!_) (~ g!translate) (~ g!inputs)) - (case (~ g!inputs) - (^ (list (~+ g!input+))) - (do compiler.Monad<Operation> - [(~+ (|> g!input+ - (list/map (function (_ g!input) - (list g!input (` ((~ g!translate) (~ g!input)))))) - list.concat))] - ((~' wrap) ((~ g!extension) [(~+ g!input+)]))) - - (~' _) - (compiler.throw wrong-arity [(~ g!name) +1 (list.size (~ g!inputs))]))))))))))) + Handler) + (function ((~ g!_) (~ g!name) (~ g!translate) (~ g!inputs)) + (case (~ g!inputs) + (^ (list (~+ g!input+))) + (do /////.Monad<Operation> + [(~+ (|> g!input+ + (list/map (function (_ g!input) + (list g!input (` ((~ g!translate) (~ g!input)))))) + list.concat))] + ((~' wrap) ((~ g!extension) [(~+ g!input+)]))) + + (~' _) + (/////.throw bundle.incorrect-arity [(~ g!name) +1 (list.size (~ g!inputs))])))))))))) (arity: nullary +0) (arity: unary +1) @@ -83,20 +63,20 @@ (arity: trinary +3) (def: #export (variadic extension) - (-> Variadic (-> Text Extension)) + (-> Variadic Handler) (function (_ extension-name) (function (_ translate inputsS) - (do compiler.Monad<Operation> + (do /////.Monad<Operation> [inputsI (monad.map @ translate inputsS)] (wrap (extension inputsI)))))) -## [Extensions] +## [Bundle] ## [[Lux]] -(def: extensions/lux +(def: bundle::lux Bundle - (|> (dict.new text.Hash<Text>) - (install "is?" (binary (product.uncurry _.eq?/2))) - (install "try" (unary ///runtime.lux//try)))) + (|> bundle.empty + (bundle.install "is?" (binary (product.uncurry _.eq?/2))) + (bundle.install "try" (unary runtime.lux//try)))) ## [[Bits]] (do-template [<name> <op>] @@ -104,67 +84,67 @@ Binary (<op> paramO subjectO))] - [bit//and _.bit-and/2] - [bit//or _.bit-or/2] - [bit//xor _.bit-xor/2] + [bit::and _.bit-and/2] + [bit::or _.bit-or/2] + [bit::xor _.bit-xor/2] ) -(def: (bit//left-shift [subjectO paramO]) +(def: (bit::left-shift [subjectO paramO]) Binary (_.arithmetic-shift/2 (_.remainder/2 (_.int 64) paramO) subjectO)) -(def: (bit//arithmetic-right-shift [subjectO paramO]) +(def: (bit::arithmetic-right-shift [subjectO paramO]) Binary (_.arithmetic-shift/2 (|> paramO (_.remainder/2 (_.int 64)) (_.*/2 (_.int -1))) subjectO)) -(def: (bit//logical-right-shift [subjectO paramO]) +(def: (bit::logical-right-shift [subjectO paramO]) Binary - (///runtime.bit//logical-right-shift (_.remainder/2 (_.int 64) paramO) subjectO)) + (runtime.bit//logical-right-shift (_.remainder/2 (_.int 64) paramO) subjectO)) -(def: extensions/bit +(def: bundle::bit Bundle - (<| (prefix "bit") - (|> (dict.new text.Hash<Text>) - (install "and" (binary bit//and)) - (install "or" (binary bit//or)) - (install "xor" (binary bit//xor)) - (install "left-shift" (binary bit//left-shift)) - (install "logical-right-shift" (binary bit//logical-right-shift)) - (install "arithmetic-right-shift" (binary bit//arithmetic-right-shift)) + (<| (bundle.prefix "bit") + (|> bundle.empty + (bundle.install "and" (binary bit::and)) + (bundle.install "or" (binary bit::or)) + (bundle.install "xor" (binary bit::xor)) + (bundle.install "left-shift" (binary bit::left-shift)) + (bundle.install "logical-right-shift" (binary bit::logical-right-shift)) + (bundle.install "arithmetic-right-shift" (binary bit::arithmetic-right-shift)) ))) ## [[Arrays]] -(def: (array//new size0) +(def: (array::new size0) Unary (_.make-vector/2 size0 _.nil)) -(def: (array//get [arrayO idxO]) +(def: (array::get [arrayO idxO]) Binary - (///runtime.array//get arrayO idxO)) + (runtime.array//get arrayO idxO)) -(def: (array//put [arrayO idxO elemO]) +(def: (array::put [arrayO idxO elemO]) Trinary - (///runtime.array//put arrayO idxO elemO)) + (runtime.array//put arrayO idxO elemO)) -(def: (array//remove [arrayO idxO]) +(def: (array::remove [arrayO idxO]) Binary - (///runtime.array//put arrayO idxO _.nil)) + (runtime.array//put arrayO idxO _.nil)) -(def: extensions/array +(def: bundle::array Bundle - (<| (prefix "array") - (|> (dict.new text.Hash<Text>) - (install "new" (unary array//new)) - (install "get" (binary array//get)) - (install "put" (trinary array//put)) - (install "remove" (binary array//remove)) - (install "size" (unary _.vector-length/1)) + (<| (bundle.prefix "array") + (|> bundle.empty + (bundle.install "new" (unary array::new)) + (bundle.install "get" (binary array::get)) + (bundle.install "put" (trinary array::put)) + (bundle.install "remove" (binary array::remove)) + (bundle.install "size" (unary _.vector-length/1)) ))) ## [[Numbers]] -(host.import: java/lang/Double +(import: java/lang/Double (#static MIN_VALUE Double) (#static MAX_VALUE Double)) @@ -173,9 +153,9 @@ Nullary (<encode> <const>))] - [frac//smallest Double::MIN_VALUE _.float] - [frac//min (f/* -1.0 Double::MAX_VALUE) _.float] - [frac//max Double::MAX_VALUE _.float] + [frac::smallest Double::MIN_VALUE _.float] + [frac::min (f/* -1.0 Double::MAX_VALUE) _.float] + [frac::max Double::MAX_VALUE _.float] ) (do-template [<name> <op>] @@ -183,11 +163,11 @@ Binary (|> subjectO (<op> paramO)))] - [int//+ _.+/2] - [int//- _.-/2] - [int//* _.*/2] - [int/// _.quotient/2] - [int//% _.remainder/2] + [int::+ _.+/2] + [int::- _.-/2] + [int::* _.*/2] + [int::/ _.quotient/2] + [int::% _.remainder/2] ) (do-template [<name> <op>] @@ -195,16 +175,16 @@ Binary (<op> paramO subjectO))] - [frac//+ _.+/2] - [frac//- _.-/2] - [frac//* _.*/2] - [frac/// _.//2] - [frac//% _.mod/2] - [frac//= _.=/2] - [frac//< _.</2] + [frac::+ _.+/2] + [frac::- _.-/2] + [frac::* _.*/2] + [frac::/ _.//2] + [frac::% _.mod/2] + [frac::= _.=/2] + [frac::< _.</2] - [text//= _.string=?/2] - [text//< _.string<?/2] + [text::= _.string=?/2] + [text::< _.string<?/2] ) (do-template [<name> <cmp>] @@ -212,66 +192,66 @@ Binary (<cmp> paramO subjectO))] - [int//= _.=/2] - [int//< _.</2] + [int::= _.=/2] + [int::< _.</2] ) -(def: int//char (|>> _.integer->char/1 _.string/1)) +(def: int::char (|>> _.integer->char/1 _.string/1)) -(def: extensions/int +(def: bundle::int Bundle - (<| (prefix "int") - (|> (dict.new text.Hash<Text>) - (install "+" (binary int//+)) - (install "-" (binary int//-)) - (install "*" (binary int//*)) - (install "/" (binary int///)) - (install "%" (binary int//%)) - (install "=" (binary int//=)) - (install "<" (binary int//<)) - (install "to-frac" (unary (|>> (_.//2 (_.float 1.0))))) - (install "char" (unary int//char))))) - -(def: extensions/frac + (<| (bundle.prefix "int") + (|> bundle.empty + (bundle.install "+" (binary int::+)) + (bundle.install "-" (binary int::-)) + (bundle.install "*" (binary int::*)) + (bundle.install "/" (binary int::/)) + (bundle.install "%" (binary int::%)) + (bundle.install "=" (binary int::=)) + (bundle.install "<" (binary int::<)) + (bundle.install "to-frac" (unary (|>> (_.//2 (_.float 1.0))))) + (bundle.install "char" (unary int::char))))) + +(def: bundle::frac Bundle - (<| (prefix "frac") - (|> (dict.new text.Hash<Text>) - (install "+" (binary frac//+)) - (install "-" (binary frac//-)) - (install "*" (binary frac//*)) - (install "/" (binary frac///)) - (install "%" (binary frac//%)) - (install "=" (binary frac//=)) - (install "<" (binary frac//<)) - (install "smallest" (nullary frac//smallest)) - (install "min" (nullary frac//min)) - (install "max" (nullary frac//max)) - (install "to-int" (unary _.exact/1)) - (install "encode" (unary _.number->string/1)) - (install "decode" (unary ///runtime.frac//decode))))) + (<| (bundle.prefix "frac") + (|> bundle.empty + (bundle.install "+" (binary frac::+)) + (bundle.install "-" (binary frac::-)) + (bundle.install "*" (binary frac::*)) + (bundle.install "/" (binary frac::/)) + (bundle.install "%" (binary frac::%)) + (bundle.install "=" (binary frac::=)) + (bundle.install "<" (binary frac::<)) + (bundle.install "smallest" (nullary frac::smallest)) + (bundle.install "min" (nullary frac::min)) + (bundle.install "max" (nullary frac::max)) + (bundle.install "to-int" (unary _.exact/1)) + (bundle.install "encode" (unary _.number->string/1)) + (bundle.install "decode" (unary runtime.frac//decode))))) ## [[Text]] -(def: (text//char [subjectO paramO]) +(def: (text::char [subjectO paramO]) Binary (_.string/1 (_.string-ref/2 subjectO paramO))) -(def: (text//clip [subjectO startO endO]) +(def: (text::clip [subjectO startO endO]) Trinary (_.substring/3 subjectO startO endO)) -(def: extensions/text +(def: bundle::text Bundle - (<| (prefix "text") - (|> (dict.new text.Hash<Text>) - (install "=" (binary text//=)) - (install "<" (binary text//<)) - (install "concat" (binary (product.uncurry _.string-append/2))) - (install "size" (unary _.string-length/1)) - (install "char" (binary text//char)) - (install "clip" (trinary text//clip))))) + (<| (bundle.prefix "text") + (|> bundle.empty + (bundle.install "=" (binary text::=)) + (bundle.install "<" (binary text::<)) + (bundle.install "concat" (binary (product.uncurry _.string-append/2))) + (bundle.install "size" (unary _.string-length/1)) + (bundle.install "char" (binary text::char)) + (bundle.install "clip" (trinary text::clip))))) ## [[Math]] -(def: (math//pow [subject param]) +(def: (math::pow [subject param]) Binary (_.expt/2 param subject)) @@ -279,25 +259,25 @@ (-> Text Unary) (|>> _.global _.apply/1)) -(def: extensions/math +(def: bundle::math Bundle - (<| (prefix "math") - (|> (dict.new text.Hash<Text>) - (install "cos" (unary (math-func "cos"))) - (install "sin" (unary (math-func "sin"))) - (install "tan" (unary (math-func "tan"))) - (install "acos" (unary (math-func "acos"))) - (install "asin" (unary (math-func "asin"))) - (install "atan" (unary (math-func "atan"))) - (install "exp" (unary (math-func "exp"))) - (install "log" (unary (math-func "log"))) - (install "ceil" (unary (math-func "ceiling"))) - (install "floor" (unary (math-func "floor"))) - (install "pow" (binary math//pow)) + (<| (bundle.prefix "math") + (|> bundle.empty + (bundle.install "cos" (unary (math-func "cos"))) + (bundle.install "sin" (unary (math-func "sin"))) + (bundle.install "tan" (unary (math-func "tan"))) + (bundle.install "acos" (unary (math-func "acos"))) + (bundle.install "asin" (unary (math-func "asin"))) + (bundle.install "atan" (unary (math-func "atan"))) + (bundle.install "exp" (unary (math-func "exp"))) + (bundle.install "log" (unary (math-func "log"))) + (bundle.install "ceil" (unary (math-func "ceiling"))) + (bundle.install "floor" (unary (math-func "floor"))) + (bundle.install "pow" (binary math::pow)) ))) ## [[IO]] -(def: (io//log input) +(def: (io::log input) Unary (_.begin (list (_.display/1 input) _.newline/0))) @@ -306,75 +286,75 @@ (-> Expression Computation) (_.begin (list code (_.string synthesis.unit)))) -(def: extensions/io +(def: bundle::io Bundle - (<| (prefix "io") - (|> (dict.new text.Hash<Text>) - (install "log" (unary (|>> io//log ..void))) - (install "error" (unary _.raise/1)) - (install "exit" (unary _.exit/1)) - (install "current-time" (nullary (function (_ _) (///runtime.io//current-time (_.string synthesis.unit)))))))) + (<| (bundle.prefix "io") + (|> bundle.empty + (bundle.install "log" (unary (|>> io::log ..void))) + (bundle.install "error" (unary _.raise/1)) + (bundle.install "exit" (unary _.exit/1)) + (bundle.install "current-time" (nullary (function (_ _) (runtime.io//current-time (_.string synthesis.unit)))))))) ## [[Atoms]] -(def: atom//new +(def: atom::new Unary (|>> (list) _.vector/*)) -(def: (atom//read atom) +(def: (atom::read atom) Unary (_.vector-ref/2 atom (_.int 0))) -(def: (atom//compare-and-swap [atomO oldO newO]) +(def: (atom::compare-and-swap [atomO oldO newO]) Trinary - (///runtime.atom//compare-and-swap atomO oldO newO)) + (runtime.atom//compare-and-swap atomO oldO newO)) -(def: extensions/atom +(def: bundle::atom Bundle - (<| (prefix "atom") - (|> (dict.new text.Hash<Text>) - (install "new" (unary atom//new)) - (install "read" (unary atom//read)) - (install "compare-and-swap" (trinary atom//compare-and-swap))))) + (<| (bundle.prefix "atom") + (|> bundle.empty + (bundle.install "new" (unary atom::new)) + (bundle.install "read" (unary atom::read)) + (bundle.install "compare-and-swap" (trinary atom::compare-and-swap))))) ## [[Box]] -(def: (box//write [valueO boxO]) +(def: (box::write [valueO boxO]) Binary - (///runtime.box//write valueO boxO)) + (runtime.box//write valueO boxO)) -(def: extensions/box +(def: bundle::box Bundle - (<| (prefix "box") - (|> (dict.new text.Hash<Text>) - (install "new" (unary atom//new)) - (install "read" (unary atom//read)) - (install "write" (binary box//write))))) + (<| (bundle.prefix "box") + (|> bundle.empty + (bundle.install "new" (unary atom::new)) + (bundle.install "read" (unary atom::read)) + (bundle.install "write" (binary box::write))))) ## [[Processes]] -(def: (process//parallelism-level []) +(def: (process::parallelism-level []) Nullary (_.int 1)) -(def: extensions/process +(def: bundle::process Bundle - (<| (prefix "process") - (|> (dict.new text.Hash<Text>) - (install "parallelism-level" (nullary process//parallelism-level)) - (install "schedule" (binary (product.uncurry ///runtime.process//schedule))) + (<| (bundle.prefix "process") + (|> bundle.empty + (bundle.install "parallelism-level" (nullary process::parallelism-level)) + (bundle.install "schedule" (binary (product.uncurry runtime.process//schedule))) ))) ## [Bundles] -(def: #export extensions +(def: #export bundle Bundle - (<| (prefix "lux") - (|> extensions/lux - (dict.merge extensions/bit) - (dict.merge extensions/int) - (dict.merge extensions/frac) - (dict.merge extensions/text) - (dict.merge extensions/array) - (dict.merge extensions/math) - (dict.merge extensions/io) - (dict.merge extensions/atom) - (dict.merge extensions/box) - (dict.merge extensions/process) + (<| (bundle.prefix "lux") + (|> bundle::lux + (dict.merge bundle::bit) + (dict.merge bundle::int) + (dict.merge bundle::frac) + (dict.merge bundle::text) + (dict.merge bundle::array) + (dict.merge bundle::math) + (dict.merge bundle::io) + (dict.merge bundle::atom) + (dict.merge bundle::box) + (dict.merge bundle::process) ))) diff --git a/stdlib/source/lux/language/compiler/translation/scheme/extension/host.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/extension/host.jvm.lux new file mode 100644 index 000000000..b8b2b7612 --- /dev/null +++ b/stdlib/source/lux/language/compiler/translation/scheme/extension/host.jvm.lux @@ -0,0 +1,11 @@ +(.module: + [lux #*] + [/// + [runtime (#+ Bundle)] + [/// + [extension + ["." bundle]]]]) + +(def: #export bundle + Bundle + bundle.empty) diff --git a/stdlib/source/lux/language/compiler/translation/scheme/function.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/function.jvm.lux index d5dc4541f..01531069e 100644 --- a/stdlib/source/lux/language/compiler/translation/scheme/function.jvm.lux +++ b/stdlib/source/lux/language/compiler/translation/scheme/function.jvm.lux @@ -1,28 +1,30 @@ (.module: [lux (#- function) [control - [monad (#+ do)] + ["." monad (#+ do)] pipe] [data - [product] + ["." product] [text format] - [collection [list ("list/" Functor<List>)]]]] - [///// - [reference (#+ Register Variable)] - [name] - [host ["_" scheme (#+ Expression Computation Var)]] - [compiler ("operation/" Monad<Operation>) - [analysis (#+ Variant Tuple Environment Arity Abstraction Application Analysis)] - [synthesis (#+ Synthesis)]]] - [///] - [//runtime (#+ Operation Compiler)] - [//primitive] - [//reference]) + [collection + ["." list ("list/" Functor<List>)]]]] + [// + ["." runtime (#+ Operation Compiler)] + ["." reference] + ["/." // + ["//." // ("operation/" Monad<Operation>) + [analysis (#+ Variant Tuple Environment Arity Abstraction Application Analysis)] + [synthesis (#+ Synthesis)] + [// + [reference (#+ Register Variable)] + ["." name] + [host + ["_" scheme (#+ Expression Computation Var)]]]]]]) (def: #export (apply translate [functionS argsS+]) (-> Compiler (Application Synthesis) (Operation Computation)) - (do compiler.Monad<Operation> + (do ////.Monad<Operation> [functionO (translate functionS) argsO+ (monad.map @ translate argsS+)] (wrap (_.apply/* functionO argsO+)))) @@ -38,7 +40,7 @@ _ (_.letrec (list [@closure (_.lambda [(|> (list.enumerate inits) - (list/map (|>> product.left //reference.foreign'))) + (list/map (|>> product.left reference.foreign'))) #.None] function-definition)]) (_.apply/* @closure inits)))))) @@ -47,17 +49,17 @@ (def: @missing (_.var "missing")) (def: input - (|>> inc //reference.local')) + (|>> inc reference.local')) (def: #export (function translate [environment arity bodyS]) (-> Compiler (Abstraction Synthesis) (Operation Computation)) - (do compiler.Monad<Operation> + (do ////.Monad<Operation> [[function-name bodyO] (///.with-context (do @ [function-name ///.context] (///.with-anchor (_.var function-name) (translate bodyS)))) - closureO+ (monad.map @ //reference.variable environment) + closureO+ (monad.map @ reference.variable environment) #let [arityO (|> arity .int _.int) @num-args (_.var "num_args") @function (_.var function-name) @@ -67,17 +69,17 @@ (_.letrec (list [@function (_.lambda [(list) (#.Some @curried)] (_.let (list [@num-args (_.length/1 @curried)]) (<| (_.if (|> @num-args (_.=/2 arityO)) - (<| (_.let (list [(//reference.local' +0) @function])) + (<| (_.let (list [(reference.local' +0) @function])) (_.let-values (list [[(|> (list.n/range +0 (dec arity)) (list/map ..input)) #.None] (_.apply/2 (_.global "apply") (_.global "values") @curried)])) bodyO)) (_.if (|> @num-args (_.>/2 arityO)) - (let [arity-args (//runtime.slice (_.int 0) arityO @curried) - output-func-args (//runtime.slice arityO - (|> @num-args (_.-/2 arityO)) - @curried)] + (let [arity-args (runtime.slice (_.int 0) arityO @curried) + output-func-args (runtime.slice arityO + (|> @num-args (_.-/2 arityO)) + @curried)] (|> @function (apply-poly arity-args) (apply-poly output-func-args)))) diff --git a/stdlib/source/lux/language/compiler/translation/scheme/loop.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/loop.jvm.lux index 4e8d90341..9863cf4ed 100644 --- a/stdlib/source/lux/language/compiler/translation/scheme/loop.jvm.lux +++ b/stdlib/source/lux/language/compiler/translation/scheme/loop.jvm.lux @@ -1,40 +1,41 @@ (.module: [lux (#- Scope) [control - [monad (#+ do)]] + ["." monad (#+ do)]] [data - [product] + ["." product] ["." text format] [collection - [list ("list/" Functor<List>)]]] - [macro]] - [///// - [host ["_" scheme (#+ Computation Var)]] - ["." compiler - [synthesis (#+ Scope Synthesis)]]] - [///] - [//runtime (#+ Operation Compiler)] - [//reference]) + ["." list ("list/" Functor<List>)]]]] + [// + [runtime (#+ Operation Compiler)] + ["." reference] + ["/." // + ["//." // + [synthesis (#+ Scope Synthesis)] + [// + [host + ["_" scheme (#+ Computation Var)]]]]]]) (def: @scope (_.var "scope")) (def: #export (scope translate [start initsS+ bodyS]) (-> Compiler (Scope Synthesis) (Operation Computation)) - (do compiler.Monad<Operation> + (do ////.Monad<Operation> [initsO+ (monad.map @ translate initsS+) bodyO (///.with-anchor @scope (translate bodyS))] (wrap (_.letrec (list [@scope (_.lambda [(|> initsS+ list.enumerate - (list/map (|>> product.left (n/+ start) //reference.local'))) + (list/map (|>> product.left (n/+ start) reference.local'))) #.None] bodyO)]) (_.apply/* @scope initsO+))))) (def: #export (recur translate argsS+) (-> Compiler (List Synthesis) (Operation Computation)) - (do compiler.Monad<Operation> + (do ////.Monad<Operation> [@scope ///.anchor argsO+ (monad.map @ translate argsS+)] (wrap (_.apply/* @scope argsO+)))) diff --git a/stdlib/source/lux/language/compiler/translation/scheme/primitive.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/primitive.jvm.lux index 6ff146393..9c64aad05 100644 --- a/stdlib/source/lux/language/compiler/translation/scheme/primitive.jvm.lux +++ b/stdlib/source/lux/language/compiler/translation/scheme/primitive.jvm.lux @@ -2,8 +2,9 @@ [lux (#- i64)] [/// (#+ State)] [///// - [compiler ("operation/" Monad<Operation>)] - [host ["_" scheme (#+ Expression)]]] + [host + ["_" scheme (#+ Expression)]] + [compiler ("operation/" Monad<Operation>)]] [//runtime (#+ Operation)]) (def: #export bit diff --git a/stdlib/source/lux/language/compiler/translation/scheme/reference.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/reference.jvm.lux index f9eba9bd7..6828f6d14 100644 --- a/stdlib/source/lux/language/compiler/translation/scheme/reference.jvm.lux +++ b/stdlib/source/lux/language/compiler/translation/scheme/reference.jvm.lux @@ -5,15 +5,15 @@ [data [text format]]] - [///// - [reference (#+ Register Variable Reference)] - [name] - [host ["_" scheme (#+ Expression Var)]] - [compiler ("operation/" Monad<Operation>) + [// + [runtime (#+ Operation)] + [/// ("operation/" Monad<Operation>) [analysis (#+ Variant Tuple)] - [synthesis (#+ Synthesis)]]] - [//runtime (#+ Operation)] - [//primitive]) + [synthesis (#+ Synthesis)] + [// + ["." reference (#+ Register Variable Reference)] + ["." name] + [host ["_" scheme (#+ Expression Var)]]]]]) (do-template [<name> <prefix>] [(def: #export <name> diff --git a/stdlib/source/lux/language/compiler/translation/scheme/runtime.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/runtime.jvm.lux index 961a682f2..a2f2250ef 100644 --- a/stdlib/source/lux/language/compiler/translation/scheme/runtime.jvm.lux +++ b/stdlib/source/lux/language/compiler/translation/scheme/runtime.jvm.lux @@ -7,24 +7,29 @@ [number (#+ hex)] [text format] - [collection [list ("list/" Monad<List>)]]] - [function] + [collection + ["." list ("list/" Monad<List>)]]] + ["." function] [macro - [code] + ["." code] ["s" syntax (#+ syntax:)]]] ["." /// ["//." // [analysis (#+ Variant)] - [synthesis] + ["." synthesis] [// - [name] + ["." name] [host ["_" scheme (#+ Expression Computation Var)]]]]]) -(type: #export Operation - (///.Operation Var Expression Expression)) +(do-template [<name> <base>] + [(type: #export <name> + (<base> Var Expression Expression))] -(type: #export Compiler - (///.Compiler Var Expression Expression)) + [Operation ///.Operation] + [Compiler ///.Compiler] + [Handler ///.Handler] + [Bundle ///.Bundle] + ) (def: prefix Text "LuxRuntime") diff --git a/stdlib/source/lux/language/compiler/translation/scheme/structure.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/structure.jvm.lux index 4637d1a25..1f7f2cf27 100644 --- a/stdlib/source/lux/language/compiler/translation/scheme/structure.jvm.lux +++ b/stdlib/source/lux/language/compiler/translation/scheme/structure.jvm.lux @@ -1,31 +1,33 @@ (.module: [lux #* - [control [monad (#+ do)]]] - [///// - [host - ["_" scheme (#+ Expression)]] - ["." compiler + [control + ["." monad (#+ do)]]] + [// + ["." runtime (#+ Operation Compiler)] + ["." primitive] + ["." /// [analysis (#+ Variant Tuple)] - [synthesis (#+ Synthesis)]]] - [//runtime (#+ Operation Compiler)] - [//primitive]) + ["." synthesis (#+ Synthesis)] + [// + [host + ["_" scheme (#+ Expression)]]]]]) (def: #export (tuple translate elemsS+) (-> Compiler (Tuple Synthesis) (Operation Expression)) (case elemsS+ #.Nil - (//primitive.text synthesis.unit) + (primitive.text synthesis.unit) (#.Cons singletonS #.Nil) (translate singletonS) _ - (do compiler.Monad<Operation> + (do ///.Monad<Operation> [elemsT+ (monad.map @ translate elemsS+)] (wrap (_.vector/* elemsT+))))) (def: #export (variant translate [lefts right? valueS]) (-> Compiler (Variant Synthesis) (Operation Expression)) - (do compiler.Monad<Operation> + (do ///.Monad<Operation> [valueT (translate valueS)] - (wrap (//runtime.variant [lefts right? valueT])))) + (wrap (runtime.variant [lefts right? valueT])))) diff --git a/stdlib/source/lux/language/host/scheme.lux b/stdlib/source/lux/language/host/scheme.lux index e312e769b..bdcd64990 100644 --- a/stdlib/source/lux/language/host/scheme.lux +++ b/stdlib/source/lux/language/host/scheme.lux @@ -3,12 +3,13 @@ [control pipe] [data - [number] + ["." number] ["." text format] [collection - [list ("list/" Functor<List> Fold<List>)]]] - [type abstract]]) + ["." list ("list/" Functor<List> Fold<List>)]]] + [type + abstract]]) (abstract: Global' {} Any) (abstract: Var' {} Any) diff --git a/stdlib/source/lux/language/name.lux b/stdlib/source/lux/language/name.lux index 0b3dc7bdd..f6489b89c 100644 --- a/stdlib/source/lux/language/name.lux +++ b/stdlib/source/lux/language/name.lux @@ -1,7 +1,7 @@ (.module: [lux #* [data - [maybe] + ["." maybe] ["." text format]]]) diff --git a/stdlib/source/lux/language/syntax.lux b/stdlib/source/lux/language/syntax.lux index 18fd61c8a..ebe2c3511 100644 --- a/stdlib/source/lux/language/syntax.lux +++ b/stdlib/source/lux/language/syntax.lux @@ -32,14 +32,14 @@ ["ex" exception (#+ exception:)]] [data ["e" error] - [number] - [product] - [maybe] + ["." number] + ["." product] + ["." maybe] ["." text ["l" lexer] format] [collection - [row (#+ Row)] + ["." row (#+ Row)] ["dict" dictionary (#+ Dictionary)]]]]) (type: #export Aliases (Dictionary Text Text)) diff --git a/stdlib/source/lux/language/type.lux b/stdlib/source/lux/language/type.lux index 11b1e1223..a3ae7aa91 100644 --- a/stdlib/source/lux/language/type.lux +++ b/stdlib/source/lux/language/type.lux @@ -5,15 +5,15 @@ [monad (#+ do Monad)] ["p" parser]] [data - [text ("text/" Monoid<Text> Equivalence<Text>)] + ["." text ("text/" Monoid<Text> Equivalence<Text>)] [ident ("ident/" Equivalence<Ident> Codec<Text,Ident>)] [number ("nat/" Codec<Text,Nat>)] - [maybe] - [collection [list ("list/" Functor<List> Monoid<List> Fold<List>)]]] + ["." maybe] + [collection + ["." list ("list/" Functor<List> Monoid<List> Fold<List>)]]] ["." macro - [code] - ["s" syntax (#+ Syntax syntax:)]] - ]) + ["." code] + ["s" syntax (#+ Syntax syntax:)]]]) ## [Utils] (def: (beta-reduce env type) diff --git a/stdlib/source/lux/language/type/check.lux b/stdlib/source/lux/language/type/check.lux index abd6bda5e..990a0261c 100644 --- a/stdlib/source/lux/language/type/check.lux +++ b/stdlib/source/lux/language/type/check.lux @@ -3,18 +3,19 @@ [control [functor (#+ Functor)] [apply (#+ Apply)] - [monad (#+ do Monad)] + ["." monad (#+ do Monad)] ["ex" exception (#+ exception:)]] [data - [maybe] - [product] - [number ("nat/" Codec<Text,Nat>)] + ["." maybe] + ["." product] + ["e" error] + ["." number ("nat/" Codec<Text,Nat>)] [text ("text/" Monoid<Text> Equivalence<Text>)] [collection - [list] - [set (#+ Set)]] - ["e" error]] - [language [type ("type/" Equivalence<Type>)]] + ["." list] + ["." set (#+ Set)]]] + [language + ["." type ("type/" Equivalence<Type>)]] ]) (exception: #export (unknown-type-var {id Nat}) diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux index fea0fa783..bbe93cbd1 100644 --- a/stdlib/source/lux/macro.lux +++ b/stdlib/source/lux/macro.lux @@ -3,16 +3,18 @@ [control [functor (#+ Functor)] [apply (#+ Apply)] - [monad (#+ do Monad)]] + ["." monad (#+ do Monad)]] [data - [number ("nat/" Codec<Text,Nat>)] - [product] + ["." product] [ident ("ident/" Codec<Text,Ident> Equivalence<Ident>)] - [maybe] + ["." maybe] ["e" error] - [text ("text/" Monoid<Text> Equivalence<Text>)] - [collection [list ("list/" Monoid<List> Monad<List>)]]]] - [/ [code]]) + ["." number ("nat/" Codec<Text,Nat>)] + ["." text ("text/" Monoid<Text> Equivalence<Text>)] + [collection + ["." list ("list/" Monoid<List> Monad<List>)]]]] + [/ + ["." code]]) ## (type: (Meta a) ## (-> Lux (e.Error [Lux a]))) diff --git a/stdlib/source/lux/macro/code.lux b/stdlib/source/lux/macro/code.lux index a599bbae8..a53804630 100644 --- a/stdlib/source/lux/macro/code.lux +++ b/stdlib/source/lux/macro/code.lux @@ -1,14 +1,14 @@ (.module: [lux (#- nat int rev) [control - [equivalence (#+ Equivalence)]] + ["." equivalence (#+ Equivalence)]] [data bit number - [text (#+ Equivalence<Text>) ("text/" Monoid<Text>)] ident - [collection [list ("list/" Functor<List> Fold<List>)]] - ]]) + ["." text (#+ Equivalence<Text>) ("text/" Monoid<Text>)] + [collection + ["." list ("list/" Functor<List> Fold<List>)]]]]) ## [Types] ## (type: (Code' w) diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux index cd37a8f4b..b40d1a3ff 100644 --- a/stdlib/source/lux/macro/poly.lux +++ b/stdlib/source/lux/macro/poly.lux @@ -1,24 +1,24 @@ (.module: [lux (#- function) [control - [monad (#+ do Monad)] + ["." monad (#+ do Monad)] [equivalence] ["p" parser] ["ex" exception (#+ exception:)]] - [function] + ["." function] [data - [text ("text/" Monoid<Text>)] - [collection - [list ("list/" Fold<List> Monad<List> Monoid<List>)] - ["dict" dictionary (#+ Dictionary)]] - [number ("nat/" Codec<Text,Nat>)] - [product] - [bit] - [maybe] + ["." product] + ["." bit] + ["." maybe] [ident ("ident/" Equivalence<Ident> Codec<Text,Ident>)] - ["e" error]] - [macro (#+ with-gensyms) - [code] + ["e" error] + ["." number ("nat/" Codec<Text,Nat>)] + ["." text ("text/" Monoid<Text>)] + [collection + ["." list ("list/" Fold<List> Monad<List> Monoid<List>)] + ["dict" dictionary (#+ Dictionary)]]] + ["." macro (#+ with-gensyms) + ["." code] ["s" syntax (#+ syntax: Syntax)] [syntax ["cs" common] @@ -26,8 +26,8 @@ ["csr" reader] ["csw" writer]]]] [language - [type ("type/" Equivalence<Type>) - [check]]] + ["." type ("type/" Equivalence<Type>) + ["." check]]] ]) (type: #export Env (Dictionary Nat [Type Code])) diff --git a/stdlib/source/lux/macro/poly/equivalence.lux b/stdlib/source/lux/macro/poly/equivalence.lux index c651a5b59..126a2f607 100644 --- a/stdlib/source/lux/macro/poly/equivalence.lux +++ b/stdlib/source/lux/macro/poly/equivalence.lux @@ -5,32 +5,34 @@ ["eq" equivalence] ["p" parser]] [data - [text ("text/" Monoid<Text>) + ["." product] + ["." bit] + ["." maybe] + ["." number ("nat/" Codec<Text,Nat>)] + ["." text ("text/" Monoid<Text>) format] [collection - [list ("list/" Monad<List>)] - [row] - [array] - [queue] - [set] + ["." list ("list/" Monad<List>)] + ["." row] + ["." array] + ["." queue] + ["." set] ["dict" dictionary (#+ Dictionary)] - [tree [rose]]] - [number ("nat/" Codec<Text,Nat>)] - [product] - [bit] - [maybe]] + [tree + ["." rose]]]] [time ["du" duration] ["da" date] ["i" instant]] ["." macro - [code] + ["." code] [syntax (#+ syntax: Syntax) - [common]] - [poly (#+ poly:)]] - [type [unit]] - [language [type]] - ]) + ["." common]] + ["." poly (#+ poly:)]] + [type + ["." unit]] + [language + ["." type]]]) ## [Derivers] (poly: #export Equivalence<?> diff --git a/stdlib/source/lux/macro/poly/functor.lux b/stdlib/source/lux/macro/poly/functor.lux index 5e509935d..824a6ce19 100644 --- a/stdlib/source/lux/macro/poly/functor.lux +++ b/stdlib/source/lux/macro/poly/functor.lux @@ -2,20 +2,21 @@ [lux #* [control [monad (#+ do Monad)] - [functor] + ["." functor] ["p" parser]] [data + ["." product] ["." text format] - [collection [list ("list/" Monad<List> Monoid<List>)]] - [product]] + [collection + ["." list ("list/" Monad<List> Monoid<List>)]]] ["." macro - [code] + ["." code] [syntax (#+ syntax: Syntax) - [common]] - [poly (#+ poly:)]] - [language [type]] - ]) + ["." common]] + ["." poly (#+ poly:)]] + [language + ["." type]]]) (poly: #export Functor<?> (do @ diff --git a/stdlib/source/lux/macro/poly/json.lux b/stdlib/source/lux/macro/poly/json.lux index 1f5b4aab6..ace84fcb3 100644 --- a/stdlib/source/lux/macro/poly/json.lux +++ b/stdlib/source/lux/macro/poly/json.lux @@ -6,20 +6,21 @@ codec ["p" parser]] [data - [bit] + ["." bit] maybe ["e" error] - [sum] - [product] + ["." sum] + ["." product] [number ("frac/" Codec<Text,Frac>) ("nat/" Codec<Text,Nat>) - [i64]] - [text ("text/" Equivalence<Text>) + ["." i64]] + ["." text ("text/" Equivalence<Text>) ["l" lexer] format] - [format ["//" json (#+ JSON)]] + [format + ["//" json (#+ JSON)]] [collection - [list ("list/" Fold<List> Monad<List>)] - [row (#+ Row row) ("row/" Monad<Row>)] + ["." list ("list/" Fold<List> Monad<List>)] + ["." row (#+ Row row) ("row/" Monad<Row>)] ["d" dictionary]]] [time ## ["i" instant] @@ -27,10 +28,12 @@ ["da" date]] [macro (#+ with-gensyms) ["s" syntax (#+ syntax:)] - [code] - [poly (#+ poly:)]] - [type [unit]] - [language [type]]]) + ["." code] + ["." poly (#+ poly:)]] + [type + ["." unit]] + [language + ["." type]]]) (def: tag (-> Nat Frac) diff --git a/stdlib/source/lux/macro/syntax.lux b/stdlib/source/lux/macro/syntax.lux index a22e8a121..1b9229309 100644 --- a/stdlib/source/lux/macro/syntax.lux +++ b/stdlib/source/lux/macro/syntax.lux @@ -1,19 +1,20 @@ (.module: [lux (#- nat int rev) - [macro (#+ with-gensyms)] [control - [monad (#+ do Monad)] + ["." monad (#+ do Monad)] [equivalence (#+ Equivalence)] ["p" parser]] [data - [bit] - [number] - [text ("text/" Monoid<Text>)] - [ident] - [collection [list ("list/" Functor<List>)]] - [maybe] - [error (#+ Error)]]] - [// [code ("code/" Equivalence<Code>)]]) + ["." bit] + ["." ident] + ["." maybe] + ["." error (#+ Error)] + ["." number] + ["." text ("text/" Monoid<Text>)] + [collection + ["." list ("list/" Functor<List>)]]]] + ["." // (#+ with-gensyms) + ["." code ("code/" Equivalence<Code>)]]) ## [Utils] (def: (join-pairs pairs) @@ -234,7 +235,7 @@ (case ?parts (#.Some [name args meta body]) (with-gensyms [g!tokens g!body g!error] - (do macro.Monad<Meta> + (do //.Monad<Meta> [vars+parsers (monad.map @ (: (-> Code (Meta [Code Code])) (function (_ arg) @@ -246,7 +247,7 @@ (wrap [(code.symbol var-name) (` any)]) _ - (macro.fail "Syntax pattern expects records or symbols.")))) + (//.fail "Syntax pattern expects records or symbols.")))) args) #let [g!state (code.symbol ["" "*compiler*"]) error-msg (code.text (text/compose "Wrong syntax for " name)) @@ -265,9 +266,9 @@ (: (..Syntax (Meta (List Code))) ((~! do) (~! p.Monad<Parser>) [(~+ (join-pairs vars+parsers))] - ((~' wrap) ((~! do) (~! macro.Monad<Meta>) + ((~' wrap) ((~! do) (~! //.Monad<Meta>) [] (~ body))))))))))))) _ - (macro.fail "Wrong syntax for syntax:")))) + (//.fail "Wrong syntax for syntax:")))) diff --git a/stdlib/source/lux/macro/syntax/common/reader.lux b/stdlib/source/lux/macro/syntax/common/reader.lux index a3dafa296..22a785049 100644 --- a/stdlib/source/lux/macro/syntax/common/reader.lux +++ b/stdlib/source/lux/macro/syntax/common/reader.lux @@ -4,13 +4,14 @@ monad ["p" parser ("parser/" Monad<Parser>)]] [data - [collection [list]] [ident ("ident/" Equivalence<Ident>)] - [product] - [maybe]] - ["." macro - ["s" syntax (#+ syntax: Syntax)]]] - [//]) + ["." product] + ["." maybe] + [collection + ["." list]]]] + ["." // + ["/." /// + ["s" syntax (#+ syntax: Syntax)]]]) ## Exports (def: #export export @@ -107,8 +108,8 @@ (do p.Monad<Parser> [definition-raw s.any me-definition-raw (|> definition-raw - macro.expand-all - (macro.run compiler) + ////.expand-all + (////.run compiler) s.lift)] (s.local me-definition-raw (s.form (do @ diff --git a/stdlib/source/lux/macro/syntax/common/writer.lux b/stdlib/source/lux/macro/syntax/common/writer.lux index 7a7416894..150cd7e52 100644 --- a/stdlib/source/lux/macro/syntax/common/writer.lux +++ b/stdlib/source/lux/macro/syntax/common/writer.lux @@ -2,10 +2,12 @@ {#.doc "Commons syntax writers."} [lux #* [data - [collection [list ("list/" Functor<List>)]] - [product]] - [macro [code]]] - [//]) + [collection + [list ("list/" Functor<List>)]] + ["." product]] + [macro + ["." code]]] + ["." //]) (def: #export (export exported?) (-> Bit (List Code)) diff --git a/stdlib/source/lux/math.lux b/stdlib/source/lux/math.lux index d90db4a33..f29eafe63 100644 --- a/stdlib/source/lux/math.lux +++ b/stdlib/source/lux/math.lux @@ -4,12 +4,13 @@ monad ["p" parser ("parser/" Functor<Parser>)]] [data - [product] - [number] - [collection [list ("list/" Fold<List>)]]] + ["." product] + ["." number] + [collection + [list ("list/" Fold<List>)]]] ["." macro ["s" syntax (#+ syntax: Syntax)] - [code]]]) + ["." code]]]) ## [Values] (do-template [<name> <value> <doc>] diff --git a/stdlib/source/lux/math/logic/fuzzy.lux b/stdlib/source/lux/math/logic/fuzzy.lux index 0ee8a0c36..99bc2f8db 100644 --- a/stdlib/source/lux/math/logic/fuzzy.lux +++ b/stdlib/source/lux/math/logic/fuzzy.lux @@ -4,9 +4,10 @@ [predicate (#+ Predicate)]] [data [collection - [list] - [set (#+ Set)]]]] - [// ["&" continuous]]) + ["." list] + ["." set (#+ Set)]]]] + [// + ["&" continuous]]) (type: #export (Fuzzy a) (-> a Rev)) diff --git a/stdlib/source/lux/math/modular.lux b/stdlib/source/lux/math/modular.lux index bb15adac1..8fda63467 100644 --- a/stdlib/source/lux/math/modular.lux +++ b/stdlib/source/lux/math/modular.lux @@ -7,14 +7,14 @@ [monad (#+ do)]] [data ["e" error (#+ Error)] - [number ("int/" Codec<Text,Int>)] + ["." number ("int/" Codec<Text,Int>)] [text ("text/" Monoid<Text>) ["l" lexer (#+ Lexer)]]] - [type abstract] + [type + abstract] [macro - [code] - ["s" syntax (#+ syntax:)]] - [math]]) + ["." code] + ["s" syntax (#+ syntax:)]]]) (exception: #export zero-cannot-be-a-modulus) diff --git a/stdlib/source/lux/math/random.lux b/stdlib/source/lux/math/random.lux index 86c7d9efd..3f9d29d53 100644 --- a/stdlib/source/lux/math/random.lux +++ b/stdlib/source/lux/math/random.lux @@ -3,27 +3,29 @@ [control [functor (#+ Functor)] [apply (#+ Apply)] - [monad (#+ do Monad)] + ["." monad (#+ do Monad)] hash] [data - [text ("text/" Monoid<Text>) - [unicode (#+ Char Segment)]] - [product] - [maybe] - [number (#+ hex) - [i64] + ["." product] + ["." maybe] + ["." number (#+ hex) + ["." i64] ["r" ratio] ["c" complex]] + ["." text ("text/" Monoid<Text>) + ["." unicode (#+ Char Segment)]] [collection - [list ("list/" Fold<List>)] - [array] - ["dict" dictionary (#+ Dictionary)] - [queue (#+ Queue)] - [set (#+ Set)] - [stack (#+ Stack)] - [row (#+ Row)] - [tree [finger (#+ Tree)]]]] - [type [refinement (#+ Refiner Refined)]] + ["." list ("list/" Fold<List>)] + ["." array] + ["." dictionary (#+ Dictionary)] + ["." queue (#+ Queue)] + ["." set (#+ Set)] + ["." stack (#+ Stack)] + ["." row (#+ Row)] + [tree + ["." finger (#+ Tree)]]]] + [type + [refinement (#+ Refiner Refined)]] ]) (type: #export #rec PRNG @@ -248,11 +250,11 @@ (do @ [k key-gen v value-gen - #let [kv+ (dict.put k v kv)]] - (if (n/= size (dict.size kv+)) + #let [kv+ (dictionary.put k v kv)]] + (if (n/= size (dictionary.size kv+)) (wrap kv+) (recur []))))) - (:: Monad<Random> wrap (dict.new Hash<a>)))) + (:: Monad<Random> wrap (dictionary.new Hash<a>)))) (def: #export (run prng calc) (All [a] (-> PRNG (Random a) [PRNG a])) diff --git a/stdlib/source/lux/test.lux b/stdlib/source/lux/test.lux index f9bd93926..723a1d63c 100644 --- a/stdlib/source/lux/test.lux +++ b/stdlib/source/lux/test.lux @@ -1,24 +1,27 @@ (.module: {#.doc "Tools for unit & property-based/generative testing."} [lux #* - [macro (#+ with-gensyms) - ["s" syntax (#+ syntax: Syntax)] - [code]] [control - [monad (#+ do Monad)] + ["." monad (#+ do Monad)] ["p" parser]] - [concurrency [promise (#+ Promise)]] [data - [product] - [maybe] + ["." product] + ["." maybe] ["e" error] ["." text format] - [collection [list ("list/" Monad<List> Fold<List>)]]] - [io (#+ IO io)] + [collection + ["." list ("list/" Monad<List> Fold<List>)]]] [time - [instant] - [duration]] - ["r" math/random]]) + ["." instant] + ["." duration]] + [math + ["r" random]] + ["." macro (#+ with-gensyms) + ["s" syntax (#+ syntax: Syntax)] + ["." code]] + [concurrency + ["." promise (#+ Promise)]] + ["." io (#+ IO io)]]) ## [Types] (type: #export Counters [Nat Nat]) diff --git a/stdlib/source/lux/time/date.lux b/stdlib/source/lux/time/date.lux index 3851d5ab4..12d928a8f 100644 --- a/stdlib/source/lux/time/date.lux +++ b/stdlib/source/lux/time/date.lux @@ -9,11 +9,12 @@ [monad (#+ do)]] [data ["e" error] - [maybe] - [number ("int/" Codec<Text,Int>)] + ["." maybe] + ["." number ("int/" Codec<Text,Int>)] [text ("text/" Monoid<Text>) ["l" lexer]] - [collection [row (#+ Row row)]]]]) + [collection + ["." row (#+ Row row)]]]]) (type: #export Year Int) diff --git a/stdlib/source/lux/time/duration.lux b/stdlib/source/lux/time/duration.lux index 748cd039e..48c49e61e 100644 --- a/stdlib/source/lux/time/duration.lux +++ b/stdlib/source/lux/time/duration.lux @@ -8,7 +8,7 @@ ["p" parser] [monad (#+ do)]] [data - [number ("int/" Codec<Text,Int> Number<Int>)] + ["." number ("int/" Codec<Text,Int> Number<Int>)] [text ("text/" Monoid<Text>) ["l" lexer]] ["e" error]] diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux index 9002ff9ef..a574ef208 100644 --- a/stdlib/source/lux/time/instant.lux +++ b/stdlib/source/lux/time/instant.lux @@ -1,6 +1,6 @@ (.module: [lux #* - [io (#- run)] + [io (#+ IO io)] [control equivalence order @@ -9,18 +9,19 @@ [monad (#+ do Monad)] ["p" parser]] [data + ["e" error] + ["." maybe] + ["." number ("int/" Codec<Text,Int>)] [text ("text/" Monoid<Text>) ["l" lexer]] - [number ("int/" Codec<Text,Int>)] - ["e" error] - [maybe] [collection - [list ("list/" Fold<List>)] - [row (#+ Row row) ("row/" Functor<Row> Fold<Row>)]]] - [type abstract]] + ["." list ("list/" Fold<List>)] + ["." row (#+ Row row) ("row/" Functor<Row> Fold<Row>)]]] + [type + abstract]] [// - [duration ("duration/" Order<Duration>)] - [date]]) + ["." duration ("duration/" Order<Duration>)] + ["." date]]) (abstract: #export Instant {#.doc "Instant is defined as milliseconds since the epoch."} diff --git a/stdlib/source/lux/type/abstract.lux b/stdlib/source/lux/type/abstract.lux index 7b8effc5d..f32f60de8 100644 --- a/stdlib/source/lux/type/abstract.lux +++ b/stdlib/source/lux/type/abstract.lux @@ -5,17 +5,19 @@ ["p" parser]] [data [text ("text/" Equivalence<Text> Monoid<Text>)] - [error] - [collection [list ("list/" Functor<List> Monoid<List>)]]] - [macro ("meta/" Monad<Meta>) - [code] + ["." error] + [collection + [list ("list/" Functor<List> Monoid<List>)]]] + ["." macro ("meta/" Monad<Meta>) + ["." code] ["s" syntax (#+ syntax:)] [syntax ["cs" common] [common ["csr" reader] ["csw" writer]]]] - [language [type (#+ :cast)]]]) + [language + [type (#+ :cast)]]]) (def: (get k plist) (All [a] diff --git a/stdlib/source/lux/type/implicit.lux b/stdlib/source/lux/type/implicit.lux index 103f79d27..b94eb6684 100644 --- a/stdlib/source/lux/type/implicit.lux +++ b/stdlib/source/lux/type/implicit.lux @@ -1,23 +1,24 @@ (.module: [lux #* - [control [monad (#+ do Monad)] + [control + ["." monad (#+ do Monad)] ["eq" equivalence] ["p" parser]] [data - [text ("text/" Equivalence<Text>) + ["." product] + ["." maybe] + ["." number] + ["." text ("text/" Equivalence<Text>) format] - [number] - [collection [list ("list/" Monad<List> Fold<List>)] - ["dict" dictionary (#+ Dictionary)]] - [product] - [maybe]] - [macro (#+ Monad<Meta>) - [code] + [collection + ["." list ("list/" Monad<List> Fold<List>)] + ["dict" dictionary (#+ Dictionary)]]] + ["." macro (#+ Monad<Meta>) + ["." code] ["s" syntax (#+ syntax: Syntax)]] [language - [type] - [type ["tc" check (#+ Check)]]] - ]) + ["." type + ["." check (#+ Check)]]]]) (def: (find-type-var id env) (-> Nat Type-Context (Meta Type)) @@ -59,20 +60,20 @@ (#.Apply arg func) (case (type.apply (list arg) func) #.None - (tc.fail (format "Cannot apply type " (%type func) " to type " (%type arg))) + (check.fail (format "Cannot apply type " (%type func) " to type " (%type arg))) (#.Some sig-type') (find-member-type idx sig-type')) (#.Product left right) (if (n/= +0 idx) - (:: tc.Monad<Check> wrap left) + (:: check.Monad<Check> wrap left) (find-member-type (dec idx) right)) _ (if (n/= +0 idx) - (:: tc.Monad<Check> wrap sig-type) - (tc.fail (format "Cannot find member type " (%n idx) " for " (%type sig-type)))))) + (:: check.Monad<Check> wrap sig-type) + (check.fail (format "Cannot find member type " (%n idx) " for " (%type sig-type)))))) (def: (find-member-name member) (-> Ident (Meta Ident)) @@ -156,41 +157,41 @@ (apply-function-type func' arg) (#.UnivQ _) - (do tc.Monad<Check> - [[id var] tc.var] + (do check.Monad<Check> + [[id var] check.var] (apply-function-type (maybe.assume (type.apply (list var) func)) arg)) (#.Function input output) - (do tc.Monad<Check> - [_ (tc.check input arg)] + (do check.Monad<Check> + [_ (check.check input arg)] (wrap output)) _ - (tc.fail (format "Invalid function type: " (%type func))))) + (check.fail (format "Invalid function type: " (%type func))))) (def: (concrete-type type) (-> Type (Check [(List Nat) Type])) (case type (#.UnivQ _) - (do tc.Monad<Check> - [[id var] tc.var + (do check.Monad<Check> + [[id var] check.var [ids final-output] (concrete-type (maybe.assume (type.apply (list var) type)))] (wrap [(#.Cons id ids) final-output])) _ - (:: tc.Monad<Check> wrap [(list) type]))) + (:: check.Monad<Check> wrap [(list) type]))) (def: (check-apply member-type input-types output-type) (-> Type (List Type) Type (Check [])) - (do tc.Monad<Check> - [member-type' (monad.fold tc.Monad<Check> + (do check.Monad<Check> + [member-type' (monad.fold check.Monad<Check> (function (_ input member) (apply-function-type member input)) member-type input-types)] - (tc.check output-type member-type'))) + (check.check output-type member-type'))) (type: #rec Instance {#constructor Ident @@ -204,14 +205,14 @@ [compiler macro.get-compiler] (case (|> alts (list/map (function (_ [alt-name alt-type]) - (case (tc.run context - (do tc.Monad<Check> - [[tvars alt-type] (concrete-type alt-type) - #let [[deps alt-type] (type.flatten-function alt-type)] - _ (tc.check dep alt-type) - context' tc.context - =deps (monad.map @ (provision compiler context') deps)] - (wrap =deps))) + (case (check.run context + (do check.Monad<Check> + [[tvars alt-type] (concrete-type alt-type) + #let [[deps alt-type] (type.flatten-function alt-type)] + _ (check.check dep alt-type) + context' check.context + =deps (monad.map @ (provision compiler context') deps)] + (wrap =deps))) (#.Left error) (list) @@ -232,18 +233,18 @@ (do Monad<Meta> [alts local-structs] (test-provision provision context dep alts)) (do Monad<Meta> [alts import-structs] (test-provision provision context dep alts)))) (#.Left error) - (tc.fail error) + (check.fail error) (#.Right candidates) (case candidates #.Nil - (tc.fail (format "No candidates for provisioning: " (%type dep))) + (check.fail (format "No candidates for provisioning: " (%type dep))) (#.Cons winner #.Nil) - (:: tc.Monad<Check> wrap winner) + (:: check.Monad<Check> wrap winner) _ - (tc.fail (format "Too many candidates for provisioning: " (%type dep) " --- " (%list (|>> product.left %ident) candidates)))) + (check.fail (format "Too many candidates for provisioning: " (%type dep) " --- " (%list (|>> product.left %ident) candidates)))) )) (def: (test-alternatives sig-type member-idx input-types output-type alts) @@ -253,16 +254,16 @@ context macro.type-context] (case (|> alts (list/map (function (_ [alt-name alt-type]) - (case (tc.run context - (do tc.Monad<Check> - [[tvars alt-type] (concrete-type alt-type) - #let [[deps alt-type] (type.flatten-function alt-type)] - _ (tc.check alt-type sig-type) - member-type (find-member-type member-idx alt-type) - _ (check-apply member-type input-types output-type) - context' tc.context - =deps (monad.map @ (provision compiler context') deps)] - (wrap =deps))) + (case (check.run context + (do check.Monad<Check> + [[tvars alt-type] (concrete-type alt-type) + #let [[deps alt-type] (type.flatten-function alt-type)] + _ (check.check alt-type sig-type) + member-type (find-member-type member-idx alt-type) + _ (check-apply member-type input-types output-type) + context' check.context + =deps (monad.map @ (provision compiler context') deps)] + (wrap =deps))) (#.Left error) (list) diff --git a/stdlib/source/lux/type/object/interface.lux b/stdlib/source/lux/type/object/interface.lux index 42284b4b3..d4d6fa518 100644 --- a/stdlib/source/lux/type/object/interface.lux +++ b/stdlib/source/lux/type/object/interface.lux @@ -1,26 +1,27 @@ (.module: [lux #* [control - [monad (#+ do Monad)] + ["." monad (#+ do Monad)] ["p" parser ("parser/" Monad<Parser>)]] [data - [product] - [maybe] + ["." product] + ["." maybe] [ident ("ident/" Equivalence<Ident>)] ["." text format] [collection - [list ("list/" Functor<List> Fold<List> Monoid<List>)] - [set (#+ Set)]]] - [macro (#+ Monad<Meta>) ("meta/" Monad<Meta>) - [code] + ["." list ("list/" Functor<List> Fold<List> Monoid<List>)] + ["." set (#+ Set)]]] + ["." macro (#+ Monad<Meta>) ("meta/" Monad<Meta>) + ["." code] ["s" syntax (#+ syntax:)] [syntax ["cs" common] [common ["csr" reader] ["csw" writer]]]] - [language [type]]]) + [language + ["." type]]]) ## [Common] (type: Declaration diff --git a/stdlib/source/lux/type/object/protocol.lux b/stdlib/source/lux/type/object/protocol.lux index ebbf9cc4b..64078b865 100644 --- a/stdlib/source/lux/type/object/protocol.lux +++ b/stdlib/source/lux/type/object/protocol.lux @@ -2,12 +2,13 @@ [lux #* [control ["p" parser] - [monad (#+ do)]] + ["." monad (#+ do)]] [data - [sum] - [collection [list ("list/" Functor<List>)]]] - [macro ("meta/" Monad<Meta>) - [code] + ["." sum] + [collection + [list ("list/" Functor<List>)]]] + ["." macro ("meta/" Monad<Meta>) + ["." code] ["s" syntax (#+ syntax:)] [syntax ["cs" common] diff --git a/stdlib/source/lux/type/quotient.lux b/stdlib/source/lux/type/quotient.lux index a2aeeaeec..63d022a31 100644 --- a/stdlib/source/lux/type/quotient.lux +++ b/stdlib/source/lux/type/quotient.lux @@ -3,12 +3,15 @@ [control [monad (#+ do)] ["p" parser]] - [data ["e" error (#+ Error)]] - [language [type]] - [type abstract] + [data + ["e" error (#+ Error)]] + [language + ["." type]] + [type + abstract] ["." macro ["s" syntax (#+ syntax:)] - [poly]]]) + ["." poly]]]) (abstract: #export (Class t c q) {} diff --git a/stdlib/source/lux/type/refinement.lux b/stdlib/source/lux/type/refinement.lux index bc8f92dae..52a3c01be 100644 --- a/stdlib/source/lux/type/refinement.lux +++ b/stdlib/source/lux/type/refinement.lux @@ -4,12 +4,15 @@ [predicate (#+ Predicate)] [monad (#+ do)] ["p" parser]] - [data ["e" error (#+ Error)]] - [language [type ("type/" Equivalence<Type>)]] - [type abstract] + [data + ["e" error (#+ Error)]] + [language + ["." type ("type/" Equivalence<Type>)]] + [type + abstract] ["." macro ["s" syntax (#+ syntax:)] - [poly]]]) + ["." poly]]]) (abstract: #export (Refined t r) {#.doc "A refined type 'r' of base type 't' using a predicate."} diff --git a/stdlib/source/lux/type/resource.lux b/stdlib/source/lux/type/resource.lux index 89523997b..7dd961ee8 100644 --- a/stdlib/source/lux/type/resource.lux +++ b/stdlib/source/lux/type/resource.lux @@ -3,24 +3,26 @@ [control ["p" parser] ["ex" exception (#+ exception:)] - [monad (#+ Monad do) + ["." monad (#+ Monad do) [indexed (#+ IxMonad)]]] [data - [identity (#+ Identity)] - [maybe] - [product] - [number] + ["." identity (#+ Identity)] + ["." maybe] + ["." product] + ["." number] [text format] [collection ["dict" dictionary (#+ Dictionary)] - [set] - [row (#+ Row)] - [list ("list/" Functor<List> Fold<List>)]]] - [concurrency [promise (#+ Promise)]] + ["." set] + ["." row (#+ Row)] + ["." list ("list/" Functor<List> Fold<List>)]]] + [concurrency + ["." promise (#+ Promise)]] ["." macro ["s" syntax (#+ Syntax syntax:)]] - [type abstract] - [io (#+ IO)]]) + [type + abstract] + ["." io (#+ IO)]]) (type: #export (Procedure monad input output value) (-> input (monad [output value]))) diff --git a/stdlib/source/lux/type/unit.lux b/stdlib/source/lux/type/unit.lux index 341e556d4..e7be06eed 100644 --- a/stdlib/source/lux/type/unit.lux +++ b/stdlib/source/lux/type/unit.lux @@ -12,7 +12,7 @@ [text format]] ["." macro - [code] + ["." code] ["s" syntax (#+ syntax:)] [syntax ["cs" common] diff --git a/stdlib/source/lux/world/blob.jvm.lux b/stdlib/source/lux/world/blob.jvm.lux index ce2e39984..c4c659ccf 100644 --- a/stdlib/source/lux/world/blob.jvm.lux +++ b/stdlib/source/lux/world/blob.jvm.lux @@ -5,13 +5,13 @@ ["ex" exception (#+ exception:)] ["eq" equivalence]] [data - [maybe] - [error (#+ Error)] - [text - format] + ["." maybe] + ["." error (#+ Error)] [number - [i64]]] - [host (#+ import:)]]) + ["." i64]] + [text + format]] + ["." host (#+ import:)]]) (exception: #export (index-out-of-bounds {description Text}) description) diff --git a/stdlib/source/lux/world/console.lux b/stdlib/source/lux/world/console.lux index b66e83ad3..2aafa9571 100644 --- a/stdlib/source/lux/world/console.lux +++ b/stdlib/source/lux/world/console.lux @@ -3,13 +3,15 @@ [control [monad (#+ do)]] [data ["e" error] - [text]] + ["." text]] [concurrency - [promise] - [task (#+ Task)]] - [type [object interface]] - [io (#+ IO Process io)] - [host]]) + ["." promise] + ["." task (#+ Task)]] + [type + [object + interface]] + ["." io (#+ IO Process io)] + [host (#+ import:)]]) (interface: #export Console (read-char [] (Task Text)) @@ -18,27 +20,27 @@ (close [] (Task Any))) (for {"JVM" - (as-is (host.import: java/io/InputStream + (as-is (import: java/io/InputStream (read [] #io #try int) (available [] #io #try int) (mark [int] #io #try void) (reset [] #io #try void)) - (host.import: java/io/Reader) + (import: java/io/Reader) - (host.import: java/io/PrintStream + (import: java/io/PrintStream (print [String] #io #try void)) - (host.import: java/lang/System + (import: java/lang/System (#static in java/io/InputStream) (#static out java/io/PrintStream)) - (host.import: java/lang/Appendable + (import: java/lang/Appendable (append [CharSequence] Appendable)) - (host.import: java/lang/String) + (import: java/lang/String) - (host.import: java/lang/StringBuffer + (import: java/lang/StringBuffer (new [String]) (toString [] String)) diff --git a/stdlib/source/lux/world/environment.jvm.lux b/stdlib/source/lux/world/environment.jvm.lux index 32af351d4..019dab706 100644 --- a/stdlib/source/lux/world/environment.jvm.lux +++ b/stdlib/source/lux/world/environment.jvm.lux @@ -1,29 +1,31 @@ (.module: [lux #* [data - [text] - [format [context (#+ Context)]] - [collection [dictionary]]] + ["." text] + [format + [context (#+ Context)]] + [collection + ["." dictionary]]] [io (#- run)] - [host]]) + [host (#+ import:)]]) -(host.import: java/lang/String) +(import: java/lang/String) -(host.import: (java/util/Map$Entry k v) +(import: (java/util/Map$Entry k v) (getKey [] k) (getValue [] v)) -(host.import: (java/util/Iterator a) +(import: (java/util/Iterator a) (hasNext [] boolean) (next [] a)) -(host.import: (java/util/Set a) +(import: (java/util/Set a) (iterator [] (Iterator a))) -(host.import: (java/util/Map k v) +(import: (java/util/Map k v) (entrySet [] (Set (Map$Entry k v)))) -(host.import: java/lang/System +(import: java/lang/System (#static getenv [] (Map String String))) (def: (consume-iterator f iterator) diff --git a/stdlib/source/lux/world/file.lux b/stdlib/source/lux/world/file.lux index 9758d7e44..acaa2c244 100644 --- a/stdlib/source/lux/world/file.lux +++ b/stdlib/source/lux/world/file.lux @@ -1,20 +1,23 @@ (.module: [lux #* [control - [monad (#+ Monad do)] + ["." monad (#+ Monad do)] ["ex" exception (#+ Exception exception:)] pipe] [data - [error (#+ Error)] - text/format - [collection [array]]] + ["." error (#+ Error)] + [text + format] + [collection + ["." array]]] [time - [instant (#+ Instant)] - [duration]] - [world [blob (#+ Blob)]] - [io (#+ Process)] + ["." instant (#+ Instant)] + ["." duration]] + [world + ["." blob (#+ Blob)]] + ["." io (#+ Process)] [host (#+ import:)] - [language/host]]) + ["." language/host]]) (type: #export File Text) diff --git a/stdlib/source/lux/world/net/tcp.jvm.lux b/stdlib/source/lux/world/net/tcp.jvm.lux index 30c3ef49b..86b19136a 100644 --- a/stdlib/source/lux/world/net/tcp.jvm.lux +++ b/stdlib/source/lux/world/net/tcp.jvm.lux @@ -3,34 +3,37 @@ [control monad] [concurrency - [promise (#+ Promise promise)] + ["." promise (#+ Promise promise)] [task (#+ Task)] - [frp]] - [data ["e" error]] - [type abstract] - [world [blob (#+ Blob)]] - [io (#+ Process)] - [host]] - [//]) + ["." frp]] + [data + ["e" error]] + [type + abstract] + [world + [blob (#+ Blob)]] + ["." io (#+ Process)] + [host (#+ import:)]] + ["." //]) -(host.import: java/lang/AutoCloseable +(import: java/lang/AutoCloseable (close [] #io #try void)) -(host.import: java/io/Flushable +(import: java/io/Flushable (flush [] #io #try void)) -(host.import: java/io/InputStream +(import: java/io/InputStream (read [(Array byte) int int] #io #try int)) -(host.import: java/io/OutputStream +(import: java/io/OutputStream (write [(Array byte) int int] #io #try void)) -(host.import: java/net/Socket +(import: java/net/Socket (new [String int] #io #try) (getInputStream [] #io #try InputStream) (getOutputStream [] #io #try OutputStream)) -(host.import: java/net/ServerSocket +(import: java/net/ServerSocket (new [int] #io #try) (accept [] #io #try Socket)) diff --git a/stdlib/source/lux/world/net/udp.jvm.lux b/stdlib/source/lux/world/net/udp.jvm.lux index 9e61e55eb..b7c3533e7 100644 --- a/stdlib/source/lux/world/net/udp.jvm.lux +++ b/stdlib/source/lux/world/net/udp.jvm.lux @@ -8,32 +8,35 @@ ["T" task]] [data ["e" error] - [maybe] - [collection [array]]] - [type abstract] - [world [blob (#+ Blob)]] - [io] - [host]] - [//]) + ["." maybe] + [collection + ["." array]]] + [type + abstract] + [world + [blob (#+ Blob)]] + ["." io] + [host (#+ import:)]] + ["." //]) -(host.import: java/lang/AutoCloseable +(import: java/lang/AutoCloseable (close [] #io #try void)) -(host.import: java/io/Flushable +(import: java/io/Flushable (flush [] #io #try void)) -(host.import: java/net/InetAddress +(import: java/net/InetAddress (#static getAllByName [String] #io #try (Array InetAddress)) (getHostAddress [] String)) -(host.import: java/net/DatagramPacket +(import: java/net/DatagramPacket (new #as new|send [(Array byte) int int InetAddress int]) (new #as new|receive [(Array byte) int int]) (getAddress [] InetAddress) (getPort [] int) (getLength [] int)) -(host.import: java/net/DatagramSocket +(import: java/net/DatagramSocket (new #as new|client [] #io #try) (new #as new|server [int] #io #try) (receive [DatagramPacket] #io #try void) diff --git a/stdlib/test/test/lux.lux b/stdlib/test/test/lux.lux index a4730e2ef..5325d9b79 100644 --- a/stdlib/test/test/lux.lux +++ b/stdlib/test/test/lux.lux @@ -2,14 +2,14 @@ [lux #* [control [monad (#+ do)]] - [math] - ["r" math/random] [data - [maybe] + ["." maybe] [number - [i64]] + ["." i64]] [text ("text/" Equivalence<Text>) format]] + ["." math + ["r" random]] ["." macro ["s" syntax (#+ syntax:)]] test]) diff --git a/stdlib/test/test/lux/cli.lux b/stdlib/test/test/lux/cli.lux index 0bcdb785e..1504f2187 100644 --- a/stdlib/test/test/lux/cli.lux +++ b/stdlib/test/test/lux/cli.lux @@ -1,19 +1,18 @@ (.module: [lux #* - [io] [control ["M" monad (#+ do Monad)] pipe ["p" parser]] [data - [product] - [sum] ["E" error] - [number] + ["." number] [text ("text/" Equivalence<Text>) format] - [collection [list]]] - [math ["r" random]] + [collection + ["." list]]] + [math + ["r" random]] ["/" cli]] lux/test) diff --git a/stdlib/test/test/lux/concurrency/actor.lux b/stdlib/test/test/lux/concurrency/actor.lux index a4f2ae234..a84ded979 100644 --- a/stdlib/test/test/lux/concurrency/actor.lux +++ b/stdlib/test/test/lux/concurrency/actor.lux @@ -1,12 +1,11 @@ (.module: [lux #* - [io (#+ IO io)] + ["." io (#+ IO io)] [control ["M" monad (#+ do Monad)] ["ex" exception]] [data ["e" error] - [number] [text format]] [concurrency diff --git a/stdlib/test/test/lux/concurrency/atom.lux b/stdlib/test/test/lux/concurrency/atom.lux index 77f52b94d..03895bdeb 100644 --- a/stdlib/test/test/lux/concurrency/atom.lux +++ b/stdlib/test/test/lux/concurrency/atom.lux @@ -1,12 +1,8 @@ (.module: [lux #* - [io] + ["." io] [control ["M" monad (#+ do Monad)]] - [data - [number] - [text - format]] [concurrency ["&" atom]] [math diff --git a/stdlib/test/test/lux/concurrency/frp.lux b/stdlib/test/test/lux/concurrency/frp.lux index 0cb6b7831..db2ad4a2f 100644 --- a/stdlib/test/test/lux/concurrency/frp.lux +++ b/stdlib/test/test/lux/concurrency/frp.lux @@ -1,18 +1,16 @@ (.module: [lux #* - [io (#+ IO io)] + ["." io (#+ IO io)] [control - [monad (#+ do Monad)]] + ["." monad (#+ do Monad)]] [data - [number] - [text - format] + ["." number] [collection - [list]]] + ["." list]]] [concurrency - [promise ("promise/" Monad<Promise>)] - [frp (#+ Channel)] - [atom (#+ Atom atom)]]] + ["." promise ("promise/" Monad<Promise>)] + ["." frp (#+ Channel)] + ["." atom (#+ Atom atom)]]] lux/test) (def: (write! values channel) diff --git a/stdlib/test/test/lux/concurrency/promise.lux b/stdlib/test/test/lux/concurrency/promise.lux index 0aae405ab..2ede2b349 100644 --- a/stdlib/test/test/lux/concurrency/promise.lux +++ b/stdlib/test/test/lux/concurrency/promise.lux @@ -1,13 +1,9 @@ (.module: [lux #* - [io (#+ IO io)] + ["." io] [control ["M" monad (#+ do Monad)] pipe] - [data - [number] - [text - format]] [concurrency ["&" promise ("&/" Monad<Promise>)]] [math @@ -17,7 +13,7 @@ (context: "Promises" ($_ seq (wrap (do &.Monad<Promise> - [running? (&.future (io #1))] + [running? (&.future (io.io #1))] (assert "Can run IO actions in separate threads." running?))) @@ -27,8 +23,8 @@ #1))) (wrap (do &.Monad<Promise> - [[left right] (&.seq (&.future (io #1)) - (&.future (io #0)))] + [[left right] (&.seq (&.future (io.io #1)) + (&.future (io.io #0)))] (assert "Can combine promises sequentially." (and left (not right))))) diff --git a/stdlib/test/test/lux/concurrency/semaphore.lux b/stdlib/test/test/lux/concurrency/semaphore.lux index 7eadd5ac7..b941654f0 100644 --- a/stdlib/test/test/lux/concurrency/semaphore.lux +++ b/stdlib/test/test/lux/concurrency/semaphore.lux @@ -1,17 +1,18 @@ (.module: [lux #* [control - [monad (#+ do)]] + ["." monad (#+ do)]] [data - [maybe] - [text ("text/" Equivalence<Text> Monoid<Text>) + ["." maybe] + ["." text ("text/" Equivalence<Text> Monoid<Text>) format] - [collection [list ("list/" Functor<List>)]]] + [collection + ["." list ("list/" Functor<List>)]]] [concurrency ["/" semaphore] - [promise (#+ Promise)] - [atom (#+ Atom)]] - [io] + ["." promise (#+ Promise)] + ["." atom (#+ Atom)]] + ["." io] [math ["r" random]]] lux/test) diff --git a/stdlib/test/test/lux/concurrency/stm.lux b/stdlib/test/test/lux/concurrency/stm.lux index 1a254284f..d4697cd6e 100644 --- a/stdlib/test/test/lux/concurrency/stm.lux +++ b/stdlib/test/test/lux/concurrency/stm.lux @@ -1,19 +1,17 @@ (.module: [lux #* - [io (#+ IO)] + ["." io (#+ IO)] [control ["M" monad (#+ do Monad)]] [data - [number] - [maybe] - [text format] + ["." number] [collection - [list ("list/" Functor<List>)]]] + ["." list ("list/" Functor<List>)]]] [concurrency - [atom (#+ Atom atom)] + ["." atom (#+ Atom atom)] ["&" stm] - [promise] - [frp (#+ Channel)]] + ["." promise] + ["." frp (#+ Channel)]] [math ["r" random]]] lux/test) diff --git a/stdlib/test/test/lux/control/continuation.lux b/stdlib/test/test/lux/control/continuation.lux index 9d5cad55b..60dfb7ac4 100644 --- a/stdlib/test/test/lux/control/continuation.lux +++ b/stdlib/test/test/lux/control/continuation.lux @@ -4,8 +4,9 @@ ["M" monad (#+ do Monad)] ["&" continuation]] [data - [number] - [collection [list]]] + ["." number] + [collection + ["." list]]] ["r" math/random]] lux/test) diff --git a/stdlib/test/test/lux/control/exception.lux b/stdlib/test/test/lux/control/exception.lux index 9e11dbe0f..c1aa9d08e 100644 --- a/stdlib/test/test/lux/control/exception.lux +++ b/stdlib/test/test/lux/control/exception.lux @@ -1,14 +1,12 @@ (.module: [lux #* - [io] [control ["M" monad (#+ do Monad)] ["&" exception (#+ exception:)]] [data ["E" error] ["." text - format] - [number]] + format]] [math ["r" random]]] lux/test) diff --git a/stdlib/test/test/lux/control/interval.lux b/stdlib/test/test/lux/control/interval.lux index 89691a719..190ebce0d 100644 --- a/stdlib/test/test/lux/control/interval.lux +++ b/stdlib/test/test/lux/control/interval.lux @@ -5,13 +5,10 @@ ["M" monad (#+ do Monad)] pipe ["&" interval]] - [io] [math ["r" random]] [data - [number] - [text - format] + ["." number] [collection ["S" set] ["L" list]]]]) diff --git a/stdlib/test/test/lux/control/parser.lux b/stdlib/test/test/lux/control/parser.lux index 70cf4cfbe..505ee4b55 100644 --- a/stdlib/test/test/lux/control/parser.lux +++ b/stdlib/test/test/lux/control/parser.lux @@ -1,16 +1,15 @@ (.module: [lux #* - [io] [control ["M" monad (#+ do)] [equivalence (#+ Equivalence)] ["&" parser]] [data - [error (#+ Error)]] + ["." error (#+ Error)]] [math ["r" random]] ["." macro - [code] + ["." code] ["s" syntax (#+ syntax:)]]] lux/test) diff --git a/stdlib/test/test/lux/control/pipe.lux b/stdlib/test/test/lux/control/pipe.lux index 6e232a255..d03becffc 100644 --- a/stdlib/test/test/lux/control/pipe.lux +++ b/stdlib/test/test/lux/control/pipe.lux @@ -1,12 +1,9 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)] pipe] [data - [number] - [product] identity [text ("text/" Equivalence<Text>) format]] diff --git a/stdlib/test/test/lux/control/reader.lux b/stdlib/test/test/lux/control/reader.lux index 560e6565c..51b1f82f3 100644 --- a/stdlib/test/test/lux/control/reader.lux +++ b/stdlib/test/test/lux/control/reader.lux @@ -1,6 +1,6 @@ (.module: [lux #* - [io] + ["." io] [control [monad (#+ do)] pipe diff --git a/stdlib/test/test/lux/control/region.lux b/stdlib/test/test/lux/control/region.lux index 266fd2733..b6cd43ea7 100644 --- a/stdlib/test/test/lux/control/region.lux +++ b/stdlib/test/test/lux/control/region.lux @@ -1,15 +1,14 @@ (.module: [lux #* [control - [monad (#+ do)] + ["." monad (#+ do)] ["/" region] - [thread (#+ Thread)] + ["." thread (#+ Thread)] ["ex" exception (#+ exception:)]] [data ["e" error (#+ Error)] - [text - format] - [collection [list]]] + [collection + ["." list]]] [math ["r" random]]] lux/test) diff --git a/stdlib/test/test/lux/control/state.lux b/stdlib/test/test/lux/control/state.lux index 3d8c2fd10..2b3b3160c 100644 --- a/stdlib/test/test/lux/control/state.lux +++ b/stdlib/test/test/lux/control/state.lux @@ -1,12 +1,12 @@ (.module: [lux #* - [io] + ["." io] [control ["M" monad (#+ do Monad)] pipe ["&" state]] [data - [product]] + ["." product]] [math ["r" random]]] lux/test) diff --git a/stdlib/test/test/lux/control/writer.lux b/stdlib/test/test/lux/control/writer.lux index 8f44f6784..7172e865e 100644 --- a/stdlib/test/test/lux/control/writer.lux +++ b/stdlib/test/test/lux/control/writer.lux @@ -1,14 +1,13 @@ (.module: [lux #* - [io] + ["." io] [control ["M" monad (#+ do Monad)] pipe ["&" writer]] [data - [number] - [product] - [text ("text/" Equivalence<Text>)]]] + ["." product] + ["." text ("text/" Equivalence<Text>)]]] lux/test) (context: "Writer." diff --git a/stdlib/test/test/lux/data/bit.lux b/stdlib/test/test/lux/data/bit.lux index 8d0a93a83..7eea70f7a 100644 --- a/stdlib/test/test/lux/data/bit.lux +++ b/stdlib/test/test/lux/data/bit.lux @@ -2,7 +2,6 @@ [lux #* [control ["M" monad (#+ do Monad)]] - [io] [data bit] [math diff --git a/stdlib/test/test/lux/data/collection/array.lux b/stdlib/test/test/lux/data/collection/array.lux index 91b67b5c5..a362df27b 100644 --- a/stdlib/test/test/lux/data/collection/array.lux +++ b/stdlib/test/test/lux/data/collection/array.lux @@ -3,13 +3,12 @@ [control [monad (#+ do Monad)] pipe] - [io] [data - [number] - [maybe] + ["." number] + ["." maybe] [collection ["@" array] - [list]]] + ["." list]]] [math ["r" random]]] lux/test) diff --git a/stdlib/test/test/lux/data/collection/bits.lux b/stdlib/test/test/lux/data/collection/bits.lux index dd53f42eb..c9c1a1b85 100644 --- a/stdlib/test/test/lux/data/collection/bits.lux +++ b/stdlib/test/test/lux/data/collection/bits.lux @@ -2,14 +2,17 @@ [lux #* [control [monad (#+ do)] - [predicate]] + ["." predicate]] [data [collection ["/" bits]]] [math ["r" random]]] lux/test - [test [lux [control ["_eq" equivalence]]]]) + [test + [lux + [control + ["_eq" equivalence]]]]) (def: (size min max) (-> Nat Nat (r.Random Nat)) diff --git a/stdlib/test/test/lux/data/collection/dictionary.lux b/stdlib/test/test/lux/data/collection/dictionary.lux index f79327c29..c56bd7d42 100644 --- a/stdlib/test/test/lux/data/collection/dictionary.lux +++ b/stdlib/test/test/lux/data/collection/dictionary.lux @@ -1,18 +1,16 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)] ["eq" equivalence]] [data - [number] - [maybe] - ["." text - format] + ["." number] + ["." maybe] [collection ["&" dictionary] - [list ("list/" Fold<List> Functor<List>)]]] - ["r" math/random]] + ["." list ("list/" Fold<List> Functor<List>)]]] + [math + ["r" random]]] lux/test) (context: "Dictionaries." diff --git a/stdlib/test/test/lux/data/collection/dictionary/ordered.lux b/stdlib/test/test/lux/data/collection/dictionary/ordered.lux index 64a51b413..b95f889b1 100644 --- a/stdlib/test/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/test/test/lux/data/collection/dictionary/ordered.lux @@ -1,17 +1,16 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)] [equivalence (#+ Equivalence)]] [data - [product] - [number] + ["." product] + ["." number] [collection ["s" set] - ["dict" dictionary] - [dictionary ["&" ordered]] - [list ("list/" Functor<List>)]]] + ["dict" dictionary + ["&" ordered]] + ["." list ("list/" Functor<List>)]]] [math ["r" random]]] lux/test) diff --git a/stdlib/test/test/lux/data/collection/list.lux b/stdlib/test/test/lux/data/collection/list.lux index f5565c455..2e8ac8b0e 100644 --- a/stdlib/test/test/lux/data/collection/list.lux +++ b/stdlib/test/test/lux/data/collection/list.lux @@ -1,13 +1,14 @@ (.module: [lux #* - [io] + ["." io] [control [monad (#+ do Monad)] pipe] - [data [number] - [bit] - [product] - [maybe] + [data + ["." number] + ["." bit] + ["." product] + ["." maybe] [collection ["&" list]]] [math diff --git a/stdlib/test/test/lux/data/collection/queue.lux b/stdlib/test/test/lux/data/collection/queue.lux index 89f674462..82ea751d8 100644 --- a/stdlib/test/test/lux/data/collection/queue.lux +++ b/stdlib/test/test/lux/data/collection/queue.lux @@ -1,10 +1,9 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)]] [data - [number] + ["." number] [collection ["&" queue]]] [math diff --git a/stdlib/test/test/lux/data/collection/queue/priority.lux b/stdlib/test/test/lux/data/collection/queue/priority.lux index d893fe960..b5f8a1d17 100644 --- a/stdlib/test/test/lux/data/collection/queue/priority.lux +++ b/stdlib/test/test/lux/data/collection/queue/priority.lux @@ -1,12 +1,13 @@ (.module: [lux #* - [io] [control - [monad (#+ do Monad)]] + ["." monad (#+ do Monad)]] [data - [number] - [maybe] - [collection [queue ["&" priority]]]] + ["." number] + ["." maybe] + [collection + [queue + ["&" priority]]]] [math ["r" random]]] lux/test) diff --git a/stdlib/test/test/lux/data/collection/row.lux b/stdlib/test/test/lux/data/collection/row.lux index dbe9280b6..ad71d0380 100644 --- a/stdlib/test/test/lux/data/collection/row.lux +++ b/stdlib/test/test/lux/data/collection/row.lux @@ -1,11 +1,10 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)]] [data - [number] - [maybe] + ["." number] + ["." maybe] [collection ["&" row] [list ("list/" Fold<List>)]]] [math diff --git a/stdlib/test/test/lux/data/collection/sequence.lux b/stdlib/test/test/lux/data/collection/sequence.lux index 16b98a90b..b33882557 100644 --- a/stdlib/test/test/lux/data/collection/sequence.lux +++ b/stdlib/test/test/lux/data/collection/sequence.lux @@ -1,15 +1,14 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)] comonad] [data - [maybe] - [number ("nat/" Codec<Text,Nat>)] - [text ("text/" Monoid<Text>) - format] - [collection [list] + ["." maybe] + ["." number ("nat/" Codec<Text,Nat>)] + ["." text ("text/" Monoid<Text>)] + [collection + ["." list] ["&" sequence]]] [math ["r" random]]] diff --git a/stdlib/test/test/lux/data/collection/set.lux b/stdlib/test/test/lux/data/collection/set.lux index 43bd48069..3db08f344 100644 --- a/stdlib/test/test/lux/data/collection/set.lux +++ b/stdlib/test/test/lux/data/collection/set.lux @@ -1,12 +1,12 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)]] [data - [number] - [collection ["&" set (#+ Set)] - [list]]] + ["." number] + [collection + ["&" set (#+ Set)] + ["." list]]] [math ["r" random]]] lux/test) diff --git a/stdlib/test/test/lux/data/collection/set/ordered.lux b/stdlib/test/test/lux/data/collection/set/ordered.lux index 261eebbb1..d75fe3c53 100644 --- a/stdlib/test/test/lux/data/collection/set/ordered.lux +++ b/stdlib/test/test/lux/data/collection/set/ordered.lux @@ -1,16 +1,15 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)]] [data - [number] + ["." number] [text format] [collection ["." set ["&" ordered]] - [list]]] + ["." list]]] [math ["r" random]]] lux/test) diff --git a/stdlib/test/test/lux/data/collection/stack.lux b/stdlib/test/test/lux/data/collection/stack.lux index 06e8af547..0be661232 100644 --- a/stdlib/test/test/lux/data/collection/stack.lux +++ b/stdlib/test/test/lux/data/collection/stack.lux @@ -3,8 +3,9 @@ [control [monad (#+ do)]] [data - [maybe] - [collection ["&" stack]]] + ["." maybe] + [collection + ["&" stack]]] [math ["r" random]]] lux/test) diff --git a/stdlib/test/test/lux/data/collection/tree/rose.lux b/stdlib/test/test/lux/data/collection/tree/rose.lux index ac340cd13..f1cb294fb 100644 --- a/stdlib/test/test/lux/data/collection/tree/rose.lux +++ b/stdlib/test/test/lux/data/collection/tree/rose.lux @@ -1,16 +1,16 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)]] [data - [product] - [number] + ["." product] + ["." number] [text ("text/" Equivalence<Text>) format] [collection - [tree ["&" rose]] - [list ("list/" Functor<List> Fold<List>)]]] + ["." list ("list/" Functor<List> Fold<List>)] + [tree + ["&" rose]]]] [math ["r" random]]] lux/test) diff --git a/stdlib/test/test/lux/data/collection/tree/rose/zipper.lux b/stdlib/test/test/lux/data/collection/tree/rose/zipper.lux index 28c7ec0f9..1a24a805b 100644 --- a/stdlib/test/test/lux/data/collection/tree/rose/zipper.lux +++ b/stdlib/test/test/lux/data/collection/tree/rose/zipper.lux @@ -1,19 +1,18 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)] pipe] [data - [number] - [maybe] + ["." number] + ["." maybe] ["." text format] [collection - [list ("list/" Fold<List> Functor<List>)] + ["." list] [tree - [rose] - [rose ["&" zipper]]]]] + ["." rose + ["&" zipper]]]]] [math ["r" random]]] lux/test) diff --git a/stdlib/test/test/lux/data/color.lux b/stdlib/test/test/lux/data/color.lux index 797a0336b..246945686 100644 --- a/stdlib/test/test/lux/data/color.lux +++ b/stdlib/test/test/lux/data/color.lux @@ -1,6 +1,5 @@ (.module: [lux #* - [io] [control [monad (#+ do)]] [data diff --git a/stdlib/test/test/lux/data/error.lux b/stdlib/test/test/lux/data/error.lux index 7e64cc5ed..9b69c6a80 100644 --- a/stdlib/test/test/lux/data/error.lux +++ b/stdlib/test/test/lux/data/error.lux @@ -1,13 +1,11 @@ (.module: [lux #* - [io] + ["." io] [control - ["M" monad (#+ do Monad)] + [monad (#+ do Monad)] pipe] [data - ["&" error] - [text - format]]] + ["&" error]]] lux/test) (context: "Errors" diff --git a/stdlib/test/test/lux/data/format/json.lux b/stdlib/test/test/lux/data/format/json.lux index 086c13ece..2183c5004 100644 --- a/stdlib/test/test/lux/data/format/json.lux +++ b/stdlib/test/test/lux/data/format/json.lux @@ -1,6 +1,5 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)] codec @@ -9,9 +8,9 @@ ["p" parser]] [data ["e" error] - [bit] - [maybe] - [number] + ["." bit] + ["." maybe] + ["." number] ["." text format] [format @@ -19,15 +18,13 @@ [collection [row (#+ row)] ["d" dictionary] - [list]]] - [macro (#+ with-gensyms) - [code] - [syntax (#+ syntax:)] + ["." list]]] + [macro [poly (#+ derived:)] - [poly/equivalence] - [poly/json]] + ["." poly/equivalence] + ["." poly/json]] [type - [unit]] + ["." unit]] [math ["r" random]] [time diff --git a/stdlib/test/test/lux/data/format/xml.lux b/stdlib/test/test/lux/data/format/xml.lux index 350718f0f..8795e7f27 100644 --- a/stdlib/test/test/lux/data/format/xml.lux +++ b/stdlib/test/test/lux/data/format/xml.lux @@ -1,21 +1,20 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)] ["p" parser] pipe] [data - [ident] + ["." ident] ["E" error] - [maybe] - [text ("text/" Equivalence<Text>) + ["." maybe] + ["." text ("text/" Equivalence<Text>) format] [format ["&" xml]] [collection ["dict" dictionary] - [list ("list/" Functor<List>)]]] + ["." list ("list/" Functor<List>)]]] [math ["r" random ("r/" Monad<Random>)]]] lux/test) diff --git a/stdlib/test/test/lux/data/ident.lux b/stdlib/test/test/lux/data/ident.lux index e0e37d7a8..622edf474 100644 --- a/stdlib/test/test/lux/data/ident.lux +++ b/stdlib/test/test/lux/data/ident.lux @@ -1,14 +1,14 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)] pipe] [data ["&" ident] - [text ("text/" Equivalence<Text>) + ["." text ("text/" Equivalence<Text>) format]] - [math ["r" random]]] + [math + ["r" random]]] lux/test) (def: (gen-part size) diff --git a/stdlib/test/test/lux/data/identity.lux b/stdlib/test/test/lux/data/identity.lux index a57a05f4c..9fe0cb50e 100644 --- a/stdlib/test/test/lux/data/identity.lux +++ b/stdlib/test/test/lux/data/identity.lux @@ -1,6 +1,5 @@ (.module: [lux #* - [io] [control ["M" monad (#+ do Monad)] comonad] diff --git a/stdlib/test/test/lux/data/lazy.lux b/stdlib/test/test/lux/data/lazy.lux index 895fa8b1c..785f08719 100644 --- a/stdlib/test/test/lux/data/lazy.lux +++ b/stdlib/test/test/lux/data/lazy.lux @@ -1,6 +1,5 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)]] [data diff --git a/stdlib/test/test/lux/data/maybe.lux b/stdlib/test/test/lux/data/maybe.lux index 8e6680ad8..4a1d39552 100644 --- a/stdlib/test/test/lux/data/maybe.lux +++ b/stdlib/test/test/lux/data/maybe.lux @@ -1,55 +1,52 @@ (.module: [lux #* - [io] + ["." io ("io/" Monad<IO>)] [control ["M" monad (#+ do Monad)] pipe] [data - ["&" maybe] - [number] - [text ("text/" Monoid<Text>)]]] + ["&" maybe ("&/" Monoid<Maybe>)] + ["." text ("text/" Monoid<Text>)]]] lux/test) (context: "Maybe" - (let [(^open "&/") &.Monoid<Maybe> - (^open "&/") &.Apply<Maybe> + (let [(^open "&/") &.Apply<Maybe> (^open "&/") &.Monad<Maybe> - (^open "Maybe/") (&.Equivalence<Maybe> text.Equivalence<Text>)] + (^open "&/") (&.Equivalence<Maybe> text.Equivalence<Text>)] ($_ seq (test "Can compare Maybe values." - (and (Maybe/= #.None #.None) - (Maybe/= (#.Some "yolo") (#.Some "yolo")) - (not (Maybe/= (#.Some "yolo") (#.Some "lol"))) - (not (Maybe/= (#.Some "yolo") #.None)))) + (and (&/= #.None #.None) + (&/= (#.Some "yolo") (#.Some "yolo")) + (not (&/= (#.Some "yolo") (#.Some "lol"))) + (not (&/= (#.Some "yolo") #.None)))) (test "Monoid respects Maybe." - (and (Maybe/= #.None &/identity) - (Maybe/= (#.Some "yolo") (&/compose (#.Some "yolo") (#.Some "lol"))) - (Maybe/= (#.Some "yolo") (&/compose (#.Some "yolo") #.None)) - (Maybe/= (#.Some "lol") (&/compose #.None (#.Some "lol"))) - (Maybe/= #.None (: (Maybe Text) (&/compose #.None #.None))))) + (and (&/= #.None &/identity) + (&/= (#.Some "yolo") (&/compose (#.Some "yolo") (#.Some "lol"))) + (&/= (#.Some "yolo") (&/compose (#.Some "yolo") #.None)) + (&/= (#.Some "lol") (&/compose #.None (#.Some "lol"))) + (&/= #.None (: (Maybe Text) (&/compose #.None #.None))))) (test "Functor respects Maybe." - (and (Maybe/= #.None (&/map (text/compose "yolo") #.None)) - (Maybe/= (#.Some "yololol") (&/map (text/compose "yolo") (#.Some "lol"))))) + (and (&/= #.None (&/map (text/compose "yolo") #.None)) + (&/= (#.Some "yololol") (&/map (text/compose "yolo") (#.Some "lol"))))) (test "Apply respects Maybe." - (and (Maybe/= (#.Some "yolo") (&/wrap "yolo")) - (Maybe/= (#.Some "yololol") - (&/apply (&/wrap (text/compose "yolo")) (&/wrap "lol"))))) + (and (&/= (#.Some "yolo") (&/wrap "yolo")) + (&/= (#.Some "yololol") + (&/apply (&/wrap (text/compose "yolo")) (&/wrap "lol"))))) (test "Monad respects Maybe." - (Maybe/= (#.Some "yololol") - (do &.Monad<Maybe> - [f (wrap text/compose) - a (wrap "yolo") - b (wrap "lol")] - (wrap (f a b))))) + (&/= (#.Some "yololol") + (do &.Monad<Maybe> + [f (wrap text/compose) + a (wrap "yolo") + b (wrap "lol")] + (wrap (f a b))))) ))) (context: "Monad transformer" - (let [lift (&.lift io.Monad<IO>) - (^open "io/") io.Monad<IO>] + (let [lift (&.lift io.Monad<IO>)] (test "Can add maybe functionality to any monad." (|> (io.run (do (&.MaybeT io.Monad<IO>) [a (lift (io/wrap 123)) diff --git a/stdlib/test/test/lux/data/number.lux b/stdlib/test/test/lux/data/number.lux index 15bdbfd4c..fc96fd8ff 100644 --- a/stdlib/test/test/lux/data/number.lux +++ b/stdlib/test/test/lux/data/number.lux @@ -1,6 +1,5 @@ (.module: [lux #* - [io] [control ["M" monad (#+ do Monad)] pipe] diff --git a/stdlib/test/test/lux/data/number/complex.lux b/stdlib/test/test/lux/data/number/complex.lux index 15d759ba7..838c625c6 100644 --- a/stdlib/test/test/lux/data/number/complex.lux +++ b/stdlib/test/test/lux/data/number/complex.lux @@ -1,17 +1,13 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)] pipe] [data - [product] - [number ("frac/" Number<Frac>) + ["." number ("frac/" Number<Frac>) ["&" complex]] - [text - format] [collection - [list ("list/" Functor<List>)]]] + ["." list ("list/" Functor<List>)]]] ["." math ["r" random]]] lux/test) diff --git a/stdlib/test/test/lux/data/number/i64.lux b/stdlib/test/test/lux/data/number/i64.lux index 52b80ea25..d48d009e6 100644 --- a/stdlib/test/test/lux/data/number/i64.lux +++ b/stdlib/test/test/lux/data/number/i64.lux @@ -1,6 +1,5 @@ (.module: [lux #* - [io] [control ["M" monad (#+ do Monad)]] [data diff --git a/stdlib/test/test/lux/data/number/ratio.lux b/stdlib/test/test/lux/data/number/ratio.lux index 5be1942f2..32fc03e7a 100644 --- a/stdlib/test/test/lux/data/number/ratio.lux +++ b/stdlib/test/test/lux/data/number/ratio.lux @@ -1,11 +1,11 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)] pipe] [data - ["&" number/ratio ("&/" Number<Ratio>)]] + [number + ["&" ratio ("&/" Number<Ratio>)]]] [math ["r" random]]] lux/test) diff --git a/stdlib/test/test/lux/data/sum.lux b/stdlib/test/test/lux/data/sum.lux index 4f8cadac2..4d699581f 100644 --- a/stdlib/test/test/lux/data/sum.lux +++ b/stdlib/test/test/lux/data/sum.lux @@ -4,9 +4,9 @@ pipe] [data sum - [text] + ["." text] [collection - [list]]]] + ["." list]]]] lux/test) (context: "Sum operations" diff --git a/stdlib/test/test/lux/data/text.lux b/stdlib/test/test/lux/data/text.lux index 478fb8c39..bb7ee219a 100644 --- a/stdlib/test/test/lux/data/text.lux +++ b/stdlib/test/test/lux/data/text.lux @@ -1,15 +1,13 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)] pipe] [data ["&" text format] - [number] [collection - [list]]] + ["." list]]] [math ["r" random]]] lux/test) diff --git a/stdlib/test/test/lux/data/text/format.lux b/stdlib/test/test/lux/data/text/format.lux index 6c877da7b..eb42a088d 100644 --- a/stdlib/test/test/lux/data/text/format.lux +++ b/stdlib/test/test/lux/data/text/format.lux @@ -1,12 +1,10 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)]] [data ["." text - format] - [number]]] + format]]] lux/test) (context: "Formatters" diff --git a/stdlib/test/test/lux/data/text/lexer.lux b/stdlib/test/test/lux/data/text/lexer.lux index cab364c59..d86093f3a 100644 --- a/stdlib/test/test/lux/data/text/lexer.lux +++ b/stdlib/test/test/lux/data/text/lexer.lux @@ -4,14 +4,13 @@ [monad (#+ do Monad)] pipe ["p" parser]] - [io] [data ["E" error] - [text ("text/" Equivalence<Text>) + ["." text ("text/" Equivalence<Text>) format ["&" lexer]] [collection - [list]]] + ["." list]]] [math ["r" random]]] lux/test) @@ -104,7 +103,7 @@ (should-fail (&.run "M" (&.range (char "X") (char "Z")))))) - (test "Can lex upper-case and &.lower-case letters." + (test "Can lex upper-case and lower-case letters." (and (should-passT "Y" (&.run "Y" &.upper)) (should-fail (&.run "m" diff --git a/stdlib/test/test/lux/data/text/regex.lux b/stdlib/test/test/lux/data/text/regex.lux index dd13cee12..c177e07a4 100644 --- a/stdlib/test/test/lux/data/text/regex.lux +++ b/stdlib/test/test/lux/data/text/regex.lux @@ -1,26 +1,23 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)] pipe ["p" parser]] [data - [product] [text ("text/" Equivalence<Text>) format - [lexer] + ["." lexer (#+ Lexer)] ["&" regex]]] - ["." macro - [code] - ["s" syntax (#+ syntax:)]] [math - ["r" random]]] + ["r" random]] + [macro + ["s" syntax (#+ syntax:)]]] lux/test) ## [Utils] (def: (should-pass regex input) - (-> (lexer.Lexer Text) Text Bit) + (-> (Lexer Text) Text Bit) (|> (lexer.run input regex) (case> (#.Right parsed) (text/= parsed input) @@ -29,7 +26,7 @@ #0))) (def: (should-passT test regex input) - (-> Text (lexer.Lexer Text) Text Bit) + (-> Text (Lexer Text) Text Bit) (|> (lexer.run input regex) (case> (#.Right parsed) (text/= test parsed) @@ -38,7 +35,7 @@ #0))) (def: (should-fail regex input) - (All [a] (-> (lexer.Lexer a) Text Bit)) + (All [a] (-> (Lexer a) Text Bit)) (|> (lexer.run input regex) (case> (#.Left _) #1 _ #0))) diff --git a/stdlib/test/test/lux/host.jvm.lux b/stdlib/test/test/lux/host.jvm.lux index 5d233187d..b2b88148c 100644 --- a/stdlib/test/test/lux/host.jvm.lux +++ b/stdlib/test/test/lux/host.jvm.lux @@ -1,29 +1,26 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)] pipe] [data - [number] - [product] - [text ("text/" Equivalence<Text>) - format]] - ["&" host (#+ class: interface: object)] - ["r" math/random]] + [text ("text/" Equivalence<Text>)]] + ["&" host (#+ import: class: interface: object)] + [math + ["r" random]]] lux/test) -(&.import: (java/util/concurrent/Callable a)) +(import: (java/util/concurrent/Callable a)) -(&.import: java/lang/Exception +(import: java/lang/Exception (new [String])) -(&.import: java/lang/Object) +(import: java/lang/Object) -(&.import: (java/lang/Class a) +(import: (java/lang/Class a) (getName [] String)) -(&.import: java/lang/System +(import: java/lang/System (#static out java/io/PrintStream) (#static currentTimeMillis [] #io long) (#static getenv [String] #io #? String)) diff --git a/stdlib/test/test/lux/language/compiler/analysis/case.lux b/stdlib/test/test/lux/language/compiler/analysis/case.lux index adbacaa0e..c15bb192a 100644 --- a/stdlib/test/test/lux/language/compiler/analysis/case.lux +++ b/stdlib/test/test/lux/language/compiler/analysis/case.lux @@ -1,26 +1,25 @@ (.module: [lux #* - [io] [control - [monad (#+ do)] + ["." monad (#+ do)] pipe] [data - [product] - [maybe] - [text ("text/" Equivalence<Text>)] + ["." product] + ["." maybe] + ["." text ("text/" Equivalence<Text>)] [collection - [list ("list/" Monad<List>)] - [set]]] + ["." list ("list/" Monad<List>)] + ["." set]]] [math ["r" random ("random/" Monad<Random>)]] [macro - [code]] + ["." code]] [language ["." type - [check]] + ["." check]] ["." compiler ["." analysis - [module] + ["." module] [".A" type] ["/" case]]]] test] diff --git a/stdlib/test/test/lux/language/compiler/analysis/function.lux b/stdlib/test/test/lux/language/compiler/analysis/function.lux index f3d8ce0dc..f3c7dc5b5 100644 --- a/stdlib/test/test/lux/language/compiler/analysis/function.lux +++ b/stdlib/test/test/lux/language/compiler/analysis/function.lux @@ -1,29 +1,28 @@ (.module: [lux #* - [io] [control [monad (#+ do)] pipe] [data ["e" error] - [maybe] - [product] + ["." maybe] + ["." product] [text ("text/" Equivalence<Text>) format] [collection - [list ("list/" Functor<List>)]]] + ["." list ("list/" Functor<List>)]]] [math ["r" random]] ["." macro - [code]] + ["." code]] ["." language - [type] - [reference] + ["." type] + ["." reference] ["." compiler - [init] - [analysis (#+ Analysis Operation) + ["." init] + ["." analysis (#+ Analysis Operation) [".A" type] - [expression] + ["." expression] ["/" function]] [extension [".E" analysis]]]] diff --git a/stdlib/test/test/lux/language/compiler/analysis/primitive.lux b/stdlib/test/test/lux/language/compiler/analysis/primitive.lux index 07510ae9d..c5a5bee5a 100644 --- a/stdlib/test/test/lux/language/compiler/analysis/primitive.lux +++ b/stdlib/test/test/lux/language/compiler/analysis/primitive.lux @@ -1,24 +1,24 @@ (.module: [lux (#- primitive) - [io] [control [monad (#+ do)] pipe ["ex" exception (#+ exception:)]] [data ["e" error] - [text format]] + [text + format]] [math ["r" random ("random/" Monad<Random>)]] [macro - [code]] + ["." code]] ["." language [".L" type ("type/" Equivalence<Type>)] ["." compiler - [init] - [analysis (#+ Analysis Operation) + ["." init] + ["." analysis (#+ Analysis Operation) [".A" type] - [expression]] + ["." expression]] [extension [".E" analysis]]]] test]) @@ -83,7 +83,7 @@ _ #0))))] - ["bit" Bit #analysis.Bit r.bit code.bit] + ["bit" Bit #analysis.Bit r.bit code.bit] ["nat" Nat #analysis.Nat r.nat code.nat] ["int" Int #analysis.Int r.int code.int] ["rev" Rev #analysis.Rev r.rev code.rev] diff --git a/stdlib/test/test/lux/language/compiler/analysis/procedure/common.lux b/stdlib/test/test/lux/language/compiler/analysis/procedure/common.lux index 19d1e8e96..82858a595 100644 --- a/stdlib/test/test/lux/language/compiler/analysis/procedure/common.lux +++ b/stdlib/test/test/lux/language/compiler/analysis/procedure/common.lux @@ -5,22 +5,22 @@ [monad (#+ do)] pipe] [concurrency - [atom]] + ["." atom]] [data ["e" error] - [product] - [text format] - [collection [array]]] + ["." product] + [text + format]] [math ["r" random]] [macro - [code]] + ["." code]] [language [type ("type/" Equivalence<Type>)] ["." compiler - [init] + ["." init] [analysis - [scope] + ["." scope] [".A" type]] [extension [".E" analysis]]]] diff --git a/stdlib/test/test/lux/language/compiler/analysis/reference.lux b/stdlib/test/test/lux/language/compiler/analysis/reference.lux index 0ae6dbe96..118b1b586 100644 --- a/stdlib/test/test/lux/language/compiler/analysis/reference.lux +++ b/stdlib/test/test/lux/language/compiler/analysis/reference.lux @@ -1,6 +1,5 @@ (.module: [lux #* - [io] [control [monad (#+ do)] pipe] @@ -11,18 +10,18 @@ [math ["r" random]] [macro - [code]] + ["." code]] ["." language] [language [type ("type/" Equivalence<Type>)] - [reference] + ["." reference] ["." compiler - [init] + ["." init] ["." analysis - [scope] - [module] + ["." scope] + ["." module] [".A" type] - [expression]] + ["." expression]] [extension [".E" analysis]]]] test] diff --git a/stdlib/test/test/lux/language/compiler/analysis/structure.lux b/stdlib/test/test/lux/language/compiler/analysis/structure.lux index 3fb2d2455..79d040e51 100644 --- a/stdlib/test/test/lux/language/compiler/analysis/structure.lux +++ b/stdlib/test/test/lux/language/compiler/analysis/structure.lux @@ -6,26 +6,26 @@ [data [bit ("bit/" Equivalence<Bit>)] ["e" error] - [product] - [maybe] + ["." product] + ["." maybe] ["." text] [collection - [list ("list/" Functor<List>)] - [set]]] + ["." list ("list/" Functor<List>)] + ["." set]]] [math ["r" random]] [macro - [code]] + ["." code]] ["." language - [type ("type/" Equivalence<Type>) - [check]] + ["." type ("type/" Equivalence<Type>) + ["." check]] ["." compiler - [init] - [analysis (#+ Analysis Variant Tag Operation) - [module] + ["." init] + ["." analysis (#+ Analysis Variant Tag Operation) + ["." module] [".A" type] ["/" structure] - [expression]] + ["." expression]] [extension [".E" analysis]]]] test] diff --git a/stdlib/test/test/lux/language/compiler/synthesis/case.lux b/stdlib/test/test/lux/language/compiler/synthesis/case.lux index da8e59fa1..2acde1a5b 100644 --- a/stdlib/test/test/lux/language/compiler/synthesis/case.lux +++ b/stdlib/test/test/lux/language/compiler/synthesis/case.lux @@ -4,19 +4,19 @@ [monad (#+ do)] pipe] [data - [error ("error/" Functor<Error>)]] + ["." error ("error/" Functor<Error>)]] [language - [reference] + ["." reference] ["." compiler - [analysis (#+ Branch Analysis)] + ["." analysis (#+ Branch Analysis)] ["//" synthesis (#+ Synthesis) - [expression]] + ["." expression]] [extension - [bundle]]]] + ["." bundle]]]] [math ["r" random]] test] - [//primitive]) + ["." //primitive]) (context: "Dummy variables." (<| (times +100) diff --git a/stdlib/test/test/lux/language/compiler/synthesis/function.lux b/stdlib/test/test/lux/language/compiler/synthesis/function.lux index 8954aafb1..35d2c4dd6 100644 --- a/stdlib/test/test/lux/language/compiler/synthesis/function.lux +++ b/stdlib/test/test/lux/language/compiler/synthesis/function.lux @@ -1,30 +1,31 @@ (.module: [lux #* - [io] [control [monad (#+ do)] pipe] [data - [product] - [maybe] - [error] - [number] - [text format] + ["." product] + ["." maybe] + ["." error] + ["." number] + [text + format] [collection - [list ("list/" Functor<List> Fold<List>)] + ["." list ("list/" Functor<List> Fold<List>)] ["dict" dictionary (#+ Dictionary)] - [set]]] + ["." set]]] [language - [reference (#+ Variable) ("variable/" Equivalence<Variable>)] + ["." reference (#+ Variable) ("variable/" Equivalence<Variable>)] ["." compiler - [analysis (#+ Arity Analysis)] + ["." analysis (#+ Arity Analysis)] ["//" synthesis (#+ Synthesis) - [expression]] + ["." expression]] [extension - [bundle]]]] - [math ["r" random]] + ["." bundle]]]] + [math + ["r" random]] test] - [//primitive]) + ["." //primitive]) (def: constant-function (r.Random [Arity Analysis Analysis]) diff --git a/stdlib/test/test/lux/language/compiler/synthesis/primitive.lux b/stdlib/test/test/lux/language/compiler/synthesis/primitive.lux index 86eecb600..c4cc940f1 100644 --- a/stdlib/test/test/lux/language/compiler/synthesis/primitive.lux +++ b/stdlib/test/test/lux/language/compiler/synthesis/primitive.lux @@ -1,20 +1,19 @@ (.module: [lux (#- primitive) - [io] [control [monad (#+ do)] pipe] [data - [error] + ["." error] [text format]] [language ["." compiler - [analysis (#+ Analysis)] + ["." analysis (#+ Analysis)] ["//" synthesis (#+ Synthesis) - [expression]] + ["." expression]] [extension - [bundle]]]] + ["." bundle]]]] [math ["r" random]] test]) diff --git a/stdlib/test/test/lux/language/compiler/synthesis/structure.lux b/stdlib/test/test/lux/language/compiler/synthesis/structure.lux index cb82f9131..2b86e318a 100644 --- a/stdlib/test/test/lux/language/compiler/synthesis/structure.lux +++ b/stdlib/test/test/lux/language/compiler/synthesis/structure.lux @@ -1,26 +1,25 @@ (.module: [lux #* - [io] [control [monad (#+ do)] pipe] [data [bit ("bit/" Equivalence<Bit>)] - [product] - [error] + ["." product] + ["." error] [collection - [list]]] + ["." list]]] [language ["." compiler - [analysis] + ["." analysis] ["//" synthesis (#+ Synthesis) - [expression]] + ["." expression]] [extension - [bundle]]]] + ["." bundle]]]] [math ["r" random]] test] - [//primitive]) + ["." //primitive]) (context: "Variants" (<| (times +100) diff --git a/stdlib/test/test/lux/language/syntax.lux b/stdlib/test/test/lux/language/syntax.lux index 110140e58..8ead2f863 100644 --- a/stdlib/test/test/lux/language/syntax.lux +++ b/stdlib/test/test/lux/language/syntax.lux @@ -1,6 +1,5 @@ (.module: [lux #* - [io] [control [monad (#+ do)]] [data @@ -10,12 +9,14 @@ format ["l" lexer]] [collection - [list] + ["." list] ["dict" dictionary (#+ Dictionary)]]] [math ["r" random ("r/" Monad<Random>)]] - [macro [code]] - [language ["&" syntax]] + [macro + ["." code]] + [language + ["&" syntax]] test]) (def: default-cursor diff --git a/stdlib/test/test/lux/language/type.lux b/stdlib/test/test/lux/language/type.lux index 631e3de09..ae0b5283b 100644 --- a/stdlib/test/test/lux/language/type.lux +++ b/stdlib/test/test/lux/language/type.lux @@ -1,15 +1,14 @@ (.module: [lux #* - [io] [control ["M" monad (#+ do Monad)] pipe] [data - [maybe] + ["." maybe] [text format] [collection - [list]]] + ["." list]]] [math ["r" random]] [language diff --git a/stdlib/test/test/lux/language/type/check.lux b/stdlib/test/test/lux/language/type/check.lux index 1faf59f16..868039238 100644 --- a/stdlib/test/test/lux/language/type/check.lux +++ b/stdlib/test/test/lux/language/type/check.lux @@ -1,22 +1,20 @@ (.module: [lux #* - [io] [control - [monad (#+ do Monad)] + ["." monad (#+ do Monad)] [pipe (#+ case>)]] [data - [product] - [maybe] - [number] - [text ("text/" Monoid<Text> Equivalence<Text>) - format] + ["." product] + ["." maybe] + ["." number] + [text ("text/" Equivalence<Text>)] [collection - [list ("list/" Functor<List>)] - [set]]] + ["." list ("list/" Functor<List>)] + ["." set]]] [math ["r" random]] [language - [type ("type/" Equivalence<Type>) + ["." type ("type/" Equivalence<Type>) ["@" check]]]] lux/test) diff --git a/stdlib/test/test/lux/macro/poly/equivalence.lux b/stdlib/test/test/lux/macro/poly/equivalence.lux index d6b48428a..d6e48ed13 100644 --- a/stdlib/test/test/lux/macro/poly/equivalence.lux +++ b/stdlib/test/test/lux/macro/poly/equivalence.lux @@ -1,21 +1,21 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)] [equivalence (#+ Equivalence)]] [data - [bit] - [maybe] + ["." bit] + ["." maybe] [number ("int/" Number<Int>)] ["." text format] - [collection [list]]] + [collection + ["." list]]] [math ["r" random]] ["." macro - [poly (#+ derived:)] - ["&" poly/equivalence]]] + [poly (#+ derived:) + ["&" equivalence]]]] lux/test) ## [Utils] diff --git a/stdlib/test/test/lux/macro/poly/functor.lux b/stdlib/test/test/lux/macro/poly/functor.lux index 3bd4a0847..873259496 100644 --- a/stdlib/test/test/lux/macro/poly/functor.lux +++ b/stdlib/test/test/lux/macro/poly/functor.lux @@ -1,12 +1,12 @@ (.module: [lux #* [control - [state]] + ["." state]] [data - [identity]] + ["." identity]] [macro - [poly (#+ derived:)] - ["&" poly/functor]]] + [poly (#+ derived:) + ["&" functor]]]] lux/test) ## [Utils] diff --git a/stdlib/test/test/lux/macro/syntax.lux b/stdlib/test/test/lux/macro/syntax.lux index c30157eb7..a9913f754 100644 --- a/stdlib/test/test/lux/macro/syntax.lux +++ b/stdlib/test/test/lux/macro/syntax.lux @@ -1,21 +1,20 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)] [equivalence (#+ Equivalence)] ["p" parser]] [data - [bit] - [ident] + ["." bit] + ["." ident] ["e" error] - [number] + ["." number] ["." text format]] [math ["r" random]] ["." macro - [code] + ["." code] ["s" syntax (#+ syntax: Syntax)]]] lux/test) @@ -73,7 +72,7 @@ (found? (s.this? (<ctor> <value>)) (list (<ctor> <value>))) (enforced? (s.this (<ctor> <value>)) (list (<ctor> <value>)))))] - ["Can parse Bit syntax." #1 code.bit bit.Equivalence<Bit> s.bit] + ["Can parse Bit syntax." #1 code.bit bit.Equivalence<Bit> s.bit] ["Can parse Nat syntax." +123 code.nat number.Equivalence<Nat> s.nat] ["Can parse Int syntax." 123 code.int number.Equivalence<Int> s.int] ["Can parse Rev syntax." .123 code.rev number.Equivalence<Rev> s.rev] diff --git a/stdlib/test/test/lux/math.lux b/stdlib/test/test/lux/math.lux index 920b0c951..ec38702ea 100644 --- a/stdlib/test/test/lux/math.lux +++ b/stdlib/test/test/lux/math.lux @@ -1,6 +1,5 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)]] [data diff --git a/stdlib/test/test/lux/math/logic/continuous.lux b/stdlib/test/test/lux/math/logic/continuous.lux index a5501b737..c53ad434b 100644 --- a/stdlib/test/test/lux/math/logic/continuous.lux +++ b/stdlib/test/test/lux/math/logic/continuous.lux @@ -2,7 +2,6 @@ [lux #* [control [monad (#+ do)]] - [io] [math ["r" random] [logic diff --git a/stdlib/test/test/lux/math/logic/fuzzy.lux b/stdlib/test/test/lux/math/logic/fuzzy.lux index 55f5d0c67..95c231dca 100644 --- a/stdlib/test/test/lux/math/logic/fuzzy.lux +++ b/stdlib/test/test/lux/math/logic/fuzzy.lux @@ -1,16 +1,15 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)]] [data [bit ("bit/" Equivalence<Bit>)] - [number] + ["." number] [text format] [collection - [list] - [set]]] + ["." list] + ["." set]]] [math ["r" random] [logic diff --git a/stdlib/test/test/lux/math/modular.lux b/stdlib/test/test/lux/math/modular.lux index f54c2ef69..cfc40fcfa 100644 --- a/stdlib/test/test/lux/math/modular.lux +++ b/stdlib/test/test/lux/math/modular.lux @@ -3,7 +3,7 @@ [control [monad (#+ do)]] [data - [product] + ["." product] [bit ("bit/" Equivalence<Bit>)] ["e" error] [text @@ -11,7 +11,8 @@ [math ["r" random] ["/" modular]] - [language [type ("type/" Equivalence<Type>)]]] + [language + [type ("type/" Equivalence<Type>)]]] lux/test) (def: %3 (/.modulus 3)) diff --git a/stdlib/test/test/lux/math/random.lux b/stdlib/test/test/lux/math/random.lux index 2785666e0..dfb58c46b 100644 --- a/stdlib/test/test/lux/math/random.lux +++ b/stdlib/test/test/lux/math/random.lux @@ -1,20 +1,19 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)]] [data - [number] - [text format] + ["." number] [collection - [list] - [row] - [array] - [queue] - [stack] - [set] + ["." list] + ["." row] + ["." array] + ["." queue] + ["." stack] + ["." set] ["dict" dictionary]]] - [math ["r" random]]] + [math + ["r" random]]] lux/test) (context: "Random." diff --git a/stdlib/test/test/lux/time/date.lux b/stdlib/test/test/lux/time/date.lux index 5e92fffce..72c15f4f5 100644 --- a/stdlib/test/test/lux/time/date.lux +++ b/stdlib/test/test/lux/time/date.lux @@ -1,18 +1,18 @@ (.module: [lux #* - [io] [control [monad (#+ do Monad)] - [pipe]] + pipe] [data - [error]] + ["." error]] [math ["r" random ("random/" Monad<Random>)]] [time ["@." instant] ["@" date]]] lux/test - [test [lux [time ["_." instant]]]]) + [// + ["_." instant]]) (def: month (r.Random @.Month) @@ -140,8 +140,8 @@ (|> sample @/encode @/decode - (pipe.case> (#error.Success decoded) - (@/= sample decoded) + (case> (#error.Success decoded) + (@/= sample decoded) - (#error.Error error) - #0)))))) + (#error.Error error) + #0)))))) diff --git a/stdlib/test/test/lux/type/object/interface.lux b/stdlib/test/test/lux/type/object/interface.lux index 6cc1eb4b0..9f1c25ad2 100644 --- a/stdlib/test/test/lux/type/object/interface.lux +++ b/stdlib/test/test/lux/type/object/interface.lux @@ -2,7 +2,7 @@ [lux #* [data [collection - [list]]] + ["." list]]] [type [object interface]]]) diff --git a/stdlib/test/test/lux/type/resource.lux b/stdlib/test/test/lux/type/resource.lux index 7a9940499..1457135a6 100644 --- a/stdlib/test/test/lux/type/resource.lux +++ b/stdlib/test/test/lux/type/resource.lux @@ -3,10 +3,9 @@ [control [monad [indexed (#+ do)]]] - [macro] [type - [resource (#+ Res)]] - [io]] + ["." resource (#+ Res)]] + ["." io]] lux/test) (context: "Sub-structural typing." diff --git a/stdlib/test/test/lux/world/blob.lux b/stdlib/test/test/lux/world/blob.lux index 24035bb0d..e24017587 100644 --- a/stdlib/test/test/lux/world/blob.lux +++ b/stdlib/test/test/lux/world/blob.lux @@ -1,14 +1,13 @@ (.module: [lux #* - [io] [control - [monad (#+ do)] - [pipe]] + ["." monad (#+ do)]] [data ["e" error] ["." number - [i64]] - [collection [list]]] + ["." i64]] + [collection + ["." list]]] [world ["/" blob]] [math diff --git a/stdlib/test/test/lux/world/net/tcp.lux b/stdlib/test/test/lux/world/net/tcp.lux index b72364e5b..370697323 100644 --- a/stdlib/test/test/lux/world/net/tcp.lux +++ b/stdlib/test/test/lux/world/net/tcp.lux @@ -1,6 +1,6 @@ (.module: [lux #* - [io] + ["." io] [control [monad (#+ do)] ["ex" exception (#+ exception:)]] @@ -13,7 +13,7 @@ ["." text format]] [world - [blob] + ["." blob] ["." net ["@" tcp]]] [math diff --git a/stdlib/test/test/lux/world/net/udp.lux b/stdlib/test/test/lux/world/net/udp.lux index a00b75dbf..444f8ac11 100644 --- a/stdlib/test/test/lux/world/net/udp.lux +++ b/stdlib/test/test/lux/world/net/udp.lux @@ -1,19 +1,16 @@ (.module: [lux #* - [io] [control - [monad (#+ do)] - ["ex" exception (#+ exception:)]] + [monad (#+ do)]] [concurrency ["P" promise] - ["T" task] - [frp]] + ["T" task]] [data ["E" error] ["." text format]] [world - [blob] + ["." blob] ["." net ["@" udp]]] [math diff --git a/stdlib/test/tests.lux b/stdlib/test/tests.lux index baa1c6f54..c79b17073 100644 --- a/stdlib/test/tests.lux +++ b/stdlib/test/tests.lux @@ -1,41 +1,49 @@ (.module: - [lux #* + [lux [cli (#+ program:)] - [test] + ["." test] ## TODO: Test these modules [control - [contract] - [concatenative] - [predicate] - [monad/free]] + ["._" contract] + ["._" concatenative] + ["._" predicate] + [monad + ["._" free]]] [data - [env] - [trace] - [store] - [tainted] + ["._" env] + ["._" trace] + ["._" store] + ["._" tainted] [format - [context] - [html] - [css] - [binary]] + ["._" context] + ["._" html] + ["._" css] + ["._" binary]] [collection - [tree ["_." rose/parser]] - [dictionary [plist]] - [set [multi]]] - [text [buffer]]] - [macro (#+) - [poly [json]]] + [tree + [rose + ["._" parser]]] + [dictionary + ["._" plist]] + [set + ["._" multi]]] + [text + ["._" buffer]]] + ["._" macro + [poly + ["._" json]]] [type - [unit] - [refinement] - [quotient]] + ["._" unit] + ["._" refinement] + ["._" quotient]] [world - [environment] - [console]] + ["._" environment] + ["._" console]] [language - [host [".H" scheme]] + [host + [".H" scheme]] [compiler - [translation (#+) + ["._" translation [scheme ["._scheme" primitive] ["._scheme" structure] @@ -46,14 +54,17 @@ ["._scheme" extension] ["._scheme" extension/common] ["._scheme" expression]]] - [default [repl [type]]] + [default + [repl + ["._" type]]] [meta - [io] - [io/context] - [io/archive] - [archive] + ["._meta" io + ["._meta_io" context] + ["._meta_io" archive]] + ["._meta" archive] ["._meta" cache]] - [default ["._default" cache]]]]] + [default + ["._default" cache]]]]] [test ["_." lux] [lux @@ -84,7 +95,6 @@ ["_." region]] [data ["_." bit] - ["_." bool] ["_." color] ["_." error] ["_." ident] @@ -93,12 +103,12 @@ ["_." maybe] ["_." product] ["_." sum] - ## ["_." number] ## Specially troublesome... [number + ## "_." number ## TODO: Specially troublesome... + ["_." i64] ["_." ratio] ["_." complex]] - ["_." text] - [text + ["_." text ["_." format] ["_." lexer] ["_." regex]] @@ -112,17 +122,16 @@ ["_." stack] ["_." row] ["_." sequence] - ["_." dictionary] - [dictionary ["_.D" ordered]] - ["_." set] - [set ["_.S" ordered]] - ["_." queue] - [queue ["_." priority]] + ["_." dictionary + ["dictionary_." ordered]] + ["_." set + ["set_." ordered]] + ["_." queue + ["_." priority]] [tree - ["_." rose] - [rose ["_." zipper]]]]] - ["_." math] - [math + ["_." rose + ["_." zipper]]]]] + ["_." math ["_." random] ["_." modular] [logic @@ -135,15 +144,15 @@ ["poly_." equivalence] ["poly_." functor]]] [type - ## ["_." implicit] ## Specially troublesome... + ## ["_." implicit] ## TODO: Specially troublesome... ["_." resource] [object ["_." interface] ["_." protocol]]] [language ["_language/." syntax] - ["_." type] - [type ["_." check]] + ["_." type + ["_." check]] [compiler [analysis ["_.A" primitive] @@ -151,24 +160,19 @@ ["_.A" reference] ["_.A" case] ["_.A" function] - ## [procedure - ## ["_.A" common] - ## ["_.A" host]] - ] - ## [synthesis - ## ["_.S" primitive] - ## ["_.S" structure] - ## ["_.S" case] - ## ["_.S" function]] - ] - ] + [procedure + ["_.A" common]]] + [synthesis + ["_.S" primitive] + ["_.S" structure] + ["_.S" case] + ["_.S" function]]]] [world ["_." blob] - ## ["_." file] ## Specially troublesome... + ## ["_." file] ## TODO: Specially troublesome... [net ["_." tcp] - ["_." udp]]] - ]] + ["_." udp]]]]] ) (program: args |