aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/ffi.jvm.lux2
-rw-r--r--stdlib/source/library/lux/ffi.old.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux2
-rw-r--r--stdlib/source/library/lux/type/poly.lux111
4 files changed, 54 insertions, 63 deletions
diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux
index 4753e6f14..32b5410ee 100644
--- a/stdlib/source/library/lux/ffi.jvm.lux
+++ b/stdlib/source/library/lux/ffi.jvm.lux
@@ -1230,7 +1230,7 @@
[(~+ (list#each field_decl$ fields))]
[(~+ methods)])))))))
-(def: .public interface:
+(def: .public interface
(syntax (_ [.let [! <>.monad]
[full_class_name class_vars] (at ! each parser.declaration ..declaration^)
supers (<>.else (list)
diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux
index db6bfb42e..1933ba032 100644
--- a/stdlib/source/library/lux/ffi.old.lux
+++ b/stdlib/source/library/lux/ffi.old.lux
@@ -1232,7 +1232,7 @@
(with_brackets (spaced (list#each (method_def$ replacer super) methods))))))]]
(in (list (` ((~ (code.text def_code)))))))))
-(def: .public interface:
+(def: .public interface
(syntax (_ [class_decl ..class_decl^
.let [class_vars (product.right class_decl)]
supers (<>.else (list)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux
index 8f5c9db8a..aa9829172 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux
@@ -53,7 +53,7 @@
list.together))]
((~' in) ((~ g!extension) [(~+ g!input+)])))
- (~' _)
+ (~ g!_)
(///.except ///extension.incorrect_arity [(~ g!name) 1 (list.size (~ g!inputs))])))))))))))
(arity: 0 nullary ..Nullary)
diff --git a/stdlib/source/library/lux/type/poly.lux b/stdlib/source/library/lux/type/poly.lux
index fa27e032b..aeb27188b 100644
--- a/stdlib/source/library/lux/type/poly.lux
+++ b/stdlib/source/library/lux/type/poly.lux
@@ -24,75 +24,66 @@
[number
["n" nat]]]]])
-(def: polyP
- (Parser [Code Text Code])
- (let [private (all <>.and
- <code>.local
- <code>.any)]
- (<>.either (<>.and <code>.any private)
- (<>.and (<>#in (` .private)) private))))
-
-(def: .public poly:
- (syntax (_ [[export_policy name body] ..polyP])
+(def: .public polytypic
+ (syntax (_ [name <code>.local
+ body <code>.any])
(with_symbols [g!_ g!type g!output]
(let [g!name (code.symbol ["" name])]
- (in (.list (` (def: (~ export_policy) (~ g!name)
- ((~! syntax) ((~ g!name) [(~ g!type) (~! <code>.any)])
- ((~! do) (~! meta.monad)
- [(~ g!type) ((~! meta.eval) .Type (~ g!type))]
- (case (is (.Either .Text .Code)
- ((~! <type>.result) ((~! <>.rec)
- (function ((~ g!_) (~ g!name))
- (~ body)))
- (.as .Type (~ g!type))))
- {.#Left (~ g!output)}
- ((~! meta.failure) (~ g!output))
+ (in (.list (` ((~! syntax) ((~ g!_) [(~ g!type) (~! <code>.any)])
+ ((~! do) (~! meta.monad)
+ [(~ g!type) ((~! meta.eval) .Type (~ g!type))]
+ (case (is (.Either .Text .Code)
+ ((~! <type>.result) ((~! <>.rec)
+ (function ((~ g!_) (~ g!name))
+ (~ body)))
+ (.as .Type (~ g!type))))
+ {.#Right (~ g!output)}
+ ((~' in) (.list (~ g!output)))
- {.#Right (~ g!output)}
- ((~' in) (.list (~ g!output))))))))))))))
+ {.#Left (~ g!output)}
+ ((~! meta.failure) (~ g!output))))))))))))
(def: .public (code env type)
(-> Env Type Code)
- (`` (case type
- {.#Primitive name params}
- (` {.#Primitive (~ (code.text name))
- (.list (~+ (list#each (code env) params)))})
+ (case type
+ {.#Primitive name params}
+ (` {.#Primitive (~ (code.text name))
+ (.list (~+ (list#each (code env) params)))})
- (^.with_template [<tag>]
- [{<tag> idx}
- (` {<tag> (~ (code.nat idx))})])
- ([.#Var] [.#Ex])
+ (^.with_template [<tag>]
+ [{<tag> idx}
+ (` {<tag> (~ (code.nat idx))})])
+ ([.#Var] [.#Ex])
- {.#Parameter idx}
- (let [idx (<type>.argument env idx)]
- (if (n.= 0 idx)
- (|> (dictionary.value idx env) maybe.trusted product.left (code env))
- (` (.$ (~ (code.nat (-- idx)))))))
+ {.#Parameter idx}
+ (let [idx (<type>.argument env idx)]
+ (if (n.= 0 idx)
+ (|> (dictionary.value idx env) maybe.trusted product.left (code env))
+ (` (.$ (~ (code.nat (-- idx)))))))
- {.#Apply {.#Primitive "" {.#End}}
- {.#Parameter idx}}
- (case (<type>.argument env idx)
- 0 (|> env (dictionary.value 0) maybe.trusted product.left (code env))
- idx (undefined))
-
- (^.with_template [<tag>]
- [{<tag> left right}
- (` {<tag> (~ (code env left))
- (~ (code env right))})])
- ([.#Function] [.#Apply])
+ {.#Apply {.#Primitive "" {.#End}}
+ {.#Parameter idx}}
+ (case (<type>.argument env idx)
+ 0 (|> env (dictionary.value 0) maybe.trusted product.left (code env))
+ idx (undefined))
+
+ (^.with_template [<tag>]
+ [{<tag> left right}
+ (` {<tag> (~ (code env left))
+ (~ (code env right))})])
+ ([.#Function] [.#Apply])
- (^.with_template [<macro> <tag> <flattener>]
- [{<tag> left right}
- (` (<macro> (~+ (list#each (code env) (<flattener> type)))))])
- ([.Union .#Sum type.flat_variant]
- [.Tuple .#Product type.flat_tuple])
+ (^.with_template [<macro> <tag> <flattener>]
+ [{<tag> left right}
+ (` (<macro> (~+ (list#each (code env) (<flattener> type)))))])
+ ([.Union .#Sum type.flat_variant]
+ [.Tuple .#Product type.flat_tuple])
- {.#Named name sub_type}
- (code.symbol name)
+ {.#Named name sub_type}
+ (code.symbol name)
- (^.with_template [<tag>]
- [{<tag> scope body}
- (` {<tag> (.list (~+ (list#each (code env) scope)))
- (~ (code env body))})])
- ([.#UnivQ] [.#ExQ])
- )))
+ (^.with_template [<tag>]
+ [{<tag> scope body}
+ (` {<tag> (.list (~+ (list#each (code env) scope)))
+ (~ (code env body))})])
+ ([.#UnivQ] [.#ExQ])))