diff options
author | Eduardo Julian | 2019-02-04 00:19:57 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-02-04 00:19:57 -0400 |
commit | 71a6928d3db3b05144c33516db307d5975a94dee (patch) | |
tree | fe087b91903c0dda41bfa84423d4958e1778f1b6 /stdlib/source/lux/macro/code.lux | |
parent | cf9e3fa6fef24cc0828ab882661fa96dc6f2570d (diff) |
Changed the naming style for structures.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/macro/code.lux | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/stdlib/source/lux/macro/code.lux b/stdlib/source/lux/macro/code.lux index 7e78fe617..34dd35a3b 100644 --- a/stdlib/source/lux/macro/code.lux +++ b/stdlib/source/lux/macro/code.lux @@ -3,14 +3,17 @@ [control ["." equivalence (#+ Equivalence)]] [data - bit - number - name - ["." text (#+ Equivalence<Text>) ("text/." Monoid<Text>)] + ["." bit] + ["." name] + [number + ["." nat] + ["." int] + ["." rev] + ["." frac]] + ["." text ("text/." monoid)] [collection - ["." list ("list/." Functor<List> Fold<List>)]]]]) + ["." list ("list/." functor fold)]]]]) -## [Types] ## (type: (Code' w) ## (#.Bit Bit) ## (#.Nat Nat) @@ -26,10 +29,8 @@ ## (type: Code ## (Ann Cursor (Code' (Ann Cursor)))) -## [Utils] (def: _cursor Cursor ["" 0 0]) -## [Functions] (do-template [<name> <type> <tag>] [(def: #export (<name> x) (-> <type> Code) @@ -57,54 +58,52 @@ [local-identifier #.Identifier "Produces a local identifier (an identifier with no module prefix)."] [local-tag #.Tag "Produces a local tag (a tag with no module prefix)."]) -## [Structures] -(structure: #export _ (Equivalence Code) +(structure: #export equivalence (Equivalence Code) (def: (= x y) (case [x y] (^template [<tag> <eq>] [[_ (<tag> x')] [_ (<tag> y')]] (:: <eq> = x' y')) - ([#.Bit Equivalence<Bit>] - [#.Nat Equivalence<Nat>] - [#.Int Equivalence<Int>] - [#.Rev Equivalence<Rev>] - [#.Frac Equivalence<Frac>] - [#.Text Equivalence<Text>] - [#.Identifier Equivalence<Name>] - [#.Tag Equivalence<Name>]) + ([#.Bit bit.equivalence] + [#.Nat nat.equivalence] + [#.Int int.equivalence] + [#.Rev rev.equivalence] + [#.Frac frac.equivalence] + [#.Text text.equivalence] + [#.Identifier name.equivalence] + [#.Tag name.equivalence]) (^template [<tag>] [[_ (<tag> xs')] [_ (<tag> ys')]] - (:: (list.Equivalence<List> =) = xs' ys')) + (:: (list.equivalence =) = xs' ys')) ([#.Form] [#.Tuple]) [[_ (#.Record xs')] [_ (#.Record ys')]] - (:: (list.Equivalence<List> (equivalence.product = =)) + (:: (list.equivalence (equivalence.product = =)) = xs' ys') _ #0))) -## [Values] (def: #export (to-text ast) (-> Code Text) (case ast (^template [<tag> <struct>] [_ (<tag> value)] (:: <struct> encode value)) - ([#.Bit Codec<Text,Bit>] - [#.Nat Codec<Text,Nat>] - [#.Int Codec<Text,Int>] - [#.Rev Codec<Text,Rev>] - [#.Frac Codec<Text,Frac>] - [#.Identifier Codec<Text,Name>]) + ([#.Bit bit.codec] + [#.Nat nat.decimal] + [#.Int int.decimal] + [#.Rev rev.decimal] + [#.Frac frac.decimal] + [#.Identifier name.codec]) [_ (#.Text value)] (text.encode value) [_ (#.Tag name)] - (text/compose "#" (:: Codec<Text,Name> encode name)) + (text/compose "#" (:: name.codec encode name)) (^template [<tag> <open> <close>] [_ (<tag> members)] @@ -132,7 +131,7 @@ (def: #export (replace original substitute ast) {#.doc "Replaces all code that looks like the 'original' with the 'substitute'."} (-> Code Code Code Code) - (if (:: Equivalence<Code> = original ast) + (if (:: ..equivalence = original ast) substitute (case ast (^template [<tag>] |