From e7fc42bbc7d0b56384864a6fcd1b1e0bf8cd880b Mon Sep 17 00:00:00 2001
From: Eduardo Julian
Date: Wed, 11 Jul 2018 07:36:33 -0400
Subject: - Improvements to import syntax [part 1].
---
stdlib/source/lux.lux | 65 ++++++++++------------
stdlib/source/lux/cli.lux | 4 +-
stdlib/source/lux/concurrency/actor.lux | 6 +-
stdlib/source/lux/concurrency/frp.lux | 2 +-
stdlib/source/lux/concurrency/stm.lux | 4 +-
stdlib/source/lux/control/comonad.lux | 2 +-
stdlib/source/lux/control/concatenative.lux | 10 ++--
stdlib/source/lux/control/exception.lux | 4 +-
stdlib/source/lux/control/monad/indexed.lux | 2 +-
stdlib/source/lux/control/parser.lux | 2 +-
stdlib/source/lux/control/pipe.lux | 2 +-
stdlib/source/lux/control/region.lux | 2 +-
stdlib/source/lux/data/collection/array.lux | 2 +-
stdlib/source/lux/data/collection/bits.lux | 2 +-
stdlib/source/lux/data/collection/dictionary.lux | 4 +-
.../lux/data/collection/dictionary/ordered.lux | 12 ++--
.../lux/data/collection/dictionary/plist.lux | 2 +-
stdlib/source/lux/data/collection/list.lux | 2 +-
stdlib/source/lux/data/collection/queue.lux | 8 +--
.../source/lux/data/collection/queue/priority.lux | 2 +-
stdlib/source/lux/data/collection/row.lux | 4 +-
stdlib/source/lux/data/collection/sequence.lux | 4 +-
stdlib/source/lux/data/collection/set.lux | 2 +-
stdlib/source/lux/data/collection/set/multi.lux | 2 +-
stdlib/source/lux/data/collection/set/ordered.lux | 2 +-
stdlib/source/lux/data/collection/tree/rose.lux | 18 +++---
.../lux/data/collection/tree/rose/zipper.lux | 48 ++++++++--------
stdlib/source/lux/data/color.lux | 24 ++++----
stdlib/source/lux/data/format/css.lux | 20 +++----
stdlib/source/lux/data/format/html.lux | 4 +-
stdlib/source/lux/data/format/json.lux | 10 ++--
stdlib/source/lux/data/format/xml.lux | 21 ++++---
stdlib/source/lux/data/ident.lux | 2 +-
stdlib/source/lux/data/number/complex.lux | 26 ++++-----
stdlib/source/lux/data/number/ratio.lux | 4 +-
stdlib/source/lux/data/text/buffer.lux | 2 +-
stdlib/source/lux/data/text/format.lux | 2 +-
stdlib/source/lux/data/text/lexer.lux | 2 +-
stdlib/source/lux/data/text/regex.lux | 16 +++---
stdlib/source/lux/data/text/unicode.lux | 2 +-
stdlib/source/lux/host.js.lux | 2 +-
stdlib/source/lux/host.jvm.lux | 8 +--
stdlib/source/lux/language/compiler/analysis.lux | 4 +-
.../source/lux/language/compiler/analysis/case.lux | 2 +-
.../language/compiler/analysis/case/coverage.lux | 8 +--
.../lux/language/compiler/analysis/function.lux | 2 +-
.../lux/language/compiler/analysis/inference.lux | 4 +-
.../lux/language/compiler/analysis/reference.lux | 2 +-
.../lux/language/compiler/analysis/structure.lux | 2 +-
.../lux/language/compiler/extension/analysis.lux | 2 +-
.../compiler/extension/analysis/common.lux | 2 +-
.../compiler/extension/analysis/host.jvm.lux | 8 +--
.../lux/language/compiler/extension/bundle.lux | 2 +-
stdlib/source/lux/language/compiler/meta/cache.lux | 4 +-
.../language/compiler/meta/cache/dependency.lux | 2 +-
.../lux/language/compiler/synthesis/case.lux | 10 ++--
.../lux/language/compiler/synthesis/expression.lux | 4 +-
.../lux/language/compiler/synthesis/function.lux | 4 +-
.../lux/language/compiler/synthesis/loop.lux | 4 +-
.../source/lux/language/compiler/translation.lux | 2 +-
.../compiler/translation/scheme/case.jvm.lux | 4 +-
.../compiler/translation/scheme/extension.jvm.lux | 2 +-
.../translation/scheme/extension/common.jvm.lux | 2 +-
.../compiler/translation/scheme/function.jvm.lux | 4 +-
.../compiler/translation/scheme/loop.jvm.lux | 2 +-
.../compiler/translation/scheme/primitive.jvm.lux | 2 +-
.../compiler/translation/scheme/reference.jvm.lux | 2 +-
.../compiler/translation/scheme/runtime.jvm.lux | 6 +-
stdlib/source/lux/language/host/scheme.lux | 2 +-
stdlib/source/lux/language/module.lux | 4 +-
stdlib/source/lux/language/scope.lux | 6 +-
stdlib/source/lux/language/syntax.lux | 4 +-
stdlib/source/lux/language/type.lux | 8 +--
stdlib/source/lux/language/type/check.lux | 6 +-
stdlib/source/lux/macro.lux | 8 +--
stdlib/source/lux/macro/code.lux | 34 +++++------
stdlib/source/lux/macro/poly.lux | 10 ++--
stdlib/source/lux/macro/poly/equivalence.lux | 6 +-
stdlib/source/lux/macro/poly/functor.lux | 20 +++----
stdlib/source/lux/macro/poly/json.lux | 10 ++--
stdlib/source/lux/macro/syntax.lux | 6 +-
stdlib/source/lux/macro/syntax/common/reader.lux | 12 ++--
stdlib/source/lux/macro/syntax/common/writer.lux | 2 +-
stdlib/source/lux/math.lux | 40 ++++++-------
stdlib/source/lux/math/logic/continuous.lux | 6 +-
stdlib/source/lux/math/modular.lux | 4 +-
stdlib/source/lux/math/random.lux | 4 +-
stdlib/source/lux/test.lux | 2 +-
stdlib/source/lux/time/date.lux | 4 +-
stdlib/source/lux/time/duration.lux | 4 +-
stdlib/source/lux/time/instant.lux | 12 ++--
stdlib/source/lux/type/abstract.lux | 6 +-
stdlib/source/lux/type/implicit.lux | 4 +-
stdlib/source/lux/type/object/interface.lux | 14 ++---
stdlib/source/lux/type/object/protocol.lux | 4 +-
stdlib/source/lux/type/refinement.lux | 2 +-
stdlib/source/lux/type/resource.lux | 2 +-
97 files changed, 348 insertions(+), 354 deletions(-)
(limited to 'stdlib/source')
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux
index 4710b022b..6d1f9e106 100644
--- a/stdlib/source/lux.lux
+++ b/stdlib/source/lux.lux
@@ -4055,7 +4055,7 @@
#Nothing)
(type: Openings
- [Text (List Ident)])
+ [Text (List Text)])
(type: Refer
{#refer-defs Referrals
@@ -4115,17 +4115,20 @@
(def: (parse-short-referrals tokens)
(-> (List Code) (Meta [Referrals (List Code)]))
(case tokens
- (^ (list& [_ (#Form (list& [_ (#Tag "" "+")] defs))] tokens'))
+ (^or (^ (list& [_ (#Form (list& [_ (#Tag ["" "+"])] defs))] tokens'))
+ (^ (list& [_ (#Form (list& [_ (#Tag ["" "only"])] defs))] tokens')))
(do Monad
[defs' (extract-defs defs)]
(return [(#Only defs') tokens']))
- (^ (list& [_ (#Form (list& [_ (#Tag "" "-")] defs))] tokens'))
+ (^or (^ (list& [_ (#Form (list& [_ (#Tag ["" "-"])] defs))] tokens'))
+ (^ (list& [_ (#Form (list& [_ (#Tag ["" "exclude"])] defs))] tokens')))
(do Monad
[defs' (extract-defs defs)]
(return [(#Exclude defs') tokens']))
- (^ (list& [_ (#Tag "" "*")] tokens'))
+ (^or (^ (list& [_ (#Tag ["" "*"])] tokens'))
+ (^ (list& [_ (#Tag ["" "all"])] tokens')))
(return [#All tokens'])
_
@@ -4160,7 +4163,7 @@
[_ (#Text prefix)]
(list& [prefix (list)] openings)
- [_ (#Symbol struct-name)]
+ [_ (#Symbol ["" struct-name])]
(case openings
#Nil
(list ["" (list struct-name)])
@@ -4180,36 +4183,28 @@
(def: (parse-short-openings parts)
(-> (List Code) (Meta [(List Openings) (List Code)]))
- (if (|> parts
- (list/map (: (-> Code Bool)
- (function (_ part)
- (case part
- (^or [_ (#Text _)] [_ (#Symbol _)])
- true
+ (case parts
+ #.Nil
+ (return [#.Nil #.Nil])
- _
- false))))
- (list/fold (function (_ r l) (and l r)) true))
- (let [openings (list/fold (: (-> Code (List Openings) (List Openings))
- (function (_ part openings)
- (case part
- [_ (#Text prefix)]
- (list& [prefix (list)] openings)
-
- [_ (#Symbol struct-name)]
- (case openings
- #Nil
- (list ["" (list struct-name)])
-
- (#Cons [prefix structs] openings')
- (#Cons [prefix (#Cons struct-name structs)] openings'))
+ (^ (list& [_ (#Form (list& [_ (#Text prefix)] structs))] parts'))
+ (do Monad
+ [structs' (monad/map Monad
+ (function (_ struct)
+ (case struct
+ [_ (#Symbol ["" struct-name])]
+ (return struct-name)
- _
- openings)))
- (: (List Openings) (list))
- parts)]
- (return [openings (list)]))
- (fail "Expected all parts of opening form to be of either prefix (text) or struct (symbol).")))
+ _
+ (fail "Expected all structures of opening form to be symbols.")))
+ structs)
+ next+remainder (parse-short-openings parts')]
+ (let [[next remainder] next+remainder]
+ (return [(#.Cons [prefix structs'] next)
+ remainder])))
+
+ _
+ (return [#.Nil parts])))
(def: (decorate-sub-importations super-name)
(-> Text (List Importation) (List Importation))
@@ -4877,7 +4872,7 @@
defs')
openings (join-map (: (-> Openings (List Code))
(function (_ [prefix structs])
- (list/map (function (_ [_ name])
+ (list/map (function (_ name)
(` (open: (~ (text$ prefix)) (~ (symbol$ [module-name name])))))
structs)))
r-opens)]]
@@ -4912,7 +4907,7 @@
#Nothing
(list)))
=opens (join-map (function (_ [prefix structs])
- (list& (text$ prefix) (list/map symbol$ structs)))
+ (list& (text$ prefix) (list/map (|>> [""] symbol$) structs)))
r-opens)]
(` (..refer (~ (text$ module-name))
(~+ =defs)
diff --git a/stdlib/source/lux/cli.lux b/stdlib/source/lux/cli.lux
index 00b39aed1..0f7659fff 100644
--- a/stdlib/source/lux/cli.lux
+++ b/stdlib/source/lux/cli.lux
@@ -2,8 +2,8 @@
lux
(lux (control monad
["p" parser])
- (data (collection [list "list/" Monoid Monad])
- [text "text/" Equivalence]
+ (data (collection [list ("list/" Monoid Monad)])
+ [text ("text/" Equivalence)]
text/format
["E" error])
[io]
diff --git a/stdlib/source/lux/concurrency/actor.lux b/stdlib/source/lux/concurrency/actor.lux
index 609e649d1..792b65dfc 100644
--- a/stdlib/source/lux/concurrency/actor.lux
+++ b/stdlib/source/lux/concurrency/actor.lux
@@ -3,11 +3,11 @@
(lux (control monad
["p" parser]
["ex" exception (#+ exception:)])
- [io (#- run) "io/" Monad]
+ [io (#- run) ("io/" Monad)]
(data [product]
["e" error]
text/format
- (collection [list "list/" Monoid Monad Fold]))
+ (collection [list ("list/" Monoid Monad Fold)]))
[macro (#+ with-gensyms Monad)]
(macro [code]
["s" syntax (#+ syntax: Syntax)]
@@ -16,7 +16,7 @@
["csw" writer])))
(type abstract))
(// [atom (#+ Atom atom)]
- [promise (#+ Promise promise) "promise/" Monad]
+ [promise (#+ Promise promise) ("promise/" Monad)]
[task (#+ Task)]))
(exception: #export poisoned)
diff --git a/stdlib/source/lux/concurrency/frp.lux b/stdlib/source/lux/concurrency/frp.lux
index 6b78d875a..0ecaf9266 100644
--- a/stdlib/source/lux/concurrency/frp.lux
+++ b/stdlib/source/lux/concurrency/frp.lux
@@ -4,7 +4,7 @@
[apply (#+ Apply)]
[monad (#+ do Monad)])
[io (#+ IO io)]
- (data (collection [list "list/" Monoid]))
+ (data (collection [list ("list/" Monoid)]))
(type abstract))
(// [atom (#+ Atom atom)]
[promise (#+ Promise)]))
diff --git a/stdlib/source/lux/concurrency/stm.lux b/stdlib/source/lux/concurrency/stm.lux
index 8039738df..1478c55e3 100644
--- a/stdlib/source/lux/concurrency/stm.lux
+++ b/stdlib/source/lux/concurrency/stm.lux
@@ -6,10 +6,10 @@
[io (#+ IO io)]
(data [product]
[maybe]
- (collection [list "list/" Functor Fold]))
+ (collection [list ("list/" Functor Fold)]))
(concurrency [atom (#+ Atom atom)]
[promise (#+ Promise promise)]
- [frp "frp/" Functor])
+ [frp ("frp/" Functor)])
(type abstract)))
(abstract: #export (Var a)
diff --git a/stdlib/source/lux/control/comonad.lux b/stdlib/source/lux/control/comonad.lux
index 557cd3b7b..a154a89a2 100644
--- a/stdlib/source/lux/control/comonad.lux
+++ b/stdlib/source/lux/control/comonad.lux
@@ -1,6 +1,6 @@
(.module:
lux
- (lux (data (collection [list "list/" Fold])))
+ (lux (data (collection [list ("list/" Fold)])))
["F" //functor])
## [Signatures]
diff --git a/stdlib/source/lux/control/concatenative.lux b/stdlib/source/lux/control/concatenative.lux
index 05e74accc..449449b97 100644
--- a/stdlib/source/lux/control/concatenative.lux
+++ b/stdlib/source/lux/control/concatenative.lux
@@ -3,12 +3,12 @@
i/+ i/- i/* i// i/% i/= i/< i/<= i/> i/>=
r/+ r/- r/* r// r/% r/= r/< r/<= r/> r/>=
f/+ f/- f/* f// f/% f/= f/< f/<= f/> f/>=)]
- (lux (control ["p" parser "p/" Monad]
+ (lux (control ["p" parser ("parser/" Monad)]
[monad])
(data [text]
text/format
- [maybe "maybe/" Monad]
- (collection [list "list/" Fold Functor]))
+ [maybe ("maybe/" Monad)]
+ (collection [list ("list/" Fold Functor)]))
[macro (#+ with-gensyms Monad)]
(macro [code]
["s" syntax (#+ syntax:)]
@@ -38,8 +38,8 @@
(s.Syntax Stack)
(p.either (p.seq (p.maybe bottom^)
(s.tuple (p.some s.any)))
- (p.seq (|> bottom^ (p/map (|>> #.Some)))
- (p/wrap (list)))))
+ (p.seq (|> bottom^ (parser/map (|>> #.Some)))
+ (parser/wrap (list)))))
(def: (stack-fold tops bottom)
(-> (List Code) Code Code)
diff --git a/stdlib/source/lux/control/exception.lux b/stdlib/source/lux/control/exception.lux
index 559324fd2..ab1b27e94 100644
--- a/stdlib/source/lux/control/exception.lux
+++ b/stdlib/source/lux/control/exception.lux
@@ -5,8 +5,8 @@
(data ["/" error (#+ Error)]
[maybe]
[product]
- [text "text/" Monoid]
- (collection [list "list/" Functor Fold]))
+ [text ("text/" Monoid)]
+ (collection [list ("list/" Functor Fold)]))
[macro]
(macro [code]
["s" syntax (#+ syntax: Syntax)]
diff --git a/stdlib/source/lux/control/monad/indexed.lux b/stdlib/source/lux/control/monad/indexed.lux
index cf5039593..cbed38690 100644
--- a/stdlib/source/lux/control/monad/indexed.lux
+++ b/stdlib/source/lux/control/monad/indexed.lux
@@ -2,7 +2,7 @@
lux
(lux (control [monad]
["p" parser])
- (data (collection [list "list/" Functor Fold]))
+ (data (collection [list ("list/" Functor Fold)]))
[macro]
(macro ["s" syntax (#+ Syntax syntax:)])))
diff --git a/stdlib/source/lux/control/parser.lux b/stdlib/source/lux/control/parser.lux
index 0fe19babd..e25115d80 100644
--- a/stdlib/source/lux/control/parser.lux
+++ b/stdlib/source/lux/control/parser.lux
@@ -4,7 +4,7 @@
[apply (#+ Apply)]
[monad (#+ do Monad)]
[codec])
- (data (collection [list "list/" Functor Monoid])
+ (data (collection [list ("list/" Functor Monoid)])
[product]
["e" error (#+ Error)])))
diff --git a/stdlib/source/lux/control/pipe.lux b/stdlib/source/lux/control/pipe.lux
index b5ac74975..82c2b5a2c 100644
--- a/stdlib/source/lux/control/pipe.lux
+++ b/stdlib/source/lux/control/pipe.lux
@@ -3,7 +3,7 @@
(lux (control [monad (#+ do)]
["p" parser])
(data ["e" error]
- (collection [list "list/" Fold Monad]))
+ (collection [list ("list/" Fold Monad)]))
[macro (#+ with-gensyms)]
(macro ["s" syntax (#+ syntax: Syntax)]
[code])
diff --git a/stdlib/source/lux/control/region.lux b/stdlib/source/lux/control/region.lux
index 51dcfc3d3..089bf9587 100644
--- a/stdlib/source/lux/control/region.lux
+++ b/stdlib/source/lux/control/region.lux
@@ -6,7 +6,7 @@
["ex" exception (#+ Exception exception:)])
(data ["e" error (#+ Error)]
text/format
- (collection [list "list/" Fold]))))
+ (collection [list ("list/" Fold)]))))
(type: (Cleaner r m)
(-> r (m (Error Any))))
diff --git a/stdlib/source/lux/data/collection/array.lux b/stdlib/source/lux/data/collection/array.lux
index eb4c24033..fa261318f 100644
--- a/stdlib/source/lux/data/collection/array.lux
+++ b/stdlib/source/lux/data/collection/array.lux
@@ -4,7 +4,7 @@
[functor (#+ Functor)]
[equivalence (#+ Equivalence)]
fold)
- (data (collection [list "list/" Fold])
+ (data (collection [list ("list/" Fold)])
[product])
))
diff --git a/stdlib/source/lux/data/collection/bits.lux b/stdlib/source/lux/data/collection/bits.lux
index c0c644e00..74a3e4189 100644
--- a/stdlib/source/lux/data/collection/bits.lux
+++ b/stdlib/source/lux/data/collection/bits.lux
@@ -4,7 +4,7 @@
pipe)
(data [maybe]
[bit]
- (collection [array "array/" Fold])
+ (collection [array ("array/" Fold)])
text/format)))
(type: #export Chunk I64)
diff --git a/stdlib/source/lux/data/collection/dictionary.lux b/stdlib/source/lux/data/collection/dictionary.lux
index 69f858502..6712b57fb 100644
--- a/stdlib/source/lux/data/collection/dictionary.lux
+++ b/stdlib/source/lux/data/collection/dictionary.lux
@@ -3,8 +3,8 @@
(lux (control hash
[equivalence (#+ Equivalence)])
(data [maybe]
- (collection [list "list/" Fold Functor Monoid]
- [array "array/" Functor Fold])
+ (collection [list ("list/" Fold Functor Monoid)]
+ [array ("array/" Functor Fold)])
[bit]
[product]
[number])
diff --git a/stdlib/source/lux/data/collection/dictionary/ordered.lux b/stdlib/source/lux/data/collection/dictionary/ordered.lux
index e10526e2c..6c0b645fc 100644
--- a/stdlib/source/lux/data/collection/dictionary/ordered.lux
+++ b/stdlib/source/lux/data/collection/dictionary/ordered.lux
@@ -3,7 +3,7 @@
(lux (control [monad (#+ do Monad)]
equivalence
[order (#+ Order)])
- (data (collection [list "L/" Monad Monoid Fold])
+ (data (collection [list ("list/" Monoid Fold)])
["p" product]
[maybe])
[macro]
@@ -527,10 +527,10 @@
(def: #export (from-list Order list)
(All [k v] (-> (Order k) (List [k v]) (Dictionary k v)))
- (L/fold (function (_ [key value] dict)
- (put key value dict))
- (new Order)
- list))
+ (list/fold (function (_ [key value] dict)
+ (put key value dict))
+ (new Order)
+ list))
(do-template [