From 1bbc4251230cee13d46df7b706859e834778aee0 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 10 Jul 2022 18:00:23 -0400 Subject: Removed the need for ,! unquoting. --- .../source/polytypic/lux/abstract/equivalence.lux | 38 ++++---- stdlib/source/polytypic/lux/abstract/functor.lux | 4 +- stdlib/source/polytypic/lux/data/format/json.lux | 104 +++++++++++---------- 3 files changed, 74 insertions(+), 72 deletions(-) (limited to 'stdlib/source/polytypic') diff --git a/stdlib/source/polytypic/lux/abstract/equivalence.lux b/stdlib/source/polytypic/lux/abstract/equivalence.lux index 64c684936..8de4a0a7a 100644 --- a/stdlib/source/polytypic/lux/abstract/equivalence.lux +++ b/stdlib/source/polytypic/lux/abstract/equivalence.lux @@ -49,7 +49,7 @@ inputT .next .let [@Equivalence (is (-> Type Code) (function (_ type) - (` ((,! /.Equivalence) (, (poly.code *env* type))))))]] + (` (/.Equivalence (, (poly.code *env* type))))))]] (all <>.either ... Basic types (,, (with_template [ ] @@ -59,12 +59,12 @@ ))))] [(.exactly Any) (function ((, g!_) (, g!_) (, g!_)) #1)] - [(.sub Bit) (,! bit.equivalence)] - [(.sub Nat) (,! nat.equivalence)] - [(.sub Int) (,! int.equivalence)] - [(.sub Rev) (,! rev.equivalence)] - [(.sub Frac) (,! frac.equivalence)] - [(.sub Text) (,! text.equivalence)])) + [(.sub Bit) bit.equivalence] + [(.sub Nat) nat.equivalence] + [(.sub Int) int.equivalence] + [(.sub Rev) rev.equivalence] + [(.sub Frac) frac.equivalence] + [(.sub Text) text.equivalence])) ... Composite types (,, (with_template [ ] [(do ! @@ -73,13 +73,13 @@ (in (` (is (, (@Equivalence inputT)) ( (, argC))))))] - [.Maybe (,! maybe.equivalence)] - [.List (,! list.equivalence)] - [sequence.Sequence (,! sequence.equivalence)] - [array.Array (,! array.equivalence)] - [queue.Queue (,! queue.equivalence)] - [set.Set (,! set.equivalence)] - [tree.Tree (,! tree.equivalence)] + [.Maybe maybe.equivalence] + [.List list.equivalence] + [sequence.Sequence sequence.equivalence] + [array.Array array.equivalence] + [queue.Queue queue.equivalence] + [set.Set set.equivalence] + [tree.Tree tree.equivalence] )) (do ! [[_ _ valC] (.applied (all <>.and @@ -87,7 +87,7 @@ .any equivalence))] (in (` (is (, (@Equivalence inputT)) - ((,! dictionary.equivalence) (, valC)))))) + (dictionary.equivalence (, valC)))))) ... Models (,, (with_template [ ] [(do ! @@ -144,8 +144,8 @@ [[g!self bodyC] (.recursive equivalence) .let [g!_ (code.local "_____________")]] (in (` (is (, (@Equivalence inputT)) - ((,! /.rec) (.function ((, g!_) (, g!self)) - (, bodyC))))))) + (/.rec (.function ((, g!_) (, g!self)) + (, bodyC))))))) .recursive_self ... Type applications (do ! @@ -157,8 +157,8 @@ (do ! [[funcC varsC bodyC] (.polymorphic equivalence)] (in (` (is (All ((, g!_) (,* varsC)) - (-> (,* (list#each (|>> (,) ((,! /.Equivalence)) (`)) varsC)) - ((,! /.Equivalence) ((, (poly.code *env* inputT)) (,* varsC))))) + (-> (,* (list#each (|>> (,) (/.Equivalence) (`)) varsC)) + (/.Equivalence ((, (poly.code *env* inputT)) (,* varsC))))) (function ((, funcC) (,* varsC)) (, bodyC)))))) .recursive_call diff --git a/stdlib/source/polytypic/lux/abstract/functor.lux b/stdlib/source/polytypic/lux/abstract/functor.lux index 43b8b2902..31a53d407 100644 --- a/stdlib/source/polytypic/lux/abstract/functor.lux +++ b/stdlib/source/polytypic/lux/abstract/functor.lux @@ -37,10 +37,10 @@ .let [@Functor (is (-> Type Code) (function (_ unwrappedT) (if (n.= 1 num_vars) - (` ((,! /.Functor) (, (poly.code *env* unwrappedT)))) + (` (/.Functor (, (poly.code *env* unwrappedT)))) (let [paramsC (|> num_vars -- list.indices (list#each (|>> %.nat code.local)))] (` (All ((, g!_) (,* paramsC)) - ((,! /.Functor) ((, (poly.code *env* unwrappedT)) (,* paramsC))))))))) + (/.Functor ((, (poly.code *env* unwrappedT)) (,* paramsC))))))))) Arg (is (-> Code (.Parser Code)) (function (Arg valueC) (all <>.either diff --git a/stdlib/source/polytypic/lux/data/format/json.lux b/stdlib/source/polytypic/lux/data/format/json.lux index c68d521ce..53eba2b21 100644 --- a/stdlib/source/polytypic/lux/data/format/json.lux +++ b/stdlib/source/polytypic/lux/data/format/json.lux @@ -23,11 +23,12 @@ ["[0]" i64] ["[0]" int] ["[0]" frac]]] - [meta + ["[0]" meta (.only) ["[0]" code (.only) ["<[1]>" \\parser]] [macro - [syntax (.only syntax)]] + [syntax (.only syntax)] + ["[0]" expansion]] ["[0]" type (.only) ["<[1]>" \\parser] ["[0]" unit] @@ -46,7 +47,7 @@ (-> Nat Frac) (|>> .int int.frac)) -(def (rec_encoded non_rec) +(def .public (rec_encoded non_rec) (All (_ a) (-> (-> (-> a JSON) (-> a JSON)) (-> a JSON))) @@ -56,7 +57,7 @@ (def low_mask Nat (|> 1 (i64.left_shifted 32) --)) (def high_mask Nat (|> low_mask (i64.left_shifted 32))) -(def nat_codec +(def .public nat_codec (codec.Codec JSON Nat) (implementation (def (encoded input) @@ -72,7 +73,7 @@ (in (n.+ (|> high frac.int .nat (i64.left_shifted 32)) (|> low frac.int .nat))))))))) -(def int_codec +(def .public int_codec (codec.Codec JSON Int) (implementation (def encoded @@ -81,14 +82,14 @@ (|>> (at nat_codec decoded) (at try.functor each (|>> .int)))))) ... Builds a JSON generator for potentially inexistent values. -(def (nullable format) +(def .public (nullable format) (All (_ a) (-> (-> a JSON) (-> (Maybe a) JSON))) (function (_ elem) (case elem {.#None} {/.#Null} {.#Some value} (format value)))) -(def measure_codec +(def .public measure_codec (All (_ unit) (codec.Codec JSON (unit.Measure unit))) (implementation @@ -111,15 +112,15 @@ [(.exactly Any) (function ((, g!_) (, (code.symbol ["" "0"]))) {/.#Null})] [(.sub Bit) (|>> {/.#Boolean})] - [(.sub Nat) (at (,! ..nat_codec) (,' encoded))] - [(.sub Int) (at (,! ..int_codec) (,' encoded))] + [(.sub Nat) (at ..nat_codec (,' encoded))] + [(.sub Int) (at ..int_codec (,' encoded))] [(.sub Frac) (|>> {/.#Number})] [(.sub Text) (|>> {/.#String})])