diff options
Diffstat (limited to 'stdlib/source/lux/macro')
-rw-r--r-- | stdlib/source/lux/macro/poly/json.lux | 76 | ||||
-rw-r--r-- | stdlib/source/lux/macro/syntax.lux | 2 | ||||
-rw-r--r-- | stdlib/source/lux/macro/syntax/common/reader.lux | 14 | ||||
-rw-r--r-- | stdlib/source/lux/macro/syntax/common/writer.lux | 6 |
4 files changed, 49 insertions, 49 deletions
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 |