diff options
Diffstat (limited to 'stdlib/source/lux.lux')
-rw-r--r-- | stdlib/source/lux.lux | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index c22036ef2..d3a0f1825 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -4246,23 +4246,17 @@ " Relative Root: " relative-root ..new-line)))))) (def: (alter-domain alteration domain import) - (-> Int Text Importation Importation) + (-> Nat Text Importation Importation) (let [[import-name import-alias import-refer] import original (text/split-all-with ..module-separator import-name) - [pre post] (if (i/< +0 alteration) - [(list) (list/drop (.nat (i/* -1 alteration)) original)] - [(list/take (.nat alteration) original) - (list/drop (.nat alteration) original)]) - altered ($_ list/compose - pre - (case domain - "" - (list) + truncated (list/drop (.nat alteration) original) + parallel (case domain + "" + truncated - _ - (list domain)) - post)] - {#import-name (text/join-with ..module-separator altered) + _ + (list& domain truncated))] + {#import-name (text/join-with ..module-separator parallel) #import-alias import-alias #import-refer import-refer})) @@ -4273,6 +4267,7 @@ (: (-> Code (Meta (List Importation))) (function (_ token) (case token + ## Simple [_ (#Identifier ["" m-name])] (do Monad<Meta> [m-name (clean-module nested? relative-root m-name)] @@ -4281,6 +4276,7 @@ #import-refer {#refer-defs #All #refer-open (list)}}))) + ## Nested (^ [_ (#Tuple (list& [_ (#Identifier ["" m-name])] extra))]) (do Monad<Meta> [import-name (clean-module nested? relative-root m-name) @@ -4311,10 +4307,25 @@ #refer-open openings}} sub-imports))) - (^ [_ (#Record (list [[_ (#Tuple (list [_ (#Int alteration)] [_ (#Text domain)]))] + ## Parallel + (^ [_ (#Record (list [[_ (#Tuple (list [_ (#Nat alteration)] + [_ (#Tag ["" domain])]))] + parallel-tree]))]) + (do Monad<Meta> + [parallel-imports (parse-imports nested? relative-root (list parallel-tree))] + (wrap (list/map (alter-domain alteration domain) parallel-imports))) + + (^ [_ (#Record (list [[_ (#Nat alteration)] parallel-tree]))]) (do Monad<Meta> [parallel-imports (parse-imports nested? relative-root (list parallel-tree))] + (wrap (list/map (alter-domain alteration "") parallel-imports))) + + (^ [_ (#Record (list [[_ (#Tag ["" domain])] + parallel-tree]))]) + (do Monad<Meta> + [parallel-imports (parse-imports nested? relative-root (list parallel-tree)) + #let [alteration (list/size (text/split-all-with ..module-separator domain))]] (wrap (list/map (alter-domain alteration domain) parallel-imports))) _ |