diff options
Diffstat (limited to '')
23 files changed, 186 insertions, 184 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 0dcc335a0..5521e2d0d 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -1205,7 +1205,7 @@ (#Cons x xs') (list/fold f (f x init) xs')})) -(def:'' (length list) +(def:'' (list/size list) #;Nil (#UnivQ #Nil (#Function ($' List (#Bound +1)) Nat)) @@ -1250,7 +1250,7 @@ [false _] (replace-syntax (#Cons [self-name (make-bound ("lux nat *" +2 ("lux nat -" - (length names) + (list/size names) +1)))] #Nil) body')}) @@ -1301,7 +1301,7 @@ [false _] (replace-syntax (#Cons [self-name (make-bound ("lux nat *" +2 ("lux nat -" - (length names) + (list/size names) +1)))] #Nil) body')}) @@ -1311,7 +1311,7 @@ (fail "Wrong syntax for Ex")}) )) -(def:'' (reverse list) +(def:'' (list/reverse list) #;Nil (All [a] (#Function ($' List a) ($' List a))) (list/fold ("lux check" (All [a] (#Function a (#Function ($' List a) ($' List a)))) @@ -1326,7 +1326,7 @@ ## This is the type of a function that takes 2 Ints and returns an Int.")] #;Nil) - ("lux case" (reverse tokens) + ("lux case" (list/reverse tokens) {(#Cons output inputs) (return (#Cons (list/fold ("lux check" (#Function Code (#Function Code Code)) (function'' [i o] (form$ (#Cons (tag$ ["lux" "Function"]) (#Cons i (#Cons o #Nil)))))) @@ -1347,7 +1347,7 @@ (#Cons (tuple$ (#Cons [head (#Cons [tail #Nil])])) #Nil)))) (tag$ ["lux" "Nil"]) - (reverse xs)) + (list/reverse xs)) #Nil))) (macro:' #export (list& xs) @@ -1356,7 +1356,7 @@ ## In other words, this macro prepends elements to another list. (list& 1 2 3 (list 4 5 6))")] #;Nil) - ("lux case" (reverse xs) + ("lux case" (list/reverse xs) {(#Cons last init) (return (list (list/fold (function'' [head tail] (form$ (list (tag$ ["lux" "Cons"]) @@ -1375,7 +1375,7 @@ ## The empty tuple, a.k.a. Unit. (&)")] #;Nil) - ("lux case" (reverse tokens) + ("lux case" (list/reverse tokens) {#Nil (return (list (tag$ ["lux" "Unit"]))) @@ -1393,7 +1393,7 @@ ## The empty tuple, a.k.a. Void. (|)")] #;Nil) - ("lux case" (reverse tokens) + ("lux case" (list/reverse tokens) {#Nil (return (list (tag$ ["lux" "Void"]))) @@ -1426,7 +1426,7 @@ arg body'))) body - (reverse targs))))))}) + (list/reverse targs))))))}) _ (fail "Wrong syntax for function'")}))) @@ -1504,7 +1504,7 @@ {[label value] (form$ (list (text$ "lux case") value (record$ (list [label body]))))}))) body - (reverse (as-pairs bindings))))) + (list/reverse (as-pairs bindings))))) _ (fail "Wrong syntax for let'")})) @@ -1600,7 +1600,7 @@ #;Nil) ("lux case" tokens {(#Cons op tokens') - ("lux case" (reverse tokens') + ("lux case" (list/reverse tokens') {(#Cons last prevs) (return (list (list/fold (_$_joiner op) last prevs))) @@ -1674,7 +1674,7 @@ (form$ (list (text$ "lux function") (symbol$ ["" ""]) var body')) value))})))) body - (reverse (as-pairs bindings)))] + (list/reverse (as-pairs bindings)))] (return (list (form$ (list (text$ "lux case") monad (record$ (list [(record$ (list [(tag$ ["lux" "wrap"]) g!wrap] [(tag$ ["lux" "bind"]) g!bind])) @@ -1847,7 +1847,7 @@ (-> Bool (-> Code ($' Meta Code)) ($' List Code) ($' Meta Code)) ("lux case" replace? {true - ("lux case" (reverse elems) + ("lux case" (list/reverse elems) {#Nil (return (tag$ ["lux" "Nil"])) @@ -2082,7 +2082,7 @@ (fold text/compose \"\" (interpose \" \" (map int/encode elems)))")]) - ("lux case" (reverse tokens) + ("lux case" (list/reverse tokens) {(#Cons [init apps]) (return (list (list/fold ("lux check" (-> Code Code Code) (function' [app acc] @@ -2210,9 +2210,9 @@ {[(#Some bindings') (#Some data')] (let' [apply ("lux check" (-> RepEnv ($' List Code)) (function' [env] (map (apply-template env) templates))) - num-bindings (length bindings')] + num-bindings (list/size bindings')] (if (every? (function' [sample] ("lux nat =" num-bindings sample)) - (map length data')) + (map list/size data')) (|> data' (join-map (. apply (make-env bindings'))) return) @@ -2480,7 +2480,7 @@ #Nil (All [a] (-> ($' List ($' List a)) ($' List a))) - (list/fold list/compose #Nil (reverse xs))) + (list/fold list/compose #Nil (list/reverse xs))) (def:''' (interpose sep xs) #Nil @@ -2752,7 +2752,7 @@ (log! \"#2\") (log! \"#3\") \"YOLO\")")]) - ("lux case" (reverse tokens) + ("lux case" (list/reverse tokens) {(#Cons value actions) (let' [dummy (symbol$ ["" ""])] (return (list (list/fold ("lux check" (-> Code Code Code) @@ -2849,21 +2849,21 @@ ($_ text/compose "(" (|> xs (map code-to-text) (interpose " ") - reverse + list/reverse (list/fold text/compose "")) ")") [_ (#Tuple xs)] ($_ text/compose "[" (|> xs (map code-to-text) (interpose " ") - reverse + list/reverse (list/fold text/compose "")) "]") [_ (#Record kvs)] ($_ text/compose "{" (|> kvs (map (function' [kv] ("lux case" kv {[k v] ($_ text/compose (code-to-text k) " " (code-to-text v))}))) (interpose " ") - reverse + list/reverse (list/fold text/compose "")) "}")} )) @@ -2897,7 +2897,7 @@ (fail ($_ text/compose "\"lux;case\" expects an even number of tokens: " (|> branches (map code-to-text) (interpose " ") - reverse + list/reverse (list/fold text/compose ""))))})) (macro:' #export (case tokens) @@ -2996,8 +2996,8 @@ (op x y))")]) (case tokens (^ (list [_ (#Tuple bindings)] body)) - (if (multiple? +2 (length bindings)) - (|> bindings as-pairs reverse + (if (multiple? +2 (list/size bindings)) + (|> bindings as-pairs list/reverse (list/fold (: (-> [Code Code] Code Code) (function' [lr body'] (let' [[l r] lr] @@ -3041,7 +3041,7 @@ (` ("lux function" (~ g!blank) (~ g!blank) (case (~ g!blank) (~ arg) (~ body'))))))) body - (reverse tail))] + (list/reverse tail))] (return (list (if (symbol? head) (` ("lux function" (~ g!name) (~ head) (~ body+))) (` ("lux function" (~ g!name) (~ g!blank) (case (~ g!blank) (~ head) (~ body+)))))))) @@ -3373,7 +3373,7 @@ (do-template [<name> <form> <message> <doc-msg>] [(macro: #export (<name> tokens) {#;doc <doc-msg>} - (case (reverse tokens) + (case (list/reverse tokens) (^ (list& last init)) (return (list (list/fold (: (-> Code Code Code) (function [pre post] (` <form>))) @@ -3442,41 +3442,19 @@ _ (#;Left "Wrong syntax for default"))) -(def: (split-text splitter input) +(def: (text/split splitter input) (-> Text Text (List Text)) (case (index-of splitter input) #;None - (#Cons input #Nil) + (list input) (#;Some idx) - (#Cons (default (error! "UNDEFINED") + (list& (default (error! "UNDEFINED") (clip2 +0 idx input)) - (split-text splitter + (text/split splitter (default (error! "UNDEFINED") (clip1 (n.+ +1 idx) input)))))) -(def: (split-module-contexts module) - (-> Text (List Text)) - (#Cons module (case (last-index-of "/" module) - #;None - #Nil - - (#;Some idx) - (split-module-contexts (default (error! "UNDEFINED") - (clip2 +0 idx module)))))) - -(def: (split-module module) - (-> Text (List Text)) - (case (index-of "/" module) - #;None - (list module) - - (#;Some idx) - (list& (default (error! "UNDEFINED") - (clip2 +0 idx module)) - (split-module (default (error! "UNDEFINED") - (clip1 (n.+ +1 idx) module)))))) - (def: (nth idx xs) (All [a] (-> Nat (List a) (Maybe a))) @@ -3719,7 +3697,7 @@ (def: (text/join parts) (-> (List Text) Text) - (|> parts reverse (list/fold text/compose ""))) + (|> parts list/reverse (list/fold text/compose ""))) (macro: #export (struct: tokens) {#;doc "## Definition of structures ala ML. @@ -3969,7 +3947,7 @@ (All [a] (-> (-> a Bool) (List a) [(List a) (List a)])) (let [[ys' xs'] (split-with' p #Nil xs)] - [(reverse ys') xs'])) + [(list/reverse ys') xs'])) (def: (parse-short-referrals tokens) (-> (List Code) (Meta [Referrals (List Code)])) @@ -4089,30 +4067,53 @@ (-> Text Text Text Text) ("lux text replace-all" template pattern value)) -(def: (clean-module module) - (-> Text (Meta Text)) - (do Monad<Meta> - [current-module current-module-name] - (case (split-module module) - (^ (list& "." parts)) - (return (|> (list& current-module parts) (interpose "/") reverse (list/fold text/compose ""))) - - parts - (let [[ups parts'] (split-with (text/= "..") parts) - num-ups (length ups)] - (if (n.= +0 num-ups) - (return module) - (case (nth num-ups (split-module-contexts current-module)) - #None - (fail (text/compose "Cannot clean module: " module)) - - (#Some top-module) - (return (|> (list& top-module parts') (interpose "/") reverse (list/fold text/compose "")))) - ))) - )) - -(def: (parse-imports imports) - (-> (List Code) (Meta (List Importation))) +(def: (count-ups ups input) + (-> Nat Text Nat) + (case ("lux text index" input "/" ups) + #;None + ups + + (#;Some found) + (if (n.= ups found) + (count-ups (n.+ +1 ups) input) + ups))) + +(def: (list/drop amount a+) + (All [a] (-> Nat (List a) (List a))) + (case [amount a+] + (^or [+0 _] [_ #;Nil]) + a+ + + [_ (#;Cons _ a+')] + (list/drop (n.- +1 amount) a+'))) + +(def: (clean-module relative-root module) + (-> Text Text (Meta Text)) + (case (count-ups +0 module) + +0 + (return module) + + ups + (let [parts (text/split "/" relative-root)] + (if (n.< (list/size parts) (n.- +1 ups)) + (let [prefix (|> parts + list/reverse + (list/drop (n.- +1 ups)) + list/reverse + (interpose "/") + text/join) + clean (|> module (clip1 ups) (default (error! "UNDEFINED"))) + output (case ("lux text size" clean) + +0 prefix + _ ($_ text/compose prefix "/" clean))] + (return output)) + (fail ($_ text/compose + "Cannot climb the module hierarchy...\n" + "Importing module: " module "\n" + " Relative Root: " relative-root "\n")))))) + +(def: (parse-imports relative-root imports) + (-> Text (List Code) (Meta (List Importation))) (do Monad<Meta> [imports' (monad/map Monad<Meta> (: (-> Code (Meta (List Importation))) @@ -4120,20 +4121,20 @@ (case token [_ (#Symbol "" m-name)] (do Monad<Meta> - [m-name (clean-module m-name)] + [m-name (clean-module relative-root m-name)] (wrap (list [m-name #None {#refer-defs #All #refer-open (list)}]))) (^ [_ (#Form (list& [_ (#Symbol "" m-name)] extra))]) (do Monad<Meta> - [m-name (clean-module m-name) + [m-name (clean-module relative-root m-name) alias+extra (parse-alias extra) #let [[alias extra] alias+extra] referral+extra (parse-referrals extra) #let [[referral extra] referral+extra] openings+extra (parse-openings extra) #let [[openings extra] openings+extra] - sub-imports (parse-imports extra) + sub-imports (parse-imports relative-root extra) #let [sub-imports (decorate-sub-importations m-name sub-imports)]] (wrap (case [referral alias openings] [#Nothing #None #Nil] sub-imports @@ -4145,7 +4146,7 @@ (^ [_ (#Tuple (list& [_ (#Text alias)] [_ (#Symbol "" m-name)] extra))]) (do Monad<Meta> - [m-name (clean-module m-name) + [m-name (clean-module relative-root m-name) referral+extra (parse-short-referrals extra) #let [[referral extra] referral+extra] openings+extra (parse-short-openings extra) @@ -4157,7 +4158,7 @@ (^ [_ (#Tuple (list& [_ (#Symbol "" raw-m-name)] extra))]) (do Monad<Meta> - [m-name (clean-module raw-m-name) + [m-name (clean-module relative-root raw-m-name) referral+extra (parse-short-referrals extra) #let [[referral extra] referral+extra] openings+extra (parse-short-openings extra) @@ -4366,7 +4367,7 @@ name _ - ($_ text/compose "(" name " " (|> params (map type/show) (interpose " ") reverse (list/fold text/compose "")) ")")) + ($_ text/compose "(" name " " (|> params (map type/show) (interpose " ") list/reverse (list/fold text/compose "")) ")")) #Void "Void" @@ -4375,13 +4376,13 @@ "Unit" (#Sum _) - ($_ text/compose "(| " (|> (flatten-variant type) (map type/show) (interpose " ") reverse (list/fold text/compose "")) ")") + ($_ text/compose "(| " (|> (flatten-variant type) (map type/show) (interpose " ") list/reverse (list/fold text/compose "")) ")") (#Product _) - ($_ text/compose "[" (|> (flatten-tuple type) (map type/show) (interpose " ") reverse (list/fold text/compose "")) "]") + ($_ text/compose "[" (|> (flatten-tuple type) (map type/show) (interpose " ") list/reverse (list/fold text/compose "")) "]") (#Function _) - ($_ text/compose "(-> " (|> (flatten-lambda type) (map type/show) (interpose " ") reverse (list/fold text/compose "")) ")") + ($_ text/compose "(-> " (|> (flatten-lambda type) (map type/show) (interpose " ") list/reverse (list/fold text/compose "")) ")") (#Bound id) (nat/encode id) @@ -4402,7 +4403,7 @@ (let [[func args] (flatten-app type)] ($_ text/compose "(" (type/show func) " " - (|> args (map type/show) (interpose " ") reverse (list/fold text/compose "")) + (|> args (map type/show) (interpose " ") list/reverse (list/fold text/compose "")) ")")) (#Named [prefix name] _) @@ -4473,9 +4474,9 @@ (n.odd? num) \"odd\" ## else-branch \"???\")"} - (if (n.= +0 (n.% +2 (length tokens))) + (if (n.= +0 (n.% +2 (list/size tokens))) (fail "cond requires an even number of arguments.") - (case (reverse tokens) + (case (list/reverse tokens) (^ (list& else branches')) (return (list (list/fold (: (-> [Code Code] Code Code) (function [branch else] @@ -4758,7 +4759,7 @@ (ident #open (\"ident/\" Codec<Text,Ident>))) meta (macro code)) - (.. (type #open (\"\" Eq<Type>)))) + (// (type #open (\"\" Eq<Type>)))) (;module: {#;doc \"Some documentation...\"} lux @@ -4769,7 +4770,7 @@ [ident \"ident/\" Codec<Text,Ident>]) meta (macro code)) - (.. [type \"\" Eq<Type>]))"} + (// [type \"\" Eq<Type>]))"} (do Monad<Meta> [#let [[_meta _imports] (: [(List [Code Code]) (List Code)] (case tokens @@ -4778,7 +4779,8 @@ _ [(list) tokens]))] - imports (parse-imports _imports) + current-module current-module-name + imports (parse-imports current-module _imports) #let [=imports (map (: (-> Importation Code) (function [[m-name m-alias =refer]] (` [(~ (text$ m-name)) (~ (text$ (default "" m-alias)))]))) @@ -4870,14 +4872,14 @@ (function [[s b] v] (` (;;set@ (~ s) (~ v) (~ b))))) value - (reverse pairs)) + (list/reverse pairs)) [_ accesses'] (list/fold (: (-> [Code Code] [Code (List (List Code))] [Code (List (List Code))]) (function [[new-slot new-binding] [old-record accesses']] [(` (get@ (~ new-slot) (~ new-binding))) (#;Cons (list new-binding old-record) accesses')])) [record (: (List (List Code)) #;Nil)] pairs) - accesses (list/join (reverse accesses'))]] + accesses (list/join (list/reverse accesses'))]] (wrap (list (` (let [(~@ accesses)] (~ update-expr))))))) @@ -5011,7 +5013,7 @@ (do Monad<Maybe> [bindings' (monad/map Monad<Maybe> get-name bindings) data' (monad/map Monad<Maybe> tuple->list data)] - (if (every? (n.= (length bindings')) (map length data')) + (if (every? (n.= (list/size bindings')) (map list/size data')) (let [apply (: (-> RepEnv (List Code)) (function [env] (map (apply-template env) templates)))] (|> data' @@ -5193,7 +5195,7 @@ (case fragment (#Doc-Comment comment) (|> comment - (split-text "\n") + (text/split "\n") (map (function [line] ($_ text/compose "## " line "\n"))) text/join) @@ -5574,7 +5576,7 @@ (~ g!_) #;None))) (` (#;Some (~ body))) - (: (List [Code Code]) (reverse levels)))] + (: (List [Code Code]) (list/reverse levels)))] (list init-pattern inner-pattern-body))) (macro: #export (^multi tokens) @@ -5680,7 +5682,7 @@ (^ (list [_ (#Nat idx)])) (do Monad<Meta> [stvs get-scope-type-vars] - (case (list-at idx (reverse stvs)) + (case (list-at idx (list/reverse stvs)) (#;Some var-id) (wrap (list (` (#Ex (~ (nat$ var-id)))))) @@ -6060,11 +6062,11 @@ (^template [<tag>] [_ (<tag> elems)] - (case (reverse elems) + (case (list/reverse elems) (#;Cons [_ (#Form (#Cons [[_ (#Symbol ["" "~@"])] (#Cons [spliced #Nil])]))] inits) (do Monad<Meta> - [=inits (monad/map Monad<Meta> untemplate-pattern (reverse inits)) + [=inits (monad/map Monad<Meta> untemplate-pattern (list/reverse inits)) g!meta (gensym "g!meta")] (wrap (` [(~ g!meta) (<tag> (~ (untemplate-list& spliced =inits)))]))) diff --git a/stdlib/source/lux/concurrency/actor.lux b/stdlib/source/lux/concurrency/actor.lux index 848350499..dbe11b3a0 100644 --- a/stdlib/source/lux/concurrency/actor.lux +++ b/stdlib/source/lux/concurrency/actor.lux @@ -15,7 +15,7 @@ ["csw" writer]))) (type opaque) (lang [type])) - (.. ["A" atom] + (// ["A" atom] ["P" promise "P/" Monad<Promise>] ["T" task] [stm #+ Monad<STM>] diff --git a/stdlib/source/lux/concurrency/frp.lux b/stdlib/source/lux/concurrency/frp.lux index d59b96563..ce5069b45 100644 --- a/stdlib/source/lux/concurrency/frp.lux +++ b/stdlib/source/lux/concurrency/frp.lux @@ -10,7 +10,7 @@ text/format) [macro] (macro ["s" syntax #+ syntax: Syntax])) - (.. ["&" promise])) + (// ["&" promise])) ## [Types] (type: #export (Channel a) diff --git a/stdlib/source/lux/control/applicative.lux b/stdlib/source/lux/control/applicative.lux index d2b505941..935fda18e 100644 --- a/stdlib/source/lux/control/applicative.lux +++ b/stdlib/source/lux/control/applicative.lux @@ -1,6 +1,6 @@ (;module: lux - (.. [functor #+ Functor])) + (// [functor #+ Functor])) (sig: #export (Applicative f) {#;doc "Applicative functors."} diff --git a/stdlib/source/lux/control/comonad.lux b/stdlib/source/lux/control/comonad.lux index 7886d8c3c..15625b8f1 100644 --- a/stdlib/source/lux/control/comonad.lux +++ b/stdlib/source/lux/control/comonad.lux @@ -1,6 +1,6 @@ (;module: lux - ["F" ../functor] + ["F" //functor] (lux/data/coll [list "list/" Fold<List>])) ## [Signatures] diff --git a/stdlib/source/lux/control/hash.lux b/stdlib/source/lux/control/hash.lux index 3472098c1..ae72d4cf0 100644 --- a/stdlib/source/lux/control/hash.lux +++ b/stdlib/source/lux/control/hash.lux @@ -1,6 +1,6 @@ (;module: lux - (.. [eq #+ Eq])) + (// [eq #+ Eq])) ## [Signatures] (sig: #export (Hash a) diff --git a/stdlib/source/lux/control/monad.lux b/stdlib/source/lux/control/monad.lux index b9ecf5470..fb900d3e7 100644 --- a/stdlib/source/lux/control/monad.lux +++ b/stdlib/source/lux/control/monad.lux @@ -1,6 +1,6 @@ (;module: lux - (.. (functor #as F) + (// (functor #as F) (applicative #as A))) ## [Utils] diff --git a/stdlib/source/lux/control/order.lux b/stdlib/source/lux/control/order.lux index 89708d986..fe8169443 100644 --- a/stdlib/source/lux/control/order.lux +++ b/stdlib/source/lux/control/order.lux @@ -1,7 +1,7 @@ (;module: lux (lux function) - (.. [eq #+ Eq])) + (// [eq #+ Eq])) ## [Signatures] (sig: #export (Order a) diff --git a/stdlib/source/lux/data/coll/tree/parser.lux b/stdlib/source/lux/data/coll/tree/parser.lux index 3b2400b92..ac6dc2a85 100644 --- a/stdlib/source/lux/data/coll/tree/parser.lux +++ b/stdlib/source/lux/data/coll/tree/parser.lux @@ -3,7 +3,7 @@ (lux (control ["p" parser] ["ex" exception #+ exception:]) (data ["E" error])) - (.. ["T" rose] + (// ["T" rose] ["Z" zipper])) (type: #export (Parser t a) diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux index 33ac0b89b..e800efcd5 100644 --- a/stdlib/source/lux/macro.lux +++ b/stdlib/source/lux/macro.lux @@ -10,7 +10,7 @@ ["e" error] [text "text/" Monoid<Text> Eq<Text>] (coll [list "list/" Monoid<List> Monad<List>]))) - (. [code])) + (/ [code])) ## (type: (Meta a) ## (-> Compiler (e;Error [Compiler a]))) diff --git a/stdlib/source/lux/macro/poly/json.lux b/stdlib/source/lux/macro/poly/json.lux index 5c3a645ee..6b4d5fed5 100644 --- a/stdlib/source/lux/macro/poly/json.lux +++ b/stdlib/source/lux/macro/poly/json.lux @@ -16,7 +16,7 @@ (coll [list "list/" Fold<List> Monad<List>] [sequence #+ Sequence sequence "sequence/" Monad<Sequence>] ["d" dict]) - (format [".." json #+ JSON])) + (format ["//" json #+ JSON])) (time ["i" instant] ["du" duration] ["da" date]) @@ -50,13 +50,13 @@ (def: (encode input) (let [high (|> input (bit;and high-mask) (bit;shift-right +32)) low (bit;and low-mask input)] - (#..;Array (sequence (|> high nat-to-int int-to-frac #..;Number) - (|> low nat-to-int int-to-frac #..;Number))))) + (#//;Array (sequence (|> high nat-to-int int-to-frac #//;Number) + (|> low nat-to-int int-to-frac #//;Number))))) (def: (decode input) - (<| (..;run input) + (<| (//;run input) (do p;Monad<Parser> - [high ..;number - low ..;number]) + [high //;number + low //;number]) (wrap (n.+ (|> high frac-to-int int-to-nat (bit;shift-left +32)) (|> low frac-to-int int-to-nat)))))) @@ -70,7 +70,7 @@ (All [a] (-> (-> a JSON) (-> (Maybe a) JSON))) (function [elem] (case elem - #;None #..;Null + #;None #//;Null (#;Some value) (writer value)))) (struct: #hidden (Codec<JSON,Qty> carrier) @@ -88,17 +88,17 @@ (wrap (` (: (~ (@JSON//encode inputT)) <encoder>))))] - [Unit poly;unit (function [(~ (code;symbol ["" "0"]))] #..;Null)] - [Bool poly;bool (|>. #..;Boolean)] + [Unit poly;unit (function [(~ (code;symbol ["" "0"]))] #//;Null)] + [Bool poly;bool (|>. #//;Boolean)] [Nat poly;nat (:: ;;Codec<JSON,Nat> (~' encode))] [Int poly;int (:: ;;Codec<JSON,Int> (~' encode))] - [Frac poly;frac (|>. #..;Number)] - [Text poly;text (|>. #..;String)]) + [Frac poly;frac (|>. #//;Number)] + [Text poly;text (|>. #//;String)]) <time> (do-template [<type> <codec>] [(do @ [_ (poly;this <type>)] (wrap (` (: (~ (@JSON//encode inputT)) - (|>. (:: <codec> (~' encode)) #..;String)))))] + (|>. (:: <codec> (~' encode)) #//;String)))))] [du;Duration du;Codec<Text,Duration>] [i;Instant i;Codec<Text,Instant>] @@ -109,7 +109,7 @@ [*env* poly;env #let [@JSON//encode (: (-> Type Code) (function [type] - (` (-> (~ (poly;to-ast *env* type)) ..;JSON))))] + (` (-> (~ (poly;to-ast *env* type)) //;JSON))))] inputT poly;peek] ($_ p;either <basic> @@ -131,7 +131,7 @@ (;;_map_ (function [[(~ g!key) (~ g!val)]] [(~ g!key) ((~ .val.) (~ g!val))])) (d;from-list text;Hash<Text>) - #..;Object))))) + #//;Object))))) (do @ [[_ .sub.] (poly;apply ($_ p;seq (poly;this ;Maybe) @@ -143,7 +143,7 @@ (poly;this ;List) Codec<JSON,?>//encode))] (wrap (` (: (~ (@JSON//encode inputT)) - (|>. (;;_map_ (~ .sub.)) sequence;from-list #..;Array))))) + (|>. (;;_map_ (~ .sub.)) sequence;from-list #//;Array))))) (do @ [#let [g!input (code;local-symbol "\u0000input")] members (poly;variant (p;many Codec<JSON,?>//encode))] @@ -152,7 +152,7 @@ (case (~ g!input) (~@ (list/join (list/map (function [[tag g!encode]] (list (` ((~ (code;nat tag)) (~ g!input))) - (` (..;json [(~ (code;frac (;;tag tag))) + (` (//;json [(~ (code;frac (;;tag tag))) ((~ g!encode) (~ g!input))])))) (list;enumerate members)))))))))) (do @ @@ -162,7 +162,7 @@ (list/map (|>. nat/encode code;local-symbol)))]] (wrap (` (: (~ (@JSON//encode inputT)) (function [[(~@ g!members)]] - (..;json [(~@ (list/map (function [[g!member g!encode]] + (//;json [(~@ (list/map (function [[g!member g!encode]] (` ((~ g!encode) (~ g!member)))) (list;zip2 g!members g!encoders)))])))))) ## Type recursion @@ -180,10 +180,10 @@ (do @ [[funcC varsC bodyC] (poly;polymorphic Codec<JSON,?>//encode)] (wrap (` (: (All [(~@ varsC)] - (-> (~@ (list/map (function [varC] (` (-> (~ varC) ..;JSON))) + (-> (~@ (list/map (function [varC] (` (-> (~ varC) //;JSON))) varsC)) (-> ((~ (poly;to-ast *env* inputT)) (~@ varsC)) - ..;JSON))) + //;JSON))) (function (~ funcC) [(~@ varsC)] (~ bodyC)))))) poly;bound @@ -200,17 +200,17 @@ (wrap (` (: (~ (@JSON//decode inputT)) <decoder>))))] - [Unit poly;unit ..;null] - [Bool poly;bool ..;boolean] - [Nat poly;nat (p;codec ;;Codec<JSON,Nat> ..;any)] - [Int poly;int (p;codec ;;Codec<JSON,Int> ..;any)] - [Frac poly;frac ..;number] - [Text poly;text ..;string]) + [Unit poly;unit //;null] + [Bool poly;bool //;boolean] + [Nat poly;nat (p;codec ;;Codec<JSON,Nat> //;any)] + [Int poly;int (p;codec ;;Codec<JSON,Int> //;any)] + [Frac poly;frac //;number] + [Text poly;text //;string]) <time> (do-template [<type> <codec>] [(do @ [_ (poly;this <type>)] (wrap (` (: (~ (@JSON//decode inputT)) - (p;codec <codec> ..;string)))))] + (p;codec <codec> //;string)))))] [du;Duration du;Codec<Text,Duration>] [i;Instant i;Codec<Text,Instant>] @@ -221,7 +221,7 @@ [*env* poly;env #let [@JSON//decode (: (-> Type Code) (function [type] - (` (..;Reader (~ (poly;to-ast *env* type))))))] + (` (//;Reader (~ (poly;to-ast *env* type))))))] inputT poly;peek] ($_ p;either <basic> @@ -230,37 +230,37 @@ [unitT (poly;apply (p;after (poly;this unit;Qty) poly;any))] (wrap (` (: (~ (@JSON//decode inputT)) - (p;codec (Codec<JSON,Qty> (:! (~ (poly;to-ast *env* unitT)) [])) ..;any))))) + (p;codec (Codec<JSON,Qty> (:! (~ (poly;to-ast *env* unitT)) [])) //;any))))) (do @ [[_ _ valC] (poly;apply ($_ p;seq (poly;this d;Dict) poly;text Codec<JSON,?>//decode))] (wrap (` (: (~ (@JSON//decode inputT)) - (..;object (~ valC)))))) + (//;object (~ valC)))))) (do @ [[_ subC] (poly;apply (p;seq (poly;this ;Maybe) Codec<JSON,?>//decode))] (wrap (` (: (~ (@JSON//decode inputT)) - (..;nullable (~ subC)))))) + (//;nullable (~ subC)))))) (do @ [[_ subC] (poly;apply (p;seq (poly;this ;List) Codec<JSON,?>//decode))] (wrap (` (: (~ (@JSON//decode inputT)) - (..;array (p;some (~ subC))))))) + (//;array (p;some (~ subC))))))) (do @ [members (poly;variant (p;many Codec<JSON,?>//decode))] (wrap (` (: (~ (@JSON//decode inputT)) ($_ p;alt (~@ (list/map (function [[tag memberC]] (` (|> (~ memberC) - (p;after (..;number! (~ (code;frac (;;tag tag))))) - ..;array))) + (p;after (//;number! (~ (code;frac (;;tag tag))))) + //;array))) (list;enumerate members)))))))) (do @ [g!decoders (poly;tuple (p;many Codec<JSON,?>//decode))] (wrap (` (: (~ (@JSON//decode inputT)) - (..;array ($_ p;seq (~@ g!decoders))))))) + (//;array ($_ p;seq (~@ g!decoders))))))) ## Type recursion (do @ [[selfC bodyC] (poly;recursive Codec<JSON,?>//decode)] @@ -276,8 +276,8 @@ (do @ [[funcC varsC bodyC] (poly;polymorphic Codec<JSON,?>//decode)] (wrap (` (: (All [(~@ varsC)] - (-> (~@ (list/map (|>. (~) ..;Reader (`)) varsC)) - (..;Reader ((~ (poly;to-ast *env* inputT)) (~@ varsC))))) + (-> (~@ (list/map (|>. (~) //;Reader (`)) varsC)) + (//;Reader ((~ (poly;to-ast *env* inputT)) (~@ varsC))))) (function (~ funcC) [(~@ varsC)] (~ bodyC)))))) poly;bound @@ -306,7 +306,7 @@ (derived: (Codec<JSON,?> Record)))} (with-gensyms [g!inputs] - (wrap (list (` (: (Codec ..;JSON (~ inputT)) + (wrap (list (` (: (Codec //;JSON (~ inputT)) (struct (def: (~' encode) (Codec<JSON,?>//encode (~ inputT))) - (def: ((~' decode) (~ g!inputs)) (..;run (~ g!inputs) (Codec<JSON,?>//decode (~ inputT)))) + (def: ((~' decode) (~ g!inputs)) (//;run (~ g!inputs) (Codec<JSON,?>//decode (~ inputT)))) ))))))) diff --git a/stdlib/source/lux/macro/syntax.lux b/stdlib/source/lux/macro/syntax.lux index 0f2777ed8..6424ff0fc 100644 --- a/stdlib/source/lux/macro/syntax.lux +++ b/stdlib/source/lux/macro/syntax.lux @@ -12,7 +12,7 @@ [product] [maybe] ["E" error])) - (.. [code "code/" Eq<Code>])) + (// [code "code/" Eq<Code>])) ## [Utils] (def: (join-pairs pairs) diff --git a/stdlib/source/lux/macro/syntax/common/reader.lux b/stdlib/source/lux/macro/syntax/common/reader.lux index 9ab6d6381..7874e4d54 100644 --- a/stdlib/source/lux/macro/syntax/common/reader.lux +++ b/stdlib/source/lux/macro/syntax/common/reader.lux @@ -8,7 +8,7 @@ [maybe]) [macro] (macro ["s" syntax #+ syntax: Syntax])) - [.. #*]) + [// #*]) ## Exports (def: #export export @@ -119,18 +119,18 @@ definition-anns (s;local (list definition-anns) (_definition-anns^ [])) #let [definition-args (find-definition-args definition-anns)]] - (wrap {#..;definition-name definition-name - #..;definition-type ?definition-type - #..;definition-anns definition-anns - #..;definition-value definition-value - #..;definition-args definition-args})))))) + (wrap {#//;definition-name definition-name + #//;definition-type ?definition-type + #//;definition-anns definition-anns + #//;definition-value definition-value + #//;definition-args definition-args})))))) (def: #export (typed-definition compiler) {#;doc "A reader for definitions that ensures the input syntax is typed."} (-> Compiler (Syntax Definition)) (do p;Monad<Parser> [_definition (definition compiler) - _ (case (get@ #..;definition-type _definition) + _ (case (get@ #//;definition-type _definition) (#;Some _) (wrap []) diff --git a/stdlib/source/lux/macro/syntax/common/writer.lux b/stdlib/source/lux/macro/syntax/common/writer.lux index 72e4a11eb..1a75e7309 100644 --- a/stdlib/source/lux/macro/syntax/common/writer.lux +++ b/stdlib/source/lux/macro/syntax/common/writer.lux @@ -3,7 +3,7 @@ (lux (data (coll [list "L/" Functor<List>]) [product]) (macro [code])) - [.. #*]) + [// #*]) ## Exports (def: #export (export ?el) @@ -12,10 +12,10 @@ #;None (list) - (#;Some #..;Exported) + (#;Some #//;Exported) (list (' #export)) - (#;Some #..;Hidden) + (#;Some #//;Hidden) (list (' #hidden)))) ## Annotations diff --git a/stdlib/source/lux/math/logic/fuzzy.lux b/stdlib/source/lux/math/logic/fuzzy.lux index 84e217d6b..6183293a8 100644 --- a/stdlib/source/lux/math/logic/fuzzy.lux +++ b/stdlib/source/lux/math/logic/fuzzy.lux @@ -5,7 +5,7 @@ [set]) text/format) [math]) - (.. ["&" continuous])) + (// ["&" continuous])) (type: #export (Fuzzy a) (-> a Deg)) diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux index 2d4c1c58b..83b415024 100644 --- a/stdlib/source/lux/time/instant.lux +++ b/stdlib/source/lux/time/instant.lux @@ -15,7 +15,7 @@ (coll [list "L/" Fold<List> Functor<List>] [sequence #+ Sequence sequence "sequence/" Functor<Sequence> Fold<Sequence>])) (type opaque)) - (.. [duration "duration/" Order<Duration>] + (// [duration "duration/" Order<Duration>] [date])) (opaque: #export Instant diff --git a/stdlib/source/lux/world/net/tcp.jvm.lux b/stdlib/source/lux/world/net/tcp.jvm.lux index 4b111fcf7..0a109d04c 100644 --- a/stdlib/source/lux/world/net/tcp.jvm.lux +++ b/stdlib/source/lux/world/net/tcp.jvm.lux @@ -9,7 +9,7 @@ (world [blob #+ Blob]) [io] [host]) - [..]) + [//]) (host;import java.lang.AutoCloseable (close [] #io #try void)) @@ -75,7 +75,7 @@ #out output})))) (def: #export (client address port) - (-> ..;Address ..;Port (T;Task TCP)) + (-> //;Address //;Port (T;Task TCP)) (P;future (do (e;ErrorT io;Monad<IO>) [socket (Socket.new [address (nat-to-int port)])] @@ -100,7 +100,7 @@ (wrap [])))) (def: #export (server port) - (-> ..;Port (T;Task (frp;Channel TCP))) + (-> //;Port (T;Task (frp;Channel TCP))) (P;future (do (e;ErrorT io;Monad<IO>) [server (ServerSocket.new [(nat-to-int port)]) diff --git a/stdlib/source/lux/world/net/udp.jvm.lux b/stdlib/source/lux/world/net/udp.jvm.lux index a3124bdf2..139ed4f49 100644 --- a/stdlib/source/lux/world/net/udp.jvm.lux +++ b/stdlib/source/lux/world/net/udp.jvm.lux @@ -12,7 +12,7 @@ (world [blob #+ Blob]) [io] [host]) - [..]) + [//]) (host;import java.lang.AutoCloseable (close [] #io #try void)) @@ -45,7 +45,7 @@ (exception: #export Multiple-Candidate-Addresses) (def: (resolve address) - (-> ..;Address (io;IO (e;Error InetAddress))) + (-> //;Address (io;IO (e;Error InetAddress))) (do (e;ErrorT io;Monad<IO>) [addresses (InetAddress.getAllByName [address])] (: (io;IO (e;Error InetAddress)) @@ -58,7 +58,7 @@ {#socket DatagramSocket} (def: #export (read data offset length self) - (-> Blob Nat Nat UDP (T;Task [Nat ..;Address ..;Port])) + (-> Blob Nat Nat UDP (T;Task [Nat //;Address //;Port])) (let [(^open) (@repr self) packet (DatagramPacket.new|receive [data (nat-to-int offset) (nat-to-int length)])] (P;future @@ -70,7 +70,7 @@ (int-to-nat (DatagramPacket.getPort [] packet))]))))) (def: #export (write address port data offset length self) - (-> ..;Address ..;Port Blob Nat Nat UDP (T;Task Unit)) + (-> //;Address //;Port Blob Nat Nat UDP (T;Task Unit)) (P;future (do (e;ErrorT io;Monad<IO>) [address (resolve address) @@ -92,7 +92,7 @@ (wrap (@opaque (#socket socket)))))) (def: #export (server port) - (-> ..;Port (T;Task UDP)) + (-> //;Port (T;Task UDP)) (P;future (do (e;ErrorT io;Monad<IO>) [socket (DatagramSocket.new|server [(nat-to-int port)])] diff --git a/stdlib/test/test/lux/cli.lux b/stdlib/test/test/lux/cli.lux index d6161a2b8..35400da79 100644 --- a/stdlib/test/test/lux/cli.lux +++ b/stdlib/test/test/lux/cli.lux @@ -12,7 +12,7 @@ text/format (coll [list])) ["r" math/random] - ["." cli]) + ["/" cli]) lux/test) (context: "CLI" @@ -28,19 +28,19 @@ post-ignore (r;list +5 gen-ignore)] ($_ seq (test "Can read any argument." - (|> (.;run (list yes) .;any) + (|> (/;run (list yes) /;any) (case> (#E;Error _) false (#E;Success arg) (text/= arg yes)))) (test "Can test tokens." - (and (|> (.;run (list yes) (.;this yes)) + (and (|> (/;run (list yes) (/;this yes)) (case> (#E;Error _) false (#E;Success _) true)) - (|> (.;run (list no) (.;this yes)) + (|> (/;run (list no) (/;this yes)) (case> (#E;Error _) true (#E;Success _) false)))) (test "Can use custom token parsers." - (|> (.;run (list yes) (.;parse Nat/decode)) + (|> (/;run (list yes) (/;parse Nat/decode)) (case> (#E;Error _) false @@ -48,13 +48,13 @@ (text/= (Nat/encode parsed) yes)))) (test "Can query if there are any more inputs." - (and (|> (.;run (list) .;end) + (and (|> (/;run (list) /;end) (case> (#E;Success []) true _ false)) - (|> (.;run (list yes) (p;not .;end)) + (|> (/;run (list yes) (p;not /;end)) (case> (#E;Success []) false _ true)))) (test "Can parse CLI input anywhere." - (|> (.;run (list;concat (list pre-ignore (list yes) post-ignore)) - (|> (.;somewhere (.;this yes)) - (p;before (p;some .;any)))) + (|> (/;run (list;concat (list pre-ignore (list yes) post-ignore)) + (|> (/;somewhere (/;this yes)) + (p;before (p;some /;any)))) (case> (#E;Error _) false (#E;Success _) true))) )))) diff --git a/stdlib/test/test/lux/time/instant.lux b/stdlib/test/test/lux/time/instant.lux index e26f7397d..95a2ce441 100644 --- a/stdlib/test/test/lux/time/instant.lux +++ b/stdlib/test/test/lux/time/instant.lux @@ -12,7 +12,7 @@ ["@d" duration] ["@date" date])) lux/test - (.. ["_;" duration])) + (// ["_;" duration])) (def: boundary Int 99_999_999_999_999) diff --git a/stdlib/test/test/lux/world/file.lux b/stdlib/test/test/lux/world/file.lux index 388e91235..4af26b095 100644 --- a/stdlib/test/test/lux/world/file.lux +++ b/stdlib/test/test/lux/world/file.lux @@ -14,7 +14,7 @@ [blob]) ["r" math/random]) lux/test - (.. ["_;" blob])) + (// ["_;" blob])) (def: truncate-millis (|>. (i./ 1_000) (i.* 1_000))) diff --git a/stdlib/test/test/lux/world/net/tcp.lux b/stdlib/test/test/lux/world/net/tcp.lux index 7a3c6bfc5..d07f5e200 100644 --- a/stdlib/test/test/lux/world/net/tcp.lux +++ b/stdlib/test/test/lux/world/net/tcp.lux @@ -14,7 +14,7 @@ (net ["@" tcp])) ["r" math/random]) lux/test - (../.. ["_;" blob])) + (/// ["_;" blob])) (def: localhost net;Address "127.0.0.1") (def: port diff --git a/stdlib/test/test/lux/world/net/udp.lux b/stdlib/test/test/lux/world/net/udp.lux index ee0a89b14..988db0471 100644 --- a/stdlib/test/test/lux/world/net/udp.lux +++ b/stdlib/test/test/lux/world/net/udp.lux @@ -14,7 +14,7 @@ (net ["@" udp])) ["r" math/random]) lux/test - (../.. ["_;" blob])) + (/// ["_;" blob])) (def: localhost net;Address "127.0.0.1") (def: port |