aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/meta/macro/syntax/input.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/meta/macro/syntax/input.lux')
-rw-r--r--stdlib/source/library/lux/meta/macro/syntax/input.lux43
1 files changed, 43 insertions, 0 deletions
diff --git a/stdlib/source/library/lux/meta/macro/syntax/input.lux b/stdlib/source/library/lux/meta/macro/syntax/input.lux
new file mode 100644
index 000000000..4461c7df9
--- /dev/null
+++ b/stdlib/source/library/lux/meta/macro/syntax/input.lux
@@ -0,0 +1,43 @@
+(.require
+ [library
+ [lux (.except)
+ [abstract
+ [equivalence (.only Equivalence)]]
+ [control
+ ["<>" parser]]
+ [data
+ ["[0]" product]
+ [collection
+ ["[0]" list (.use "[1]#[0]" monad)]]]
+ [meta
+ ["[0]" code (.only)
+ ["<[1]>" \\parser (.only Parser)]]]]])
+
+(type .public Input
+ (Record
+ [#binding Code
+ #type Code]))
+
+(def .public equivalence
+ (Equivalence Input)
+ (all product.equivalence
+ code.equivalence
+ code.equivalence
+ ))
+
+(def .public format
+ (-> (List Input) Code)
+ (|>> (list#each (function (_ value)
+ (list (the #binding value)
+ (the #type value))))
+ list#conjoint
+ code.tuple))
+
+(def .public parser
+ (Parser (List Input))
+ (<| <code>.tuple
+ <>.some
+ (all <>.and
+ <code>.any
+ <code>.any
+ )))