aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/macro
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/macro')
-rw-r--r--stdlib/source/lux/macro/code.lux60
-rw-r--r--stdlib/source/lux/macro/poly.lux30
-rw-r--r--stdlib/source/lux/macro/syntax.lux14
-rw-r--r--stdlib/source/lux/macro/syntax/common/reader.lux14
-rw-r--r--stdlib/source/lux/macro/syntax/common/writer.lux10
-rw-r--r--stdlib/source/lux/macro/template.lux32
6 files changed, 80 insertions, 80 deletions
diff --git a/stdlib/source/lux/macro/code.lux b/stdlib/source/lux/macro/code.lux
index e2d528dad..839084537 100644
--- a/stdlib/source/lux/macro/code.lux
+++ b/stdlib/source/lux/macro/code.lux
@@ -10,9 +10,9 @@
["." int]
["." rev]
["." frac]]
- ["." text ("#//." monoid equivalence)]
+ ["." text ("#\." monoid equivalence)]
[collection
- ["." list ("#//." functor fold)]]]
+ ["." list ("#\." functor fold)]]]
[meta
["." location]]])
@@ -65,8 +65,8 @@
(def: (= x y)
(case [x y]
(^template [<tag> <eq>]
- [[_ (<tag> x')] [_ (<tag> y')]]
- (:: <eq> = x' y'))
+ [[[_ (<tag> x')] [_ (<tag> y')]]
+ (:: <eq> = x' y')])
([#.Bit bit.equivalence]
[#.Nat nat.equivalence]
[#.Int int.equivalence]
@@ -77,8 +77,8 @@
[#.Tag name.equivalence])
(^template [<tag>]
- [[_ (<tag> xs')] [_ (<tag> ys')]]
- (:: (list.equivalence =) = xs' ys'))
+ [[[_ (<tag> xs')] [_ (<tag> ys')]]
+ (:: (list.equivalence =) = xs' ys')])
([#.Form]
[#.Tuple])
@@ -93,8 +93,8 @@
(-> Code Text)
(case ast
(^template [<tag> <struct>]
- [_ (<tag> value)]
- (:: <struct> encode value))
+ [[_ (<tag> value)]
+ (:: <struct> encode value)])
([#.Bit bit.codec]
[#.Nat nat.decimal]
[#.Int int.decimal]
@@ -106,33 +106,33 @@
(text.encode value)
[_ (#.Tag name)]
- (text//compose "#" (:: name.codec encode name))
+ (text\compose "#" (:: name.codec encode name))
(^template [<tag> <open> <close>]
- [_ (<tag> members)]
- ($_ text//compose
- <open>
- (list//fold (function (_ next prev)
+ [[_ (<tag> members)]
+ ($_ text\compose
+ <open>
+ (list\fold (function (_ next prev)
(let [next (format next)]
- (if (text//= "" prev)
+ (if (text\= "" prev)
next
- ($_ text//compose prev " " next))))
+ ($_ text\compose prev " " next))))
""
members)
- <close>))
+ <close>)])
([#.Form "(" ")"]
[#.Tuple "[" "]"])
[_ (#.Record pairs)]
- ($_ text//compose
+ ($_ text\compose
"{"
- (list//fold (function (_ [left right] prev)
- (let [next ($_ text//compose (format left) " " (format right))]
- (if (text//= "" prev)
- next
- ($_ text//compose prev " " next))))
- ""
- pairs)
+ (list\fold (function (_ [left right] prev)
+ (let [next ($_ text\compose (format left) " " (format right))]
+ (if (text\= "" prev)
+ next
+ ($_ text\compose prev " " next))))
+ ""
+ pairs)
"}")
))
@@ -143,16 +143,16 @@
substitute
(case ast
(^template [<tag>]
- [location (<tag> parts)]
- [location (<tag> (list//map (replace original substitute) parts))])
+ [[location (<tag> parts)]
+ [location (<tag> (list\map (replace original substitute) parts))]])
([#.Form]
[#.Tuple])
[location (#.Record parts)]
- [location (#.Record (list//map (function (_ [left right])
- [(replace original substitute left)
- (replace original substitute right)])
- parts))]
+ [location (#.Record (list\map (function (_ [left right])
+ [(replace original substitute left)
+ (replace original substitute right)])
+ parts))]
_
ast)))
diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux
index 328e74ef1..0b4964897 100644
--- a/stdlib/source/lux/macro/poly.lux
+++ b/stdlib/source/lux/macro/poly.lux
@@ -13,7 +13,7 @@
[number
["n" nat]]
[collection
- ["." list ("#//." fold functor)]
+ ["." list ("#\." fold functor)]
["." dictionary]]]
["." meta (#+ with-gensyms)]
[macro
@@ -50,7 +50,7 @@
(def: (derivation-name poly args)
(-> Text (List Text) (Maybe Text))
(if (common-poly-name? poly)
- (#.Some (list//fold (text.replace-once "?") poly args))
+ (#.Some (list\fold (text.replace-once "?") poly args))
#.None))
(syntax: #export (derived: {export csr.export}
@@ -64,7 +64,7 @@
(wrap name)
(^multi #.None
- [(derivation-name (product.right poly-func) (list//map product.right poly-args))
+ [(derivation-name (product.right poly-func) (list\map product.right poly-args))
(#.Some derived-name)])
(wrap derived-name)
@@ -75,7 +75,7 @@
custom-impl
#.None
- (` ((~ (code.identifier poly-func)) (~+ (list//map code.identifier poly-args)))))]]
+ (` ((~ (code.identifier poly-func)) (~+ (list\map code.identifier poly-args)))))]]
(wrap (.list (` (def: (~+ (csw.export export))
(~ (code.identifier ["" name]))
{#.struct? #1}
@@ -86,11 +86,11 @@
(case type
(#.Primitive name params)
(` (#.Primitive (~ (code.text name))
- (list (~+ (list//map (to-code env) params)))))
+ (list (~+ (list\map (to-code env) params)))))
(^template [<tag>]
- (<tag> idx)
- (` (<tag> (~ (code.nat idx)))))
+ [(<tag> idx)
+ (` (<tag> (~ (code.nat idx))))])
([#.Var] [#.Ex])
(#.Parameter idx)
@@ -106,14 +106,14 @@
(undefined)))
(^template [<tag>]
- (<tag> left right)
- (` (<tag> (~ (to-code env left))
- (~ (to-code env right)))))
+ [(<tag> left right)
+ (` (<tag> (~ (to-code env left))
+ (~ (to-code env right))))])
([#.Function] [#.Apply])
(^template [<macro> <tag> <flattener>]
- (<tag> left right)
- (` (<macro> (~+ (list//map (to-code env) (<flattener> type))))))
+ [(<tag> left right)
+ (` (<macro> (~+ (list\map (to-code env) (<flattener> type)))))])
([| #.Sum type.flatten-variant]
[& #.Product type.flatten-tuple])
@@ -121,8 +121,8 @@
(code.identifier name)
(^template [<tag>]
- (<tag> scope body)
- (` (<tag> (list (~+ (list//map (to-code env) scope)))
- (~ (to-code env body)))))
+ [(<tag> scope body)
+ (` (<tag> (list (~+ (list\map (to-code env) scope)))
+ (~ (to-code env body))))])
([#.UnivQ] [#.ExQ])
))
diff --git a/stdlib/source/lux/macro/syntax.lux b/stdlib/source/lux/macro/syntax.lux
index 78ae223d2..3c11a2a43 100644
--- a/stdlib/source/lux/macro/syntax.lux
+++ b/stdlib/source/lux/macro/syntax.lux
@@ -8,14 +8,14 @@
["</>" code (#+ Parser)]]]
[data
["." maybe]
- ["." text ("#//." monoid)]
+ ["." text ("#\." monoid)]
[number
["." nat]
["." int]
["." rev]
["." frac]]
[collection
- ["." list ("#//." functor)]]]
+ ["." list ("#\." functor)]]]
["." meta (#+ with-gensyms)]]
[//
["." code]])
@@ -28,7 +28,7 @@
(#try.Success [tokens output])
(#try.Failure error)
- (#try.Failure ($_ text//compose
+ (#try.Failure ($_ text\compose
"Failed to parse: " (code.format binding) text.new-line
error)))))
@@ -49,11 +49,11 @@
{interfaces (tuple (some (super-class-decl^ imports class-vars)))}
{constructor-args (constructor-args^ imports class-vars)}
{methods (some (overriden-method-def^ imports))})
- (let [def-code ($_ text//compose "anon-class:"
+ (let [def-code ($_ text\compose "anon-class:"
(spaced (list (super-class-decl$ (maybe.default object-super-class super))
- (with-brackets (spaced (list//map super-class-decl$ interfaces)))
- (with-brackets (spaced (list//map constructor-arg$ constructor-args)))
- (with-brackets (spaced (list//map (method-def$ id) methods))))))]
+ (with-brackets (spaced (list\map super-class-decl$ interfaces)))
+ (with-brackets (spaced (list\map constructor-arg$ constructor-args)))
+ (with-brackets (spaced (list\map (method-def$ id) methods))))))]
(wrap (list (` ((~ (code.text def-code)))))))))}
(let [[exported? tokens] (: [Bit (List Code)]
(case tokens
diff --git a/stdlib/source/lux/macro/syntax/common/reader.lux b/stdlib/source/lux/macro/syntax/common/reader.lux
index 776674926..03fea57bc 100644
--- a/stdlib/source/lux/macro/syntax/common/reader.lux
+++ b/stdlib/source/lux/macro/syntax/common/reader.lux
@@ -3,10 +3,10 @@
[abstract
monad]
[control
- ["p" parser ("#//." monad)
+ ["p" parser ("#\." monad)
["s" code (#+ Parser)]]]
[data
- ["." name ("#//." equivalence)]
+ ["." name ("#\." equivalence)]
["." product]
["." maybe]
[collection
@@ -18,8 +18,8 @@
(def: #export export
(Parser Bit)
- (p.either (p.after (s.tag! (name-of #export)) (p//wrap #1))
- (p//wrap #0)))
+ (p.either (p.after (s.tag! (name-of #export)) (p\wrap #1))
+ (p\wrap #0)))
(def: #export declaration
{#.doc (doc "A reader for declaration syntax."
@@ -28,7 +28,7 @@
(foo bar baz))}
(Parser //.Declaration)
(p.either (p.and s.local-identifier
- (p//wrap (list)))
+ (p\wrap (list)))
(s.form (p.and s.local-identifier
(p.some s.local-identifier)))))
@@ -44,7 +44,7 @@
type s.any
value s.any]
(wrap [(#.Some type) value])))
- (p.and (p//wrap #.None)
+ (p.and (p\wrap #.None)
s.any)))
(def: _definition-anns-tag^
@@ -90,7 +90,7 @@
(-> (List [Name Code]) (List Text))
(<| (maybe.default (list))
(: (Maybe (List Text)))
- (case (list.find (|>> product.left (name//= ["lux" "func-args"])) meta-data)
+ (case (list.find (|>> product.left (name\= ["lux" "func-args"])) meta-data)
(^multi (#.Some [_ value])
[(p.run tuple-meta^ (list value))
(#.Right [_ args])]
diff --git a/stdlib/source/lux/macro/syntax/common/writer.lux b/stdlib/source/lux/macro/syntax/common/writer.lux
index e2e10f319..18abab65a 100644
--- a/stdlib/source/lux/macro/syntax/common/writer.lux
+++ b/stdlib/source/lux/macro/syntax/common/writer.lux
@@ -5,7 +5,7 @@
["." function]]
[data
[collection
- ["." list ("#//." functor)]]
+ ["." list ("#\." functor)]]
["." product]]
[macro
["." code]]]
@@ -20,12 +20,12 @@
(def: #export (declaration declaration)
(-> //.Declaration Code)
(` ((~ (code.local-identifier (get@ #//.declaration-name declaration)))
- (~+ (list//map code.local-identifier
- (get@ #//.declaration-args declaration))))))
+ (~+ (list\map code.local-identifier
+ (get@ #//.declaration-args declaration))))))
(def: #export annotations
(-> //.Annotations Code)
- (|>> (list//map (product.both code.tag function.identity))
+ (|>> (list\map (product.both code.tag function.identity))
code.record))
(def: #export (typed-input value)
@@ -35,4 +35,4 @@
(def: #export type-variables
(-> (List //.Type-Var) (List Code))
- (list//map code.local-identifier))
+ (list\map code.local-identifier))
diff --git a/stdlib/source/lux/macro/template.lux b/stdlib/source/lux/macro/template.lux
index c54f11d8c..12b3d9261 100644
--- a/stdlib/source/lux/macro/template.lux
+++ b/stdlib/source/lux/macro/template.lux
@@ -3,18 +3,18 @@
[abstract
["." monad (#+ do)]]
[control
- ["<>" parser ("#//." functor)
+ ["<>" parser ("#\." functor)
["<.>" code (#+ Parser)]]]
[data
- ["." bit ("#//." codec)]
+ ["." bit ("#\." codec)]
["." text]
[number
- ["." nat ("#//." decimal)]
- ["." int ("#//." decimal)]
- ["." rev ("#//." decimal)]
- ["." frac ("#//." decimal)]]
+ ["." nat ("#\." decimal)]
+ ["." int ("#\." decimal)]
+ ["." rev ("#\." decimal)]
+ ["." frac ("#\." decimal)]]
[collection
- ["." list ("#//." monad)]]]
+ ["." list ("#\." monad)]]]
["." meta]]
[//
[syntax (#+ syntax:)]
@@ -30,12 +30,12 @@
body)
(do {! meta.monad}
[g!locals (|> locals
- (list//map meta.gensym)
+ (list\map meta.gensym)
(monad.seq !))]
(wrap (list (` (.with-expansions [(~+ (|> (list.zip/2 locals g!locals)
- (list//map (function (_ [name identifier])
- (list (code.local-identifier name) (as-is identifier))))
- list//join))]
+ (list\map (function (_ [name identifier])
+ (list (code.local-identifier name) (as-is identifier))))
+ list\join))]
(~ body)))))))
(def: (name-side module-side? parser)
@@ -62,11 +62,11 @@
full-tag
(<>.either <code>.local-tag
full-tag))
- (<>//map bit//encode <code>.bit)
- (<>//map nat//encode <code>.nat)
- (<>//map int//encode <code>.int)
- (<>//map rev//encode <code>.rev)
- (<>//map frac//encode <code>.frac)
+ (<>\map bit\encode <code>.bit)
+ (<>\map nat\encode <code>.nat)
+ (<>\map int\encode <code>.int)
+ (<>\map rev\encode <code>.rev)
+ (<>\map frac\encode <code>.frac)
)))
(def: (part module-side?)