From eea741e9b4a47ae09832311d6d61f0bd6024f673 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 31 Oct 2020 02:59:48 -0400 Subject: Easy to use Rev constants. --- stdlib/source/poly/lux/abstract/equivalence.lux | 26 +++++++------- stdlib/source/poly/lux/abstract/functor.lux | 8 ++--- stdlib/source/poly/lux/data/format/json.lux | 48 ++++++++++++------------- 3 files changed, 41 insertions(+), 41 deletions(-) (limited to 'stdlib/source/poly') diff --git a/stdlib/source/poly/lux/abstract/equivalence.lux b/stdlib/source/poly/lux/abstract/equivalence.lux index 69c2d24fb..8826b9ed9 100644 --- a/stdlib/source/poly/lux/abstract/equivalence.lux +++ b/stdlib/source/poly/lux/abstract/equivalence.lux @@ -42,7 +42,7 @@ ["." /]}) (poly: #export equivalence - (`` (do {@ p.monad} + (`` (do {! p.monad} [#let [g!_ (code.local-identifier "_____________")] *env* .env inputT .peek @@ -52,7 +52,7 @@ ($_ p.either ## Basic types (~~ (template [ ] - [(do @ + [(do ! [_ ] (wrap (` (: (~ (@Equivalence inputT)) ))))] @@ -66,7 +66,7 @@ [(.sub Text) (~! text.equivalence)])) ## Composite types (~~ (template [ ] - [(do @ + [(do ! [[_ argC] (.apply (p.and (.exactly ) equivalence))] (wrap (` (: (~ (@Equivalence inputT)) @@ -80,7 +80,7 @@ [set.Set (~! set.equivalence)] [tree.Tree (~! tree.equivalence)] )) - (do @ + (do ! [[_ _ valC] (.apply ($_ p.and (.exactly dictionary.Dictionary) .any @@ -89,7 +89,7 @@ ((~! dictionary.equivalence) (~ valC)))))) ## Models (~~ (template [ ] - [(do @ + [(do ! [_ (.exactly )] (wrap (` (: (~ (@Equivalence inputT)) ))))] @@ -100,13 +100,13 @@ [day.Day day.equivalence] [month.Month month.equivalence] )) - (do @ + (do ! [_ (.apply (p.and (.exactly unit.Qty) .any))] (wrap (` (: (~ (@Equivalence inputT)) unit.equivalence)))) ## Variants - (do @ + (do ! [members (.variant (p.many equivalence)) #let [last (dec (list.size members)) g!_ (code.local-identifier "_____________") @@ -127,7 +127,7 @@ (~ g!_) #0)))))) ## Tuples - (do @ + (do ! [g!eqs (.tuple (p.many equivalence)) #let [g!_ (code.local-identifier "_____________") indices (list.indices (list.size g!eqs)) @@ -139,7 +139,7 @@ (list@map (function (_ [g!eq g!left g!right]) (` ((~ g!eq) (~ g!left) (~ g!right))))))))))))) ## Type recursion - (do @ + (do ! [[g!self bodyC] (.recursive equivalence) #let [g!_ (code.local-identifier "_____________")]] (wrap (` (: (~ (@Equivalence inputT)) @@ -147,13 +147,13 @@ (~ bodyC))))))) .recursive-self ## Type applications - (do @ + (do ! [[funcC argsC] (.apply (p.and equivalence (p.many equivalence)))] (wrap (` ((~ funcC) (~+ argsC))))) ## Parameters .parameter ## Polymorphism - (do @ + (do ! [[funcC varsC bodyC] (.polymorphic equivalence)] (wrap (` (: (All [(~+ varsC)] (-> (~+ (list@map (|>> (~) ((~! /.Equivalence)) (`)) varsC)) @@ -163,6 +163,6 @@ .recursive-call ## If all else fails... (|> .any - (:: @ map (|>> %.type (format "Cannot create Equivalence for: ") p.fail)) - (:: @ join)) + (:: ! map (|>> %.type (format "Cannot create Equivalence for: ") p.fail)) + (:: ! join)) )))) diff --git a/stdlib/source/poly/lux/abstract/functor.lux b/stdlib/source/poly/lux/abstract/functor.lux index d1219bf87..da14b2b6c 100644 --- a/stdlib/source/poly/lux/abstract/functor.lux +++ b/stdlib/source/poly/lux/abstract/functor.lux @@ -24,7 +24,7 @@ ["." /]}) (poly: #export functor - (do {@ p.monad} + (do {! p.monad} [#let [type-funcC (code.local-identifier "____________type-funcC") funcC (code.local-identifier "____________funcC") inputC (code.local-identifier "____________inputC")] @@ -49,7 +49,7 @@ _ (.parameter! varI)] (wrap (` ((~ funcC) (~ valueC))))) ## Variants - (do @ + (do ! [_ (wrap []) membersC (.variant (p.many (Arg valueC))) #let [last (dec (list.size membersC))]] @@ -68,7 +68,7 @@ pairsCC (: (List [Code Code]) (list))] (p.either (let [slotC (|> idx %.nat (format "____________slot") code.local-identifier)] - (do @ + (do ! [_ (wrap []) memberC (Arg slotC)] (recur (inc idx) @@ -78,7 +78,7 @@ [(~+ (list;map product.left pairsCC))] [(~+ (list;map product.right pairsCC))])))) ## Functions - (do @ + (do ! [_ (wrap []) #let [g! (code.local-identifier "____________") outL (code.local-identifier "____________outL")] diff --git a/stdlib/source/poly/lux/data/format/json.lux b/stdlib/source/poly/lux/data/format/json.lux index 1921ecd3a..9cc39c994 100644 --- a/stdlib/source/poly/lux/data/format/json.lux +++ b/stdlib/source/poly/lux/data/format/json.lux @@ -99,7 +99,7 @@ (poly: #export codec//encode (with-expansions [ (template [ ] - [(do @ + [(do ! [#let [g!_ (code.local-identifier "_______")] _ ] (wrap (` (: (~ (@JSON//encode inputT)) @@ -112,7 +112,7 @@ [(.sub Frac) (|>> #/.Number)] [(.sub Text) (|>> #/.String)])