aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux.lux66
-rw-r--r--stdlib/source/library/lux/abstract/interval.lux8
-rw-r--r--stdlib/source/library/lux/abstract/predicate.lux4
-rw-r--r--stdlib/source/library/lux/control/concatenative.lux4
-rw-r--r--stdlib/source/library/lux/control/concurrency/async.lux4
-rw-r--r--stdlib/source/library/lux/control/concurrency/semaphore.lux2
-rw-r--r--stdlib/source/library/lux/control/function/contract.lux2
-rw-r--r--stdlib/source/library/lux/control/io.lux18
-rw-r--r--stdlib/source/library/lux/control/parser/analysis.lux2
-rw-r--r--stdlib/source/library/lux/control/parser/binary.lux40
-rw-r--r--stdlib/source/library/lux/control/parser/code.lux4
-rw-r--r--stdlib/source/library/lux/control/parser/json.lux4
-rw-r--r--stdlib/source/library/lux/control/parser/synthesis.lux2
-rw-r--r--stdlib/source/library/lux/control/parser/text.lux18
-rw-r--r--stdlib/source/library/lux/control/parser/tree.lux2
-rw-r--r--stdlib/source/library/lux/control/parser/type.lux13
-rw-r--r--stdlib/source/library/lux/control/remember.lux2
-rw-r--r--stdlib/source/library/lux/control/security/policy.lux2
-rw-r--r--stdlib/source/library/lux/data/binary.lux4
-rw-r--r--stdlib/source/library/lux/data/bit.lux4
-rw-r--r--stdlib/source/library/lux/data/collection/array.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/bits.lux4
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary/ordered.lux10
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary/plist.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/list.lux8
-rw-r--r--stdlib/source/library/lux/data/collection/sequence.lux4
-rw-r--r--stdlib/source/library/lux/data/collection/set/multi.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/set/ordered.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/stream.lux6
-rw-r--r--stdlib/source/library/lux/data/collection/tree/finger.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/tree/zipper.lux6
-rw-r--r--stdlib/source/library/lux/data/color.lux8
-rw-r--r--stdlib/source/library/lux/data/color/named.lux2
-rw-r--r--stdlib/source/library/lux/data/format/binary.lux23
-rw-r--r--stdlib/source/library/lux/data/format/css.lux15
-rw-r--r--stdlib/source/library/lux/data/format/css/property.lux6
-rw-r--r--stdlib/source/library/lux/data/format/css/query.lux8
-rw-r--r--stdlib/source/library/lux/data/format/css/selector.lux18
-rw-r--r--stdlib/source/library/lux/data/format/css/value.lux72
-rw-r--r--stdlib/source/library/lux/data/format/html.lux34
-rw-r--r--stdlib/source/library/lux/data/format/json.lux18
-rw-r--r--stdlib/source/library/lux/data/format/markdown.lux8
-rw-r--r--stdlib/source/library/lux/data/format/tar.lux10
-rw-r--r--stdlib/source/library/lux/data/product.lux2
-rw-r--r--stdlib/source/library/lux/data/sum.lux4
-rw-r--r--stdlib/source/library/lux/data/text.lux4
-rw-r--r--stdlib/source/library/lux/data/text/encoding.lux2
-rw-r--r--stdlib/source/library/lux/data/text/escape.lux12
-rw-r--r--stdlib/source/library/lux/data/text/format.lux6
-rw-r--r--stdlib/source/library/lux/data/text/unicode/block.lux4
-rw-r--r--stdlib/source/library/lux/data/text/unicode/set.lux2
-rw-r--r--stdlib/source/library/lux/debug.lux18
-rw-r--r--stdlib/source/library/lux/documentation.lux23
-rw-r--r--stdlib/source/library/lux/extension.lux2
-rw-r--r--stdlib/source/library/lux/ffi.jvm.lux84
-rw-r--r--stdlib/source/library/lux/ffi.lux109
-rw-r--r--stdlib/source/library/lux/ffi.old.lux53
-rw-r--r--stdlib/source/library/lux/ffi.php.lux4
-rw-r--r--stdlib/source/library/lux/ffi.scm.lux4
-rw-r--r--stdlib/source/library/lux/ffi/export.rb.lux2
-rw-r--r--stdlib/source/library/lux/ffi/node_js.js.lux2
-rw-r--r--stdlib/source/library/lux/locale/language.lux8
-rw-r--r--stdlib/source/library/lux/locale/territory.lux6
-rw-r--r--stdlib/source/library/lux/macro.lux2
-rw-r--r--stdlib/source/library/lux/macro/code.lux14
-rw-r--r--stdlib/source/library/lux/macro/local.lux2
-rw-r--r--stdlib/source/library/lux/macro/pattern.lux16
-rw-r--r--stdlib/source/library/lux/macro/syntax.lux5
-rw-r--r--stdlib/source/library/lux/macro/template.lux4
-rw-r--r--stdlib/source/library/lux/math.lux14
-rw-r--r--stdlib/source/library/lux/math/logic/continuous.lux2
-rw-r--r--stdlib/source/library/lux/math/logic/fuzzy.lux13
-rw-r--r--stdlib/source/library/lux/math/modular.lux8
-rw-r--r--stdlib/source/library/lux/math/number.lux2
-rw-r--r--stdlib/source/library/lux/math/number/complex.lux6
-rw-r--r--stdlib/source/library/lux/math/number/frac.lux70
-rw-r--r--stdlib/source/library/lux/math/number/i64.lux8
-rw-r--r--stdlib/source/library/lux/math/number/int.lux12
-rw-r--r--stdlib/source/library/lux/math/number/nat.lux12
-rw-r--r--stdlib/source/library/lux/math/number/ratio.lux2
-rw-r--r--stdlib/source/library/lux/math/number/rev.lux14
-rw-r--r--stdlib/source/library/lux/math/random.lux8
-rw-r--r--stdlib/source/library/lux/meta.lux4
-rw-r--r--stdlib/source/library/lux/meta/configuration.lux2
-rw-r--r--stdlib/source/library/lux/meta/symbol.lux2
-rw-r--r--stdlib/source/library/lux/static.lux4
-rw-r--r--stdlib/source/library/lux/target.lux2
-rw-r--r--stdlib/source/library/lux/target/common_lisp.lux28
-rw-r--r--stdlib/source/library/lux/target/js.lux22
-rw-r--r--stdlib/source/library/lux/target/jvm/attribute.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode.lux60
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/environment.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/instruction.lux44
-rw-r--r--stdlib/source/library/lux/target/jvm/class.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/constant.lux10
-rw-r--r--stdlib/source/library/lux/target/jvm/constant/pool.lux116
-rw-r--r--stdlib/source/library/lux/target/jvm/constant/tag.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/encoding/signed.lux8
-rw-r--r--stdlib/source/library/lux/target/jvm/encoding/unsigned.lux6
-rw-r--r--stdlib/source/library/lux/target/jvm/field.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/method.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/modifier.lux22
-rw-r--r--stdlib/source/library/lux/target/jvm/reflection.lux12
-rw-r--r--stdlib/source/library/lux/target/jvm/type.lux8
-rw-r--r--stdlib/source/library/lux/target/jvm/type/alias.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/type/box.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/type/category.lux2
-rw-r--r--stdlib/source/library/lux/target/jvm/type/descriptor.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/type/lux.lux10
-rw-r--r--stdlib/source/library/lux/target/jvm/type/parser.lux10
-rw-r--r--stdlib/source/library/lux/target/jvm/type/reflection.lux6
-rw-r--r--stdlib/source/library/lux/target/jvm/type/signature.lux6
-rw-r--r--stdlib/source/library/lux/target/jvm/version.lux2
-rw-r--r--stdlib/source/library/lux/target/lua.lux18
-rw-r--r--stdlib/source/library/lux/target/php.lux26
-rw-r--r--stdlib/source/library/lux/target/python.lux28
-rw-r--r--stdlib/source/library/lux/target/r.lux26
-rw-r--r--stdlib/source/library/lux/target/ruby.lux32
-rw-r--r--stdlib/source/library/lux/target/scheme.lux20
-rw-r--r--stdlib/source/library/lux/test.lux4
-rw-r--r--stdlib/source/library/lux/time.lux4
-rw-r--r--stdlib/source/library/lux/time/date.lux4
-rw-r--r--stdlib/source/library/lux/time/day.lux12
-rw-r--r--stdlib/source/library/lux/time/duration.lux10
-rw-r--r--stdlib/source/library/lux/time/instant.lux6
-rw-r--r--stdlib/source/library/lux/time/month.lux14
-rw-r--r--stdlib/source/library/lux/time/year.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/arity.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/default/platform.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux51
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis/coverage.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis/inference.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis/pattern.lux28
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis/simple.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/directive.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/generation.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux96
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/complex.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/simple.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux57
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux16
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux5
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux28
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux9
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux5
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux5
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux5
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux9
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/primitive.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux12
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux12
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/primitive.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/primitive.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux12
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/primitive.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux23
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/primitive.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux24
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux9
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux295
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux146
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/synthesis/simple.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/cli.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/context.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/io/archive.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/phase.lux9
-rw-r--r--stdlib/source/library/lux/tool/compiler/reference.lux29
-rw-r--r--stdlib/source/library/lux/tool/compiler/reference/variable.lux9
-rw-r--r--stdlib/source/library/lux/type.lux32
-rw-r--r--stdlib/source/library/lux/type/check.lux26
-rw-r--r--stdlib/source/library/lux/type/poly.lux8
-rw-r--r--stdlib/source/library/lux/type/primitive.lux46
-rw-r--r--stdlib/source/library/lux/type/quotient.lux2
-rw-r--r--stdlib/source/library/lux/type/refinement.lux2
-rw-r--r--stdlib/source/library/lux/type/resource.lux6
-rw-r--r--stdlib/source/library/lux/type/unit.lux8
-rw-r--r--stdlib/source/library/lux/type/variance.lux22
-rw-r--r--stdlib/source/library/lux/world/console.lux43
-rw-r--r--stdlib/source/library/lux/world/db/jdbc.lux4
-rw-r--r--stdlib/source/library/lux/world/db/jdbc/input.lux8
-rw-r--r--stdlib/source/library/lux/world/db/jdbc/output.lux6
-rw-r--r--stdlib/source/library/lux/world/db/sql.lux32
-rw-r--r--stdlib/source/library/lux/world/file.lux69
-rw-r--r--stdlib/source/library/lux/world/file/watch.lux4
-rw-r--r--stdlib/source/library/lux/world/input/keyboard.lux4
-rw-r--r--stdlib/source/library/lux/world/net/http/client.lux2
-rw-r--r--stdlib/source/library/lux/world/net/http/cookie.lux4
-rw-r--r--stdlib/source/library/lux/world/net/http/mime.lux2
-rw-r--r--stdlib/source/library/lux/world/net/http/response.lux2
-rw-r--r--stdlib/source/library/lux/world/net/http/route.lux4
-rw-r--r--stdlib/source/library/lux/world/net/http/status.lux2
-rw-r--r--stdlib/source/library/lux/world/net/http/version.lux2
-rw-r--r--stdlib/source/library/lux/world/output/video/resolution.lux2
-rw-r--r--stdlib/source/library/lux/world/program.lux4
-rw-r--r--stdlib/source/library/lux/world/shell.lux10
251 files changed, 1686 insertions, 1564 deletions
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index 0b45af385..1a35551fa 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -1940,7 +1940,7 @@
(-> ($' List ($' List a)) ($' List a)))
(list#mix list#composite {#End} (list#reversed xs)))
-(def:'' .public template
+(def:'' .public with_template
Macro
(macro (_ tokens)
({{#Item [[_ {#Tuple bindings}] {#Item [[_ {#Tuple templates}] data]}]}
@@ -1954,15 +1954,15 @@
(list#each (function#composite apply (replacement_environment bindings')))
list#conjoint
meta#in)
- (failure "Irregular arguments tuples for template.")))
+ (failure (..wrong_syntax_error [..prelude_module "with_template"]))))
_
- (failure "Wrong syntax for template")}
+ (failure (..wrong_syntax_error [..prelude_module "with_template"]))}
[(monad#each maybe_monad symbol_short bindings)
(monad#each maybe_monad tuple_list data)])
_
- (failure "Wrong syntax for template")}
+ (failure (..wrong_syntax_error [..prelude_module "with_template"]))}
tokens)))
(def:''' .private (n// param subject)
@@ -2415,7 +2415,7 @@
_ #0}
xs))
-(template [<name> <type> <value>]
+(with_template [<name> <type> <value>]
[(def:''' .private (<name> xy)
(All (_ a b)
(-> (Tuple a b) <type>))
@@ -2809,7 +2809,7 @@
_
{#None}))
-(template [<parser> <item_type> <item_parser>]
+(with_template [<parser> <item_type> <item_parser>]
[(def:' .private (<parser> tokens)
(-> (List Code) (Maybe (List <item_type>)))
(case tokens
@@ -2827,7 +2827,7 @@
[enhanced_parametersP Code anyP]
)
-(template [<parser> <parameter_type> <parameters_parser>]
+(with_template [<parser> <parameter_type> <parameters_parser>]
[(def:' .private (<parser> tokens)
(Parser [Text (List <parameter_type>)])
(case tokens
@@ -2868,7 +2868,7 @@
_
[tokens (` .private)]))
-(template [<parser> <parameter_type> <local>]
+(with_template [<parser> <parameter_type> <local>]
[(def:' .private (<parser> tokens)
(-> (List Code) (Maybe [(List Code) [Code Text (List <parameter_type>)]]))
(do maybe_monad
@@ -2956,7 +2956,7 @@
{#Some y}
{#Some y})))
-(template [<name> <form> <message>]
+(with_template [<name> <form> <message>]
[(def: .public <name>
(macro (_ tokens)
(case (list#reversed tokens)
@@ -3090,7 +3090,7 @@
_
{#None}))
-(template [<name> <tag>]
+(with_template [<name> <tag>]
[(def: (<name> type)
(-> Type (List Type))
(case type
@@ -4543,7 +4543,7 @@
_
(failure "Wrong syntax for pattern#template"))))
-(template [<name> <extension>]
+(with_template [<name> <extension>]
[(def: .public <name>
(All (_ s)
(-> (I64 s) (I64 s)))
@@ -4897,19 +4897,19 @@
(failure (..wrong_syntax_error (symbol ..type_of))))))
(def: (templateP tokens)
- (-> (List Code) (Maybe [Code Text (List Text) (List Code)]))
+ (-> (List Code) (Maybe [Text (List Text) (List Code)]))
(do maybe_monad
- [% (declarationP tokens)
- .let' [[tokens [export_policy name parameters]] %]
+ [% (local_declarationP tokens)
+ .let' [[tokens [name parameters]] %]
% (tupleP (someP anyP) tokens)
.let' [[tokens templates] %]
_ (endP tokens)]
- (in [export_policy name parameters templates])))
+ (in [name parameters templates])))
-(def: .public template:
+(def: .public template
(macro (_ tokens)
(case (templateP tokens)
- {#Some [export_policy name args input_templates]}
+ {#Some [name args input_templates]}
(do meta_monad
[g!tokens (..generated_symbol "tokens")
g!compiler (..generated_symbol "compiler")
@@ -4918,25 +4918,25 @@
[arg (` ((~' ~) (~ (local$ arg))))])
args)]
this_module current_module_name]
- (in (list (` (..def: (~ export_policy) (~ (local$ name))
- (..macro ((~ (local$ name)) (~ g!tokens) (~ g!compiler))
- (case (~ g!tokens)
- (pattern (list (~+ (list#each local$ args))))
- {.#Right [(~ g!compiler)
- (list (~+ (list#each (function (_ template)
- (` (`' (~ (with_replacements rep_env
- template)))))
- input_templates)))]}
-
- (~ g!_)
- {.#Left (~ (text$ (..wrong_syntax_error [this_module name])))})))))))
+ (in (list (` (..macro ((~ (local$ name)) (~ g!tokens) (~ g!compiler))
+ (case (~ g!tokens)
+ (pattern (list (~+ (list#each local$ args))))
+ {.#Right [(~ g!compiler)
+ (list (~+ (list#each (function (_ template)
+ (` (`' (~ (with_replacements rep_env
+ template)))))
+ input_templates)))]}
+
+ (~ g!_)
+ {.#Left "Invalid syntax."}))))))
{#None}
- (failure (..wrong_syntax_error (symbol ..template:))))))
+ (failure (..wrong_syntax_error (symbol ..template))))))
-(template [<name> <to>]
- [(template: .public (<name> it)
- [(..|> it (..is (..I64 ..Any)) (..as <to>))])]
+(with_template [<name> <to>]
+ [(def: .public <name>
+ (template (<name> it)
+ [(..|> it (..is (..I64 ..Any)) (..as <to>))]))]
[i64 ..I64]
[nat ..Nat]
diff --git a/stdlib/source/library/lux/abstract/interval.lux b/stdlib/source/library/lux/abstract/interval.lux
index c38e3a75b..2ec0a1fa5 100644
--- a/stdlib/source/library/lux/abstract/interval.lux
+++ b/stdlib/source/library/lux/abstract/interval.lux
@@ -32,7 +32,7 @@
(def: bottom elem)
(def: top elem)))
-(template [<name> <comp>]
+(with_template [<name> <comp>]
[(def: .public (<name> interval)
(All (_ a) (-> (Interval a) Bit))
(let [(open ",#[0]") interval]
@@ -58,7 +58,7 @@
(and (,#= ,#bottom elem)
(,#= ,#top elem)))))
-(template [<name> <limit>]
+(with_template [<name> <limit>]
[(def: .public (<name> elem interval)
(All (_ a) (-> a (Interval a) Bit))
(let [(open "[0]") interval]
@@ -105,7 +105,7 @@
(All (_ a) (-> (Interval a) (Interval a) Bit))
(precedes? sample reference))
-(template [<name> <comp>]
+(with_template [<name> <comp>]
[(def: .public (<name> reference sample)
(All (_ a) (-> a (Interval a) Bit))
(let [(open ",#[0]") sample]
@@ -128,7 +128,7 @@
(or (meets? reference sample)
(meets? sample reference)))
-(template [<name> <eq_side> <ineq> <ineq_side>]
+(with_template [<name> <eq_side> <ineq> <ineq_side>]
[(def: .public (<name> reference sample)
(All (_ a) (-> (Interval a) (Interval a) Bit))
(let [(open ",#[0]") reference]
diff --git a/stdlib/source/library/lux/abstract/predicate.lux b/stdlib/source/library/lux/abstract/predicate.lux
index 590741de7..10efde28e 100644
--- a/stdlib/source/library/lux/abstract/predicate.lux
+++ b/stdlib/source/library/lux/abstract/predicate.lux
@@ -11,7 +11,7 @@
(type: .public (Predicate a)
(-> a Bit))
-(template [<identity_name> <identity_value> <composition_name> <composition>]
+(with_template [<identity_name> <identity_value> <composition_name> <composition>]
[(def: .public <identity_name>
Predicate
(function.constant <identity_value>))
@@ -26,7 +26,7 @@
[all #1 and .and]
)
-(template [<name> <identity> <composition>]
+(with_template [<name> <identity> <composition>]
[(implementation: .public <name>
(All (_ a) (Monoid (Predicate a)))
diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux
index 81a5af65d..344af48e8 100644
--- a/stdlib/source/library/lux/control/concatenative.lux
+++ b/stdlib/source/library/lux/control/concatenative.lux
@@ -144,7 +144,7 @@
(function ((~ g!_) (~ (stack_mix g!inputs g!stack)))
[(~ g!stack) ((~ g!func) (~+ g!inputs))]))))))))))
-(template [<arity>]
+(with_template [<arity>]
[(`` (def: .public (~~ (template.symbol ["apply_" <arity>]))
(..apply <arity>)))]
@@ -202,7 +202,7 @@
(function (_ [stack r])
[stack {0 #1 r}]))
-(template [<input> <output> <word> <func>]
+(with_template [<input> <output> <word> <func>]
[(`` (def: .public <word>
(=> [<input> <input>] [<output>])
(function (_ [[stack subject] param])
diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux
index b933ea350..8882fc928 100644
--- a/stdlib/source/library/lux/control/concurrency/async.lux
+++ b/stdlib/source/library/lux/control/concurrency/async.lux
@@ -172,7 +172,7 @@
[(Async (Or lr rr)) (Resolver (Or lr rr))]
(..async []))]
(with_expansions
- [<sides> (template [<async> <tag>]
+ [<sides> (with_template [<async> <tag>]
[(io.run! (upon! (|>> {<tag>} resolve) <async>))]
[left .#Left]
@@ -191,7 +191,7 @@
[(Async a) (Resolver a)]
(..async []))]
(`` (exec
- (~~ (template [<async>]
+ (~~ (with_template [<async>]
[(io.run! (upon! resolve <async>))]
[left]
diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux
index a9c93433a..20236531a 100644
--- a/stdlib/source/library/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux
@@ -147,7 +147,7 @@
(again (++ step)))
(at async.monad in []))))
- (template [<phase> <update> <goal> <turnstile>]
+ (with_template [<phase> <update> <goal> <turnstile>]
[(def: (<phase> barrier)
(-> Barrier (Async Any))
(do async.monad
diff --git a/stdlib/source/library/lux/control/function/contract.lux b/stdlib/source/library/lux/control/function/contract.lux
index b5de83e82..fbb5dc725 100644
--- a/stdlib/source/library/lux/control/function/contract.lux
+++ b/stdlib/source/library/lux/control/function/contract.lux
@@ -15,7 +15,7 @@
[number
["i" int]]]]])
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [condition Code])
(exception.report
"Condition" (%.code condition)))]
diff --git a/stdlib/source/library/lux/control/io.lux b/stdlib/source/library/lux/control/io.lux
index ef5e9eecf..50ed5ca0c 100644
--- a/stdlib/source/library/lux/control/io.lux
+++ b/stdlib/source/library/lux/control/io.lux
@@ -21,15 +21,17 @@
(All (_ a) (-> (-> Any a) (IO a)))
(|>> abstraction))
- (template: (!io computation)
- [(abstraction
- (template.with_locals [g!func g!arg]
- (function (g!func g!arg)
- computation)))])
+ (def: !io
+ (template (!io computation)
+ [(abstraction
+ (template.with_locals [g!func g!arg]
+ (function (g!func g!arg)
+ computation)))]))
- (template: (run!' io)
- ... creatio ex nihilo
- [((representation io) [])])
+ (def: run!'
+ (template (run!' io)
+ ... creatio ex nihilo
+ [((representation io) [])]))
(def: .public io
(syntax (_ [computation <code>.any])
diff --git a/stdlib/source/library/lux/control/parser/analysis.lux b/stdlib/source/library/lux/control/parser/analysis.lux
index e23cc495e..ebf4f2ec6 100644
--- a/stdlib/source/library/lux/control/parser/analysis.lux
+++ b/stdlib/source/library/lux/control/parser/analysis.lux
@@ -88,7 +88,7 @@
{.#End} true
_ false)]}))
-(template [<query> <assertion> <tag> <type> <eq>]
+(with_template [<query> <assertion> <tag> <type> <eq>]
[(`` (these (def: .public <query>
(Parser <type>)
(function (_ input)
diff --git a/stdlib/source/library/lux/control/parser/binary.lux b/stdlib/source/library/lux/control/parser/binary.lux
index 36f70c1e0..28f13e9b7 100644
--- a/stdlib/source/library/lux/control/parser/binary.lux
+++ b/stdlib/source/library/lux/control/parser/binary.lux
@@ -43,9 +43,10 @@
"Binary length" (%.nat binary_length)
"Bytes read" (%.nat bytes_read)))
-(template [<name> <extension>]
- [(template: (<name> <parameter> <subject>)
- [(<extension> <parameter> <subject>)])]
+(with_template [<name> <extension>]
+ [(def: <name>
+ (template (<name> <parameter> <subject>)
+ [(<extension> <parameter> <subject>)]))]
[n#= "lux i64 ="]
[n#+ "lux i64 +"]
@@ -95,7 +96,7 @@
"Range start" (%.nat start)
"Range end" (%.nat end)))
-(template [<name> <size> <read>]
+(with_template [<name> <size> <read>]
[(def: .public <name>
(Parser I64)
(function (_ [start binary])
@@ -112,7 +113,7 @@
[bits_64 ..size_64 /.bits_64]
)
-(template [<name> <type>]
+(with_template [<name> <type>]
[(def: .public <name> (Parser <type>) ..bits_64)]
[nat Nat]
@@ -130,17 +131,18 @@
"Tag range" (%.nat range)
"Tag value" (%.nat byte)))
-(template: (!variant <case>+)
- [(do [! //.monad]
- [flag (is (Parser Nat)
- ..bits_8)]
- (with_expansions [<case>+' (template.spliced <case>+)]
- (case flag
- (^.template [<number> <tag> <parser>]
- [<number> (`` (at ! each (|>> {(~~ (template.spliced <tag>))}) <parser>))])
- (<case>+')
-
- _ (//.lifted (exception.except ..invalid_tag [(template.amount [<case>+]) flag])))))])
+(def: !variant
+ (template (!variant <case>+)
+ [(do [! //.monad]
+ [flag (is (Parser Nat)
+ ..bits_8)]
+ (with_expansions [<case>+' (template.spliced <case>+)]
+ (case flag
+ (^.with_template [<number> <tag> <parser>]
+ [<number> (`` (at ! each (|>> {(~~ (template.spliced <tag>))}) <parser>))])
+ (<case>+')
+
+ _ (//.lifted (exception.except ..invalid_tag [(template.amount [<case>+]) flag])))))]))
(def: .public (or left right)
(All (_ l r) (-> (Parser l) (Parser r) (Parser (Or l r))))
@@ -185,7 +187,7 @@
[[end binary]]
{try.#Success}))))))
-(template [<size> <name> <bits>]
+(with_template [<size> <name> <bits>]
[(`` (def: .public <name>
(Parser Binary)
(do //.monad
@@ -198,7 +200,7 @@
[64 binary_64 ..bits_64]
)
-(template [<size> <name> <binary>]
+(with_template [<size> <name> <binary>]
[(`` (def: .public <name>
(Parser Text)
(do //.monad
@@ -213,7 +215,7 @@
(def: .public text ..utf8_64)
-(template [<size> <name> <bits>]
+(with_template [<size> <name> <bits>]
[(def: .public (<name> valueP)
(All (_ v) (-> (Parser v) (Parser (Sequence v))))
(do //.monad
diff --git a/stdlib/source/library/lux/control/parser/code.lux b/stdlib/source/library/lux/control/parser/code.lux
index e2b1b9c9e..017895abf 100644
--- a/stdlib/source/library/lux/control/parser/code.lux
+++ b/stdlib/source/library/lux/control/parser/code.lux
@@ -57,7 +57,7 @@
{.#Item next _}
{try.#Success [tokens next]})))
-(template [<query> <check> <type> <tag> <eq> <desc>]
+(with_template [<query> <check> <type> <tag> <eq> <desc>]
[(with_expansions [<failure> (these {try.#Failure (all text#composite "Cannot parse " <desc> (remaining_inputs tokens))})]
(def: .public <query>
(Parser <type>)
@@ -155,7 +155,7 @@
_
<failure>))))
-(template [<name> <tag> <desc>]
+(with_template [<name> <tag> <desc>]
[(def: .public (<name> p)
(All (_ a)
(-> (Parser a) (Parser a)))
diff --git a/stdlib/source/library/lux/control/parser/json.lux b/stdlib/source/library/lux/control/parser/json.lux
index 1887b387b..cf778566d 100644
--- a/stdlib/source/library/lux/control/parser/json.lux
+++ b/stdlib/source/library/lux/control/parser/json.lux
@@ -59,7 +59,7 @@
(exception.report
"Value" (/.format value)))
-(template [<name> <type> <tag>]
+(with_template [<name> <type> <tag>]
[(def: .public <name>
(Parser <type>)
(do //.monad
@@ -83,7 +83,7 @@
"Reference" (/.format reference)
"Sample" (/.format sample)))
-(template [<test> <check> <type> <equivalence> <tag>]
+(with_template [<test> <check> <type> <equivalence> <tag>]
[(def: .public (<test> test)
(-> <type> (Parser Bit))
(do //.monad
diff --git a/stdlib/source/library/lux/control/parser/synthesis.lux b/stdlib/source/library/lux/control/parser/synthesis.lux
index 2fd9942fb..130b271ac 100644
--- a/stdlib/source/library/lux/control/parser/synthesis.lux
+++ b/stdlib/source/library/lux/control/parser/synthesis.lux
@@ -87,7 +87,7 @@
{.#End} true
_ false)]}))
-(template [<query> <assertion> <tag> <type> <eq>]
+(with_template [<query> <assertion> <tag> <type> <eq>]
[(`` (def: .public <query>
(Parser <type>)
(.function (_ input)
diff --git a/stdlib/source/library/lux/control/parser/text.lux b/stdlib/source/library/lux/control/parser/text.lux
index c03a62dae..fbe318d12 100644
--- a/stdlib/source/library/lux/control/parser/text.lux
+++ b/stdlib/source/library/lux/control/parser/text.lux
@@ -118,7 +118,7 @@
_
(exception.except ..cannot_slice []))))
-(template [<name> <type> <any>]
+(with_template [<name> <type> <any>]
[(`` (def: .public (<name> parser)
(All (_ a) (-> (Parser a) (Parser <type>)))
(function (_ input)
@@ -193,7 +193,7 @@
(n.<= top char')))]
(in it)))
-(template [<bottom> <top> <text> <slice>]
+(with_template [<bottom> <top> <text> <slice>]
[(def: .public <text>
(Parser Text)
(..range (char <bottom>) (char <top>)))
@@ -228,7 +228,7 @@
(..range! (char "a") (char "f"))
(..range! (char "A") (char "F"))))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [options Text
character Char])
(exception.report
@@ -239,7 +239,7 @@
[character_should_not_be]
)
-(template [<name> <modifier> <exception>]
+(with_template [<name> <modifier> <exception>]
[(def: .public (<name> options)
(-> Text (Parser Text))
(function (_ [offset tape])
@@ -257,7 +257,7 @@
[none_of .not ..character_should_not_be]
)
-(template [<name> <modifier> <exception>]
+(with_template [<name> <modifier> <exception>]
[(def: .public (<name> options)
(-> Text (Parser Slice))
(function (_ [offset tape])
@@ -328,7 +328,7 @@
(open "right[0]") right]
(in [left#basis ("lux i64 +" left#distance right#distance)])))
-(template [<name> <base> <doc_modifier>]
+(with_template [<name> <base> <doc_modifier>]
[(def: .public (<name> parser)
(-> (Parser Text) (Parser Text))
(|> parser <base> (at //.monad each /.together)))]
@@ -337,7 +337,7 @@
[many //.many "many"]
)
-(template [<name> <base> <doc_modifier>]
+(with_template [<name> <base> <doc_modifier>]
[(def: .public (<name> parser)
(-> (Parser Slice) (Parser Slice))
(with_slices (<base> parser)))]
@@ -346,7 +346,7 @@
[many! //.many "many"]
)
-(template [<name> <base> <doc_modifier>]
+(with_template [<name> <base> <doc_modifier>]
[(def: .public (<name> amount parser)
(-> Nat (Parser Text) (Parser Text))
(|> parser
@@ -358,7 +358,7 @@
[at_least //.at_least "at least"]
)
-(template [<name> <base> <doc_modifier>]
+(with_template [<name> <base> <doc_modifier>]
[(def: .public (<name> amount parser)
(-> Nat (Parser Slice) (Parser Slice))
(with_slices
diff --git a/stdlib/source/library/lux/control/parser/tree.lux b/stdlib/source/library/lux/control/parser/tree.lux
index b45e40449..751d370db 100644
--- a/stdlib/source/library/lux/control/parser/tree.lux
+++ b/stdlib/source/library/lux/control/parser/tree.lux
@@ -32,7 +32,7 @@
(exception: .public cannot_move_further)
-(template [<name> <direction>]
+(with_template [<name> <direction>]
[(def: .public <name>
(All (_ t) (Parser t []))
(function (_ zipper)
diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux
index 4b2e9cd90..b2dcbce6e 100644
--- a/stdlib/source/library/lux/control/parser/type.lux
+++ b/stdlib/source/library/lux/control/parser/type.lux
@@ -23,10 +23,11 @@
["[0]" check]]]]
["[0]" //])
-(template: (|recursion_dummy|)
- [{.#Primitive "" {.#End}}])
+(def: |recursion_dummy|
+ (template (|recursion_dummy|)
+ [{.#Primitive "" {.#End}}]))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [type Type])
(exception.report
"Type" (%.type type)))]
@@ -43,7 +44,7 @@
[not_tuple]
)
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [expected Type
actual Type])
(exception.report
@@ -153,7 +154,7 @@
{try.#Success [[_ inputs'] output]}
{try.#Success [[env inputs'] [g!var output]]}))))
-(template [<name> <flattener> <exception>]
+(with_template [<name> <flattener> <exception>]
[(`` (def: .public (<name> poly)
(All (_ a) (-> (Parser a) (Parser a)))
(do //.monad
@@ -232,7 +233,7 @@
(//.failure (exception.error ..not_application headT))
(..local {.#Item funcT paramsT} poly))))
-(template [<name> <test>]
+(with_template [<name> <test>]
[(def: .public (<name> expected)
(-> Type (Parser Any))
(do //.monad
diff --git a/stdlib/source/library/lux/control/remember.lux b/stdlib/source/library/lux/control/remember.lux
index dd72e4d7a..372a217f3 100644
--- a/stdlib/source/library/lux/control/remember.lux
+++ b/stdlib/source/library/lux/control/remember.lux
@@ -65,7 +65,7 @@
(list)))
(meta.failure (exception.error ..must_remember [deadline today message focus]))))))
-(template [<name> <message>]
+(with_template [<name> <message>]
[(`` (def: .public <name>
(syntax (_ [deadline ..deadline
message <c>.text
diff --git a/stdlib/source/library/lux/control/security/policy.lux b/stdlib/source/library/lux/control/security/policy.lux
index f01773f36..a41783bc9 100644
--- a/stdlib/source/library/lux/control/security/policy.lux
+++ b/stdlib/source/library/lux/control/security/policy.lux
@@ -76,7 +76,7 @@
(def: conjoint (|>> representation)))
)
-(template [<brand> <value> <upgrade> <downgrade>]
+(with_template [<brand> <value> <upgrade> <downgrade>]
[(primitive: .public <brand>
Any
diff --git a/stdlib/source/library/lux/data/binary.lux b/stdlib/source/library/lux/data/binary.lux
index 2335c38a0..d39c1eff1 100644
--- a/stdlib/source/library/lux/data/binary.lux
+++ b/stdlib/source/library/lux/data/binary.lux
@@ -46,7 +46,7 @@
"Size" (%.nat size)
"Index" (%.nat index)))
-(template [<safe> <unsafe> <shift>]
+(with_template [<safe> <unsafe> <shift>]
[(def: .public (<safe> index it)
(-> Nat Binary (Try I64))
(if (n.< (/.size it) (|> index <shift>))
@@ -59,7 +59,7 @@
[bits_64 /.bits_64 (n.+ 7)]
)
-(template [<safe> <unsafe> <shift>]
+(with_template [<safe> <unsafe> <shift>]
[(def: .public (<safe> index value it)
(-> Nat (I64 Any) Binary (Try Binary))
(if (n.< (/.size it) (|> index <shift>))
diff --git a/stdlib/source/library/lux/data/bit.lux b/stdlib/source/library/lux/data/bit.lux
index db83b05a9..da276ed5a 100644
--- a/stdlib/source/library/lux/data/bit.lux
+++ b/stdlib/source/library/lux/data/bit.lux
@@ -9,7 +9,7 @@
[control
["[0]" function]]]])
-(template [<zero> <one>]
+(with_template [<zero> <one>]
[(def: .public <zero> Bit #0)
(def: .public <one> Bit #1)]
@@ -35,7 +35,7 @@
#0 2
#1 3)))
-(template [<name> <identity> <op>]
+(with_template [<name> <identity> <op>]
[(implementation: .public <name>
(Monoid Bit)
diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux
index 074e5e7f9..7d239d16a 100644
--- a/stdlib/source/library/lux/data/collection/array.lux
+++ b/stdlib/source/library/lux/data/collection/array.lux
@@ -139,7 +139,7 @@
(def: (each $ input)
(!.each $ input)))
-(template [<safe> <unsafe>]
+(with_template [<safe> <unsafe>]
[(def: .public (<safe> ? it)
(All (_ r w)
(-> (Predicate r) (Predicate (Array' r w))))
diff --git a/stdlib/source/library/lux/data/collection/bits.lux b/stdlib/source/library/lux/data/collection/bits.lux
index e9b659d3a..1df1551e6 100644
--- a/stdlib/source/library/lux/data/collection/bits.lux
+++ b/stdlib/source/library/lux/data/collection/bits.lux
@@ -60,7 +60,7 @@
(|> bits (array.item idx) (maybe.else empty_chunk))
empty_chunk))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: .public (<name> index input)
(-> Nat Bits Bits)
(let [[chunk_index bit_index] (n./% chunk_size index)]
@@ -130,7 +130,7 @@
(again (-- size|output)))
output))))))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: .public (<name> param subject)
(-> Bits Bits Bits)
(case (n.max (array.size param)
diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux
index a4b122919..ef8f4f75d 100644
--- a/stdlib/source/library/lux/data/collection/dictionary.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary.lux
@@ -638,7 +638,7 @@
(empty key_hash)
kvs))
-(template [<side> <name>]
+(with_template [<side> <name>]
[(def: .public <name>
(All (_ k v) (-> (Dictionary k v) (List <side>)))
(|>> (the #root)
diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
index 76e5939be..00c1cc840 100644
--- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
@@ -33,7 +33,7 @@
#left (Maybe (Node k v))
#right (Maybe (Node k v))]))
-(template [<create> <color>]
+(with_template [<create> <color>]
[(def: (<create> key value left right)
(All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v)))
[#color {<color>}
@@ -101,7 +101,7 @@
(again (the #left node))
(again (the #right node)))))))))
-(template [<name> <side>]
+(with_template [<name> <side>]
[(def: .public (<name> dict)
(All (_ k v) (-> (Dictionary k v) (Maybe v)))
(case (the #root dict)
@@ -136,7 +136,7 @@
(All (_ k v) (-> (Dictionary k v) Bit))
(|>> ..size (n.= 0)))
-(template [<name> <other_color> <self_color> <no_change>]
+(with_template [<name> <other_color> <self_color> <no_change>]
[(def: (<name> self)
(All (_ k v) (-> (Node k v) (Node k v)))
(case (the #color self)
@@ -259,7 +259,7 @@
{.#Some root}
(let [reference (the #key root)]
- (`` (cond (~~ (template [<comp> <tag> <add>]
+ (`` (cond (~~ (with_template [<comp> <tag> <add>]
[(<comp> reference key)
(let [side_root (the <tag> root)
outcome (again side_root)]
@@ -543,7 +543,7 @@
(empty order)
list))
-(template [<name> <type> <output>]
+(with_template [<name> <type> <output>]
[(def: .public (<name> dict)
(All (_ k v) (-> (Dictionary k v) (List <type>)))
(loop (again [node (the #root dict)])
diff --git a/stdlib/source/library/lux/data/collection/dictionary/plist.lux b/stdlib/source/library/lux/data/collection/dictionary/plist.lux
index 1d7c385c2..4f91cfc6d 100644
--- a/stdlib/source/library/lux/data/collection/dictionary/plist.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary/plist.lux
@@ -42,7 +42,7 @@
{.#Some v'}
(value key properties'))))
-(template [<name> <type> <access>]
+(with_template [<name> <type> <access>]
[(def: .public <name>
(All (_ a) (-> (PList a) (List <type>)))
(list#each <access>))]
diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux
index d29b0889a..64dbcb141 100644
--- a/stdlib/source/library/lux/data/collection/list.lux
+++ b/stdlib/source/library/lux/data/collection/list.lux
@@ -92,7 +92,7 @@
_
{.#None}))
-(template [<name> <then> <else>]
+(with_template [<name> <then> <else>]
[(def: .public (<name> n xs)
(All (_ a)
(-> Nat (List a) (List a)))
@@ -109,7 +109,7 @@
[after (after (-- n) xs') xs]
)
-(template [<name> <then> <else>]
+(with_template [<name> <then> <else>]
[(def: .public (<name> predicate xs)
(All (_ a)
(-> (Predicate a) (List a) (List a)))
@@ -261,7 +261,7 @@
(All (_ a) (-> (List a) Nat))
(mix (function (_ _ acc) (n.+ 1 acc)) 0 list))
-(template [<name> <init> <op>]
+(with_template [<name> <init> <op>]
[(def: .public (<name> predicate items)
(All (_ a)
(-> (Predicate a) (List a) Bit))
@@ -408,7 +408,7 @@
(or (at eq = x x')
(member? eq xs' x))))
-(template [<name> <output> <side>]
+(with_template [<name> <output> <side>]
[(def: .public (<name> xs)
(All (_ a) (-> (List a) (Maybe <output>)))
(case xs
diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux
index 39bce01ad..b6bdf698a 100644
--- a/stdlib/source/library/lux/data/collection/sequence.lux
+++ b/stdlib/source/library/lux/data/collection/sequence.lux
@@ -59,7 +59,7 @@
Level
0)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: <name>
(-> Level Level)
(<op> branching_exponent))]
@@ -482,7 +482,7 @@
list.reversed
(list#mix suffix ..empty)))
-(template [<name> <array> <init> <op>]
+(with_template [<name> <array> <init> <op>]
[(def: .public <name>
(All (_ a)
(-> (Predicate a) (Sequence a) Bit))
diff --git a/stdlib/source/library/lux/data/collection/set/multi.lux b/stdlib/source/library/lux/data/collection/set/multi.lux
index ac422fd99..9141df9b2 100644
--- a/stdlib/source/library/lux/data/collection/set/multi.lux
+++ b/stdlib/source/library/lux/data/collection/set/multi.lux
@@ -66,7 +66,7 @@
(list#composite (list.repeated multiplicity elem) output))
{.#End})))
- (template [<name> <composite>]
+ (with_template [<name> <composite>]
[(def: .public (<name> parameter subject)
(All (_ a) (-> (Set a) (Set a) (Set a)))
(abstraction (dictionary.composite_with <composite> (representation parameter) (representation subject))))]
diff --git a/stdlib/source/library/lux/data/collection/set/ordered.lux b/stdlib/source/library/lux/data/collection/set/ordered.lux
index 9e83655b9..296e0aadc 100644
--- a/stdlib/source/library/lux/data/collection/set/ordered.lux
+++ b/stdlib/source/library/lux/data/collection/set/ordered.lux
@@ -23,7 +23,7 @@
(All (_ a) (-> (Set a) a Bit))
(/.key? (representation set) elem))
- (template [<type> <name> <alias>]
+ (with_template [<type> <name> <alias>]
[(def: .public <name>
(All (_ a) (-> (Set a) <type>))
(|>> representation <alias>))]
diff --git a/stdlib/source/library/lux/data/collection/stream.lux b/stdlib/source/library/lux/data/collection/stream.lux
index 0c8ba2d85..a005782b4 100644
--- a/stdlib/source/library/lux/data/collection/stream.lux
+++ b/stdlib/source/library/lux/data/collection/stream.lux
@@ -45,7 +45,7 @@
{.#Item head' tail'}
(again head' tail'))])))
-(template [<name> <return>]
+(with_template [<name> <return>]
[(def: .public (<name> stream)
(All (_ a) (-> (Stream a) <return>))
(let [[head tail] (//.result stream)]
@@ -62,7 +62,7 @@
0 head
_ (item (-- idx) tail))))
-(template [<taker> <dropper> <pred_type> <pred_test> <pred_step> <post_test>]
+(with_template [<taker> <dropper> <pred_type> <pred_test> <pred_step> <post_test>]
[(def: .public (<taker> pred xs)
(All (_ a)
(-> <pred_type> (Stream a) (List a)))
@@ -83,7 +83,7 @@
[first after Nat (n.= 0 pred) (-- pred) not]
)
-(template [<splitter> <pred_type> <pred_test> <pred_step>]
+(with_template [<splitter> <pred_type> <pred_test> <pred_step>]
[(def: .public (<splitter> pred xs)
(All (_ a)
(-> <pred_type> (Stream a) [(List a) (Stream a)]))
diff --git a/stdlib/source/library/lux/data/collection/tree/finger.lux b/stdlib/source/library/lux/data/collection/tree/finger.lux
index 1a559f2ef..74b2c633b 100644
--- a/stdlib/source/library/lux/data/collection/tree/finger.lux
+++ b/stdlib/source/library/lux/data/collection/tree/finger.lux
@@ -29,7 +29,7 @@
(Tree @ t v)))
branch)))
- (template [<name> <tag> <output>]
+ (with_template [<name> <tag> <output>]
[(def: .public <name>
(All (_ @ t v) (-> (Tree @ t v) <output>))
(|>> representation (the <tag>)))]
diff --git a/stdlib/source/library/lux/data/collection/tree/zipper.lux b/stdlib/source/library/lux/data/collection/tree/zipper.lux
index 33bc9b1b6..861713b8c 100644
--- a/stdlib/source/library/lux/data/collection/tree/zipper.lux
+++ b/stdlib/source/library/lux/data/collection/tree/zipper.lux
@@ -116,7 +116,7 @@
_#rights})
_#parent))))))
-(template [<one> <all> <side> <op_side>]
+(with_template [<one> <all> <side> <op_side>]
[(def: .public (<one> zipper)
(All (_ a) (-> (Zipper a) (Maybe (Zipper a))))
(case (the #family zipper)
@@ -215,7 +215,7 @@
{.#None}
backward)}))
-(template [<name> <move>]
+(with_template [<name> <move>]
[(def: .public (<name> zipper)
(All (_ a) (-> (Zipper a) (Maybe (Zipper a))))
(case (<move> zipper)
@@ -273,7 +273,7 @@
{.#Some}))
(has #node next))))))
-(template [<name> <side>]
+(with_template [<name> <side>]
[(def: .public (<name> value zipper)
(All (_ a) (-> a (Zipper a) (Maybe (Zipper a))))
(case (the #family zipper)
diff --git a/stdlib/source/library/lux/data/color.lux b/stdlib/source/library/lux/data/color.lux
index ebc8f8371..40424f426 100644
--- a/stdlib/source/library/lux/data/color.lux
+++ b/stdlib/source/library/lux/data/color.lux
@@ -316,7 +316,7 @@
#green (interpolated' greenE greenS)
#blue (interpolated' blueE blueS)])))
-(template [<name> <target>]
+(with_template [<name> <target>]
[(def: .public (<name> ratio color)
(-> Frac Color Color)
(..interpolated ratio <target> color))]
@@ -325,7 +325,7 @@
[brighter ..white]
)
-(template [<op> <name>]
+(with_template [<op> <name>]
[(def: .public (<name> ratio color)
(-> Frac Color Color)
(let [[hue saturation luminance] (hsl color)]
@@ -346,7 +346,7 @@
+0.0
luminance])))
-(template [<name> <1> <2>]
+(with_template [<name> <1> <2>]
[(`` (def: .public (<name> color)
(-> Color [Color Color Color])
(let [[hue saturation luminance] (hsl color)]
@@ -363,7 +363,7 @@
[split_complement (|> +1.0 (f./ +5.0)) (|> +3.0 (f./ +5.0))]
)
-(template [<name> <1> <2> <3>]
+(with_template [<name> <1> <2> <3>]
[(`` (def: .public (<name> color)
(-> Color [Color Color Color Color])
(let [[hue saturation luminance] (hsb color)]
diff --git a/stdlib/source/library/lux/data/color/named.lux b/stdlib/source/library/lux/data/color/named.lux
index 4e7ab9c1a..99fae8434 100644
--- a/stdlib/source/library/lux/data/color/named.lux
+++ b/stdlib/source/library/lux/data/color/named.lux
@@ -6,7 +6,7 @@
["[0]" // (.only Color)])
... https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
-(template [<red> <green> <blue> <name>]
+(with_template [<red> <green> <blue> <name>]
[(`` (def: .public <name>
Color
(//.of_rgb [//.#red (hex <red>)
diff --git a/stdlib/source/library/lux/data/format/binary.lux b/stdlib/source/library/lux/data/format/binary.lux
index 1f257ea7e..290996b4e 100644
--- a/stdlib/source/library/lux/data/format/binary.lux
+++ b/stdlib/source/library/lux/data/format/binary.lux
@@ -33,9 +33,10 @@
["[0]" i64]
["[0]" frac]]]]])
-(template [<name> <extension> <post>]
- [(template: (<name> <parameter> <subject>)
- [(<post> (<extension> (.int <parameter>) (.int <subject>)))])]
+(with_template [<name> <extension> <post>]
+ [(def: <name>
+ (template (<name> <parameter> <subject>)
+ [(<post> (<extension> (.int <parameter>) (.int <subject>)))]))]
[n#= "lux i64 =" .|>]
[n#+ "lux i64 +" .nat]
@@ -77,7 +78,7 @@
(All (_ a) (-> (Writer a) a Binary))
(..instance (writer value)))
-(template [<name> <size> <write>]
+(with_template [<name> <size> <write>]
[(def: .public <name>
(Writer (I64 Any))
(function (_ value)
@@ -96,7 +97,7 @@
(All (_ l r) (-> (Writer l) (Writer r) (Writer (Or l r))))
(function (_ altV)
(case altV
- (^.template [<number> <tag> <writer>]
+ (^.with_template [<number> <tag> <writer>]
[{<tag> caseV}
(let [[caseS caseT] (<writer> caseV)]
[(.++ caseS)
@@ -127,7 +128,7 @@
(Writer Bit)
(|>> (pipe.case #0 0 #1 1) ..bits_8))
-(template [<name> <type>]
+(with_template [<name> <type>]
[(def: .public <name> (Writer <type>) ..bits_64)]
[nat Nat]
@@ -151,7 +152,7 @@
offset
binary)])]))
-(template [<name> <bits> <size> <write>]
+(with_template [<name> <bits> <size> <write>]
[(def: .public <name>
(Writer Binary)
(let [mask (..mask <size>)]
@@ -171,7 +172,7 @@
[binary_64 ..bits_64 </>.size_64 /.has_64!]
)
-(template [<name> <binary>]
+(with_template [<name> <binary>]
[(def: .public <name>
(Writer Text)
(|>> (at utf8.codec encoded) <binary>))]
@@ -184,7 +185,7 @@
(def: .public text ..utf8_64)
-(template [<name> <size> <write>]
+(with_template [<name> <size> <write>]
[(def: .public (<name> valueW)
(All (_ v) (-> (Writer v) (Writer (Sequence v))))
(function (_ value)
@@ -241,7 +242,7 @@
quantified (..and (..list again) again)]
(function (_ altV)
(case altV
- (^.template [<number> <tag> <writer>]
+ (^.with_template [<number> <tag> <writer>]
[{<tag> caseV}
(let [[caseS caseT] (<writer> caseV)]
[(.++ caseS)
@@ -275,7 +276,7 @@
(..and ..location
(function (_ altV)
(case altV
- (^.template [<number> <tag> <writer>]
+ (^.with_template [<number> <tag> <writer>]
[{<tag> caseV}
(let [[caseS caseT] (<writer> caseV)]
[(.++ caseS)
diff --git a/stdlib/source/library/lux/data/format/css.lux b/stdlib/source/library/lux/data/format/css.lux
index 75013483b..3bb1f1da5 100644
--- a/stdlib/source/library/lux/data/format/css.lux
+++ b/stdlib/source/library/lux/data/format/css.lux
@@ -105,11 +105,12 @@
(text.interposed ..separator))
"}")))
- (template: (!composite <pre> <post>)
- [(abstraction
- (format (representation <pre>)
- ..separator
- (representation <post>)))])
+ (def: !composite
+ (template (!composite <pre> <post>)
+ [(abstraction
+ (format (representation <pre>)
+ ..separator
+ (representation <post>)))]))
(def: .public (and pre post)
(All (_ kind) (-> (CSS kind) (CSS kind) (CSS kind)))
@@ -132,7 +133,7 @@
(!composite (..rule selector style)
(..in_context combinator selector inner)))
- (template [<name> <combinator>]
+ (with_template [<name> <combinator>]
[(def: .public <name>
(-> (Selector Any) Style (CSS Common) (CSS Common))
(..dependent <combinator>))]
@@ -160,7 +161,7 @@
(!composite (..rule selector style)
(..in_case combinator selector inner)))
- (template [<name> <combinator>]
+ (with_template [<name> <combinator>]
[(def: .public <name>
(-> (Selector (Generic Any)) Style (CSS Common) (CSS Common))
(..specialized <combinator>))]
diff --git a/stdlib/source/library/lux/data/format/css/property.lux b/stdlib/source/library/lux/data/format/css/property.lux
index 3ee23b2b7..9361d2d4a 100644
--- a/stdlib/source/library/lux/data/format/css/property.lux
+++ b/stdlib/source/library/lux/data/format/css/property.lux
@@ -65,8 +65,8 @@
(-> (Property Any) Text)
(|>> representation))
- (template [<brand> <alias>+ <property>+]
- [(`` (template [<alias> <property>]
+ (with_template [<brand> <alias>+ <property>+]
+ [(`` (with_template [<alias> <property>]
[(def: .public <alias>
(Property <brand>)
(abstraction <property>))]
@@ -74,7 +74,7 @@
(~~ (template.spliced <alias>+))))
(with_expansions [<rows> (template.spliced <property>+)]
- (template [<property>]
+ (with_template [<property>]
[(`` (def: .public (~~ (text_symbol <property>))
(Property <brand>)
(abstraction <property>)))]
diff --git a/stdlib/source/library/lux/data/format/css/query.lux b/stdlib/source/library/lux/data/format/css/query.lux
index 7bd1c2c5d..ba0ee101f 100644
--- a/stdlib/source/library/lux/data/format/css/query.lux
+++ b/stdlib/source/library/lux/data/format/css/query.lux
@@ -32,7 +32,7 @@
(-> Media Text)
(|>> representation))
- (template [<media>]
+ (with_template [<media>]
[(`` (def: .public (~~ (text_symbol <media>))
Media
(abstraction <media>)))]
@@ -50,7 +50,7 @@
(-> Feature Text)
(|>> representation))
- (template [<feature> <brand>]
+ (with_template [<feature> <brand>]
[(`` (def: .public ((~~ (text_symbol <feature>)) input)
(-> (Value <brand>) Feature)
(abstraction (format "(" <feature> ": " (//value.value input) ")"))))]
@@ -110,7 +110,7 @@
(-> Query Text)
(|>> representation))
- (template [<name> <operator>]
+ (with_template [<name> <operator>]
[(def: .public <name>
(-> Media Query)
(|>> ..media (format <operator>) abstraction))]
@@ -123,7 +123,7 @@
(-> Feature Query)
(|>> ..feature (format "not ") abstraction))
- (template [<name> <operator>]
+ (with_template [<name> <operator>]
[(def: .public (<name> left right)
(-> Query Query Query)
(abstraction (format (representation left)
diff --git a/stdlib/source/library/lux/data/format/css/selector.lux b/stdlib/source/library/lux/data/format/css/selector.lux
index 9f62dc879..d982cfd55 100644
--- a/stdlib/source/library/lux/data/format/css/selector.lux
+++ b/stdlib/source/library/lux/data/format/css/selector.lux
@@ -23,7 +23,7 @@
(primitive: .public (Generic brand) Any)
-(template [<generic> <brand>]
+(with_template [<generic> <brand>]
[(primitive: <brand> Any)
(type: .public <generic> (Generic <brand>))]
@@ -50,7 +50,7 @@
(-> Tag (Selector Cannot_Chain))
(|>> abstraction))
- (template [<name> <type> <prefix> <kind> <out>]
+ (with_template [<name> <type> <prefix> <kind> <out>]
[(def: .public <name>
(-> <type> (Selector <kind>))
(|>> <out> (format <prefix>) abstraction))]
@@ -59,8 +59,8 @@
[class Class "." Can_Chain //class.class]
)
- (template [<right> <left> <combinator>+]
- [(`` (template [<combinator> <name>]
+ (with_template [<right> <left> <combinator>+]
+ [(`` (with_template [<combinator> <name>]
[(def: .public (<name> right left)
(-> (Selector <right>) (Selector <left>) (Selector Composite))
(abstraction (format (representation left)
@@ -93,7 +93,7 @@
(-> Attribute (Selector Can_Chain))
(abstraction (format "[" attribute "]")))
- (template [<check> <name>]
+ (with_template [<check> <name>]
[(def: .public (<name> attribute value)
(-> Attribute Text (Selector Can_Chain))
(abstraction (format "[" attribute <check> value "]")))]
@@ -106,8 +106,8 @@
["*=" contains?]
)
- (template [<kind> <pseudo>+]
- [(`` (template [<name> <pseudo>]
+ (with_template [<kind> <pseudo>+]
+ [(`` (with_template [<name> <pseudo>]
[(def: .public <name>
(Selector <kind>)
(abstraction <pseudo>))]
@@ -174,7 +174,7 @@
(-> Nat Index)
(|>> %.nat abstraction))
- (template [<name> <index>]
+ (with_template [<name> <index>]
[(def: .public <name> Index (abstraction <index>))]
[odd "odd"]
@@ -194,7 +194,7 @@
(%.nat (.nat _#variable)))
(%.int _#constant)))))
- (template [<name> <pseudo>]
+ (with_template [<name> <pseudo>]
[(def: .public (<name> index)
(-> Index (Selector Can_Chain))
(|> (representation index)
diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux
index 743cd781b..61a8be4fb 100644
--- a/stdlib/source/library/lux/data/format/css/value.lux
+++ b/stdlib/source/library/lux/data/format/css/value.lux
@@ -33,28 +33,30 @@
(syntax (_ [symbol <code>.text])
(in (list (code.local (text.replaced "-" "_" symbol))))))
-(template: (enumeration: <abstraction> <representation> <out> <sample>+ <definition>+)
- [(primitive: .public <abstraction>
- <representation>
+(def: enumeration:
+ (template (enumeration: <abstraction> <representation> <out> <sample>+ <definition>+)
+ [(primitive: .public <abstraction>
+ <representation>
- (def: .public <out>
- (-> <abstraction> <representation>)
- (|>> representation))
+ (def: .public <out>
+ (-> <abstraction> <representation>)
+ (|>> representation))
- (`` (template [<name> <value>]
- [(def: .public <name> <abstraction> (abstraction <value>))]
+ (`` (with_template [<name> <value>]
+ [(def: .public <name> <abstraction> (abstraction <value>))]
- (~~ (template.spliced <sample>+))
- ))
+ (~~ (template.spliced <sample>+))
+ ))
- (template.spliced <definition>+))])
+ (template.spliced <definition>+))]))
-(template: (multi: <multi> <type> <separator>)
- [(def: .public (<multi> pre post)
- (-> (Value <type>) (Value <type>) (Value <type>))
- (abstraction (format (representation pre)
- <separator>
- (representation post))))])
+(def: multi:
+ (template (multi: <multi> <type> <separator>)
+ [(def: .public (<multi> pre post)
+ (-> (Value <type>) (Value <type>) (Value <type>))
+ (abstraction (format (representation pre)
+ <separator>
+ (representation post))))]))
(def: (%number value)
(Format Frac)
@@ -70,7 +72,7 @@
(-> (Value Any) Text)
(|>> representation))
- (template [<name> <value>]
+ (with_template [<name> <value>]
[(def: .public <name> Value (abstraction <value>))]
[initial "initial"]
@@ -80,7 +82,7 @@
(primitive: .public (Numeric kind) Any)
- (template [<name>]
+ (with_template [<name>]
[(with_expansions [<name>' (template.symbol [<name> "'"])]
(primitive: .public <name>' Any)
(type: .public <name>
@@ -92,10 +94,10 @@
[Percentage]
)
- (template [<brand> <alias>+ <value>+]
+ (with_template [<brand> <alias>+ <value>+]
[(primitive: .public <brand> Any)
- (`` (template [<name> <value>]
+ (`` (with_template [<name> <value>]
[(def: .public <name>
(Value <brand>)
(abstraction <value>))]
@@ -103,7 +105,7 @@
(~~ (template.spliced <alias>+))))
(with_expansions [<rows> (template.spliced <value>+)]
- (template [<value>]
+ (with_template [<value>]
[(`` (def: .public (~~ (..text_symbol <value>))
(Value <brand>)
(abstraction <value>)))]
@@ -807,7 +809,7 @@
(list#each %number)
(..apply "cubic-bezier")))
- (template [<name> <brand>]
+ (with_template [<name> <brand>]
[(def: .public <name>
(-> Nat (Value <brand>))
(|>> %.nat abstraction))]
@@ -840,7 +842,7 @@
"1.0"
(format "0" (%.rev _#alpha)))))))
- (template [<name> <suffix>]
+ (with_template [<name> <suffix>]
[(def: .public (<name> value)
(-> Frac (Value Length))
(abstraction (format (%number value) <suffix>)))]
@@ -869,7 +871,7 @@
(%.int value)
(%.nat (.nat value))))
- (template [<name> <suffix>]
+ (with_template [<name> <suffix>]
[(def: .public (<name> value)
(-> Int (Value Time))
(abstraction (format (if (i.< +0 value)
@@ -949,7 +951,7 @@
(-> Nat Angle)
(abstraction (format (%.nat (n.% ..degree_limit value)) "deg")))
- (template [<degree> <name>]
+ (with_template [<degree> <name>]
[(def: .public <name>
Angle
(..degree <degree>))]
@@ -960,7 +962,7 @@
[270 to_left]
)
- (template [<name> <function>]
+ (with_template [<name> <function>]
[(def: .public (<name> angle start next)
(-> Angle Stop (List/1 [(Maybe Hint) Stop]) (Value Image))
(let [[now after] next]
@@ -988,8 +990,8 @@
(abstraction (format (representation horizontal) ..slice_separator
(representation vertical))))
- (template [<input> <pre> <function>+]
- [(`` (template [<name> <function>]
+ (with_template [<input> <pre> <function>+]
+ [(`` (with_template [<name> <function>]
[(def: .public <name>
(-> <input> (Value Filter))
(|>> <pre> (list) (..apply <function>)))]
@@ -1032,7 +1034,7 @@
(def: length_separator " ")
- (template [<name> <type>]
+ (with_template [<name> <type>]
[(def: .public (<name> horizontal vertical)
(-> (Value Length) (Value Length) (Value <type>))
(abstraction (format (representation horizontal)
@@ -1067,7 +1069,7 @@
[farthest_corner "farthest-corner"]]
[])
- (template [<name> <function>]
+ (with_template [<name> <function>]
[(def: .public (<name> shape extent location start next)
(-> Shape (Maybe Extent) (Value Location)
Stop (List/1 [(Maybe Hint) Stop])
@@ -1115,7 +1117,7 @@
(def: .public (clip rectangle)
(-> Rectangle (Value Clip))
- (`` (..apply "rect" (list (~~ (template [<side>]
+ (`` (..apply "rect" (list (~~ (with_template [<side>]
[(representation (the <side> rectangle))]
[#top] [#right] [#bottom] [#left]))))))
@@ -1255,7 +1257,7 @@
(list#each %number)
(..apply "matrix3d")))
- (template [<name> <function> <input_types> <input_values>]
+ (with_template [<name> <function> <input_types> <input_values>]
[(`` (def: .public (<name> [(~~ (template.spliced <input_values>))])
(-> [(~~ (template.spliced <input_types>))] (Value Transform))
(|> (list (~~ (template.spliced <input_values>)))
@@ -1277,7 +1279,7 @@
[perspective "perspective" [Frac] [value]]
)
- (template [<name> <function> <input_types> <input_values>]
+ (with_template [<name> <function> <input_types> <input_values>]
[(`` (def: .public (<name> [(~~ (template.spliced <input_values>))])
(-> [(~~ (template.spliced <input_types>))] (Value Transform))
(|> (list (~~ (template.spliced <input_values>)))
@@ -1327,7 +1329,7 @@
(multi: multi_content Content " ")
... https://developer.mozilla.org/en-US/docs/Web/CSS/calc()
- (template [<name> <parameter>]
+ (with_template [<name> <parameter>]
[(def: .public (<name> parameter subject)
(.All (_ kind)
(-> (Value <parameter>) (Value (Numeric kind))
diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux
index 8a3a964c1..9d7821328 100644
--- a/stdlib/source/library/lux/data/format/html.lux
+++ b/stdlib/source/library/lux/data/format/html.lux
@@ -82,7 +82,7 @@
(primitive: .public (HTML brand)
Text
- (.template [<name> <brand>]
+ (.with_template [<name> <brand>]
[(primitive: <brand> Any)
(type: .public <name> (HTML <brand>))]
@@ -100,11 +100,11 @@
[Document Document']
)
- (.template [<super> <super_raw> <sub>+]
+ (.with_template [<super> <super_raw> <sub>+]
[(primitive: (<super_raw> brand) Any)
(type: .public <super> (HTML (<super_raw> Any)))
- (`` (.template [<sub> <sub_raw>]
+ (`` (.with_template [<sub> <sub_raw>]
[(primitive: <sub_raw> Any)
(type: .public <sub> (HTML (<super_raw> <sub_raw>)))]
@@ -159,7 +159,7 @@
content
(..close tag))))
- (.template [<name> <tag> <brand>]
+ (.with_template [<name> <tag> <brand>]
[(def: .public <name>
(-> Attributes <brand>)
(..simple <tag>))]
@@ -199,7 +199,7 @@
(|>> ..safe
abstraction))
- (.template [<tag> <alias> <name>]
+ (.with_template [<tag> <alias> <name>]
[(def: .public <name>
Element
(..simple <tag> (list)))
@@ -271,7 +271,7 @@
{#Circle Circle}
{#Polygon Polygon}))
- (.template [<name> <shape> <type> <format>]
+ (.with_template [<name> <shape> <type> <format>]
[(def: (<name> attributes shape)
(-> Attributes <type> (HTML Any))
(..simple "area" (partial_list ["shape" <shape>]
@@ -307,7 +307,7 @@
(..tag "map" attributes
(list#mix (function.flipped ..and) head tail)))))
- (.template [<name> <tag> <type>]
+ (.with_template [<name> <tag> <type>]
[(def: .public <name>
(-> Attributes <type>)
(..empty <tag>))]
@@ -319,7 +319,7 @@
[track "track" Track]
)
- (.template [<name> <tag>]
+ (.with_template [<name> <tag>]
[(def: .public (<name> attributes media on_unsupported)
(-> Attributes Media (Maybe Content) Element)
(..tag <tag> attributes
@@ -343,7 +343,7 @@
(-> ID Input)
(|>> ["for"] list (..empty "label")))
- (.template [<name> <container_tag> <description_tag> <type>]
+ (.with_template [<name> <container_tag> <description_tag> <type>]
[(def: .public (<name> description attributes content)
(-> (Maybe Content) Attributes <type> <type>)
(..tag <container_tag> attributes
@@ -361,7 +361,7 @@
[figure "figure" "figcaption" Element]
)
- (.template [<name> <tag> <type>]
+ (.with_template [<name> <tag> <type>]
[(def: .public (<name> attributes content)
(-> Attributes (Maybe Content) <type>)
(|> content
@@ -375,7 +375,7 @@
(type: .public Phrase
(-> Attributes Content Element))
- (.template [<name> <tag>]
+ (.with_template [<name> <tag>]
[(def: .public <name>
Phrase
(..tag <tag>))]
@@ -432,7 +432,7 @@
(type: .public Composite
(-> Attributes Element Element))
- (.template [<name> <tag>]
+ (.with_template [<name> <tag>]
[(def: .public <name>
Composite
(..tag <tag>))]
@@ -450,7 +450,7 @@
[span "span"]
)
- (.template [<tag> <name> <input>]
+ (.with_template [<tag> <name> <input>]
[(def: <name>
(-> <input> (HTML Any))
(..tag <tag> (list)))]
@@ -475,7 +475,7 @@
(def: .public p ..paragraph)
- (.template [<name> <tag> <input> <output>]
+ (.with_template [<name> <tag> <input> <output>]
[(def: .public <name>
(-> Attributes <input> <output>)
(..tag <tag>))]
@@ -494,7 +494,7 @@
[object "object" Parameter Element]
)
- (.template [<name> <tag> <input> <output>]
+ (.with_template [<name> <tag> <input> <output>]
[(def: .public <name>
(-> <input> <output>)
(..tag <tag> (list)))]
@@ -508,7 +508,7 @@
[body "body" Element Body]
)
- (.template [<name> <tag> <input> <output>]
+ (.with_template [<name> <tag> <input> <output>]
[(def: <name>
(-> <input> <output>)
(..tag <tag> (list)))]
@@ -555,7 +555,7 @@
(..tag "table" attributes
content)))
- (.template [<name> <doc_type>]
+ (.with_template [<name> <doc_type>]
[(def: .public <name>
(-> Head Body Document)
(let [doc_type <doc_type>]
diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux
index 6e358ec80..4f95615ed 100644
--- a/stdlib/source/library/lux/data/format/json.lux
+++ b/stdlib/source/library/lux/data/format/json.lux
@@ -31,7 +31,7 @@
["n" nat]
["f" frac (.open: "[1]#[0]" decimal)]]]]])
-(template [<name> <type>]
+(with_template [<name> <type>]
[(type: .public <name>
<type>)]
@@ -51,7 +51,7 @@
{#Array (Sequence JSON)}
{#Object (Dictionary String JSON)})))
-(template [<name> <type>]
+(with_template [<name> <type>]
[(type: .public <name>
<type>)]
@@ -101,7 +101,7 @@
{#Null' _}
(` {..#Null})
- (^.template [<ctor> <input_tag> <output_tag>]
+ (^.with_template [<ctor> <input_tag> <output_tag>]
[{<input_tag> value}
(` {<output_tag> (~ (<ctor> value))})])
([code.bit ..#Boolean' ..#Boolean]
@@ -158,7 +158,7 @@
_
{try.#Failure (all text#composite "Cannot set field '" key "' on a non-object.")}))
-(template [<name> <tag> <type>]
+(with_template [<name> <tag> <type>]
[(def: .public (<name> key json)
(-> Text JSON (Try <type>))
(case (field key json)
@@ -186,7 +186,7 @@
[{#Null} {#Null}]
#1
- (^.template [<tag> <struct>]
+ (^.with_template [<tag> <struct>]
[[{<tag> x'} {<tag> y'}]
(at <struct> = x' y')])
([#Boolean bit.equivalence]
@@ -252,7 +252,7 @@
(|>> (text.replaced text.double_quote ..escaped_dq)
(text.enclosed [text.double_quote text.double_quote])))
-(template [<token> <name>]
+(with_template [<token> <name>]
[(def: <name>
Text
<token>)]
@@ -292,7 +292,7 @@
(def: .public (format json)
(-> JSON Text)
(case json
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[{<tag> value}
(<format> value)])
([#Null ..null_format]
@@ -324,7 +324,7 @@
[_ (<text>.this "null")]
(in [])))
-(template [<name> <token> <value>]
+(with_template [<name> <token> <value>]
[(def: <name>
(Parser Boolean)
(do <>.monad
@@ -405,7 +405,7 @@
value json_parser]
(in [key value])))
-(template [<name> <type> <open> <close> <elem_parser> <prep>]
+(with_template [<name> <type> <open> <close> <elem_parser> <prep>]
[(def: (<name> json_parser)
(-> (Parser JSON) (Parser <type>))
(do <>.monad
diff --git a/stdlib/source/library/lux/data/format/markdown.lux b/stdlib/source/library/lux/data/format/markdown.lux
index 4982a2b63..1ebea0782 100644
--- a/stdlib/source/library/lux/data/format/markdown.lux
+++ b/stdlib/source/library/lux/data/format/markdown.lux
@@ -48,7 +48,7 @@
(def: blank_line
(format text.new_line text.new_line))
- (template [<name> <prefix>]
+ (with_template [<name> <prefix>]
[(def: .public (<name> content)
(-> Text (Markdown Block))
(abstraction (format <prefix> " " (..safe content) ..blank_line)))]
@@ -73,7 +73,7 @@
(Markdown Span)
(abstraction (format " " text.new_line)))
- (template [<name> <wrapper>]
+ (with_template [<name> <wrapper>]
[(def: .public <name>
(-> (Markdown Span) (Markdown Span))
(|>> representation
@@ -176,7 +176,7 @@
(type: .public Email
Text)
- (template [<name> <type>]
+ (with_template [<name> <type>]
[(def: .public <name>
(-> <type> (Markdown Span))
(|>> (text.enclosed ["<" ">"]) abstraction))]
@@ -185,7 +185,7 @@
[email Email]
)
- (template [<name> <brand> <infix>]
+ (with_template [<name> <brand> <infix>]
[(def: .public (<name> pre post)
(-> (Markdown <brand>) (Markdown <brand>) (Markdown <brand>))
(abstraction (format (representation pre) <infix> (representation post))))]
diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux
index 42088c430..c3644dcee 100644
--- a/stdlib/source/library/lux/data/format/tar.lux
+++ b/stdlib/source/library/lux/data/format/tar.lux
@@ -61,7 +61,7 @@
(def: small_size Size 6)
(def: big_size Size 11)
-(template [<exception> <limit> <size>
+(with_template [<exception> <limit> <size>
<type> <in> <out> <writer> <suffix>
<coercion>]
[(def: .public <limit>
@@ -249,7 +249,7 @@
_
(binary!.slice 0 (++ end) string))))))))
-(template [<type> <representation> <size> <exception> <in> <out> <writer> <parser> <none>]
+(with_template [<type> <representation> <size> <exception> <in> <out> <writer> <parser> <none>]
[(primitive: .public <type>
<representation>
@@ -415,7 +415,7 @@
[(char "5") directory]
[(char "6") fifo]
[(char "7") contiguous])]
- (template [<flag> <name>]
+ (with_template [<flag> <name>]
[(def: <name>
Link_Flag
(abstraction <flag>))]
@@ -432,7 +432,7 @@
(do <>.monad
[it <binary>.bits_8]
(case (.nat it)
- (^.template [<value> <link_flag>]
+ (^.with_template [<value> <link_flag>]
[(pattern <value>)
(in <link_flag>)])
(<options>)
@@ -483,7 +483,7 @@
["1000" save_text]
["2000" set_group_id_on_execution]
["4000" set_user_id_on_execution])]
- (template [<code> <name>]
+ (with_template [<code> <name>]
[(def: .public <name>
Mode
(abstraction (number.oct <code>)))]
diff --git a/stdlib/source/library/lux/data/product.lux b/stdlib/source/library/lux/data/product.lux
index 669f58e4f..c57ec6cfc 100644
--- a/stdlib/source/library/lux/data/product.lux
+++ b/stdlib/source/library/lux/data/product.lux
@@ -5,7 +5,7 @@
[equivalence (.only Equivalence)]
[hash (.only Hash)]]]])
-(template [<name>]
+(with_template [<name>]
[(def: .public (<name> [left right])
(All (_ left right)
(-> [left right] <name>))
diff --git a/stdlib/source/library/lux/data/sum.lux b/stdlib/source/library/lux/data/sum.lux
index a021449c0..00dddc0e6 100644
--- a/stdlib/source/library/lux/data/sum.lux
+++ b/stdlib/source/library/lux/data/sum.lux
@@ -5,7 +5,7 @@
[equivalence (.only Equivalence)]
[hash (.only Hash)]]]])
-(template [<right?> <name>]
+(with_template [<right?> <name>]
[(def: .public (<name> value)
(All (_ left right)
(-> <name> (Or left right)))
@@ -32,7 +32,7 @@
{0 #0 l} {0 #0 (on_left l)}
{0 #1 r} {0 #1 (on_right r)})))
-(template [<name> <side> <right?>]
+(with_template [<name> <side> <right?>]
[(def: .public (<name> items)
(All (_ a b) (-> (List (Or a b)) (List <side>)))
(case items
diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux
index 8e9eccac7..91c9cedf6 100644
--- a/stdlib/source/library/lux/data/text.lux
+++ b/stdlib/source/library/lux/data/text.lux
@@ -30,7 +30,7 @@
(-> Char Text)
(|>> .int "lux i64 char"))
-(template [<code> <short> <long>]
+(with_template [<code> <short> <long>]
[(def: .public <long> (..of_char <code>))
(def: .public <short> <long>)]
@@ -337,7 +337,7 @@
(def: .public (space? char)
(-> Char Bit)
- (with_expansions [<options> (template [<char>]
+ (with_expansions [<options> (with_template [<char>]
[(pattern (.char (~~ (static <char>))))]
[..tab]
diff --git a/stdlib/source/library/lux/data/text/encoding.lux b/stdlib/source/library/lux/data/text/encoding.lux
index 6eaf948d0..da140a7e1 100644
--- a/stdlib/source/library/lux/data/text/encoding.lux
+++ b/stdlib/source/library/lux/data/text/encoding.lux
@@ -10,7 +10,7 @@
(primitive: .public Encoding
Text
- (template [<name> <encoding>]
+ (with_template [<name> <encoding>]
[(`` (def: .public <name>
Encoding
(abstraction <encoding>)))]
diff --git a/stdlib/source/library/lux/data/text/escape.lux b/stdlib/source/library/lux/data/text/escape.lux
index 7b9caa349..608737079 100644
--- a/stdlib/source/library/lux/data/text/escape.lux
+++ b/stdlib/source/library/lux/data/text/escape.lux
@@ -22,7 +22,7 @@
(def: sigil "\")
-(template [<char> <sigil>]
+(with_template [<char> <sigil>]
[(def: <char>
(|> <sigil> (//.char 0) maybe.trusted))]
@@ -30,7 +30,7 @@
[\u_sigil "u"]
)
-(template [<literal> <sigil> <escaped>]
+(with_template [<literal> <sigil> <escaped>]
[(def: <sigil>
(|> <literal> (//.char 0) maybe.trusted))
@@ -49,7 +49,7 @@
[..sigil \\_sigil escaped_\\]
)
-(template [<char> <text>]
+(with_template [<char> <text>]
[(def: <char>
(|> <text> (//.char 0) maybe.trusted))]
@@ -73,7 +73,7 @@
(or (n.< ..ascii_bottom char)
(n.> ..ascii_top char)
(case char
- (^.template [<char>]
+ (^.with_template [<char>]
[(pattern (static <char>))
true])
([..\0] [..\a] [..\b] [..\t]
@@ -118,7 +118,7 @@
limit ("lux text size" text)])
(if (n.< limit offset)
(case ("lux text char" offset current)
- (^.template [<char> <replacement>]
+ (^.with_template [<char> <replacement>]
[(pattern (static <char>))
(let [[previous' current' limit'] (ascii_escaped <replacement> offset limit previous current)]
(again 0 previous' current' limit'))])
@@ -206,7 +206,7 @@
(let [@sigil (++ offset)]
(if (n.< limit @sigil)
(case ("lux text char" @sigil current)
- (^.template [<sigil> <un_escaped>]
+ (^.with_template [<sigil> <un_escaped>]
[(pattern (static <sigil>))
(let [[previous' current' limit'] (..ascii_un_escaped <un_escaped> offset previous current limit)]
(again 0 previous' current' limit'))])
diff --git a/stdlib/source/library/lux/data/text/format.lux b/stdlib/source/library/lux/data/text/format.lux
index 7c5483112..ce3642c9e 100644
--- a/stdlib/source/library/lux/data/text/format.lux
+++ b/stdlib/source/library/lux/data/text/format.lux
@@ -52,7 +52,7 @@
(syntax (_ [fragments (<>.many <code>.any)])
(in (.list (` (all "lux text concat" (~+ fragments)))))))
-(template [<name> <type> <formatter>]
+(with_template [<name> <type> <formatter>]
[(def: .public <name>
(Format <type>)
<formatter>)]
@@ -81,8 +81,8 @@
[json json.JSON (at json.codec encoded)]
)
-(template [<type> <format>,<codec>]
- [(`` (template [<format> <codec>]
+(with_template [<type> <format>,<codec>]
+ [(`` (with_template [<format> <codec>]
[(def: .public <format>
(Format <type>)
(at <codec> encoded))]
diff --git a/stdlib/source/library/lux/data/text/unicode/block.lux b/stdlib/source/library/lux/data/text/unicode/block.lux
index e016e68bb..92398a955 100644
--- a/stdlib/source/library/lux/data/text/unicode/block.lux
+++ b/stdlib/source/library/lux/data/text/unicode/block.lux
@@ -38,7 +38,7 @@
(-> Char Nat Block)
(abstraction (interval.between n.enum start (n.+ additional start))))
- (template [<name> <slot>]
+ (with_template [<name> <slot>]
[(def: .public <name>
(-> Block Char)
(|>> representation (the <slot>)))]
@@ -73,7 +73,7 @@
(i64.or (i64.left_shifted 32 (..start value))
(..end value))))
-(template [<start> <end> <name>]
+(with_template [<start> <end> <name>]
[(def: .public <name>
Block
(let [start (hex <start>)
diff --git a/stdlib/source/library/lux/data/text/unicode/set.lux b/stdlib/source/library/lux/data/text/unicode/set.lux
index 92f5d26c6..f7211bc8a 100644
--- a/stdlib/source/library/lux/data/text/unicode/set.lux
+++ b/stdlib/source/library/lux/data/text/unicode/set.lux
@@ -233,7 +233,7 @@
(set.of_list //block.hash (tree.tags (representation subject))))))
)
-(template [<name> <blocks>]
+(with_template [<name> <blocks>]
[(def: .public <name>
Set
(..set <blocks>))]
diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux
index 64f1cb80f..942db335e 100644
--- a/stdlib/source/library/lux/debug.lux
+++ b/stdlib/source/library/lux/debug.lux
@@ -146,7 +146,7 @@
(def: .public (inspection value)
Inspector
(with_expansions [<jvm> (let [object (as java/lang/Object value)]
- (`` (<| (~~ (template [<class> <processing>]
+ (`` (<| (~~ (with_template [<class> <processing>]
[(case (ffi.as <class> object)
{.#Some value}
(`` (|> value (~~ (template.spliced <processing>))))
@@ -184,7 +184,7 @@
@.js
(case (ffi.type_of value)
- (^.template [<type_of> <then>]
+ (^.with_template [<type_of> <then>]
[<type_of>
(`` (|> value (~~ (template.spliced <then>))))])
(["boolean" [(as .Bit) %.bit]]
@@ -219,7 +219,7 @@
@.python
(case (..str (..type value))
- (^.template [<type_of> <class_of> <then>]
+ (^.with_template [<type_of> <class_of> <then>]
[(^.or <type_of> <class_of>)
(`` (|> value (~~ (template.spliced <then>))))])
(["<type 'bool'>" "<class 'bool'>" [(as .Bit) %.bit]]
@@ -251,7 +251,7 @@
@.lua
(case (..type value)
- (^.template [<type_of> <then>]
+ (^.with_template [<type_of> <then>]
[<type_of>
(`` (|> value (~~ (template.spliced <then>))))])
(["boolean" [(as .Bit) %.bit]]
@@ -292,7 +292,7 @@
(as ..Object)
Object::to_s)]]
(let [value_class (class_of value)]
- (`` (cond (~~ (template [<literal> <type> <format>]
+ (`` (cond (~~ (with_template [<literal> <type> <format>]
[(same? (class_of <literal>) value_class)
(|> value (as <type>) <format>)]
@@ -324,7 +324,7 @@
@.php
(case (..gettype value)
- (^.template [<type_of> <then>]
+ (^.with_template [<type_of> <then>]
[<type_of>
(`` (|> value (~~ (template.spliced <then>))))])
(["boolean" [(as .Bit) %.bit]]
@@ -350,7 +350,7 @@
(..strval value))
@.scheme
- (`` (cond (~~ (template [<when> <then>]
+ (`` (cond (~~ (with_template [<when> <then>]
[(<when> value)
(`` (|> value (~~ (template.spliced <then>))))]
@@ -394,7 +394,7 @@
[_ (<type>.exactly Any)]
(in (function.constant "[]")))
- (~~ (template [<type> <formatter>]
+ (~~ (with_template [<type> <formatter>]
[(do <>.monad
[_ (<type>.sub <type>)]
(in (|>> (as <type>) <formatter>)))]
@@ -410,7 +410,7 @@
(def: (special_representation representation)
(-> (Parser Representation) (Parser Representation))
(`` (all <>.either
- (~~ (template [<type> <formatter>]
+ (~~ (with_template [<type> <formatter>]
[(do <>.monad
[_ (<type>.sub <type>)]
(in (|>> (as <type>) <formatter>)))]
diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux
index 8a67b4805..7460eb2fd 100644
--- a/stdlib/source/library/lux/documentation.lux
+++ b/stdlib/source/library/lux/documentation.lux
@@ -35,8 +35,9 @@
[lux
["[0]" syntax]]]]]]])
-(template: (|recursion_dummy|)
- [{.#Primitive "" {.#End}}])
+(def: |recursion_dummy|
+ (template (_)
+ [{.#Primitive "" {.#End}}]))
(type: Fragment
(Variant
@@ -51,7 +52,7 @@
(def: (reference_column code)
(-> Code Nat)
(case code
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[[_ _ column] {<tag> _}]
column])
([.#Bit]
@@ -62,7 +63,7 @@
[.#Text]
[.#Symbol])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[[_ _ column] {<tag> members}]
(|> members
(list#each reference_column)
@@ -101,7 +102,7 @@
(format (padding reference_column old_location new_location)
documentation)])
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[[new_location {<tag> value}]
(let [documentation (`` (|> value (~~ (template.spliced <format>))))]
[(revised .#column (n.+ (text.size documentation)) new_location)
@@ -114,7 +115,7 @@
[.#Frac [%.frac]]
[.#Text [%.text]])
- (^.template [|<| |>| <tag>]
+ (^.with_template [|<| |>| <tag>]
[[group_location {<tag> members}]
(let [[group_location' members_documentation] (list#mix (function (_ part [last_location text_accum])
(let [[member_location member_documentation] (code_documentation expected_module last_location reference_column part)]
@@ -170,7 +171,7 @@
(stream.iterations (product.forked ++ parameter_type_name)
0))
-(template [<name> <partition>]
+(with_template [<name> <partition>]
[(def: (<name> id)
(-> Nat Bit)
(<partition> id))]
@@ -251,13 +252,13 @@
{.#Parameter idx}
(parameter_name [type_function_name (list)] level idx)
- (^.template [<tag> <pre> <post>]
+ (^.with_template [<tag> <pre> <post>]
[{<tag> id}
(format <pre> (%.nat id) <post>)])
([.#Var "⌈" "⌋"]
[.#Ex "⟨" "⟩"])
- (^.template [<tag> <name> <flat>]
+ (^.with_template [<tag> <name> <flat>]
[{<tag> _}
(let [[level' body] (<flat> type)
args (level_parameters level level')
@@ -382,13 +383,13 @@
{.#Parameter idx}
(parameter_name type_function_info level idx)
- (^.template [<tag> <pre>]
+ (^.with_template [<tag> <pre>]
[{<tag> id}
(format <pre> (%.nat id))])
([.#Var "-"]
[.#Ex "+"])
- (^.template [<tag> <name> <flat>]
+ (^.with_template [<tag> <name> <flat>]
[{<tag> _}
(let [[level' body] (<flat> type)
args (level_parameters (n.- arity level) level')
diff --git a/stdlib/source/library/lux/extension.lux b/stdlib/source/library/lux/extension.lux
index fd4781f84..ffe7a4a78 100644
--- a/stdlib/source/library/lux/extension.lux
+++ b/stdlib/source/library/lux/extension.lux
@@ -36,7 +36,7 @@
<c>.local
(<c>.tuple (<>.some <c>.any)))))
-(template [<any> <end> <and> <result> <extension> <name>]
+(with_template [<any> <end> <and> <result> <extension> <name>]
[(def: .public <name>
(syntax (_ [[name extension phase archive inputs] (..declaration (` <any>))
body <c>.any])
diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux
index ebf0a980e..dfc01098b 100644
--- a/stdlib/source/library/lux/ffi.jvm.lux
+++ b/stdlib/source/library/lux/ffi.jvm.lux
@@ -53,7 +53,7 @@
(-> (Type (<| Return' Value' category)) Text))
(|>> jvm.reflection reflection.reflection))
-(template [<name> <class>]
+(with_template [<name> <class>]
[(`` (def: .public <name>
.Type
{.#Primitive <class> {.#End}}))]
@@ -69,7 +69,7 @@
[String "java.lang.String"]
)
-(template [<name> <class>]
+(with_template [<name> <class>]
[(`` (def: .public <name>
.Type
{.#Primitive (reflection.reflection <class>) {.#End}}))]
@@ -110,7 +110,7 @@
[jvm.char box.char])
(dictionary.of_list jvm.hash)))
-(template [<name> <pre> <post>]
+(with_template [<name> <pre> <post>]
[(def: (<name> unboxed boxed raw)
(-> (Type Value) Text Code Code)
(let [unboxed (..reflection unboxed)]
@@ -123,14 +123,15 @@
[box unboxed boxed]
)
-(template [<name> <op> <from> <to>]
- [(template: .public (<name> value)
- [(|> value
- (.is <from>)
- "jvm object cast"
- <op>
- "jvm object cast"
- (.is <to>))])]
+(with_template [<name> <op> <from> <to>]
+ [(def: .public <name>
+ (template (<name> value)
+ [(|> value
+ (.is <from>)
+ "jvm object cast"
+ <op>
+ "jvm object cast"
+ (.is <to>))]))]
[byte_to_long "jvm conversion byte-to-long" ..Byte ..Long]
@@ -163,9 +164,10 @@
[char_to_long "jvm conversion char-to-long" ..Character ..Long]
)
-(template [<name> <from> <to> <0> <1>]
- [(template: .public (<name> value)
- [(|> value <0> <1>)])]
+(with_template [<name> <from> <to> <0> <1>]
+ [(def: .public <name>
+ (template (<name> value)
+ [(|> value <0> <1>)]))]
[long_to_char ..Long ..Character ..long_to_int ..int_to_char]
[byte_to_int ..Byte ..Integer ..byte_to_long ..long_to_int]
@@ -362,7 +364,7 @@
(def: (parameter_type value_type type)
(-> (-> (Type Value) Code)
(-> (Type Parameter) Code))
- (`` (<| (~~ (template [<when> <binding> <then>]
+ (`` (<| (~~ (with_template [<when> <binding> <then>]
[(case (<when> type)
{.#Some <binding>}
<then>
@@ -389,7 +391,7 @@
(def: (value_type mode type)
(-> Primitive_Mode (Type Value) Code)
- (`` (<| (~~ (template [<when> <binding> <then>]
+ (`` (<| (~~ (with_template [<when> <binding> <then>]
[(case (<when> type)
{.#Some <binding>}
<then>
@@ -434,7 +436,7 @@
(def: (replaced f input)
(-> (-> Code Code) Code Code)
(case (f input)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[meta {<tag> parts}]
[meta {<tag> (list#each (replaced f) parts)}]])
([.#Form]
@@ -491,7 +493,7 @@
(list.zipped_2 (list#each product.right arguments))
(list#each ..decorate_input))))))))
-(template [<name> <jvm_op>]
+(with_template [<name> <jvm_op>]
[(def: (<name> class_vars class_name type_vars method_name arguments self_name)
(-> (List (Type Var)) Text (List (Type Var)) Text (List Argument) Text (Parser Code))
(do <>.monad
@@ -607,7 +609,7 @@
[_ (<code>.this (' ?))]
(in jvm.wildcard)))
-(template [<name> <comparison> <constructor>]
+(with_template [<name> <comparison> <constructor>]
[(def: <name>
(-> (Parser (Type Class)) (Parser (Type Parameter)))
(|>> (<>.after (<code>.this (' <comparison>)))
@@ -1022,7 +1024,7 @@
(-> Annotation Code)
(` ((~ (code.text name)) (~+ (list#each annotation_parameter$ params)))))
-(template [<name> <category>]
+(with_template [<name> <category>]
[(def: <name>
(-> (Type <category>) Code)
(|>> ..signature code.text))]
@@ -1388,7 +1390,7 @@
_
return_term))
-(template [<name> <tag> <term_trans>]
+(with_template [<name> <tag> <term_trans>]
[(def: (<name> member return_term)
(-> Import_Member_Declaration Code Code)
(case member
@@ -1404,7 +1406,7 @@
[with_return_io #import_member_io? (` ((~! io.io) (~ return_term)))]
)
-(template [<input?> <name> <unbox/box> <special+>]
+(with_template [<input?> <name> <unbox/box> <special+>]
[(def: (<name> mode [unboxed raw])
(-> Primitive_Mode [(Type Value) Code] Code)
(let [[unboxed refined post] (.is [(Type Value) Code (List Code)]
@@ -1414,7 +1416,7 @@
{#AutoPrM}
(with_expansions [<special+>' (template.spliced <special+>)
- <cond_cases> (template [<primitive> <pre> <post>]
+ <cond_cases> (with_template [<primitive> <pre> <post>]
[(at jvm.equivalence = <primitive> unboxed)
(with_expansions [<post>' (template.spliced <post>)]
[<primitive>
@@ -1692,7 +1694,7 @@
(.as (.Primitive (~ (code.text box.long))))
"jvm object cast"
"jvm conversion long-to-int"))]
- (`` (cond (~~ (template [<primitive> <array_op>]
+ (`` (cond (~~ (with_template [<primitive> <array_op>]
[(at jvm.equivalence = <primitive> type)
(in (list (` (<array_op> (~ g!size)))))]
@@ -1720,7 +1722,7 @@
(at meta.monad in $Object)
(case type
{.#Primitive name params}
- (`` (cond (~~ (template [<type>]
+ (`` (cond (~~ (with_template [<type>]
[(text#= (..reflection <type>) name)
(case params
{.#End}
@@ -1738,7 +1740,7 @@
[jvm.double]
[jvm.char]))
- (~~ (template [<type>]
+ (~~ (with_template [<type>]
[(text#= (..reflection (jvm.array <type>)) name)
(case params
{.#End}
@@ -1820,7 +1822,7 @@
[array_type (meta.type array_name)
context meta.type_context
array_jvm_type (lux_type->jvm_type context array_type)
- .let [g!extension (code.text (`` (cond (~~ (template [<primitive> <extension>]
+ .let [g!extension (code.text (`` (cond (~~ (with_template [<primitive> <extension>]
[(at jvm.equivalence =
(jvm.array <primitive>)
array_jvm_type)
@@ -1862,7 +1864,7 @@
(.as (.Primitive (~ (code.text box.long))))
"jvm object cast"
"jvm conversion long-to-int"))]]
- (`` (cond (~~ (template [<primitive> <extension> <box>]
+ (`` (cond (~~ (with_template [<primitive> <extension> <box>]
[(at jvm.equivalence =
(jvm.array <primitive>)
array_jvm_type)
@@ -1902,7 +1904,7 @@
(.as (.Primitive (~ (code.text box.long))))
"jvm object cast"
"jvm conversion long-to-int"))]]
- (`` (cond (~~ (template [<primitive> <extension> <box>]
+ (`` (cond (~~ (with_template [<primitive> <extension> <box>]
[(at jvm.equivalence =
(jvm.array <primitive>)
array_jvm_type)
@@ -1953,12 +1955,14 @@
_
(meta.failure (exception.error ..cannot_cast_to_non_object [type])))))
-(template [<forward> <from> <to> <backward>]
- [(template: .public (<forward> it)
- [(|> it (.is <from>) (.as <to>))])
+(with_template [<forward> <from> <to> <backward>]
+ [(def: .public <forward>
+ (template (<forward> it)
+ [(|> it (.is <from>) (.as <to>))]))
- (template: .public (<backward> it)
- [(|> it (.is <to>) (.as <from>))])]
+ (def: .public <backward>
+ (template (<backward> it)
+ [(|> it (.is <to>) (.as <from>))]))]
[as_boolean .Bit ..Boolean of_boolean]
[as_long .Int ..Long of_long]
@@ -1966,12 +1970,14 @@
[as_string .Text ..String of_string]
)
-(template [<forward> <from> <$> <mid> <$'> <to> <backward>]
- [(template: .public (<forward> it)
- [(|> it (.is <from>) (.as <mid>) <$> (.is <to>))])
+(with_template [<forward> <from> <$> <mid> <$'> <to> <backward>]
+ [(def: .public <forward>
+ (template (<forward> it)
+ [(|> it (.is <from>) (.as <mid>) <$> (.is <to>))]))
- (template: .public (<backward> it)
- [(|> it (.is <to>) <$'> (.is <mid>) (.as <from>))])]
+ (def: .public <backward>
+ (template (<backward> it)
+ [(|> it (.is <to>) <$'> (.is <mid>) (.as <from>))]))]
[as_byte .Int ..long_to_byte ..Long ..byte_to_long ..Byte of_byte]
[as_short .Int ..long_to_short ..Long ..short_to_long ..Short of_short]
diff --git a/stdlib/source/library/lux/ffi.lux b/stdlib/source/library/lux/ffi.lux
index 25d65c691..e9843701d 100644
--- a/stdlib/source/library/lux/ffi.lux
+++ b/stdlib/source/library/lux/ffi.lux
@@ -64,7 +64,7 @@
[Table])
@.ruby (these [Nil]))
<un_common> <un_common>]
- (template [<name>]
+ (with_template [<name>]
[(with_expansions [<brand> (template.symbol [<name> "'"])]
(primitive: <brand>
Any
@@ -84,7 +84,7 @@
@.ruby (these [Integer Int]
[Float Frac]))
<un_common> <un_common>]
- (template [<name> <type>]
+ (with_template [<name> <type>]
[(type: .public <name>
<type>)]
@@ -118,7 +118,7 @@
#alias Alias
#anonymous a]))
- (template [<case> <name>]
+ (with_template [<case> <name>]
[(def: <case>
(All (_ a) (-> (Parser a) (Parser (Named a))))
(|>> (all <>.and
@@ -262,8 +262,8 @@
(` (.Maybe (~ (the #mandatory it))))
(the #mandatory it)))
- (`` (template [<lux_it> <host_it>
- <lux_?> <host_?>]
+ (`` (with_template [<lux_it> <host_it>
+ <lux_?> <host_?>]
[(def: .public (<lux_it> _)
(-> Any Nothing)
(as_expected (<host_it>)))
@@ -622,8 +622,9 @@
(.function ((~ (code.local self)) [(~+ (list#each product.left inputs))])
(~ term)))))))))
- (for @.js (these (template: .public (type_of object)
- [("js type-of" object)])
+ (for @.js (these (def: .public type_of
+ (template (type_of object)
+ [("js type-of" object)]))
(def: .public global
(syntax (_ [type <code>.any
@@ -651,15 +652,16 @@
(..global (~ type) [(~ (code.local (%.format head "." next)))
(~+ (list#each code.local tail))]))))))))))))
- (template: (!defined? <global>)
- [(.case (..global Any <global>)
- {.#None}
- .false
+ (def: !defined?
+ (template (_ <global>)
+ [(.case (..global Any <global>)
+ {.#None}
+ .false
- {.#Some _}
- .true)])
+ {.#Some _}
+ .true)]))
- (template [<name> <global>]
+ (with_template [<name> <global>]
[(def: .public <name>
Bit
(!defined? <global>))]
@@ -690,36 +692,40 @@
(with_expansions [<undefined> (..extension_name)
<undefined?> (..extension_name)
<object> (..extension_name)]
- (these (template: (extension_analysis <name> <parameter>)
- [{5 #1 [<name> <parameter>]}])
-
- (template: (text_analysis <it>)
- [{0 #0 {5 #1 <it>}}])
-
- (template: (analysis <name> <bindings> <parser> <inputs> <body>)
- [("lux def analysis" <name>
- (.function (_ name phase archive inputs)
- (.function (_ state)
- (let [<bindings> [name phase archive state]]
- (case (<code>.result <parser> inputs)
- {try.#Failure error}
- {try.#Failure (%.format "Invalid inputs for extension: " (%.text name)
- text.\n error)}
-
- {try.#Success <inputs>}
- <body>)))))])
-
- (template: (generation <name> <bindings> <inputs> <body>)
- [("lux def generation" <name>
- (.function (_ name phase archive inputs)
- (.function (_ state)
- (let [<bindings> [name phase archive state]]
- (case inputs
- (pattern <inputs>)
- <body>
-
- _
- {try.#Failure (%.format "Invalid inputs for extension: " (%.text name))})))))])
+ (these (def: extension_analysis
+ (template (_ <name> <parameter>)
+ [{5 #1 [<name> <parameter>]}]))
+
+ (def: text_analysis
+ (template (_ <it>)
+ [{0 #0 {5 #1 <it>}}]))
+
+ (def: analysis
+ (template (_ <name> <bindings> <parser> <inputs> <body>)
+ [("lux def analysis" <name>
+ (.function (_ name phase archive inputs)
+ (.function (_ state)
+ (let [<bindings> [name phase archive state]]
+ (case (<code>.result <parser> inputs)
+ {try.#Failure error}
+ {try.#Failure (%.format "Invalid inputs for extension: " (%.text name)
+ text.\n error)}
+
+ {try.#Success <inputs>}
+ <body>)))))]))
+
+ (def: generation
+ (template (_ <name> <bindings> <inputs> <body>)
+ [("lux def generation" <name>
+ (.function (_ name phase archive inputs)
+ (.function (_ state)
+ (let [<bindings> [name phase archive state]]
+ (case inputs
+ (pattern <inputs>)
+ <body>
+
+ _
+ {try.#Failure (%.format "Invalid inputs for extension: " (%.text name))})))))]))
(analysis <undefined>
[name phase archive state]
@@ -732,8 +738,9 @@
(list)
{try.#Success [state js.undefined]})
- (template: .public (undefined)
- [(.is ..Undefined (<undefined>))])
+ (def: .public undefined
+ (template (undefined)
+ [(.is ..Undefined (<undefined>))]))
(analysis <undefined?>
[name phase archive state]
@@ -750,8 +757,9 @@
[[state it] (phase archive it state)]
(in [state (js.= js.undefined it)])))
- (template: .public (undefined? <it>)
- [(.as .Bit (.is .Any (<undefined?> <it>)))])
+ (def: .public undefined?
+ (template (undefined? <it>)
+ [(.as .Bit (.is .Any (<undefined?> <it>)))]))
(analysis <object>
[name phase archive state]
@@ -766,8 +774,9 @@
it)]
(in [state (extension_analysis name (list.reversed output))])))
- (template: (text_synthesis <it>)
- [{0 #0 {2 #1 <it>}}])
+ (def: text_synthesis
+ (template (_ <it>)
+ [{0 #0 {2 #1 <it>}}]))
(def: (pairs it)
(All (_ a) (-> (List a) (List [a a])))
diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux
index 8aa106b28..1e6d515dc 100644
--- a/stdlib/source/library/lux/ffi.old.lux
+++ b/stdlib/source/library/lux/ffi.old.lux
@@ -27,7 +27,7 @@
["[0]" template]]
["[0]" meta]]])
-(template [<name> <op> <from> <to>]
+(with_template [<name> <op> <from> <to>]
[(def: .public (<name> value)
(-> (Primitive <from>) (Primitive <to>))
(<op> value))]
@@ -63,12 +63,14 @@
[char_to_long "jvm convert char-to-long" "java.lang.Character" "java.lang.Long"]
)
-(template [<forward> <from> <to> <backward>]
- [(template: .public (<forward> it)
- [(|> it (.is <from>) (.as (Primitive <to>)))])
+(with_template [<forward> <from> <to> <backward>]
+ [(def: .public <forward>
+ (template (<forward> it)
+ [(|> it (.is <from>) (.as (Primitive <to>)))]))
- (template: .public (<backward> it)
- [(|> it (.is (Primitive <to>)) (.as <from>))])]
+ (def: .public <backward>
+ (template (<backward> it)
+ [(|> it (.is (Primitive <to>)) (.as <from>))]))]
[as_boolean .Bit "java.lang.Boolean" of_boolean]
[as_long .Int "java.lang.Long" of_long]
@@ -76,12 +78,14 @@
[as_string .Text "java.lang.String" of_string]
)
-(template [<forward> <from> <$> <mid> <$'> <to> <backward>]
- [(template: .public (<forward> it)
- [(|> it (.is <from>) (.as (Primitive <mid>)) <$> (.is (Primitive <to>)))])
+(with_template [<forward> <from> <$> <mid> <$'> <to> <backward>]
+ [(def: .public <forward>
+ (template (<forward> it)
+ [(|> it (.is <from>) (.as (Primitive <mid>)) <$> (.is (Primitive <to>)))]))
- (template: .public (<backward> it)
- [(|> it (.is (Primitive <to>)) <$'> (.is (Primitive <mid>)) (.as <from>))])]
+ (def: .public <backward>
+ (template (<backward> it)
+ [(|> it (.is (Primitive <to>)) <$'> (.is (Primitive <mid>)) (.as <from>))]))]
[as_byte .Int ..long_to_byte "java.lang.Long" ..byte_to_long "java.lang.Byte" of_byte]
[as_short .Int ..long_to_short "java.lang.Long" ..short_to_long "java.lang.Short" of_short]
@@ -281,7 +285,7 @@
(def: (manual_primitive_type class)
(-> Text (Maybe Code))
(case class
- (^.template [<prim> <type>]
+ (^.with_template [<prim> <type>]
[<prim>
{.#Some (' <type>)}])
(["boolean" (Primitive "java.lang.Boolean")]
@@ -300,7 +304,7 @@
(def: (auto_primitive_type class)
(-> Text (Maybe Code))
(case class
- (^.template [<prim> <type>]
+ (^.with_template [<prim> <type>]
[<prim>
{.#Some (' <type>)}])
(["boolean" .Bit]
@@ -423,7 +427,7 @@
{#GenericArray param}
(format "[" (simple_class$ env param))
- (^.template [<prim> <class>]
+ (^.with_template [<prim> <class>]
[{#GenericClass <prim> {.#End}}
<class>])
(["boolean" "[Z"]
@@ -464,7 +468,7 @@
(def: (pre_walk_replace f input)
(-> (-> Code Code) Code Code)
(case (f input)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[meta {<tag> parts}]
[meta {<tag> (list#each (pre_walk_replace f) parts)}]])
([.#Form]
@@ -515,7 +519,7 @@
(in (`' ((~ (code.text (format "jvm invokestatic" ":" class_name ":" method_name ":" (text.interposed "," arg_decls'))))
(~+ args))))))
-(template [<name> <jvm_op>]
+(with_template [<name> <jvm_op>]
[(def: (<name> params class_name method_name arg_decls)
(-> (List Type_Parameter) Text Text (List ArgDecl) (Parser Code))
(do <>.monad
@@ -600,7 +604,7 @@
(<code>.tuple (do <>.monad
[component again^]
(case component
- (^.template [<class> <name>]
+ (^.with_template [<class> <name>]
[{#GenericClass <name> {.#End}}
(in {#GenericClass <class> (list)})])
(["[Z" "boolean"]
@@ -1391,7 +1395,7 @@
_
return_term))
-(template [<name> <tag> <term_trans>]
+(with_template [<name> <tag> <term_trans>]
[(def: (<name> member return_term)
(-> Import_Member_Declaration Code Code)
(case member
@@ -1417,7 +1421,7 @@
(-> Type_Parameter Code)
(code.symbol ["" name]))
-(template [<name> <byte> <short> <int> <float>]
+(with_template [<name> <byte> <short> <int> <float>]
[(def: (<name> mode [class expression])
(-> Primitive_Mode [Text Code] Code)
(case mode
@@ -1639,7 +1643,7 @@
(syntax (_ [type (..generic_type^ (list))
size <code>.any])
(case type
- (^.template [<type> <array_op>]
+ (^.with_template [<type> <array_op>]
[(pattern {#GenericClass <type> (list)})
(in (list (` (<array_op> (~ size)))))])
(["boolean" "jvm znewarray"]
@@ -1689,7 +1693,7 @@
[array_type (meta.type array_name)
array_jvm_type (type_class_name array_type)]
(case array_jvm_type
- (^.template [<type> <array_op>]
+ (^.with_template [<type> <array_op>]
[<type>
(in (list (` (<array_op> (~ array) (~ idx)))))])
(["[Z" "jvm zaload"]
@@ -1719,7 +1723,7 @@
[array_type (meta.type array_name)
array_jvm_type (type_class_name array_type)]
(case array_jvm_type
- (^.template [<type> <array_op>]
+ (^.with_template [<type> <array_op>]
[<type>
(in (list (` (<array_op> (~ array) (~ idx) (~ value)))))])
(["[Z" "jvm zastore"]
@@ -1747,5 +1751,6 @@
(syntax (_ [type (..generic_type^ (list))])
(in (list (..class_type {#ManualPrM} (list) type)))))
-(template: .public (is type term)
- [(.as type term)])
+(def: .public is
+ (template (is type term)
+ [(.as type term)]))
diff --git a/stdlib/source/library/lux/ffi.php.lux b/stdlib/source/library/lux/ffi.php.lux
index a387237db..037f713c4 100644
--- a/stdlib/source/library/lux/ffi.php.lux
+++ b/stdlib/source/library/lux/ffi.php.lux
@@ -25,7 +25,7 @@
(abstract: .public (Object brand) Any)
-(template [<name>]
+(with_template [<name>]
[(with_expansions [<brand> (template.symbol [<name> "'"])]
(abstract: .public <brand> Any)
(type: .public <name>
@@ -35,7 +35,7 @@
[Function]
)
-(template [<name> <type>]
+(with_template [<name> <type>]
[(type: .public <name>
<type>)]
diff --git a/stdlib/source/library/lux/ffi.scm.lux b/stdlib/source/library/lux/ffi.scm.lux
index 8822efd3d..34a35a3c8 100644
--- a/stdlib/source/library/lux/ffi.scm.lux
+++ b/stdlib/source/library/lux/ffi.scm.lux
@@ -25,7 +25,7 @@
(abstract: .public (Object brand) Any)
-(template [<name>]
+(with_template [<name>]
[(with_expansions [<brand> (template.symbol [<name> "'"])]
(abstract: .public <brand> Any)
(type: .public <name>
@@ -35,7 +35,7 @@
[Function]
)
-(template [<name> <type>]
+(with_template [<name> <type>]
[(type: .public <name>
<type>)]
diff --git a/stdlib/source/library/lux/ffi/export.rb.lux b/stdlib/source/library/lux/ffi/export.rb.lux
index e8cbc6f8b..46c259fbe 100644
--- a/stdlib/source/library/lux/ffi/export.rb.lux
+++ b/stdlib/source/library/lux/ffi/export.rb.lux
@@ -51,7 +51,7 @@
..sigil!
))
-(template [<name> <head>]
+(with_template [<name> <head>]
[(def: <name>
(Parser Text)
(<| <text>.slice
diff --git a/stdlib/source/library/lux/ffi/node_js.js.lux b/stdlib/source/library/lux/ffi/node_js.js.lux
index a31054f74..27d69787d 100644
--- a/stdlib/source/library/lux/ffi/node_js.js.lux
+++ b/stdlib/source/library/lux/ffi/node_js.js.lux
@@ -6,7 +6,7 @@
["[0]" function]
["[0]" maybe (.open: "[1]#[0]" monoid functor)]]]])
-(template [<name> <path>]
+(with_template [<name> <path>]
[(def: <name>
(Maybe (-> Text Any))
(ffi.global (-> Text Any) <path>))]
diff --git a/stdlib/source/library/lux/locale/language.lux b/stdlib/source/library/lux/locale/language.lux
index cfc25fe7d..82b4ca4c2 100644
--- a/stdlib/source/library/lux/locale/language.lux
+++ b/stdlib/source/library/lux/locale/language.lux
@@ -17,7 +17,7 @@
[#name Text
#code Text])
- (template [<name> <tag>]
+ (with_template [<name> <tag>]
[(def: .public <name>
(-> Language Text)
(|>> representation (the <tag>)))]
@@ -26,14 +26,14 @@
[code #code]
)
- (template [<bundle>]
+ (with_template [<bundle>]
[(with_expansions [<bundle>' (template.spliced <bundle>)]
- (template [<code> <name> <definition> <alias>+]
+ (with_template [<code> <name> <definition> <alias>+]
[(def: .public <definition>
Language
(abstraction [#name <name>
#code <code>]))
- (`` (template [<alias>]
+ (`` (with_template [<alias>]
[(def: .public <alias>
Language
<definition>)]
diff --git a/stdlib/source/library/lux/locale/territory.lux b/stdlib/source/library/lux/locale/territory.lux
index 06e1d3b4a..0d0bca38b 100644
--- a/stdlib/source/library/lux/locale/territory.lux
+++ b/stdlib/source/library/lux/locale/territory.lux
@@ -19,7 +19,7 @@
#long Text
#code Nat])
- (template [<name> <field> <type>]
+ (with_template [<name> <field> <type>]
[(def: .public <name>
(-> Territory <type>)
(|>> representation
@@ -31,7 +31,7 @@
[numeric_code #code Nat]
)
- (template [<short> <long> <number> <name> <main> <neighbor>+]
+ (with_template [<short> <long> <number> <name> <main> <neighbor>+]
[(def: .public <main>
Territory
(abstraction [#name <name>
@@ -39,7 +39,7 @@
#long <long>
#code <number>]))
- (`` (template [<neighbor>]
+ (`` (with_template [<neighbor>]
[(def: .public <neighbor> Territory <main>)]
(~~ (template.spliced <neighbor>+))))]
diff --git a/stdlib/source/library/lux/macro.lux b/stdlib/source/library/lux/macro.lux
index a96545566..1aeadcd0c 100644
--- a/stdlib/source/library/lux/macro.lux
+++ b/stdlib/source/library/lux/macro.lux
@@ -142,7 +142,7 @@
_
(//.failure "Macro expanded to more than 1 element."))))
-(template [<macro> <func>]
+(with_template [<macro> <func>]
[(def: .public <macro>
(.macro (_ tokens)
(let [[module _] (.symbol .._)
diff --git a/stdlib/source/library/lux/macro/code.lux b/stdlib/source/library/lux/macro/code.lux
index 6dc56c320..0131567c7 100644
--- a/stdlib/source/library/lux/macro/code.lux
+++ b/stdlib/source/library/lux/macro/code.lux
@@ -36,7 +36,7 @@
... (type: Code
... (Ann Location (Code' (Ann Location))))
-(template [<name> <type> <tag>]
+(with_template [<name> <type> <tag>]
[(def: .public (<name> x)
(-> <type> Code)
[location.dummy {<tag> x}])]
@@ -53,7 +53,7 @@
[tuple (List Code) .#Tuple]
)
-(template [<name> <tag>]
+(with_template [<name> <tag>]
[(def: .public (<name> name)
(-> Text Code)
[location.dummy {<tag> ["" name]}])]
@@ -65,7 +65,7 @@
(def: (= x y)
(case [x y]
- (^.template [<tag> <eq>]
+ (^.with_template [<tag> <eq>]
[[[_ {<tag> x'}] [_ {<tag> y'}]]
(at <eq> = x' y')])
([.#Bit bit.equivalence]
@@ -76,7 +76,7 @@
[.#Text text.equivalence]
[.#Symbol symbol.equivalence])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[[_ {<tag> xs'}] [_ {<tag> ys'}]]
(at (list.equivalence =) = xs' ys')])
([.#Form]
@@ -89,7 +89,7 @@
(def: .public (format ast)
(-> Code Text)
(case ast
- (^.template [<tag> <struct>]
+ (^.with_template [<tag> <struct>]
[[_ {<tag> value}]
(at <struct> encoded value)])
([.#Bit bit.codec]
@@ -102,7 +102,7 @@
[_ {.#Text value}]
(text.format value)
- (^.template [<tag> <open> <close>]
+ (^.with_template [<tag> <open> <close>]
[[_ {<tag> members}]
(all text#composite
<open>
@@ -124,7 +124,7 @@
(if (at ..equivalence = original ast)
substitute
(case ast
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[location {<tag> parts}]
[location {<tag> (list#each (replaced original substitute) parts)}]])
([.#Form]
diff --git a/stdlib/source/library/lux/macro/local.lux b/stdlib/source/library/lux/macro/local.lux
index b564df336..a921afee1 100644
--- a/stdlib/source/library/lux/macro/local.lux
+++ b/stdlib/source/library/lux/macro/local.lux
@@ -21,7 +21,7 @@
(exception.report
"Module" (text.format module)))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [module Text
definition Text])
(exception.report
diff --git a/stdlib/source/library/lux/macro/pattern.lux b/stdlib/source/library/lux/macro/pattern.lux
index 4e6811c93..ecad74d18 100644
--- a/stdlib/source/library/lux/macro/pattern.lux
+++ b/stdlib/source/library/lux/macro/pattern.lux
@@ -1,6 +1,6 @@
(.using
[library
- [lux (.except or template let |> `)]])
+ [lux (.except or let with_template |> `)]])
(def: locally
(macro (_ tokens lux)
@@ -13,7 +13,7 @@
_
{.#Left ""}))))
-(.template [<name>]
+(.with_template [<name>]
[(def: <name> (..locally <name>))]
[list#size]
@@ -85,7 +85,7 @@
_
(failure (..wrong_syntax_error (symbol ..or))))))
-(def: .public template
+(def: .public with_template
(macro (_ tokens)
(case tokens
(pattern (partial_list [_ {.#Form (list [_ {.#Tuple bindings}]
@@ -110,10 +110,10 @@
(meta#in (list#composite output branches))
{.#None}
- (failure (..wrong_syntax_error (symbol ..template))))
+ (failure (..wrong_syntax_error (symbol ..with_template))))
_
- (failure (..wrong_syntax_error (symbol ..template))))))
+ (failure (..wrong_syntax_error (symbol ..with_template))))))
(def: .public multi
(macro (_ tokens)
@@ -185,7 +185,7 @@
{.#Item [init inits']}
(.` {.#Item (~ init) (~ (untemplated_partial_list last inits'))})))
-(.template [<tag> <name>]
+(.with_template [<tag> <name>]
[(def: (<name> g!meta untemplated_pattern elems)
(-> Code (-> Code (Meta Code))
(-> (List Code) (Meta Code)))
@@ -211,7 +211,7 @@
(do meta_monad
[g!meta (..generated_symbol "g!meta")]
(case pattern
- (..template [<tag> <gen>]
+ (..with_template [<tag> <gen>]
[[_ {<tag> value}]
(in (.` [(~ g!meta) {<tag> (~ (<gen> value))}]))])
([.#Bit bit$]
@@ -228,7 +228,7 @@
[_ {.#Form {.#Item [[_ {.#Symbol ["" "~+"]}] {.#Item [spliced {.#End}]}]}}]
(failure "Cannot use (~+) inside of `code` unless it is the last element in a form or a tuple.")
- (template [<tag> <untemplated>]
+ (..with_template [<tag> <untemplated>]
[[_ {<tag> elems}]
(<untemplated> g!meta untemplated_pattern elems)])
([.#Form ..untemplated_form]
diff --git a/stdlib/source/library/lux/macro/syntax.lux b/stdlib/source/library/lux/macro/syntax.lux
index a510cb759..e4ae7260f 100644
--- a/stdlib/source/library/lux/macro/syntax.lux
+++ b/stdlib/source/library/lux/macro/syntax.lux
@@ -85,8 +85,7 @@
{.#None}
(//.symbol "g!state"))
this_module meta.current_module_name
- .let [error_msg (code.text (//.wrong_syntax_error [this_module name]))
- g!name (code.symbol ["" name])]]
+ .let [g!name (code.symbol ["" name])]]
(in (list (` (.macro ((~ g!name) (~ g!tokens) (~ g!state))
(.case ((~! </>.result)
(is ((~! </>.Parser) (Meta (List Code)))
@@ -98,7 +97,7 @@
((~ g!body) (~ g!state))
{try.#Failure (~ g!error)}
- {try.#Failure ((~! text.interposed) (~! text.new_line) (list (~ error_msg) (~ g!error)))})))))))
+ {try.#Failure ((~! text.interposed) (~! text.new_line) (list "Invalid syntax:" (~ g!error)))})))))))
{try.#Failure error}
(meta.failure (//.wrong_syntax_error (symbol ..syntax))))))
diff --git a/stdlib/source/library/lux/macro/template.lux b/stdlib/source/library/lux/macro/template.lux
index cec732f01..439c99a3a 100644
--- a/stdlib/source/library/lux/macro/template.lux
+++ b/stdlib/source/library/lux/macro/template.lux
@@ -83,7 +83,7 @@
(syntax (_ [simple (..part false)])
(in (list (|> simple (text.interposed "") code.text)))))
-(template [<name> <simple> <complex>]
+(with_template [<name> <simple> <complex>]
[(def: .public <name>
(syntax (_ [name (<>.or (<>.and (..part true) (..part false))
(..part false))])
@@ -112,7 +112,7 @@
{.#None}
template)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[meta {<tag> elems}]
[meta {<tag> (list#each (applied env) elems)}]])
([.#Form]
diff --git a/stdlib/source/library/lux/math.lux b/stdlib/source/library/lux/math.lux
index 9a53b8f0e..01274b28c 100644
--- a/stdlib/source/library/lux/math.lux
+++ b/stdlib/source/library/lux/math.lux
@@ -68,7 +68,7 @@
<ratio/1> [ratio.#numerator 1 ratio.#denominator 1]
<complex/0> [complex.#real +0.0 complex.#imaginary +0.0]
<complex/1> [complex.#real +1.0 complex.#imaginary +0.0]]
- (these (template [<name> <scenarios>']
+ (these (with_template [<name> <scenarios>']
[(with_expansions [<extension> (static.seed)
<extension> (template.text [<@> " " <extension>])
<scenarios> (template.spliced <scenarios>')]
@@ -88,7 +88,7 @@
(`` (cond (check.subsumes? .I64 :it:)
(phase.except ..no_arithmetic_for [:it:])
- (~~ (template [<type> <0> <+>]
+ (~~ (with_template [<type> <0> <+>]
[(check.subsumes? <type> :it:)
<0>]
@@ -101,7 +101,7 @@
(`` (cond (check.subsumes? .I64 :it:)
(phase.except ..no_arithmetic_for [:it:])
- (~~ (template [<type> <0> <+>]
+ (~~ (with_template [<type> <0> <+>]
[(check.subsumes? <type> :it:)
(..composite phase archive (` <+>) last prevs)]
@@ -138,7 +138,7 @@
[Ratio (type.expecting Ratio (phase archive (` <ratio/1>))) ratio./]
[Complex (type.expecting Complex (phase archive (` <complex/1>))) complex./]]]
)
- (template [<name> <scenarios>']
+ (with_template [<name> <scenarios>']
[(with_expansions [<extension> (static.seed)
<extension> (template.text [<@> " " <extension>])
<scenarios> (template.spliced <scenarios>')]
@@ -154,7 +154,7 @@
(`` (cond (check.subsumes? .I64 :it:)
(phase.except ..no_arithmetic_for [:it:])
- (~~ (template [<type> <+>]
+ (~~ (with_template [<type> <+>]
[(check.subsumes? <type> :it:)
(..composite phase archive (` <+>) right (list left))]
@@ -194,7 +194,7 @@
[.Frac frac.>=]
[Ratio ratio.>=]]]
)
- (template [<name> <scenarios>']
+ (with_template [<name> <scenarios>']
[(with_expansions [<extension> (static.seed)
<extension> (template.text [<@> " " <extension>])
<scenarios> (template.spliced <scenarios>')]
@@ -210,7 +210,7 @@
(`` (cond (check.subsumes? .I64 :it:)
(phase.except ..no_arithmetic_for [:it:])
- (~~ (template [<type> <+>]
+ (~~ (with_template [<type> <+>]
[(check.subsumes? <type> :it:)
(..composite phase archive (` <+>) right (list left))]
diff --git a/stdlib/source/library/lux/math/logic/continuous.lux b/stdlib/source/library/lux/math/logic/continuous.lux
index eec2d573f..c72e296d1 100644
--- a/stdlib/source/library/lux/math/logic/continuous.lux
+++ b/stdlib/source/library/lux/math/logic/continuous.lux
@@ -11,7 +11,7 @@
(def: .public false Rev /#bottom)
(def: .public true Rev /#top)
-(template [<name> <chooser> <monoid> <identity>]
+(with_template [<name> <chooser> <monoid> <identity>]
[(def: .public <name>
(-> Rev Rev Rev)
<chooser>)
diff --git a/stdlib/source/library/lux/math/logic/fuzzy.lux b/stdlib/source/library/lux/math/logic/fuzzy.lux
index 679ebc4a7..79555e858 100644
--- a/stdlib/source/library/lux/math/logic/fuzzy.lux
+++ b/stdlib/source/library/lux/math/logic/fuzzy.lux
@@ -25,7 +25,7 @@
(def: (each f fb)
(|>> f fb)))
-(template [<name> <verdict>]
+(with_template [<name> <verdict>]
[(def: .public <name>
Fuzzy
(function (_ _)
@@ -39,7 +39,7 @@
(All (_ a) (-> (Fuzzy a) a Rev))
(set elem))
-(template [<set_composition> <membership_composition>]
+(with_template [<set_composition> <membership_composition>]
[(def: .public (<set_composition> left right)
(All (_ a) (-> (Fuzzy a) (Fuzzy a) (Fuzzy a)))
(function (_ elem)
@@ -101,10 +101,11 @@
(..ascending from to)
(..descending from to)))
-(template: (!sort_2 <low> <high>)
- [(if (/.> <low> <high>)
- [<low> <high>]
- [<high> <low>])])
+(def: !sort_2
+ (template (_ <low> <high>)
+ [(if (/.> <low> <high>)
+ [<low> <high>]
+ [<high> <low>])]))
(def: .public (triangle bottom middle top)
(-> Rev Rev Rev (Fuzzy Rev))
diff --git a/stdlib/source/library/lux/math/modular.lux b/stdlib/source/library/lux/math/modular.lux
index 1af638ee7..09e1b6a31 100644
--- a/stdlib/source/library/lux/math/modular.lux
+++ b/stdlib/source/library/lux/math/modular.lux
@@ -36,7 +36,7 @@
(abstraction [#modulus modulus
#value (i.mod (//.divisor modulus) value)]))
- (template [<name> <type> <side>]
+ (with_template [<name> <type> <side>]
[(def: .public <name>
(All (_ %) (-> (Mod %) <type>))
(|>> representation <side>))]
@@ -77,7 +77,7 @@
(i.= (//.divisor expected) actual))]
(in (..modular expected value))))))
- (template [<name> <op>]
+ (with_template [<name> <op>]
[(def: .public (<name> reference subject)
(All (_ %) (-> (Mod %) (Mod %) Bit))
(let [[_ reference] (representation reference)
@@ -102,7 +102,7 @@
(def: equivalence ..equivalence)
(def: < ..<))
- (template [<name> <op>]
+ (with_template [<name> <op>]
[(def: .public (<name> param subject)
(All (_ %) (-> (Mod %) (Mod %) (Mod %)))
(let [[modulus param] (representation param)
@@ -117,7 +117,7 @@
[* i.*]
)
- (template [<composition> <identity> <monoid>]
+ (with_template [<composition> <identity> <monoid>]
[(implementation: .public (<monoid> modulus)
(All (_ %) (-> (Modulus %) (Monoid (Mod %))))
diff --git a/stdlib/source/library/lux/math/number.lux b/stdlib/source/library/lux/math/number.lux
index 3f4fe8c9e..59310fc99 100644
--- a/stdlib/source/library/lux/math/number.lux
+++ b/stdlib/source/library/lux/math/number.lux
@@ -31,7 +31,7 @@
(-> Text Text)
(text.replaced ..separator ""))
-(template [<macro> <nat> <int> <rev> <frac> <error>]
+(with_template [<macro> <nat> <int> <rev> <frac> <error>]
[(def: .public <macro>
(macro (_ tokens state)
(case tokens
diff --git a/stdlib/source/library/lux/math/number/complex.lux b/stdlib/source/library/lux/math/number/complex.lux
index 2965f2c12..56e2cefc7 100644
--- a/stdlib/source/library/lux/math/number/complex.lux
+++ b/stdlib/source/library/lux/math/number/complex.lux
@@ -56,7 +56,7 @@
(f.= (the #imaginary param)
(the #imaginary input))))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: .public (<name> param input)
(-> Complex Complex Complex)
[#real (<op> (the #real param)
@@ -73,7 +73,7 @@
(def: = ..=))
-(template [<name> <transform>]
+(with_template [<name> <transform>]
[(def: .public <name>
(-> Complex Complex)
(|>> (revised #real <transform>)
@@ -213,7 +213,7 @@
[..#real (|> subject ..abs f.log)
..#imaginary (f.atan_2 #real #imaginary)]))
-(template [<name> <type> <op>]
+(with_template [<name> <type> <op>]
[(def: .public (<name> param input)
(-> <type> Complex Complex)
(|> input log (<op> param) exp))]
diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux
index aa58c684f..149ca8e50 100644
--- a/stdlib/source/library/lux/math/number/frac.lux
+++ b/stdlib/source/library/lux/math/number/frac.lux
@@ -23,7 +23,7 @@
["[1][0]" int]
["[1][0]" rev]])
-(template [<name> <value>]
+(with_template [<name> <value>]
[(def: .public <name>
<value>)]
@@ -35,7 +35,7 @@
)
(for @.old
- (these (template [<name> <method>]
+ (these (with_template [<name> <method>]
[(def: .public (<name> it)
(-> Frac Frac)
(<method> it))]
@@ -62,18 +62,20 @@
("jvm invokestatic:java.lang.Math:pow:double,double" subject param)))
@.jvm
- (these (template: (!double value)
- [(|> value
- (as (Primitive "java.lang.Double"))
- "jvm object cast")])
+ (these (def: !double
+ (template (_ value)
+ [(|> value
+ (as (Primitive "java.lang.Double"))
+ "jvm object cast")]))
- (template: (!frac value)
- [(|> value
- "jvm object cast"
- (is (Primitive "java.lang.Double"))
- (as Frac))])
+ (def: !frac
+ (template (_ value)
+ [(|> value
+ "jvm object cast"
+ (is (Primitive "java.lang.Double"))
+ (as Frac))]))
- (template [<name> <method>]
+ (with_template [<name> <method>]
[(def: .public <name>
(-> Frac Frac)
(|>> !double
@@ -106,7 +108,7 @@
!frac)))
@.js
- (these (template [<name> <method>]
+ (these (with_template [<name> <method>]
[(def: .public <name>
(-> Frac Frac)
(|>> []
@@ -136,7 +138,7 @@
(as Frac ("js apply" ("js constant" "Math.pow") [subject param]))))
@.python
- (these (template [<name> <method>]
+ (these (with_template [<name> <method>]
[(def: .public <name>
(-> Frac Frac)
(|>> []
@@ -175,7 +177,7 @@
(..pow ("lux f64 /" +3.0 +1.0))))))
@.lua
- (these (template [<name> <method>]
+ (these (with_template [<name> <method>]
[(def: .public <name>
(-> Frac Frac)
(|>> []
@@ -214,7 +216,7 @@
(..pow ("lux f64 /" +3.0 +1.0))))))
@.ruby
- (these (template [<name> <method>]
+ (these (with_template [<name> <method>]
[(def: .public <name>
(-> Frac Frac)
(|>> []
@@ -236,7 +238,7 @@
[root_3 "Math.cbrt"]
)
- (template [<name> <method>]
+ (with_template [<name> <method>]
[(def: .public (<name> it)
(-> Frac Frac)
(|> ("ruby object do" <method> it [])
@@ -252,7 +254,7 @@
(as Frac ("ruby object do" "**" subject [param]))))
@.php
- (these (template [<name> <method>]
+ (these (with_template [<name> <method>]
[(def: .public <name>
(-> Frac Frac)
(|>> ("php apply" ("php constant" <method>))
@@ -284,7 +286,7 @@
(..pow ("lux f64 /" +3.0 +1.0))))
@.scheme
- (these (template [<name> <method>]
+ (these (with_template [<name> <method>]
[(def: .public <name>
(-> Frac Frac)
(|>> ("scheme apply" ("scheme constant" <method>))
@@ -372,7 +374,7 @@
... Hyperbolic functions
... https://en.wikipedia.org/wiki/Hyperbolic_function#Definitions
-(template [<name> <comp> <inverse>]
+(with_template [<name> <comp> <inverse>]
[(def: .public (<name> it)
(-> Frac Frac)
(|> (..exp it) (<comp> (..exp ("lux f64 *" -1.0 it))) ("lux f64 /" +2.0)))
@@ -385,7 +387,7 @@
[cosh "lux f64 +" sech]
)
-(template [<name> <top> <bottom>]
+(with_template [<name> <top> <bottom>]
[(def: .public (<name> it)
(-> Frac Frac)
(let [e+ (exp it)
@@ -399,7 +401,7 @@
)
... https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions#Definitions_in_terms_of_logarithms
-(template [<name> <comp>]
+(with_template [<name> <comp>]
[(def: .public (<name> it)
(-> Frac Frac)
(|> it (pow +2.0) (<comp> +1.0) (pow +0.5) ("lux f64 +" it) log))]
@@ -408,7 +410,7 @@
[acosh "lux f64 -"]
)
-(template [<name> <base> <diff>]
+(with_template [<name> <base> <diff>]
[(def: .public (<name> it)
(-> Frac Frac)
(let [it+ (|> <base> ("lux f64 +" <diff>))
@@ -419,7 +421,7 @@
[acoth it +1.0]
)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: .public (<name> it)
(-> Frac Frac)
(let [it^2 (|> it (pow +2.0))]
@@ -429,7 +431,7 @@
[acsch "lux f64 +"]
)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: .public (<name> param subject)
(-> Frac Frac Bit)
(<op> param subject))]
@@ -452,7 +454,7 @@
(or ("lux f64 <" sample reference)
("lux f64 =" sample reference)))
-(template [<comparison> <name>]
+(with_template [<comparison> <name>]
[(def: .public <name>
(Predicate Frac)
(<comparison> +0.0))]
@@ -462,7 +464,7 @@
[..= zero?]
)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: .public (<name> param subject)
(-> Frac Frac Frac)
(<op> param subject))]
@@ -499,7 +501,7 @@
(def: min_exponent -1022)
(def: max_exponent (//int.frac +1023))
-(template [<name> <test>]
+(with_template [<name> <test>]
[(def: .public (<name> left right)
(-> Frac Frac Frac)
(if (<test> right left)
@@ -534,7 +536,7 @@
"lux f64 i64"
("lux i64 left-shift" ..exponent_size)))
-(template [<name> <numerator>]
+(with_template [<name> <numerator>]
[(def: .public <name>
Frac
(../ +0.0 <numerator>))]
@@ -584,7 +586,7 @@
(..- f2^-52)
(..* f2^+1023))))
-(template [<name> <composite> <identity>]
+(with_template [<name> <composite> <identity>]
[(implementation: .public <name>
(Monoid Frac)
@@ -630,7 +632,7 @@
(def: exponent_offset ..mantissa_size)
(def: sign_offset (//nat.+ ..exponent_size ..exponent_offset))
-(template [<cast> <hex> <name>]
+(with_template [<cast> <hex> <name>]
[(def: <name>
(|> <hex>
(at //nat.hex decoded)
@@ -700,7 +702,7 @@
(//i64.zero ..mantissa_size mantissa_bits)))
)))
-(template [<getter> <size> <offset>]
+(with_template [<getter> <size> <offset>]
[(def: <getter>
(-> (I64 Any) I64)
(let [mask (|> 1 (//i64.left_shifted <size>) -- (//i64.left_shifted <offset>))]
@@ -756,7 +758,7 @@
("lux text index" 0 "E+" representation)
("lux text index" 0 "e-" representation)
("lux text index" 0 "E-" representation)]
- (^.template [<factor> <patterns>]
+ (^.with_template [<factor> <patterns>]
[<patterns>
(do try.monad
[.let [after_offset (//nat.+ 2 split_index)
@@ -774,7 +776,7 @@
_
{try.#Success [representation +0]}))
-(template [<struct> <nat> <int> <error>]
+(with_template [<struct> <nat> <int> <error>]
[(implementation: .public <struct>
(Codec Text Frac)
diff --git a/stdlib/source/library/lux/math/number/i64.lux b/stdlib/source/library/lux/math/number/i64.lux
index 36a50c5fe..81cea98f4 100644
--- a/stdlib/source/library/lux/math/number/i64.lux
+++ b/stdlib/source/library/lux/math/number/i64.lux
@@ -21,7 +21,7 @@
(n.* ..bits_per_byte
..bytes_per_i64))
-(template [<parameter_type> <name> <op>]
+(with_template [<parameter_type> <name> <op>]
[(def: .public (<name> parameter subject)
(All (_ s) (-> <parameter_type> (I64 s) (I64 s)))
(<op> parameter subject))]
@@ -86,7 +86,7 @@
(All (_ s) (-> Nat (I64 s) (I64 s)))
(|> index ..bit ..not (..and input)))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: .public (<name> index input)
(All (_ s) (-> Nat (I64 s) (I64 s)))
(|> index ..bit (<op> input)))]
@@ -103,7 +103,7 @@
(-> Nat (I64 Any) Bit)
(.not (..one? index input)))
-(template [<name> <forward> <backward>]
+(with_template [<name> <forward> <backward>]
[(def: .public (<name> distance input)
(All (_ s) (-> Nat (I64 s) (I64 s)))
(..or (<forward> distance input)
@@ -130,7 +130,7 @@
(def: hash (|>> .nat)))
-(template [<monoid> <identity> <composite>]
+(with_template [<monoid> <identity> <composite>]
[(implementation: .public <monoid>
(All (_ a) (Monoid (I64 a)))
diff --git a/stdlib/source/library/lux/math/number/int.lux b/stdlib/source/library/lux/math/number/int.lux
index f4953d6b0..a59608af6 100644
--- a/stdlib/source/library/lux/math/number/int.lux
+++ b/stdlib/source/library/lux/math/number/int.lux
@@ -21,7 +21,7 @@
["[1][0]" nat]
["[1][0]" i64]])
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: .public (<name> param subject)
(-> Int Int Bit)
(<op> param subject))]
@@ -46,7 +46,7 @@
#1
("lux i64 =" reference sample)))
-(template [<comparison> <name>]
+(with_template [<comparison> <name>]
[(def: .public <name>
(Predicate Int)
(<comparison> +0))]
@@ -56,7 +56,7 @@
[..= zero?]
)
-(template [<name> <test>]
+(with_template [<name> <test>]
[(def: .public (<name> left right)
(-> Int Int Int)
(if (<test> right left)
@@ -67,7 +67,7 @@
[max ..>]
)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: .public (<name> param subject)
(-> Int Int Int)
(<op> param subject))]
@@ -190,7 +190,7 @@
... -9,223,372,036,854,775,808
(//i64.left_shifted 63 +1)))
-(template [<name> <composite> <identity>]
+(with_template [<name> <composite> <identity>]
[(implementation: .public <name>
(Monoid Int)
@@ -206,7 +206,7 @@
(def: -sign "-")
(def: +sign "+")
-(template [<struct> <codec> <error>]
+(with_template [<struct> <codec> <error>]
[(implementation: .public <struct>
(Codec Text Int)
diff --git a/stdlib/source/library/lux/math/number/nat.lux b/stdlib/source/library/lux/math/number/nat.lux
index 0e5d5f6d4..988efc62b 100644
--- a/stdlib/source/library/lux/math/number/nat.lux
+++ b/stdlib/source/library/lux/math/number/nat.lux
@@ -16,7 +16,7 @@
[macro
["^" pattern]]]])
-(template [<extension> <output> <name>]
+(with_template [<extension> <output> <name>]
[(def: .public (<name> parameter subject)
(-> Nat Nat <output>)
(<extension> parameter subject))]
@@ -61,7 +61,7 @@
(or (..< sample reference)
("lux i64 =" reference sample)))
-(template [<name> <test>]
+(with_template [<name> <test>]
[(def: .public (<name> left right)
(-> Nat Nat Nat)
(if (<test> right left)
@@ -167,7 +167,7 @@
(def: top (-- 0))
(def: bottom 0))
-(template [<name> <composite> <identity>]
+(with_template [<name> <composite> <identity>]
[(implementation: .public <name>
(Monoid Nat)
@@ -274,18 +274,18 @@
(def: (hexadecimal_value digit)
(-> Nat (Maybe Nat))
(case digit
- (^.template [<character> <number>]
+ (^.with_template [<character> <number>]
[(pattern (char <character>)) {.#Some <number>}])
(["0" 0] ["1" 1] ["2" 2] ["3" 3] ["4" 4]
["5" 5] ["6" 6] ["7" 7] ["8" 8] ["9" 9])
- (^.template [<lower> <upper> <number>]
+ (^.with_template [<lower> <upper> <number>]
[(^.or (pattern (char <lower>)) (pattern (char <upper>))) {.#Some <number>}])
(["a" "A" 10] ["b" "B" 11] ["c" "C" 12]
["d" "D" 13] ["e" "E" 14] ["f" "F" 15])
_ {.#None}))
-(template [<shift> <struct> <to_character> <to_value> <error>]
+(with_template [<shift> <struct> <to_character> <to_value> <error>]
[(implementation: .public <struct>
(Codec Text Nat)
diff --git a/stdlib/source/library/lux/math/number/ratio.lux b/stdlib/source/library/lux/math/number/ratio.lux
index 50ba795b2..df07ca898 100644
--- a/stdlib/source/library/lux/math/number/ratio.lux
+++ b/stdlib/source/library/lux/math/number/ratio.lux
@@ -149,7 +149,7 @@
{.#None}
{.#Left (text#composite "Invalid syntax for ratio: " input)})))
-(template [<identity> <composite> <name>]
+(with_template [<identity> <composite> <name>]
[(implementation: .public <name>
(Monoid Ratio)
diff --git a/stdlib/source/library/lux/math/number/rev.lux b/stdlib/source/library/lux/math/number/rev.lux
index d919af0b4..7afe11894 100644
--- a/stdlib/source/library/lux/math/number/rev.lux
+++ b/stdlib/source/library/lux/math/number/rev.lux
@@ -24,7 +24,7 @@
Rev
(.rev -1))
-(template [<power> <name>]
+(with_template [<power> <name>]
[(def: .public <name>
Rev
(.rev (//i64.left_shifted (//nat.- <power> //i64.width) 1)))]
@@ -65,7 +65,7 @@
(or (..< sample reference)
("lux i64 =" reference sample)))
-(template [<name> <test>]
+(with_template [<name> <test>]
[(def: .public (<name> left right)
(-> Rev Rev Rev)
(if (<test> right left)
@@ -76,7 +76,7 @@
[max ..>]
)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: .public (<name> param subject)
(-> Rev Rev Rev)
(<op> param subject))]
@@ -140,7 +140,7 @@
_ (..odd_reciprocal (.nat param)))]
(.rev (//nat.* reciprocal (.nat subject)))))))
-(template [<operator> <name> <output> <output_type>]
+(with_template [<operator> <name> <output> <output_type>]
[(def: .public (<name> param subject)
(-> Rev Rev <output_type>)
(<output> (<operator> (.nat param) (.nat subject))))]
@@ -149,7 +149,7 @@
[//nat./ ratio |> Nat]
)
-(template [<operator> <name>]
+(with_template [<operator> <name>]
[(def: .public (<name> scale subject)
(-> Nat Rev Rev)
(.rev (<operator> (.nat scale) (.nat subject))))]
@@ -206,7 +206,7 @@
(def: top (.rev -1))
(def: bottom (.rev 0)))
-(template [<name> <composite> <identity>]
+(with_template [<name> <composite> <identity>]
[(implementation: .public <name>
(Monoid Rev)
@@ -222,7 +222,7 @@
(-> Text Text)
("lux text clip" 1 (-- ("lux text size" input)) input))
-(template [<struct> <codec> <char_bit_size> <error>]
+(with_template [<struct> <codec> <char_bit_size> <error>]
[(with_expansions [<failure> (these {try.#Failure ("lux text concat" <error> repr)})]
(implementation: .public <struct>
(Codec Text Rev)
diff --git a/stdlib/source/library/lux/math/random.lux b/stdlib/source/library/lux/math/random.lux
index f22cc5647..2a05eac36 100644
--- a/stdlib/source/library/lux/math/random.lux
+++ b/stdlib/source/library/lux/math/random.lux
@@ -123,7 +123,7 @@
(i64.left_shifted 32)
("lux i64 +" right))])))
-(template [<name> <type> <cast>]
+(with_template [<name> <type> <cast>]
[(def: .public <name>
(Random <type>)
(at ..functor each (|>> <cast>) ..i64))]
@@ -167,7 +167,7 @@
xs (text char_gen (-- size))]
(in (text#composite (text.of_char x) xs)))))
-(template [<name> <set>]
+(with_template [<name> <set>]
[(def: .public <name>
(-> Nat (Random Text))
(..text (..char <set>)))]
@@ -181,7 +181,7 @@
[lower_case unicode.lower_case]
)
-(template [<name> <type> <ctor> <gen>]
+(with_template [<name> <type> <ctor> <gen>]
[(def: .public <name>
(Random <type>)
(do ..monad
@@ -252,7 +252,7 @@
(in (sequence.suffix x xs)))
(at ..monad in sequence.empty)))
-(template [<name> <type> <ctor>]
+(with_template [<name> <type> <ctor>]
[(def: .public (<name> size value_gen)
(All (_ a) (-> Nat (Random a) (Random (<type> a))))
(do ..monad
diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux
index 884945642..f056570b4 100644
--- a/stdlib/source/library/lux/meta.lux
+++ b/stdlib/source/library/lux/meta.lux
@@ -550,7 +550,7 @@
(|>> (the .#imports) (list.any? (text#= import)))
..current_module))
-(template [<name> <tag> <description>]
+(with_template [<name> <tag> <description>]
[(def: .public (<name> label_name)
(-> Symbol (Meta [Nat (List Symbol) Type]))
(do ..monad
@@ -666,7 +666,7 @@
{try.#Failure error}
{try.#Success [lux {try.#Failure error}]})))
-(template [<type> <name> <slot>]
+(with_template [<type> <name> <slot>]
[(def: .public <name>
(Meta <type>)
(function (_ lux)
diff --git a/stdlib/source/library/lux/meta/configuration.lux b/stdlib/source/library/lux/meta/configuration.lux
index 18464b10c..cf6675195 100644
--- a/stdlib/source/library/lux/meta/configuration.lux
+++ b/stdlib/source/library/lux/meta/configuration.lux
@@ -40,7 +40,7 @@
Configuration
/.empty)
-(template [<ascii> <name>]
+(with_template [<ascii> <name>]
[(def: <name>
Text
(text.of_char (hex <ascii>)))]
diff --git a/stdlib/source/library/lux/meta/symbol.lux b/stdlib/source/library/lux/meta/symbol.lux
index 43d2277af..a539acea7 100644
--- a/stdlib/source/library/lux/meta/symbol.lux
+++ b/stdlib/source/library/lux/meta/symbol.lux
@@ -13,7 +13,7 @@
... (type: Symbol
... [Text Text])
-(template [<name>]
+(with_template [<name>]
[(def: .public (<name> [module short])
(-> Symbol Text)
<name>)]
diff --git a/stdlib/source/library/lux/static.lux b/stdlib/source/library/lux/static.lux
index 21f749b1c..ea40d2733 100644
--- a/stdlib/source/library/lux/static.lux
+++ b/stdlib/source/library/lux/static.lux
@@ -17,7 +17,7 @@
[number (.only hex)]
["[0]" random (.only Random)]]]])
-(template [<name> <type> <format>]
+(with_template [<name> <type> <format>]
[(def: .public <name>
(syntax (_ [expression <code>.any])
(at meta.monad each
@@ -64,7 +64,7 @@
(syntax (_ [])
(meta#each (|>> code.nat list) meta.seed)))
-(template [<name> <random> <format>]
+(with_template [<name> <random> <format>]
[(def: .public <name>
(syntax (_ [])
(do meta.monad
diff --git a/stdlib/source/library/lux/target.lux b/stdlib/source/library/lux/target.lux
index 0f7d94d8f..66e8ea31b 100644
--- a/stdlib/source/library/lux/target.lux
+++ b/stdlib/source/library/lux/target.lux
@@ -5,7 +5,7 @@
(type: .public Target
Text)
-(template [<name> <value>]
+(with_template [<name> <value>]
[(def: .public <name>
Target
<value>)]
diff --git a/stdlib/source/library/lux/target/common_lisp.lux b/stdlib/source/library/lux/target/common_lisp.lux
index ce523f4d4..ee50aee0c 100644
--- a/stdlib/source/library/lux/target/common_lisp.lux
+++ b/stdlib/source/library/lux/target/common_lisp.lux
@@ -31,7 +31,7 @@
(-> (Code Any) Text)
(|>> representation))
- (template [<type> <super>]
+ (with_template [<type> <super>]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(`` (primitive: .public (<brand> brand) Any))
(`` (type: .public (<type> brand)
@@ -45,7 +45,7 @@
[Input Code]
)
- (template [<type> <super>]
+ (with_template [<type> <super>]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(`` (primitive: .public <brand> Any))
(`` (type: .public <type> (<super> <brand>))))]
@@ -66,7 +66,7 @@
Literal
(abstraction "()"))
- (template [<prefix> <name>]
+ (with_template [<prefix> <name>]
[(def: .public <name>
(-> Text Literal)
(|>> (format <prefix>) abstraction))]
@@ -119,7 +119,7 @@
(def: safe
(-> Text Text)
- (`` (|>> (~~ (template [<find> <replace>]
+ (`` (|>> (~~ (with_template [<find> <replace>]
[(text.replaced <find> <replace>)]
["\" "\\"]
@@ -177,7 +177,7 @@
(-> (Expression Any) (-> (List (Expression Any)) (Computation Any)))
(|>> {.#Item func} ..form))
- (template [<name> <function>]
+ (with_template [<name> <function>]
[(def: .public <name>
(-> (List (Expression Any)) (Computation Any))
(..call/* (..var <function>)))]
@@ -200,12 +200,12 @@
(transmutation bindings) expression
body)))
- (template [<call> <input_var>+ <input_type>+ <function>+]
+ (with_template [<call> <input_var>+ <input_type>+ <function>+]
[(`` (def: .public (<call> [(~~ (template.spliced <input_var>+))] function)
(-> [(~~ (template.spliced <input_type>+))] (Expression Any) (Computation Any))
(..call/* function (list (~~ (template.spliced <input_var>+))))))
- (`` (template [<lux_name> <host_name>]
+ (`` (with_template [<lux_name> <host_name>]
[(def: .public (<lux_name> args)
(-> [(~~ (template.spliced <input_type>+))] (Computation Any))
(<call> args (..var <host_name>)))]
@@ -262,8 +262,8 @@
[format/3 "format"]]]
)
- (template [<call> <input_type>+ <function>+]
- [(`` (template [<lux_name> <host_name>]
+ (with_template [<call> <input_type>+ <function>+]
+ [(`` (with_template [<lux_name> <host_name>]
[(def: .public (<lux_name> args)
(-> [(~~ (template.spliced <input_type>+))] (Access Any))
(transmutation (<call> args (..var <host_name>))))]
@@ -302,7 +302,7 @@
(-> [(Expression Any) (Expression Any)] (Computation Any))
(concatenate/3 [(..symbol "string") left right]))
- (template [<lux_name> <host_name>]
+ (with_template [<lux_name> <host_name>]
[(def: .public (<lux_name> left right)
(-> (Expression Any) (Expression Any) (Computation Any))
(..form (list (..var <host_name>) left right)))]
@@ -311,7 +311,7 @@
[and "and"]
)
- (template [<lux_name> <host_name>]
+ (with_template [<lux_name> <host_name>]
[(def: .public (<lux_name> [param subject])
(-> [(Expression Any) (Expression Any)] (Computation Any))
(..form (list (..var <host_name>) subject param)))]
@@ -344,7 +344,7 @@
(-> Var/* (Expression Any) Literal)
(..form (list (..var "lambda") (transmutation input) body)))
- (template [<lux_name> <host_name>]
+ (with_template [<lux_name> <host_name>]
[(def: .public (<lux_name> bindings body)
(-> (List [Var/1 (Expression Any)]) (List (Expression Any)) (Computation Any))
(..form (partial_list (..var <host_name>)
@@ -366,7 +366,7 @@
(-> Var/1 Var/* (Expression Any) (Expression Any))
(..form (list (..var "defun") name (transmutation inputs) body)))
- (template [<name> <symbol>]
+ (with_template [<name> <symbol>]
[(def: .public <name>
(-> (List (Expression Any)) (Computation Any))
(|>> (partial_list (..var <symbol>)) ..form))]
@@ -400,7 +400,7 @@
handler)))
handlers))))
- (template [<name> <prefix>]
+ (with_template [<name> <prefix>]
[(def: .public (<name> conditions expression)
(-> (List Text) (Expression Any) (Expression Any))
(case conditions
diff --git a/stdlib/source/library/lux/target/js.lux b/stdlib/source/library/lux/target/js.lux
index e1d894f56..3ee9dbcfb 100644
--- a/stdlib/source/library/lux/target/js.lux
+++ b/stdlib/source/library/lux/target/js.lux
@@ -40,7 +40,7 @@
(-> (Code Any) Text)
(|>> representation))
- (template [<type> <super>+]
+ (with_template [<type> <super>+]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(primitive: (<brand> brand) Any)
(`` (type: .public <type> (|> Any <brand> (~~ (template.spliced <super>+))))))]
@@ -51,7 +51,7 @@
[Statement [Code]]
)
- (template [<type> <super>+]
+ (with_template [<type> <super>+]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(primitive: <brand> Any)
(`` (type: .public <type> (|> <brand> (~~ (template.spliced <super>+))))))]
@@ -63,7 +63,7 @@
[Label [Code]]
)
- (template [<name> <literal>]
+ (with_template [<name> <literal>]
[(def: .public <name> Literal (abstraction <literal>))]
[null "null"]
@@ -94,7 +94,7 @@
(def: safe
(-> Text Text)
- (`` (|>> (~~ (template [<replace> <find>]
+ (`` (|>> (~~ (with_template [<replace> <find>]
[(text.replaced <find> <replace>)]
["\\" "\"]
@@ -213,7 +213,7 @@
..expression
abstraction))
- (template [<name> <op>]
+ (with_template [<name> <op>]
[(def: .public (<name> param subject)
(-> Expression Expression Computation)
(|> (format (representation subject) " " <op> " " (representation param))
@@ -243,7 +243,7 @@
[bit_and "&"]
)
- (template [<prefix> <name>]
+ (with_template [<prefix> <name>]
[(def: .public <name>
(-> Expression Computation)
(|>> representation (text.prefix <prefix>) ..expression abstraction))]
@@ -253,7 +253,7 @@
["-" opposite]
)
- (template [<name> <input> <format>]
+ (with_template [<name> <input> <format>]
[... A 32-bit integer expression.
(def: .public (<name> value)
(-> <input> Computation)
@@ -374,7 +374,7 @@
(-> Label Loop Statement)
(abstraction (format (representation label) ": " (representation loop))))
- (template [<keyword> <0> <1>]
+ (with_template [<keyword> <0> <1>]
[(def: .public <0>
Statement
(abstraction (format <keyword> ..statement_suffix)))
@@ -387,7 +387,7 @@
["continue" continue continue_at]
)
- (template [<name> <js>]
+ (with_template [<name> <js>]
[(def: .public <name>
(-> Location Expression)
(|>> representation
@@ -424,13 +424,13 @@
..block))))
)
-(template [<apply> <arg>+ <type>+ <function>+]
+(with_template [<apply> <arg>+ <type>+ <function>+]
[(`` (def: .public (<apply> function)
(-> Expression (~~ (template.spliced <type>+)) Computation)
(.function (_ (~~ (template.spliced <arg>+)))
(..apply function (list (~~ (template.spliced <arg>+)))))))
- (`` (template [<definition> <function>]
+ (`` (with_template [<definition> <function>]
[(def: .public <definition> (<apply> (..var <function>)))]
(~~ (template.spliced <function>+))))]
diff --git a/stdlib/source/library/lux/target/jvm/attribute.lux b/stdlib/source/library/lux/target/jvm/attribute.lux
index 2d356943d..856bb7eac 100644
--- a/stdlib/source/library/lux/target/jvm/attribute.lux
+++ b/stdlib/source/library/lux/target/jvm/attribute.lux
@@ -88,7 +88,7 @@
(def: (length attribute)
(-> Attribute Nat)
(case attribute
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> [name length info]}
(|> length //unsigned.value (n.+ ..common_attribute_length))])
([#Constant]
diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux
index e9cf5735d..7925c5c24 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode.lux
@@ -82,16 +82,18 @@
(function (_ _)
{try.#Success [..no_exceptions _.empty]}))
-(template: (try|do <binding> <term> <then>)
- [(.case <term>
- {try.#Success <binding>}
- <then>
+(def: try|do
+ (template (_ <binding> <term> <then>)
+ [(.case <term>
+ {try.#Success <binding>}
+ <then>
- failure
- (as_expected failure))])
+ failure
+ (as_expected failure))]))
-(template: (try|in <it>)
- [{try.#Success <it>}])
+(def: try|in
+ (template (_ <it>)
+ [{try.#Success <it>}]))
(def: (relative#composite left right)
(-> Relative Relative Relative)
@@ -300,7 +302,7 @@
(try|in [..no_exceptions (bytecode input)]))
[]]]))))
-(template [<name> <frames>]
+(with_template [<name> <frames>]
[(def: <name> U2
(|> <frames> //unsigned.u2 try.trusted))]
@@ -313,7 +315,7 @@
[$6 6]
)
-(template [<name> <registry>]
+(with_template [<name> <registry>]
[(def: <name> Registry (|> <registry> //unsigned.u2 try.trusted /registry.registry))]
[@_ 0]
@@ -324,7 +326,7 @@
[@4 5]
)
-(template [<name> <consumption> <production> <registry> <instruction>]
+(with_template [<name> <consumption> <production> <registry> <instruction>]
[(def: .public <name>
(Bytecode Any)
(..bytecode <consumption>
@@ -518,7 +520,7 @@
[..relative#identity
[]]]))))
-(template [<name> <consumption> <instruction>]
+(with_template [<name> <consumption> <instruction>]
[(def: .public <name>
(Bytecode Any)
(do ..monad
@@ -568,11 +570,11 @@
"[1]::[0]"
("static" doubleToRawLongBits "manual" [double] long))
-(template [<name> <type> <constructor> <constant> <wide> <to_lux> <specializations>]
+(with_template [<name> <type> <constructor> <constant> <wide> <to_lux> <specializations>]
[(def: .public (<name> value)
(-> <type> (Bytecode Any))
(case (|> value <to_lux>)
- (^.template [<special> <instruction>]
+ (^.with_template [<special> <instruction>]
[<special> (..bytecode $0 $1 @_ <instruction> [])])
<specializations>
@@ -622,7 +624,7 @@
(..float_bits value))
(..arbitrary_float value)
(case (|> value ffi.float_to_double (as Frac))
- (^.template [<special> <instruction>]
+ (^.with_template [<special> <instruction>]
[<special> (..bytecode $0 $1 @_ <instruction> [])])
([+0.0 _.fconst_0]
[+1.0 _.fconst_1]
@@ -630,11 +632,11 @@
_ (..arbitrary_float value))))
-(template [<name> <type> <constructor> <constant> <wide> <to_lux> <specializations>]
+(with_template [<name> <type> <constructor> <constant> <wide> <to_lux> <specializations>]
[(def: .public (<name> value)
(-> <type> (Bytecode Any))
(case (|> value <to_lux>)
- (^.template [<special> <instruction>]
+ (^.with_template [<special> <instruction>]
[<special> (..bytecode $0 $2 @_ <instruction> [])])
<specializations>
@@ -668,7 +670,7 @@
(..double_bits value))
(..arbitrary_double value)
(case (as Frac value)
- (^.template [<special> <instruction>]
+ (^.with_template [<special> <instruction>]
[<special> (..bytecode $0 $2 @_ <instruction> [])])
([+0.0 _.dconst_0]
[+1.0 _.dconst_1])
@@ -688,12 +690,12 @@
{try.#Failure error}
(..except ..invalid_register [id])))
-(template [<for> <size> <name> <general> <specials>]
+(with_template [<for> <size> <name> <general> <specials>]
[(def: .public (<name> local)
(-> Nat (Bytecode Any))
(with_expansions [<specials>' (template.spliced <specials>)]
(`` (case local
- (~~ (template [<case> <instruction> <registry>]
+ (~~ (with_template [<case> <instruction> <registry>]
[<case> (..bytecode $0 <size> <registry> <instruction> [])]
<specials>'))
@@ -728,12 +730,12 @@
[3 _.aload_3 @3]]]
)
-(template [<for> <size> <name> <general> <specials>]
+(with_template [<for> <size> <name> <general> <specials>]
[(def: .public (<name> local)
(-> Nat (Bytecode Any))
(with_expansions [<specials>' (template.spliced <specials>)]
(`` (case local
- (~~ (template [<case> <instruction> <registry>]
+ (~~ (with_template [<case> <instruction> <registry>]
[<case> (..bytecode <size> $0 <registry> <instruction> [])]
<specials>'))
@@ -768,7 +770,7 @@
[3 _.astore_3 @3]]]
)
-(template [<consumption> <production> <name> <instruction> <input>]
+(with_template [<consumption> <production> <name> <instruction> <input>]
[(def: .public <name>
(-> <input> (Bytecode Any))
(..bytecode <consumption> <production> @_ <instruction>))]
@@ -832,7 +834,7 @@
_
(revised #known (dictionary.has label [stack {.#None}]) tracker)))
-(template [<consumption> <name> <instruction>]
+(with_template [<consumption> <name> <instruction>]
[(def: .public (<name> label)
(-> Label (Bytecode Any))
(let [[estimator bytecode] <instruction>]
@@ -882,7 +884,7 @@
[$2 if_acmpne _.if_acmpne]
)
-(template [<name> <instruction> <on_long_jump> <on_short_jump>]
+(with_template [<name> <instruction> <on_long_jump> <on_short_jump>]
[(def: .public (<name> label)
(-> Label (Bytecode Any))
(let [[estimator bytecode] <instruction>]
@@ -1018,7 +1020,7 @@
(-> (Type (<| Return' Value' category)) Text))
(|>> type.reflection reflection.reflection))
-(template [<consumption> <production> <name> <category> <instruction>]
+(with_template [<consumption> <production> <name> <category> <instruction>]
[(def: .public (<name> class)
(-> (Type <category>) (Bytecode Any))
(do ..monad
@@ -1064,7 +1066,7 @@
... else
1))
-(template [<static?> <name> <instruction> <method>]
+(with_template [<static?> <name> <instruction> <method>]
[(def: .public (<name> class method type)
(-> (Type Class) Text (Type Method) (Bytecode Any))
(let [[type_variables inputs output exceptions] (parser.method type)]
@@ -1090,7 +1092,7 @@
[#0 invokeinterface _.invokeinterface //constant/pool.interface_method]
)
-(template [<consumption> <name> <1> <2>]
+(with_template [<consumption> <name> <1> <2>]
[(def: .public (<name> class field type)
(-> (Type Class) Text (Type Value) (Bytecode Any))
(do ..monad
@@ -1107,7 +1109,7 @@
[$1 getfield _.getfield/1 _.getfield/2]
)
-(template [<name> <consumption/1> <1> <consumption/2> <2>]
+(with_template [<name> <consumption/1> <1> <consumption/2> <2>]
[(def: .public (<name> class field type)
(-> (Type Class) Text (Type Value) (Bytecode Any))
(do [! ..monad]
diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment.lux
index f2ff4b9f9..bcef16e3e 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/environment.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/environment.lux
@@ -22,7 +22,7 @@
[#limit Limit
#stack (Maybe Stack)]))
-(template [<name> <limit>]
+(with_template [<name> <limit>]
[(def: .public (<name> type)
(-> (Type Method) (Try Environment))
(do try.monad
diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux
index a1c60d8d2..e859bb3af 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux
@@ -25,7 +25,7 @@
[#stack Stack
#registry Registry]))
-(template [<name> <registry>]
+(with_template [<name> <registry>]
[(def: .public (<name> type)
(-> (Type Method) (Try Limit))
(do try.monad
diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux
index 336ab6035..954c2d6fc 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux
@@ -46,7 +46,7 @@
..normal)))
(list#mix n.+ 0))))
- (template [<start> <name>]
+ (with_template [<start> <name>]
[(def: .public <name>
(-> (Type Method) (Try Registry))
(|>> ..minimal
@@ -74,7 +74,7 @@
(/////unsigned.max/2 (representation needed))
abstraction))
- (template [<name> <extra>]
+ (with_template [<name> <extra>]
[(def: .public <name>
(-> Register Registry)
(let [extra (|> <extra> /////unsigned.u2 try.trusted)]
diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux
index 3c8e419fb..89ea421a1 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux
@@ -20,7 +20,7 @@
(primitive: .public Stack
U2
- (template [<frames> <name>]
+ (with_template [<frames> <name>]
[(def: .public <name>
Stack
(|> <frames> /////unsigned.u2 maybe.trusted abstraction))]
@@ -43,7 +43,7 @@
(-> U2 Stack)
(|>> abstraction))
- (template [<op> <name>]
+ (with_template [<op> <name>]
[(def: .public (<name> amount)
(-> U2 (-> Stack (Try Stack)))
(|>> representation
diff --git a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux
index 028a60f47..145fe13e0 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux
@@ -63,7 +63,7 @@
(type: Opcode
Nat)
-(template [<size> <name>]
+(with_template [<size> <name>]
[(def: <name> Size (|> <size> ///unsigned.u2 try.trusted))]
[1 opcode_size]
@@ -89,7 +89,7 @@
size)
(|>> mutation ((nullary' opcode)))])])
-(template [<name> <size>]
+(with_template [<name> <size>]
[(def: <name>
Size
(|> ..opcode_size
@@ -101,7 +101,7 @@
[size/4 ..big_jump_size]
)
-(template [<shift> <name> <inputT> <writer> <unwrap>]
+(with_template [<shift> <name> <inputT> <writer> <unwrap>]
[(with_expansions [<private> (template.symbol ["'" <name>])]
(def: (<private> opcode input0)
(-> Opcode <inputT> Mutation)
@@ -125,7 +125,7 @@
[..size/4 jump/4 Big_Jump binary.has_32! ///signed.value]
)
-(template [<shift> <name> <inputT> <writer>]
+(with_template [<shift> <name> <inputT> <writer>]
[(with_expansions [<private> (template.symbol ["'" <name>])]
(def: (<private> opcode input0)
(-> Opcode <inputT> Mutation)
@@ -229,7 +229,7 @@
(-> Primitive_Array_Type U1)
(|>> representation))
- (template [<code> <name>]
+ (with_template [<code> <name>]
[(def: .public <name>
(|> <code> ///unsigned.u1 try.trusted abstraction))]
@@ -244,7 +244,7 @@
))
... https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5
-(with_expansions [<constants> (template [<code> <name>]
+(with_expansions [<constants> (with_template [<code> <name>]
[[<code> <name> [] []]]
["01" aconst_null]
@@ -266,7 +266,7 @@
["0E" dconst_0]
["0F" dconst_1])
- <register_loads> (template [<code> <name>]
+ <register_loads> (with_template [<code> <name>]
[[<code> <name> [[register Register]] [register]]]
["15" iload]
@@ -274,7 +274,7 @@
["17" fload]
["18" dload]
["19" aload])
- <simple_register_loads> (template [<code> <name>]
+ <simple_register_loads> (with_template [<code> <name>]
[[<code> <name> [] []]]
["1A" iload_0]
@@ -301,7 +301,7 @@
["2B" aload_1]
["2C" aload_2]
["2D" aload_3])
- <register_stores> (template [<code> <name>]
+ <register_stores> (with_template [<code> <name>]
[[<code> <name> [[register Register]] [register]]]
["36" istore]
@@ -309,7 +309,7 @@
["38" fstore]
["39" dstore]
["3A" astore])
- <simple_register_stores> (template [<code> <name>]
+ <simple_register_stores> (with_template [<code> <name>]
[[<code> <name> [] []]]
["3B" istore_0]
@@ -336,7 +336,7 @@
["4C" astore_1]
["4D" astore_2]
["4E" astore_3])
- <array_loads> (template [<code> <name>]
+ <array_loads> (with_template [<code> <name>]
[[<code> <name> [] []]]
["2E" iaload]
@@ -347,7 +347,7 @@
["33" baload]
["34" caload]
["35" saload])
- <array_stores> (template [<code> <name>]
+ <array_stores> (with_template [<code> <name>]
[[<code> <name> [] []]]
["4f" iastore]
@@ -358,7 +358,7 @@
["54" bastore]
["55" castore]
["56" sastore])
- <arithmetic> (template [<code> <name>]
+ <arithmetic> (with_template [<code> <name>]
[[<code> <name> [] []]]
["60" iadd]
@@ -397,7 +397,7 @@
["6F" ddiv]
["73" drem]
["77" dneg])
- <conversions> (template [<code> <name>]
+ <conversions> (with_template [<code> <name>]
[[<code> <name> [] []]]
["88" l2i]
@@ -418,7 +418,7 @@
["91" i2b]
["92" i2c]
["93" i2s])
- <comparisons> (template [<code> <name>]
+ <comparisons> (with_template [<code> <name>]
[[<code> <name> [] []]]
["94" lcmp]
@@ -428,7 +428,7 @@
["97" dcmpl]
["98" dcmpg])
- <returns> (template [<code> <name>]
+ <returns> (with_template [<code> <name>]
[[<code> <name> [] []]]
["AC" ireturn]
@@ -438,7 +438,7 @@
["B0" areturn]
["B1" return]
)
- <jumps> (template [<code> <name>]
+ <jumps> (with_template [<code> <name>]
[[<code> <name> [[jump Jump]] [jump]]]
["99" ifeq]
@@ -463,22 +463,22 @@
["C6" ifnull]
["C7" ifnonnull])
- <fields> (template [<code> <name>]
+ <fields> (with_template [<code> <name>]
[[<code> <name> [[index (Index (Reference Value))]] [(///index.value index)]]]
["B2" getstatic/1] ["B2" getstatic/2]
["B3" putstatic/1] ["B3" putstatic/2]
["B4" getfield/1] ["B4" getfield/2]
["B5" putfield/1] ["B5" putfield/2])]
- (template [<arity> <definitions>]
+ (with_template [<arity> <definitions>]
[(with_expansions [<definitions>' (template.spliced <definitions>)]
- (template [<code> <name> <instruction_inputs> <arity_inputs>]
+ (with_template [<code> <name> <instruction_inputs> <arity_inputs>]
[(with_expansions [<inputs>' (template.spliced <instruction_inputs>)
- <input_types> (template [<input_name> <input_type>]
+ <input_types> (with_template [<input_name> <input_type>]
[<input_type>]
<inputs>')
- <input_names> (template [<input_name> <input_type>]
+ <input_names> (with_template [<input_name> <input_type>]
[<input_name>]
<inputs>')]
diff --git a/stdlib/source/library/lux/target/jvm/class.lux b/stdlib/source/library/lux/target/jvm/class.lux
index 9c224c715..f365b2391 100644
--- a/stdlib/source/library/lux/target/jvm/class.lux
+++ b/stdlib/source/library/lux/target/jvm/class.lux
@@ -129,7 +129,7 @@
(def: .public (writer class)
(Writer Class)
(`` (all binaryF#composite
- (~~ (template [<writer> <slot>]
+ (~~ (with_template [<writer> <slot>]
[(<writer> (the <slot> class))]
[//magic.writer #magic]
@@ -139,7 +139,7 @@
[//modifier.writer #modifier]
[//index.writer #this]
[//index.writer #super]))
- (~~ (template [<writer> <slot>]
+ (~~ (with_template [<writer> <slot>]
[((binaryF.sequence_16 <writer>) (the <slot> class))]
[//index.writer #interfaces]
diff --git a/stdlib/source/library/lux/target/jvm/constant.lux b/stdlib/source/library/lux/target/jvm/constant.lux
index 93b959f5d..f8ca85cc0 100644
--- a/stdlib/source/library/lux/target/jvm/constant.lux
+++ b/stdlib/source/library/lux/target/jvm/constant.lux
@@ -97,7 +97,7 @@
(|>> representation)
Equivalence<kind>))
- (template [<constructor> <type> <marker>]
+ (with_template [<constructor> <type> <marker>]
[(type: .public <type>
(Value <marker>))
@@ -112,7 +112,7 @@
[string String (Index UTF8)]
)
- (template [<writer_name> <type> <write> <writer>]
+ (with_template [<writer_name> <type> <write> <writer>]
[(def: <writer_name>
(Writer <type>)
(`` (|>> representation
@@ -137,7 +137,7 @@
[#class (Index Class)
#name_and_type (Index (Name_And_Type of))]))
-(template [<type> <equivalence> <writer>]
+(with_template [<type> <equivalence> <writer>]
[(def: .public <equivalence>
(Equivalence (<type> Any))
(all product.equivalence
@@ -184,7 +184,7 @@
(implementation
(def: (= reference sample)
(case [reference sample]
- (^.template [<tag> <equivalence>]
+ (^.with_template [<tag> <equivalence>]
[[{<tag> reference} {<tag> sample}]
(at <equivalence> = reference sample)])
([#UTF8 text.equivalence]
@@ -242,7 +242,7 @@
)]
(function (_ value)
(case value
- (^.template [<case> <tag> <writer>]
+ (^.with_template [<case> <tag> <writer>]
[{<case> value}
(binaryF#composite (/tag.writer <tag>)
(<writer> value))])
diff --git a/stdlib/source/library/lux/target/jvm/constant/pool.lux b/stdlib/source/library/lux/target/jvm/constant/pool.lux
index 129659e05..b69d7ef21 100644
--- a/stdlib/source/library/lux/target/jvm/constant/pool.lux
+++ b/stdlib/source/library/lux/target/jvm/constant/pool.lux
@@ -76,64 +76,69 @@
failure
(as_expected failure)))))
-(template: (try|each <binding> <value> <body>)
- [(case <value>
- {try.#Success <binding>}
- <body>
-
- ... {try.#Failure error}
- failure
- (as_expected failure))])
-
-(template: (try|in <it>)
- [{try.#Success <it>}])
-
-(template: (!add <state> <tag> <equivalence> <value>)
- [(let [[current pool] <state>
- <value>' <value>]
- (with_expansions [<try_again> (these (again (.++ idx)))]
- (loop (again [idx 0])
- (case (sequence.item idx pool)
- {try.#Success entry}
- (case entry
- [index {<tag> reference}]
- (if (at <equivalence> = reference <value>')
- {try.#Success [[current pool]
- index]}
+(def: try|each
+ (template (_ <binding> <value> <body>)
+ [(case <value>
+ {try.#Success <binding>}
+ <body>
+
+ ... {try.#Failure error}
+ failure
+ (as_expected failure))]))
+
+(def: try|in
+ (template (_ <it>)
+ [{try.#Success <it>}]))
+
+(def: !add
+ (template (_ <state> <tag> <equivalence> <value>)
+ [(let [[current pool] <state>
+ <value>' <value>]
+ (with_expansions [<try_again> (these (again (.++ idx)))]
+ (loop (again [idx 0])
+ (case (sequence.item idx pool)
+ {try.#Success entry}
+ (case entry
+ [index {<tag> reference}]
+ (if (at <equivalence> = reference <value>')
+ {try.#Success [[current pool]
+ index]}
+ <try_again>)
+
+ _
<try_again>)
- _
- <try_again>)
-
- {try.#Failure _}
- (<| (let [new {<tag> <value>'}])
- (try|each @new (//unsigned.u2 (//.size new)))
- (try|each next (is (Try Index)
- (|> current
- //index.value
- (//unsigned.+/2 @new)
- (at try.monad each //index.index))))
- (try|in [[next
- (sequence.suffix [current new] pool)]
- current]))))))])
-
-(template: (/|do <state> <body>)
- [(function (_ <state>)
- <body>)])
-
-(template: (/|each <state> <binding> <value> <body>)
- [(case (<value> <state>)
- {try.#Success [<state> <binding>]}
- <body>
-
- ... {try.#Failure error}
- failure
- (as_expected failure))])
+ {try.#Failure _}
+ (<| (let [new {<tag> <value>'}])
+ (try|each @new (//unsigned.u2 (//.size new)))
+ (try|each next (is (Try Index)
+ (|> current
+ //index.value
+ (//unsigned.+/2 @new)
+ (at try.monad each //index.index))))
+ (try|in [[next
+ (sequence.suffix [current new] pool)]
+ current]))))))]))
+
+(def: /|do
+ (template (_ <state> <body>)
+ [(function (_ <state>)
+ <body>)]))
+
+(def: /|each
+ (template (_ <state> <binding> <value> <body>)
+ [(case (<value> <state>)
+ {try.#Success [<state> <binding>]}
+ <body>
+
+ ... {try.#Failure error}
+ failure
+ (as_expected failure))]))
(type: (Adder of)
(-> of (Resource (Index of))))
-(template [<name> <type> <tag> <equivalence>]
+(with_template [<name> <type> <tag> <equivalence>]
[(def: .public (<name> value)
(Adder <type>)
(<| (/|do %)
@@ -181,7 +186,7 @@
(/|each % @descriptor (..descriptor descriptor))
(!add % //.#Name_And_Type //.name_and_type_equivalence [//.#name @name //.#descriptor @descriptor])))
-(template [<name> <tag> <of>]
+(with_template [<name> <tag> <of>]
[(def: .public (<name> class member)
(-> External (Member <of>) (Resource (Index (Reference <of>))))
(<| (/|do %)
@@ -194,8 +199,9 @@
[interface_method //.#Interface_Method Method]
)
-(template: (!index <index>)
- [(|> <index> //index.value //unsigned.value)])
+(def: !index
+ (template (_ <index>)
+ [(|> <index> //index.value //unsigned.value)]))
(def: .public writer
(Writer Pool)
diff --git a/stdlib/source/library/lux/target/jvm/constant/tag.lux b/stdlib/source/library/lux/target/jvm/constant/tag.lux
index 7a859d75b..cf629c062 100644
--- a/stdlib/source/library/lux/target/jvm/constant/tag.lux
+++ b/stdlib/source/library/lux/target/jvm/constant/tag.lux
@@ -23,7 +23,7 @@
(u1//= (representation reference)
(representation sample))))
- (template [<code> <name>]
+ (with_template [<code> <name>]
[(def: .public <name>
Tag
(|> <code> ///unsigned.u1 try.trusted abstraction))]
diff --git a/stdlib/source/library/lux/target/jvm/encoding/signed.lux b/stdlib/source/library/lux/target/jvm/encoding/signed.lux
index a70a557de..9f94e12c1 100644
--- a/stdlib/source/library/lux/target/jvm/encoding/signed.lux
+++ b/stdlib/source/library/lux/target/jvm/encoding/signed.lux
@@ -47,7 +47,7 @@
"Value" (%.int value)
"Scope (in bytes)" (%.nat scope)))
- (template [<bytes> <name> <size> <constructor> <maximum> <minimum> <+> <->]
+ (with_template [<bytes> <name> <size> <constructor> <maximum> <minimum> <+> <->]
[(with_expansions [<raw> (template.symbol [<name> "'"])]
(primitive: <raw> Any)
(type: .public <name> (Signed <raw>)))
@@ -75,7 +75,7 @@
{try.#Success (abstraction value)}
(exception.except ..value_exceeds_the_scope [value <size>])))))
- (template [<abstract_operation> <concrete_operation>]
+ (with_template [<abstract_operation> <concrete_operation>]
[(def: .public (<abstract_operation> parameter subject)
(-> <name> <name> (Try <name>))
(<constructor>
@@ -91,7 +91,7 @@
[4 S4 bytes/4 s4 maximum/4 minimum/4 +/4 -/4]
)
- (template [<name> <from> <to>]
+ (with_template [<name> <from> <to>]
[(def: .public <name>
(-> <from> <to>)
(|>> transmutation))]
@@ -100,7 +100,7 @@
[lifted/4 S2 S4]
)
- (template [<writer_name> <type> <writer>]
+ (with_template [<writer_name> <type> <writer>]
[(def: .public <writer_name>
(Writer <type>)
(|>> representation <writer>))]
diff --git a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux
index 8bbc74213..6126469a4 100644
--- a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux
+++ b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux
@@ -59,7 +59,7 @@
"Parameter" (%.nat (representation parameter))
"Subject" (%.nat (representation subject))))
- (template [<bytes> <name> <size> <constructor> <maximum> <+> <-> <max>]
+ (with_template [<bytes> <name> <size> <constructor> <maximum> <+> <-> <max>]
[(with_expansions [<raw> (template.symbol [<name> "'"])]
(primitive: .public <raw> Any)
(type: .public <name> (Unsigned <raw>)))
@@ -100,7 +100,7 @@
[4 U4 bytes/4 u4 maximum/4 +/4 -/4 max/4]
)
- (template [<name> <from> <to>]
+ (with_template [<name> <from> <to>]
[(def: .public <name>
(-> <from> <to>)
(|>> transmutation))]
@@ -109,7 +109,7 @@
[lifted/4 U2 U4]
)
- (template [<writer_name> <type> <writer>]
+ (with_template [<writer_name> <type> <writer>]
[(def: .public <writer_name>
(Writer <type>)
(|>> representation <writer>))]
diff --git a/stdlib/source/library/lux/target/jvm/field.lux b/stdlib/source/library/lux/target/jvm/field.lux
index 196bd76f2..32ef049e5 100644
--- a/stdlib/source/library/lux/target/jvm/field.lux
+++ b/stdlib/source/library/lux/target/jvm/field.lux
@@ -51,7 +51,7 @@
(def: .public (writer field)
(Writer Field)
(`` (all binaryF#composite
- (~~ (template [<writer> <slot>]
+ (~~ (with_template [<writer> <slot>]
[(<writer> (the <slot> field))]
[modifier.writer #modifier]
diff --git a/stdlib/source/library/lux/target/jvm/method.lux b/stdlib/source/library/lux/target/jvm/method.lux
index 261ae04f6..57cc56e41 100644
--- a/stdlib/source/library/lux/target/jvm/method.lux
+++ b/stdlib/source/library/lux/target/jvm/method.lux
@@ -99,7 +99,7 @@
(def: .public (writer field)
(Writer Method)
(`` (all format#composite
- (~~ (template [<writer> <slot>]
+ (~~ (with_template [<writer> <slot>]
[(<writer> (the <slot> field))]
[//modifier.writer #modifier]
diff --git a/stdlib/source/library/lux/target/jvm/modifier.lux b/stdlib/source/library/lux/target/jvm/modifier.lux
index 68d8d8b7b..3900196fe 100644
--- a/stdlib/source/library/lux/target/jvm/modifier.lux
+++ b/stdlib/source/library/lux/target/jvm/modifier.lux
@@ -38,16 +38,18 @@
(representation reference)
(representation sample))))
- (template: (!wrap value)
- [(|> value
- //unsigned.u2
- try.trusted
- abstraction)])
+ (def: !wrap
+ (template (_ value)
+ [(|> value
+ //unsigned.u2
+ try.trusted
+ abstraction)]))
- (template: (!unwrap value)
- [(|> value
- representation
- //unsigned.value)])
+ (def: !unwrap
+ (template (_ value)
+ [(|> value
+ representation
+ //unsigned.value)]))
(def: .public (has? sub super)
(All (_ of) (-> (Modifier of) (Modifier of) Bit))
@@ -82,7 +84,7 @@
(syntax (_ [ofT <code>.any
options (<>.many <code>.any)])
(with_symbols [g!modifier g!code]
- (in (list (` (template [(~ g!code) (~ g!modifier)]
+ (in (list (` (with_template [(~ g!code) (~ g!modifier)]
[(def: (~' .public) (~ g!modifier)
(..Modifier (~ ofT))
((~! ..modifier) ((~! number.hex) (~ g!code))))]
diff --git a/stdlib/source/library/lux/target/jvm/reflection.lux b/stdlib/source/library/lux/target/jvm/reflection.lux
index d903e9fa0..5a76db47d 100644
--- a/stdlib/source/library/lux/target/jvm/reflection.lux
+++ b/stdlib/source/library/lux/target/jvm/reflection.lux
@@ -100,7 +100,7 @@
(exception.report
"Class" (%.text class)))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [jvm_type java/lang/reflect/Type])
(exception.report
"Type" (java/lang/reflect/Type::getTypeName jvm_type)
@@ -135,7 +135,7 @@
(let [class_name (|> class
(as (java/lang/Class java/lang/Object))
java/lang/Class::getName)]
- (`` (if (or (~~ (template [<reflection>]
+ (`` (if (or (~~ (with_template [<reflection>]
[(text#= (/reflection.reflection <reflection>)
class_name)]
@@ -185,7 +185,7 @@
... allow for multiple ones.
(case [(array.item 0 (java/lang/reflect/WildcardType::getLowerBounds reflection))
(array.item 0 (java/lang/reflect/WildcardType::getUpperBounds reflection))]
- (^.template [<pattern> <kind>]
+ (^.with_template [<pattern> <kind>]
[<pattern>
(case (ffi.as java/lang/reflect/GenericArrayType bound)
{.#Some it}
@@ -226,7 +226,7 @@
(let [class_name (|> reflection
(as (java/lang/Class java/lang/Object))
java/lang/Class::getName)]
- (`` (cond (~~ (template [<reflection> <type>]
+ (`` (cond (~~ (with_template [<reflection> <type>]
[(text#= (/reflection.reflection <reflection>)
class_name)
{try.#Success <type>}]
@@ -335,7 +335,7 @@
"Owner" (java/lang/Object::toString owner)
"Target" (java/lang/Object::toString target)))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [field Text
class (java/lang/Class java/lang/Object)])
(exception.report
@@ -366,7 +366,7 @@
list.empty?
not))
-(template [<name> <exception> <then?> <else?>]
+(with_template [<name> <exception> <then?> <else?>]
[(def: .public (<name> field class)
(-> Text (java/lang/Class java/lang/Object) (Try [Bit Bit (/.Type Value)]))
(do [! try.monad]
diff --git a/stdlib/source/library/lux/target/jvm/type.lux b/stdlib/source/library/lux/target/jvm/type.lux
index cdf8690e9..268743ce0 100644
--- a/stdlib/source/library/lux/target/jvm/type.lux
+++ b/stdlib/source/library/lux/target/jvm/type.lux
@@ -42,7 +42,7 @@
#super_class (Type Class)
#super_interfaces (List (Type Class))]))
- (template [<name> <style>]
+ (with_template [<name> <style>]
[(def: .public (<name> type)
(All (_ category) (-> (Type category) (<style> category)))
(let [[signature descriptor reflection] (representation type)]
@@ -59,7 +59,7 @@
(let [[signature descriptor reflection] (representation type)]
reflection))
- (template [<category> <name> <signature> <descriptor> <reflection>]
+ (with_template [<category> <name> <signature> <descriptor> <reflection>]
[(def: .public <name>
(Type <category>)
(abstraction [<signature> <descriptor> <reflection>]))]
@@ -166,7 +166,7 @@
(def: .public (primitive? type)
(-> (Type Value) (Either (Type Object)
(Type Primitive)))
- (if (`` (or (~~ (template [<type>]
+ (if (`` (or (~~ (with_template [<type>]
[(at ..equivalence = (is (Type Value) <type>) type)]
[..boolean]
@@ -183,7 +183,7 @@
(def: .public (void? type)
(-> (Type Return) (Either (Type Value)
(Type Void)))
- (if (`` (or (~~ (template [<type>]
+ (if (`` (or (~~ (with_template [<type>]
[(at ..equivalence = (is (Type Return) <type>) type)]
[..void]))))
diff --git a/stdlib/source/library/lux/target/jvm/type/alias.lux b/stdlib/source/library/lux/target/jvm/type/alias.lux
index 26462ac28..2d6cb7c49 100644
--- a/stdlib/source/library/lux/target/jvm/type/alias.lux
+++ b/stdlib/source/library/lux/target/jvm/type/alias.lux
@@ -52,7 +52,7 @@
(<>.after (<text>.this //descriptor.class_prefix))
(<>.before (<text>.this //descriptor.class_suffix))))
-(template [<name> <prefix> <bound> <constructor>]
+(with_template [<name> <prefix> <bound> <constructor>]
[(def: <name>
(-> (Parser (Type Class)) (Parser (Type Parameter)))
(|>> (<>.after (<text>.this <prefix>))
diff --git a/stdlib/source/library/lux/target/jvm/type/box.lux b/stdlib/source/library/lux/target/jvm/type/box.lux
index b50bffce2..08a6e1213 100644
--- a/stdlib/source/library/lux/target/jvm/type/box.lux
+++ b/stdlib/source/library/lux/target/jvm/type/box.lux
@@ -5,7 +5,7 @@
[encoding
[name (.only External)]]])
-(template [<name> <box>]
+(with_template [<name> <box>]
[(def: .public <name> External <box>)]
[boolean "java.lang.Boolean"]
diff --git a/stdlib/source/library/lux/target/jvm/type/category.lux b/stdlib/source/library/lux/target/jvm/type/category.lux
index e70d645d6..03e389d2a 100644
--- a/stdlib/source/library/lux/target/jvm/type/category.lux
+++ b/stdlib/source/library/lux/target/jvm/type/category.lux
@@ -21,7 +21,7 @@
(primitive: (Parameter' brand) Any)
(type: .public Parameter (<| Return' Value' Object' Parameter' Any))
-(template [<parents> <child>]
+(with_template [<parents> <child>]
[(with_expansions [<raw> (template.symbol [<child> "'"])]
(primitive: <raw> Any)
(type: .public <child>
diff --git a/stdlib/source/library/lux/target/jvm/type/descriptor.lux b/stdlib/source/library/lux/target/jvm/type/descriptor.lux
index ba72068a8..d063eecb7 100644
--- a/stdlib/source/library/lux/target/jvm/type/descriptor.lux
+++ b/stdlib/source/library/lux/target/jvm/type/descriptor.lux
@@ -28,7 +28,7 @@
(-> (Descriptor Any) Text)
(|>> representation))
- (template [<sigil> <category> <name>]
+ (with_template [<sigil> <category> <name>]
[(def: .public <name>
(Descriptor <category>)
(abstraction <sigil>))]
@@ -62,7 +62,7 @@
(-> (Descriptor Declaration) (Descriptor Class))
(|>> transmutation))
- (template [<name> <category>]
+ (with_template [<name> <category>]
[(def: .public <name>
(Descriptor <category>)
(transmutation
diff --git a/stdlib/source/library/lux/target/jvm/type/lux.lux b/stdlib/source/library/lux/target/jvm/type/lux.lux
index b63cafeab..96fa31b11 100644
--- a/stdlib/source/library/lux/target/jvm/type/lux.lux
+++ b/stdlib/source/library/lux/target/jvm/type/lux.lux
@@ -29,7 +29,7 @@
[encoding
["[1][0]" name]]]])
-(template [<name>]
+(with_template [<name>]
[(primitive: .public (<name> class) Any)]
[Lower] [Upper]
@@ -51,7 +51,7 @@
(<>.after //parser.void
(<>#in (check#in .Any))))
-(template [<name> <parser> <reflection>]
+(with_template [<name> <parser> <reflection>]
[(def: <name>
(Parser (Check Type))
(<>.after <parser>
@@ -67,7 +67,7 @@
[char //parser.char //reflection.char]
)
-(template [<name> <parser> <box>]
+(with_template [<name> <parser> <box>]
[(def: <name>
(Parser (Check Type))
(<>.after <parser>
@@ -140,7 +140,7 @@
(<>.after (<text>.this //descriptor.class_prefix))
(<>.before (<text>.this //descriptor.class_suffix))))
-(template [<name> <prefix> <constructor>]
+(with_template [<name> <prefix> <constructor>]
[(def: <name>
(-> (Parser (Check Type)) (Parser (Check Type)))
(|> (<>.after (<text>.this <prefix>))
@@ -174,7 +174,7 @@
(|>> (<>#each (check#each (function (_ elementT)
(case elementT
{.#Primitive name {.#End}}
- (if (`` (or (~~ (template [<reflection>]
+ (if (`` (or (~~ (with_template [<reflection>]
[(text#= (//reflection.reflection <reflection>) name)]
[//reflection.boolean]
diff --git a/stdlib/source/library/lux/target/jvm/type/parser.lux b/stdlib/source/library/lux/target/jvm/type/parser.lux
index 54be9b30b..166b2d984 100644
--- a/stdlib/source/library/lux/target/jvm/type/parser.lux
+++ b/stdlib/source/library/lux/target/jvm/type/parser.lux
@@ -22,7 +22,7 @@
[encoding
["[1][0]" name (.only External)]]]])
-(template [<category> <name> <signature> <type>]
+(with_template [<category> <name> <signature> <type>]
[(def: .public <name>
(Parser (Type <category>))
(<>.after (<text>.this (//signature.signature <signature>))
@@ -65,7 +65,7 @@
(def: class/set
(format var/tail //name.internal_separator))
-(template [<type> <name> <head> <tail> <adapter>]
+(with_template [<type> <name> <head> <tail> <adapter>]
[(def: .public <name>
(Parser <type>)
(at <>.functor each <adapter>
@@ -100,7 +100,7 @@
(<text>.result ..var')
try.trusted))
-(template [<name> <prefix> <constructor>]
+(with_template [<name> <prefix> <constructor>]
[(def: <name>
(-> (Parser (Type Parameter)) (Parser (Type Parameter)))
(|>> (<>.after (<text>.this <prefix>))
@@ -163,7 +163,7 @@
(Parser (Type Class))
(..class' ..parameter))
-(template [<name> <prefix> <constructor>]
+(with_template [<name> <prefix> <constructor>]
[(def: .public <name>
(-> (Type Value) (Maybe (Type Parameter)))
(|>> //.signature
@@ -238,7 +238,7 @@
(<text>.result parser)
try.trusted)))
-(template [<name> <category> <parser>]
+(with_template [<name> <category> <parser>]
[(def: .public <name>
(-> (Type Value) (Maybe <category>))
(|>> //.signature
diff --git a/stdlib/source/library/lux/target/jvm/type/reflection.lux b/stdlib/source/library/lux/target/jvm/type/reflection.lux
index de9afb234..37f1a7eab 100644
--- a/stdlib/source/library/lux/target/jvm/type/reflection.lux
+++ b/stdlib/source/library/lux/target/jvm/type/reflection.lux
@@ -28,7 +28,7 @@
(def: (= parameter subject)
(text#= (representation parameter) (representation subject))))
- (template [<category> <name> <reflection>]
+ (with_template [<category> <name> <reflection>]
[(def: .public <name>
(Reflection <category>)
(abstraction <reflection>))]
@@ -62,7 +62,7 @@
elementR (`` (cond (text.starts_with? //descriptor.array_prefix element')
element'
- (~~ (template [<primitive> <descriptor>]
+ (~~ (with_template [<primitive> <descriptor>]
[(at ..equivalence = <primitive> element)
(//descriptor.descriptor <descriptor>)]
@@ -84,7 +84,7 @@
(format //descriptor.array_prefix)
abstraction)))
- (template [<name> <category>]
+ (with_template [<name> <category>]
[(def: .public <name>
(Reflection <category>)
(transmutation
diff --git a/stdlib/source/library/lux/target/jvm/type/signature.lux b/stdlib/source/library/lux/target/jvm/type/signature.lux
index f66989972..1c35b96f7 100644
--- a/stdlib/source/library/lux/target/jvm/type/signature.lux
+++ b/stdlib/source/library/lux/target/jvm/type/signature.lux
@@ -27,7 +27,7 @@
(-> (Signature Any) Text)
(|>> representation))
- (template [<category> <name> <descriptor>]
+ (with_template [<category> <name> <descriptor>]
[(def: .public <name>
(Signature <category>)
(abstraction (//descriptor.descriptor <descriptor>)))]
@@ -53,7 +53,7 @@
(Signature Parameter)
(abstraction "*"))
- (template [<char> <name>]
+ (with_template [<char> <name>]
[(def: .public <name> <char>)]
["T" var_prefix]
@@ -69,7 +69,7 @@
["^" exception_prefix]
)
- (template [<name> <prefix>]
+ (with_template [<name> <prefix>]
[(def: .public <name>
(-> (Signature Parameter) (Signature Parameter))
(|>> representation (format <prefix>) abstraction))]
diff --git a/stdlib/source/library/lux/target/jvm/version.lux b/stdlib/source/library/lux/target/jvm/version.lux
index 9e3d7a33b..60778c7f7 100644
--- a/stdlib/source/library/lux/target/jvm/version.lux
+++ b/stdlib/source/library/lux/target/jvm/version.lux
@@ -17,7 +17,7 @@
//unsigned.u2
try.trusted))
-(template [<number> <name>]
+(with_template [<number> <name>]
[(def: .public <name>
Major
(|> <number>
diff --git a/stdlib/source/library/lux/target/lua.lux b/stdlib/source/library/lux/target/lua.lux
index 51c4ac911..2c92e2c18 100644
--- a/stdlib/source/library/lux/target/lua.lux
+++ b/stdlib/source/library/lux/target/lua.lux
@@ -63,7 +63,7 @@
(-> (Code Any) Text)
(|>> representation))
- (template [<type> <super>+]
+ (with_template [<type> <super>+]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(primitive: (<brand> brand) Any)
(`` (type: .public <type> (|> Any <brand> (~~ (template.spliced <super>+))))))]
@@ -74,7 +74,7 @@
[Statement [Code]]
)
- (template [<type> <super>+]
+ (with_template [<type> <super>+]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(primitive: <brand> Any)
(`` (type: .public <type> (|> <brand> (~~ (template.spliced <super>+))))))]
@@ -123,7 +123,7 @@
(def: safe
(-> Text Text)
- (`` (|>> (~~ (template [<find> <replace>]
+ (`` (|>> (~~ (with_template [<find> <replace>]
[(text.replaced <find> <replace>)]
["\" "\\"]
@@ -195,7 +195,7 @@
(format (representation table) ":" method)
abstraction))
- (template [<op> <name>]
+ (with_template [<op> <name>]
[(def: .public (<name> parameter subject)
(-> Expression Expression Expression)
(abstraction (format "("
@@ -228,7 +228,7 @@
[">>" bit_shr]
)
- (template [<name> <unary>]
+ (with_template [<name> <unary>]
[(def: .public (<name> subject)
(-> Expression Expression)
(abstraction (format "(" <unary> " " (representation subject) ")")))]
@@ -237,7 +237,7 @@
[opposite "-"]
)
- (template [<name> <type>]
+ (with_template [<name> <type>]
[(def: .public <name>
(-> Text <type>)
(|>> abstraction))]
@@ -340,7 +340,7 @@
(text.enclosed ["(" ")"])
abstraction))
- (template [<name> <code> <binding>]
+ (with_template [<name> <code> <binding>]
[(def: .public (<name> name args body!)
(-> <binding> (List Var) Statement Statement)
(abstraction
@@ -385,11 +385,11 @@
(syntax (_ [arity <code>.nat])
(in (list.repeated arity (` ..Expression)))))
-(template [<arity> <function>+]
+(with_template [<arity> <function>+]
[(with_expansions [<inputs> (arity_inputs <arity>)
<types> (arity_types <arity>)
<definitions> (template.spliced <function>+)]
- (template [<function>]
+ (with_template [<function>]
[(`` (def: .public ((~~ (template.symbol [<function> "/" <arity>])) <inputs>)
(-> <types> Computation)
(..apply (.list <inputs>) (..var <function>))))]
diff --git a/stdlib/source/library/lux/target/php.lux b/stdlib/source/library/lux/target/php.lux
index 73581a5e0..a100adb9f 100644
--- a/stdlib/source/library/lux/target/php.lux
+++ b/stdlib/source/library/lux/target/php.lux
@@ -71,7 +71,7 @@
(-> (Code Any) Text)
(|>> representation))
- (template [<type> <super>+]
+ (with_template [<type> <super>+]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(primitive: (<brand> brand) Any)
(`` (type: .public <type> (|> Any <brand> (~~ (template.spliced <super>+))))))]
@@ -82,7 +82,7 @@
[Statement [Code]]
)
- (template [<type> <super>+]
+ (with_template [<type> <super>+]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(primitive: .public <brand> Any)
(`` (type: .public <type> (|> <brand> (~~ (template.spliced <super>+))))))]
@@ -110,7 +110,7 @@
(-> Text Var)
(|>> (format "$") abstraction))
- (template [<name> <type>]
+ (with_template [<name> <type>]
[(def: .public <name>
(-> Text <type>)
(|>> abstraction))]
@@ -164,7 +164,7 @@
(def: safe
(-> Text Text)
- (`` (|>> (~~ (template [<find> <replace>]
+ (`` (|>> (~~ (with_template [<find> <replace>]
[(text.replaced <find> <replace>)]
["\" "\\"]
@@ -209,7 +209,7 @@
(text.interposed ..input_separator)
..group))
- (template [<name> <reference?>]
+ (with_template [<name> <reference?>]
[(def: .public <name>
(-> Var Argument)
(|>> [<reference?>]))]
@@ -244,7 +244,7 @@
(syntax (_ [arity <code>.nat])
(in (list.repeated arity (` ..Expression)))))
- (template [<arity> <function>+]
+ (with_template [<arity> <function>+]
[(with_expansions [<apply> (template.symbol ["apply/" <arity>])
<inputs> (arity_inputs <arity>)
<types> (arity_types <arity>)
@@ -253,7 +253,7 @@
(-> Expression [<types>] Computation)
(..apply (.list <inputs>) function))
- (template [<function>]
+ (with_template [<function>]
[(`` (def: .public (~~ (template.symbol [<function> "/" <arity>]))
(<apply> (..constant <function>))))]
@@ -369,7 +369,7 @@
..group
abstraction))
- (template [<name> <op>]
+ (with_template [<name> <op>]
[(def: .public (<name> parameter subject)
(-> Expression Expression Computation)
(|> (format (representation subject) " " <op> " " (representation parameter))
@@ -397,7 +397,7 @@
[concat "."]
)
- (template [<unary> <name>]
+ (with_template [<unary> <name>]
[(def: .public <name>
(-> Computation Computation)
(|>> representation (format <unary>) abstraction))]
@@ -421,7 +421,7 @@
(-> Var Computation)
(..apply/1 [var] (..constant "isset")))
- (template [<name> <modifier>]
+ (with_template [<name> <modifier>]
[(def: .public <name>
(-> Var Statement)
(|>> representation (format <modifier> " ") (text.suffix ..statement_suffix) abstraction))]
@@ -429,7 +429,7 @@
[define_global "global"]
)
- (template [<name> <modifier> <location>]
+ (with_template [<name> <modifier> <location>]
[(def: .public (<name> location value)
(-> <location> Expression Statement)
(abstraction (format <modifier> " " (representation location)
@@ -503,7 +503,7 @@
(list#each catch)
(text.interposed \n+)))))
- (template [<name> <keyword>]
+ (with_template [<name> <keyword>]
[(def: .public <name>
(-> Expression Statement)
(|>> representation (format <keyword> " ") (text.suffix ..statement_suffix) abstraction))]
@@ -527,7 +527,7 @@
" "
(..block (representation body!)))))
- (template [<name> <keyword>]
+ (with_template [<name> <keyword>]
[(def: .public <name>
Statement
(|> <keyword>
diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux
index 03033e4be..1d9f93737 100644
--- a/stdlib/source/library/lux/target/python.lux
+++ b/stdlib/source/library/lux/target/python.lux
@@ -80,7 +80,7 @@
(-> (Code Any) Text)
(|>> representation))
- (template [<type> <super>]
+ (with_template [<type> <super>]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(`` (primitive: (<brand> brand) Any))
(`` (type: .public (<type> brand)
@@ -93,7 +93,7 @@
[Statement Code]
)
- (template [<type> <super>]
+ (with_template [<type> <super>]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(`` (primitive: <brand> Any))
(`` (type: .public <type> (<super> <brand>))))]
@@ -103,7 +103,7 @@
[Loop Statement]
)
- (template [<var> <brand>]
+ (with_template [<var> <brand>]
[(primitive: .public <brand> Any)
(type: .public <var> (Var <brand>))]
@@ -117,7 +117,7 @@
(-> Text SVar)
(|>> abstraction))
- (template [<name> <brand> <prefix>]
+ (with_template [<name> <brand> <prefix>]
[(def: .public <name>
(-> SVar (Var <brand>))
(|>> representation (format <prefix>) abstraction))]
@@ -147,7 +147,7 @@
(def: .public float
(-> Frac Literal)
- (`` (|>> (pipe.cond (~~ (template [<test> <python>]
+ (`` (|>> (pipe.cond (~~ (with_template [<test> <python>]
[[<test>]
[(pipe.new (format "float(" text.double_quote <python> text.double_quote ")") [])]]
@@ -162,7 +162,7 @@
(def: safe
(-> Text Text)
- (`` (|>> (~~ (template [<find> <replace>]
+ (`` (|>> (~~ (with_template [<find> <replace>]
[(text.replaced <find> <replace>)]
["\" "\\"]
@@ -203,7 +203,7 @@
text.together)
right_delimiter))))
- (template [<name> <pre> <post>]
+ (with_template [<name> <pre> <post>]
[(def: .public <name>
(-> (List (Expression Any)) Literal)
(composite_literal <pre> <post> ..code))]
@@ -237,7 +237,7 @@
(|> args (list#each ..code) (text.interposed ..input_separator))
")")))
- (template [<name> <brand> <prefix>]
+ (with_template [<name> <brand> <prefix>]
[(def: .public <name>
(-> (Expression Any) (Expression Any))
(|>> representation
@@ -268,7 +268,7 @@
..expression
(format (representation then) " if " (representation test) " else " (representation else))))
- (template [<name> <op>]
+ (with_template [<name> <op>]
[(def: .public (<name> param subject)
(-> (Expression Any) (Expression Any) (Computation Any))
(<| abstraction
@@ -300,7 +300,7 @@
[in? "in"]
)
- (template [<name> <unary>]
+ (with_template [<name> <unary>]
[(def: .public (<name> subject)
(-> (Expression Any) (Computation Any))
(<| abstraction
@@ -356,7 +356,7 @@
\n+
(representation post!))))
- (template [<keyword> <0>]
+ (with_template [<keyword> <0>]
[(def: .public <0>
(Statement Any)
(abstraction <keyword>))]
@@ -410,7 +410,7 @@
(..nested (representation catch!)))))
text.together))))
- (template [<name> <keyword> <pre>]
+ (with_template [<name> <keyword> <pre>]
[(def: .public (<name> value)
(-> (Expression Any) (Statement Any))
(abstraction
@@ -463,10 +463,10 @@
(syntax (_ [arity <code>.nat])
(in (list.repeated arity (` (Expression Any))))))
-(template [<arity> <function>+]
+(with_template [<arity> <function>+]
[(with_expansions [<inputs> (arity_inputs <arity>)
<definitions> (template.spliced <function>+)]
- (template [<function>]
+ (with_template [<function>]
[(`` (def: .public ((~~ (template.symbol [<function> "/" <arity>])) <inputs>)
(-> (~~ (arity_types <arity>)) (Computation Any))
(..apply (.list <inputs>) (..var <function>))))]
diff --git a/stdlib/source/library/lux/target/r.lux b/stdlib/source/library/lux/target/r.lux
index 15cf46b21..0a4a61863 100644
--- a/stdlib/source/library/lux/target/r.lux
+++ b/stdlib/source/library/lux/target/r.lux
@@ -25,7 +25,7 @@
(primitive: .public (Code kind)
Text
- (template [<type> <super>+]
+ (with_template [<type> <super>+]
[(with_expansions [<kind> (template.symbol [<type> "'"])]
(primitive: .public (<kind> kind) Any)
(`` (type: .public <type> (|> Any <kind> (~~ (template.spliced <super>+))))))]
@@ -33,7 +33,7 @@
[Expression [Code]]
)
- (template [<type> <super>+]
+ (with_template [<type> <super>+]
[(with_expansions [<kind> (template.symbol [<type> "'"])]
(primitive: .public (<kind> kind) Any)
(`` (type: .public (<type> <brand>) (|> <brand> <kind> (~~ (template.spliced <super>+))))))]
@@ -41,7 +41,7 @@
[Var [Expression' Code]]
)
- (template [<var> <kind>]
+ (with_template [<var> <kind>]
[(primitive: .public <kind> Any)
(type: .public <var> (Var <kind>))]
@@ -94,7 +94,7 @@
(..nested (representation expression))
\n+ "}")))
- (template [<name> <r>]
+ (with_template [<name> <r>]
[(def: .public <name>
Expression
(abstraction <r>))]
@@ -103,7 +103,7 @@
[n/a "NA"]
)
- (template [<name>]
+ (with_template [<name>]
[(def: .public <name> Expression n/a)]
[not_available]
@@ -139,7 +139,7 @@
(def: safe
(-> Text Text)
- (`` (|>> (~~ (template [<find> <replace>]
+ (`` (|>> (~~ (with_template [<find> <replace>]
[(text.replaced <find> <replace>)]
["\" "\\"]
@@ -183,7 +183,7 @@
..nested)
")"))))
- (template [<name> <function>]
+ (with_template [<name> <function>]
[(def: .public (<name> members)
(-> (List Expression) Expression)
(..apply members (..var <function>)))]
@@ -221,7 +221,7 @@
(syntax (_ [arity <code>.nat])
(in (list.repeated arity (` ..Expression)))))
- (template [<arity> <function>+]
+ (with_template [<arity> <function>+]
[(with_expansions [<apply> (template.symbol ["apply/" <arity>])
<inputs> (arity_inputs <arity>)
<types> (arity_types <arity>)
@@ -230,7 +230,7 @@
(-> Expression [<types>] Expression)
(..apply (.list <inputs>) function))
- (template [<function>]
+ (with_template [<function>]
[(`` (def: .public (~~ (template.symbol [<function> "/" <arity>]))
(-> [<types>] Expression)
(<apply> (..var <function>))))]
@@ -275,7 +275,7 @@
else
(list.reversed clauses)))
- (template [<name> <op>]
+ (with_template [<name> <op>]
[(def: .public (<name> param subject)
(-> Expression Expression Expression)
(..self_contained
@@ -298,7 +298,7 @@
[and "&&"]
)
- (template [<name> <func>]
+ (with_template [<name> <func>]
[(def: .public (<name> param subject)
(-> Expression Expression Expression)
(..apply (.list subject param) (..var <func>)))]
@@ -314,7 +314,7 @@
(-> Expression Expression)
(..apply (.list subject) (..var "bitwNot")))
- (template [<name> <op>]
+ (with_template [<name> <op>]
[(def: .public <name>
(-> Expression Expression)
(|>> representation (format <op>) ..self_contained))]
@@ -366,7 +366,7 @@
(format "for (" (representation var) " in " (representation inputs) ")"
(.._block (representation body)))))
- (template [<name> <keyword>]
+ (with_template [<name> <keyword>]
[(def: .public (<name> message)
(-> Expression Expression)
(..apply (.list message) (..var <keyword>)))]
diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux
index 3942e8af0..238bc052f 100644
--- a/stdlib/source/library/lux/target/ruby.lux
+++ b/stdlib/source/library/lux/target/ruby.lux
@@ -57,7 +57,7 @@
(-> (Code Any) Text)
(|>> representation))
- (template [<type> <super>+]
+ (with_template [<type> <super>+]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(primitive: (<brand> brand) Any)
(`` (type: .public <type> (|> Any <brand> (~~ (template.spliced <super>+))))))]
@@ -70,7 +70,7 @@
[Statement [Code]]
)
- (template [<type> <super>+]
+ (with_template [<type> <super>+]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
(primitive: <brand> Any)
(`` (type: .public <type> (|> <brand> (~~ (template.spliced <super>+))))))]
@@ -85,7 +85,7 @@
[LVar** [LVar' Var' Location' Computation' Expression' Code]]
)
- (template [<var> <prefix> <constructor>]
+ (with_template [<var> <prefix> <constructor>]
[(def: .public <constructor>
(-> Text <var>)
(|>> (format <prefix>) abstraction))]
@@ -97,8 +97,8 @@
[SVar "@@" static]
)
- (template [<var> <prefix> <modifier> <unpacker>]
- [(template [<name> <input> <output>]
+ (with_template [<var> <prefix> <modifier> <unpacker>]
+ [(with_template [<name> <input> <output>]
[(def: .public <name>
(-> <input> <output>)
(|>> representation (format <prefix>) abstraction))]
@@ -111,7 +111,7 @@
[LVar** "**" variadic_kv double_splat]
)
- (template [<ruby_name> <lux_name>]
+ (with_template [<ruby_name> <lux_name>]
[(def: .public <lux_name>
GVar
(..global <ruby_name>))]
@@ -133,7 +133,7 @@
["stdin" stdin]
)
- (template [<ruby_name> <lux_name>]
+ (with_template [<ruby_name> <lux_name>]
[(def: .public <lux_name>
CVar
(..manual <ruby_name>))]
@@ -160,7 +160,7 @@
(def: safe
(-> Text Text)
- (`` (|>> (~~ (template [<find> <replace>]
+ (`` (|>> (~~ (with_template [<find> <replace>]
[(text.replaced <find> <replace>)]
["\" "\\"]
@@ -175,7 +175,7 @@
))
)))
- (template [<format> <name> <type> <prep>]
+ (with_template [<format> <name> <type> <prep>]
[(def: .public <name>
(-> <type> Literal)
(|>> <prep> <format> abstraction))]
@@ -312,7 +312,7 @@
\n+ "else"
(..nested (representation else!)))))
- (template [<name> <control_structure>]
+ (with_template [<name> <control_structure>]
[(def: .public (<name> test then!)
(-> Expression Statement Statement)
(<| abstraction
@@ -365,7 +365,7 @@
(-> Expression Expression)
(abstraction (format "raise " (representation message))))
- (template [<name> <keyword>]
+ (with_template [<name> <keyword>]
[(def: .public <name>
Statement
(|> <keyword>
@@ -404,7 +404,7 @@
(text.enclosed ["(" ")"])
abstraction)))
- (template [<op> <name>]
+ (with_template [<op> <name>]
[(def: .public (<name> parameter subject)
(-> Expression Expression Computation)
(abstraction (format "(" (representation subject) " " <op> " " (representation parameter) ")")))]
@@ -432,7 +432,7 @@
[">>" bit_shr]
)
- (template [<unary> <name>]
+ (with_template [<unary> <name>]
[(def: .public (<name> subject)
(-> Expression Computation)
(abstraction (format "(" <unary> (representation subject) ")")))]
@@ -447,7 +447,7 @@
(abstraction (format "# " (..safe commentary) \n+
(representation on))))
- (template [<name>]
+ (with_template [<name>]
[(`` (def: .public ((~~ (template.symbol [<name> "/*"])) attributes)
(-> (List Text) Statement)
(..statement
@@ -493,12 +493,12 @@
(syntax (_ [arity <code>.nat])
(in (list.repeated arity (` ..Expression)))))
-(template [<arity> <function>+]
+(with_template [<arity> <function>+]
[(with_expansions [<apply> (template.symbol ["apply/" <arity>])
<inputs> (arity_inputs <arity>)
<types> (arity_types <arity>)
<definitions> (template.spliced <function>+)]
- (template [<function>]
+ (with_template [<function>]
[(`` (def: .public ((~~ (template.symbol [<function> "/" <arity>])) <inputs>)
(-> <types> Computation)
(..apply (.list <inputs>) {.#None} (..manual <function>))))]
diff --git a/stdlib/source/library/lux/target/scheme.lux b/stdlib/source/library/lux/target/scheme.lux
index 09d717980..52e8862fc 100644
--- a/stdlib/source/library/lux/target/scheme.lux
+++ b/stdlib/source/library/lux/target/scheme.lux
@@ -46,14 +46,14 @@
(def: equivalence ..equivalence)
(def: hash (|>> representation (at text.hash hash))))
- (template [<type> <brand> <super>+]
+ (with_template [<type> <brand> <super>+]
[(primitive: .public (<brand> brand) Any)
(`` (type: .public <type> (|> Any <brand> (~~ (template.spliced <super>+)))))]
[Expression Expression' [Code]]
)
- (template [<type> <brand> <super>+]
+ (with_template [<type> <brand> <super>+]
[(primitive: .public <brand> Any)
(`` (type: .public <type> (|> <brand> (~~ (template.spliced <super>+)))))]
@@ -137,7 +137,7 @@
(def: safe
(-> Text Text)
- (`` (|>> (~~ (template [<find> <replace>]
+ (`` (|>> (~~ (with_template [<find> <replace>]
[(text.replaced <find> <replace>)]
["\" "\\"]
@@ -178,7 +178,7 @@
(-> (List Expression) Expression Computation)
(..form {.#Item func args}))
- (template [<name> <function>]
+ (with_template [<name> <function>]
[(def: .public (<name> members)
(-> (List Expression) Computation)
(..apply members (..var <function>)))]
@@ -191,20 +191,20 @@
(-> Expression Computation)
(..apply (list)))
- (template [<lux_name> <scheme_name>]
+ (with_template [<lux_name> <scheme_name>]
[(def: .public <lux_name>
(apply/0 (..var <scheme_name>)))]
[newline/0 "newline"]
)
- (template [<apply> <arg>+ <type>+ <function>+]
+ (with_template [<apply> <arg>+ <type>+ <function>+]
[(`` (def: .public (<apply> procedure)
(-> Expression (~~ (template.spliced <type>+)) Computation)
(function (_ (~~ (template.spliced <arg>+)))
(..apply (list (~~ (template.spliced <arg>+))) procedure))))
- (`` (template [<definition> <function>]
+ (`` (with_template [<definition> <function>]
[(def: .public <definition> (<apply> (..var <function>)))]
(~~ (template.spliced <function>+))))]
@@ -273,7 +273,7 @@
(-> Expression Expression Computation)
(..form (list (..var "invoke") vector (..symbol "getRaw") index)))
- (template [<lux_name> <scheme_name>]
+ (with_template [<lux_name> <scheme_name>]
[(def: .public (<lux_name> param subject)
(-> Expression Expression Computation)
(..apply/2 (..var <scheme_name>) subject param))]
@@ -301,7 +301,7 @@
[bitwise_xor/2 "bitwise-xor"]
)
- (template [<lux_name> <scheme_name>]
+ (with_template [<lux_name> <scheme_name>]
[(def: .public <lux_name>
(-> (List Expression) Computation)
(|>> (partial_list (..var <scheme_name>)) ..form))]
@@ -310,7 +310,7 @@
[and "and"]
)
- (template [<lux_name> <scheme_name> <var> <pre>]
+ (with_template [<lux_name> <scheme_name> <var> <pre>]
[(def: .public (<lux_name> bindings body)
(-> (List [<var> Expression]) Expression Computation)
(..form (list (..var <scheme_name>)
diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux
index b3ec2b657..9e0244547 100644
--- a/stdlib/source/library/lux/test.lux
+++ b/stdlib/source/library/lux/test.lux
@@ -65,7 +65,7 @@
#expected_coverage (set.empty symbol.hash)
#actual_coverage (set.empty symbol.hash)])
-(template [<name> <category>]
+(with_template [<name> <category>]
[(def: <name>
Tally
(revised <category> .++ ..start))]
@@ -333,7 +333,7 @@
{.#None}
(set.has [module remaining] output))))
-(template [<macro> <function>]
+(with_template [<macro> <function>]
[(def: .public <macro>
(syntax (_ [coverage (<code>.tuple (<>.many <code>.any))
condition <code>.any])
diff --git a/stdlib/source/library/lux/time.lux b/stdlib/source/library/lux/time.lux
index 8ccbec9dc..532961dcb 100644
--- a/stdlib/source/library/lux/time.lux
+++ b/stdlib/source/library/lux/time.lux
@@ -23,7 +23,7 @@
[/
["[0]" duration (.only Duration)]])
-(template [<name> <singular> <plural>]
+(with_template [<name> <singular> <plural>]
[(def: .public <name>
Nat
(.nat (duration.ticks <singular> <plural>)))]
@@ -56,7 +56,7 @@
(<>.after (<text>.this ".")))
(at <>.monad in 0)))
-(template [<maximum> <parser> <exception> <sub_parser>]
+(with_template [<maximum> <parser> <exception> <sub_parser>]
[(exception: .public (<exception> [value Nat])
(exception.report
"Value" (n#encoded value)
diff --git a/stdlib/source/library/lux/time/date.lux b/stdlib/source/library/lux/time/date.lux
index 52ac839bd..54d7a90ff 100644
--- a/stdlib/source/library/lux/time/date.lux
+++ b/stdlib/source/library/lux/time/date.lux
@@ -92,7 +92,7 @@
{//month.#January}
..minimum_day)))
- (template [<name> <type> <field>]
+ (with_template [<name> <type> <field>]
[(def: .public <name>
(-> Date <type>)
(|>> representation (the <field>)))]
@@ -152,7 +152,7 @@
(<>.after (<text>.this ".")))
(at <>.monad in 0)))
-(template [<minimum> <maximum> <parser> <exception>]
+(with_template [<minimum> <maximum> <parser> <exception>]
[(exception: .public (<exception> [value Nat])
(exception.report
"Value" (n#encoded value)
diff --git a/stdlib/source/library/lux/time/day.lux b/stdlib/source/library/lux/time/day.lux
index 38d71e7fd..0d8b6a369 100644
--- a/stdlib/source/library/lux/time/day.lux
+++ b/stdlib/source/library/lux/time/day.lux
@@ -34,7 +34,7 @@
(def: (= reference sample)
(case [reference sample]
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag>} {<tag>}]
#1])
([#Sunday]
@@ -101,7 +101,7 @@
(def: (encoded value)
(case value
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag>}
(text.replaced "#" "" (template.text [<tag>]))])
([..#Monday]
@@ -113,7 +113,7 @@
[..#Sunday])))
(def: (decoded value)
(case (text#composite "#" value)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern (template.text [<tag>]))
{try.#Success {<tag>}}])
([..#Monday]
@@ -145,7 +145,7 @@
(def: .public (number day)
(-> Day Nat)
(case day
- (^.template [<number> <day>]
+ (^.with_template [<number> <day>]
[{<day>}
<number>])
(<pairs>)))
@@ -161,7 +161,7 @@
(def: .public (by_number number)
(-> Nat (Try Day))
(case number
- (^.template [<number> <day>]
+ (^.with_template [<number> <day>]
[<number>
{try.#Success {<day>}}])
(<pairs>)
@@ -176,7 +176,7 @@
(def: equivalence ..equivalence)
(def: (hash day)
(case day
- (^.template [<prime> <day>]
+ (^.with_template [<prime> <day>]
[{<day>}
<prime>])
([02 #Sunday]
diff --git a/stdlib/source/library/lux/time/duration.lux b/stdlib/source/library/lux/time/duration.lux
index e2ba78067..c9869c08c 100644
--- a/stdlib/source/library/lux/time/duration.lux
+++ b/stdlib/source/library/lux/time/duration.lux
@@ -34,7 +34,7 @@
(-> Duration Int)
(|>> representation))
- (template [<op> <name>]
+ (with_template [<op> <name>]
[(def: .public (<name> param subject)
(-> Duration Duration Duration)
(abstraction (<op> (representation param) (representation subject))))]
@@ -43,7 +43,7 @@
[i.% framed]
)
- (template [<op> <name>]
+ (with_template [<op> <name>]
[(def: .public (<name> scalar)
(-> Nat Duration Duration)
(|>> representation (<op> (.int scalar)) abstraction))]
@@ -73,7 +73,7 @@
(def: (< param subject)
(i.< (representation param) (representation subject))))
- (template [<op> <name>]
+ (with_template [<op> <name>]
[(def: .public <name>
(-> Duration Bit)
(|>> representation (<op> +0)))]
@@ -90,7 +90,7 @@
(def: .public milli_second
(..of_millis +1))
-(template [<name> <scale> <base>]
+(with_template [<name> <scale> <base>]
[(def: .public <name>
(..up <scale> <base>))]
@@ -112,7 +112,7 @@
(def: identity ..empty)
(def: composite ..composite))
-(template [<value> <definition>]
+(with_template [<value> <definition>]
[(def: <definition> <value>)]
["D" day_suffix]
diff --git a/stdlib/source/library/lux/time/instant.lux b/stdlib/source/library/lux/time/instant.lux
index 1c6ea5458..366bfe020 100644
--- a/stdlib/source/library/lux/time/instant.lux
+++ b/stdlib/source/library/lux/time/instant.lux
@@ -74,7 +74,7 @@
(Enum Instant)
(def: order ..order)
- (~~ (template [<name>]
+ (~~ (with_template [<name>]
[(def: <name>
(|>> representation (at i.enum <name>) abstraction))]
@@ -102,7 +102,7 @@
[(date.of_days days)
(duration.of_millis day_time)]))
-(template [<value> <definition>]
+(with_template [<value> <definition>]
[(def: <definition> Text <value>)]
["T" date_suffix]
@@ -188,7 +188,7 @@
(i.* +1,000))
))))
-(template [<field> <type> <post_processing>]
+(with_template [<field> <type> <post_processing>]
[(def: .public (<field> instant)
(-> Instant <type>)
(let [[date time] (..date_time instant)]
diff --git a/stdlib/source/library/lux/time/month.lux b/stdlib/source/library/lux/time/month.lux
index 99d5ae4bc..7e7ddc447 100644
--- a/stdlib/source/library/lux/time/month.lux
+++ b/stdlib/source/library/lux/time/month.lux
@@ -39,7 +39,7 @@
(def: (= reference sample)
(case [reference sample]
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag>} {<tag>}]
true])
([#January]
@@ -73,7 +73,7 @@
(def: .public (number month)
(-> Month Nat)
(case month
- (^.template [<number> <month>]
+ (^.with_template [<number> <month>]
[{<month>}
<number>])
(<pairs>)))
@@ -89,7 +89,7 @@
(def: .public (by_number number)
(-> Nat (Try Month))
(case number
- (^.template [<number> <month>]
+ (^.with_template [<number> <month>]
[<number>
{try.#Success {<month>}}])
(<pairs>)
@@ -104,7 +104,7 @@
(def: equivalence ..equivalence)
(def: (hash month)
(case month
- (^.template [<prime> <month>]
+ (^.with_template [<prime> <month>]
[{<month>}
<prime>])
([02 #January]
@@ -167,7 +167,7 @@
(def: .public (days month)
(-> Month Nat)
(case month
- (^.template [<days> <month>]
+ (^.with_template [<days> <month>]
[{<month>}
<days>])
([31 #January]
@@ -216,7 +216,7 @@
(def: (encoded value)
(case value
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag>}
(text.replaced "#" "" (template.text [<tag>]))])
([..#January]
@@ -233,7 +233,7 @@
[..#December])))
(def: (decoded value)
(case (text#composite "#" value)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern (template.text [<tag>]))
{try.#Success {<tag>}}])
([..#January]
diff --git a/stdlib/source/library/lux/time/year.lux b/stdlib/source/library/lux/time/year.lux
index d10df7456..135607980 100644
--- a/stdlib/source/library/lux/time/year.lux
+++ b/stdlib/source/library/lux/time/year.lux
@@ -60,7 +60,7 @@
(type: .public Period
Nat)
-(template [<period> <name>]
+(with_template [<period> <name>]
[(def: .public <name>
Period
<period>)]
@@ -95,7 +95,7 @@
(-- year)
(++ year))]
(`` (|> +0
- (~~ (template [<polarity> <years>]
+ (~~ (with_template [<polarity> <years>]
[(<polarity> (i./ (.int <years>) limit))]
[i.+ ..leap]
diff --git a/stdlib/source/library/lux/tool/compiler/arity.lux b/stdlib/source/library/lux/tool/compiler/arity.lux
index 055f46a63..c1e2796c3 100644
--- a/stdlib/source/library/lux/tool/compiler/arity.lux
+++ b/stdlib/source/library/lux/tool/compiler/arity.lux
@@ -8,7 +8,7 @@
(type: .public Arity
Nat)
-(template [<comparison> <name>]
+(with_template [<comparison> <name>]
[(def: .public <name> (-> Arity Bit) (<comparison> 1))]
[n.< nullary?]
diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux
index 81653a205..f25ade369 100644
--- a/stdlib/source/library/lux/tool/compiler/default/platform.lux
+++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux
@@ -441,7 +441,7 @@
(list.only (|>> product.left (dictionary.key? to) not)
(dictionary.entries from))))
- (template [<name> <path>]
+ (with_template [<name> <path>]
[(def: (<name> from state)
(All (_ <type_vars>)
(-> <State+> <State+> (Try <State+>)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
index b3c99bdbf..7563bce90 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
@@ -114,19 +114,22 @@
_
false)))
-(template [<name> <tag>]
- [(template: .public (<name> content)
- [{<tag> content}])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [{<tag> content}]))]
[case ..#Case]
)
-(template: .public (unit)
- [{..#Simple {/simple.#Unit}}])
+(def: .public unit
+ (template (unit)
+ [{..#Simple {/simple.#Unit}}]))
-(template [<name> <tag>]
- [(template: .public (<name> value)
- [{..#Simple {<tag> value}}])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> value)
+ [{..#Simple {<tag> value}}]))]
[bit /simple.#Bit]
[nat /simple.#Nat]
@@ -142,13 +145,14 @@
(type: .public (Reification c)
[c (List c)])
-(template: .public (no_op value)
- [(|> 1
- {variable.#Local}
- {reference.#Variable}
- {..#Reference}
- {..#Function (list)}
- {..#Apply value})])
+(def: .public no_op
+ (template (no_op value)
+ [(|> 1
+ {variable.#Local}
+ {reference.#Variable}
+ {..#Reference}
+ {..#Function (list)}
+ {..#Apply value})]))
(def: .public (reified [abstraction inputs])
(-> (Reification Analysis) Analysis)
@@ -169,7 +173,7 @@
_
[abstraction inputs])))
-(template [<name> <tag>]
+(with_template [<name> <tag>]
[(def: .public <name>
(syntax (_ [content <code>.any])
(in (list (` (.<| {..#Reference}
@@ -183,11 +187,12 @@
[foreign ((~! reference.foreign))]
)
-(template [<name> <tag>]
- [(template: .public (<name> content)
- [(.<| {..#Structure}
- {<tag>}
- content)])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [(.<| {..#Structure}
+ {<tag>}
+ content)]))]
[variant /complex.#Variant]
[tuple /complex.#Tuple]
@@ -239,7 +244,7 @@
(%.format (%.text name) " ")
(text.enclosed ["(" ")"]))))
-(template [<special> <general>]
+(with_template [<special> <general>]
[(type: .public <special>
(<general> .Lux Code Analysis))]
@@ -330,7 +335,7 @@
{try.#Success [[bundle state]
[]]}))
-(template [<name> <type> <field> <value>]
+(with_template [<name> <type> <field> <value>]
[(def: .public (<name> value)
(-> <type> (Operation Any))
(extension.update (has <field> <value>)))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/coverage.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/coverage.lux
index b4b554a4f..cbb1e7ea4 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/coverage.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/coverage.lux
@@ -90,7 +90,7 @@
[{#Bit sideR} {#Bit sideS}]
(bit#= sideR sideS)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag> partialR} {<tag> partialS}]
(set#= partialR partialS)])
([#Nat]
@@ -126,7 +126,7 @@
{#Bit it}
(%.bit it)
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[{<tag> it}
(|> it
set.list
@@ -171,7 +171,7 @@
... Simple patterns (other than unit/[]) always have partial coverage because there
... are too many possibilities as far as values go.
- (^.template [<from> <to> <hash>]
+ (^.with_template [<from> <to> <hash>]
[{//pattern.#Simple {<from> it}}
{try.#Success {<to> (set.of_list <hash> (list it))}}])
([//simple.#Nat #Nat n.hash]
@@ -274,7 +274,7 @@
{try.#Success {#Exhaustive}}
<redundancy>)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag> partialA} {<tag> partialSF}]
(if (set.empty? (set.intersection partialA partialSF))
{try.#Success {<tag> (set.union partialA partialSF)}}
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/inference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/inference.lux
index 1baaf5e1d..fb8f92d44 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/inference.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/inference.lux
@@ -44,7 +44,7 @@
"Type" (%.type type)
"Argument" (%.code argument)))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [type Type])
(exception.report
"Type" (%.type type)))]
@@ -60,7 +60,7 @@
{.#Primitive name co_variant}
{.#Primitive name (list#each (quantified @var @parameter) co_variant)}
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
{<tag> (quantified @var @parameter left)
(quantified @var @parameter right)}])
@@ -74,7 +74,7 @@
{.#Parameter @parameter}
:it:)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> env body}
{<tag> (list#each (quantified @var @parameter) env)
(quantified @var (n.+ 2 @parameter) body)}])
@@ -199,12 +199,12 @@
recursion
it)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
{<tag> (again left) (again right)}])
([.#Sum] [.#Product] [.#Function] [.#Apply])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> environment quantified}
{<tag> (list#each again environment)
(with_recursion (n.+ 2 @self) recursion quantified)}])
@@ -222,7 +222,7 @@
(list#each (|>> (n.* 2) ++ {.#Parameter}))
list.reversed))
-(template [<name> <types> <inputs> <exception> <when> <then>]
+(with_template [<name> <types> <inputs> <exception> <when> <then>]
[(`` (def: .public (<name> (~~ (template.spliced <inputs>)) complex)
(-> (~~ (template.spliced <types>)) Type (Operation Type))
(loop (again [depth 0
@@ -231,7 +231,7 @@
{.#Named name it}
(again depth it)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> env it}
(phase#each (|>> {<tag> env})
(again (++ depth) it))])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux
index 1a897fb6c..086419cf3 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux
@@ -29,7 +29,7 @@
(exception.report
"Module" module))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [labels (List Label)
owner Type])
(exception.report
@@ -155,7 +155,7 @@
module (///extension.lifted (meta.module name))]
(in [module output])))
-(template [<setter> <asker> <tag>]
+(with_template [<setter> <asker> <tag>]
[(def: .public (<setter> module_name)
(-> Text (Operation Any))
(///extension.lifted
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/pattern.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/pattern.lux
index a462e62d1..23f8796db 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/pattern.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/pattern.lux
@@ -52,22 +52,25 @@
{#Bind it}
(//variable.format {//variable.#Local it})))
-(template [<name> <tag>]
- [(template: .public (<name> content)
- [(.<| {..#Complex}
- <tag>
- content)])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [(.<| {..#Complex}
+ <tag>
+ content)]))]
[variant {//complex.#Variant}]
[tuple {//complex.#Tuple}]
)
-(template: .public (unit)
- [{..#Simple {//simple.#Unit}}])
+(def: .public unit
+ (template (unit)
+ [{..#Simple {//simple.#Unit}}]))
-(template [<name> <tag>]
- [(template: .public (<name> content)
- [{..#Simple {<tag> content}}])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [{..#Simple {<tag> content}}]))]
[bit //simple.#Bit]
[nat //simple.#Nat]
@@ -77,5 +80,6 @@
[text //simple.#Text]
)
-(template: .public (bind register)
- [{..#Bind register}])
+(def: .public bind
+ (template (bind register)
+ [{..#Bind register}]))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/simple.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/simple.lux
index 4907be964..e9d2d8b87 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/simple.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/simple.lux
@@ -34,7 +34,7 @@
[{#Unit} {#Unit}]
true
- (^.template [<tag> <=>]
+ (^.with_template [<tag> <=>]
[[{<tag> reference} {<tag> sample}]
(<=> reference sample)])
([#Bit bit#=]
@@ -53,7 +53,7 @@
{#Unit}
"[]"
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[{<tag> value}
(<format> value)])
([#Bit %.bit]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux
index 7f1c5d418..afe5c1aa8 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux
@@ -55,7 +55,7 @@
[#imports (list#composite (the #imports left) (the #imports right))
#referrals (list#composite (the #referrals left) (the #referrals right))])
-(template [<special> <general>]
+(with_template [<special> <general>]
[(type: .public (<special> anchor expression directive)
(<general> (..State anchor expression directive) Code Requirements))]
@@ -66,7 +66,7 @@
[Bundle extension.Bundle]
)
-(template [<name> <component> <phase>]
+(with_template [<name> <component> <phase>]
[(def: .public <name>
(All (_ anchor expression directive)
(Operation anchor expression directive <phase>))
@@ -78,7 +78,7 @@
[generation ..#generation (generation.Phase anchor expression directive)]
)
-(template [<name> <component> <operation>]
+(with_template [<name> <component> <operation>]
[(def: .public <name>
(All (_ anchor expression directive output)
(-> (<operation> output)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux
index 42ad80162..695920880 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux
@@ -46,7 +46,7 @@
(exception.report
"Error" error))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [it artifact.ID])
(exception.report
"Artifact ID" (%.nat it)))]
@@ -84,7 +84,7 @@
#log (Sequence Text)
#interim_artifacts (List artifact.ID)]))
-(template [<special> <general>]
+(with_template [<special> <general>]
[(type: .public (<special> anchor expression directive)
(<general> (State anchor expression directive) Synthesis expression))]
@@ -116,7 +116,7 @@
Buffer
sequence.empty)
-(template [<tag>
+(with_template [<tag>
<with_declaration> <with_type> <with_value>
<set> <get> <get_type> <exception>]
[(exception: .public <exception>)
@@ -250,7 +250,7 @@
{.#None}
(phase.except ..no_buffer_for_saving_code [artifact_id]))))
-(template [<type> <mandatory?> <inputs> <input_types> <name> <artifact>]
+(with_template [<type> <mandatory?> <inputs> <input_types> <name> <artifact>]
[(`` (def: .public (<name> it (~~ (template.spliced <inputs>)) dependencies)
(All (_ anchor expression directive)
(-> <type> (~~ (template.spliced <input_types>)) (Set unit.ID) (Operation anchor expression directive artifact.ID)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux
index 0033addf3..55aa12407 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux
@@ -40,53 +40,57 @@
(exception.report
"Syntax" (%.code syntax)))
-(template: (variant_analysis analysis archive tag values)
- ... (-> Phase Archive Symbol (List Code) (Operation Analysis))
- [(case values
- (pattern (list value))
- (/complex.variant analysis tag archive value)
-
- _
- (/complex.variant analysis tag archive (code.tuple values)))])
-
-(template: (sum_analysis analysis archive lefts right? values)
- ... (-> Phase Archive Nat Bit (List Code) (Operation Analysis))
- [(case values
- (pattern (list value))
- (/complex.sum analysis lefts right? archive value)
-
- _
- (/complex.sum analysis lefts right? archive (code.tuple values)))])
-
-(template: (case_analysis analysis archive input branches code)
- ... (-> Phase Archive Code (List Code) Code (Operation Analysis))
- [(case (list.pairs branches)
- {.#Some branches}
- (/case.case analysis branches archive input)
-
- {.#None}
- (//.except ..invalid [code]))])
-
-(template: (apply_analysis expander analysis archive functionC argsC+)
- ... (-> Expander Phase Archive Code (List Code) (Operation Analysis))
- [(do [! //.monad]
- [[functionT functionA] (/type.inferring
- (analysis archive functionC))]
- (case functionA
- (pattern (/.constant def_name))
- (do !
- [?macro (//extension.lifted (meta.macro def_name))]
- (case ?macro
- {.#Some macro}
- (do !
- [expansion (//extension.lifted (/macro.single_expansion expander def_name macro argsC+))]
- (analysis archive expansion))
-
- _
- (/function.apply analysis argsC+ functionT functionA archive functionC)))
+(def: variant_analysis
+ (template (_ analysis archive tag values)
+ ... (-> Phase Archive Symbol (List Code) (Operation Analysis))
+ [(case values
+ (pattern (list value))
+ (/complex.variant analysis tag archive value)
_
- (/function.apply analysis argsC+ functionT functionA archive functionC)))])
+ (/complex.variant analysis tag archive (code.tuple values)))]))
+
+(def: sum_analysis
+ (template (_ analysis archive lefts right? values)
+ ... (-> Phase Archive Nat Bit (List Code) (Operation Analysis))
+ [(case values
+ (pattern (list value))
+ (/complex.sum analysis lefts right? archive value)
+
+ _
+ (/complex.sum analysis lefts right? archive (code.tuple values)))]))
+
+(def: case_analysis
+ (template (_ analysis archive input branches code)
+ ... (-> Phase Archive Code (List Code) Code (Operation Analysis))
+ [(case (list.pairs branches)
+ {.#Some branches}
+ (/case.case analysis branches archive input)
+
+ {.#None}
+ (//.except ..invalid [code]))]))
+
+(def: apply_analysis
+ (template (_ expander analysis archive functionC argsC+)
+ ... (-> Expander Phase Archive Code (List Code) (Operation Analysis))
+ [(do [! //.monad]
+ [[functionT functionA] (/type.inferring
+ (analysis archive functionC))]
+ (case functionA
+ (pattern (/.constant def_name))
+ (do !
+ [?macro (//extension.lifted (meta.macro def_name))]
+ (case ?macro
+ {.#Some macro}
+ (do !
+ [expansion (//extension.lifted (/macro.single_expansion expander def_name macro argsC+))]
+ (analysis archive expansion))
+
+ _
+ (/function.apply analysis argsC+ functionT functionA archive functionC)))
+
+ _
+ (/function.apply analysis argsC+ functionT functionA archive functionC)))]))
(def: .public (phase expander)
(-> Expander Phase)
@@ -96,7 +100,7 @@
... of having useful error messages.
(/.with_location location)
(case code
- (^.template [<tag> <analyser>]
+ (^.with_template [<tag> <analyser>]
[[_ {<tag> value}]
(<analyser> value)])
([.#Symbol /reference.reference]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux
index bb9d617f6..0bb0f208d 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux
@@ -235,7 +235,7 @@
idx /scope.next]
(in [{/pattern.#Bind idx} outputA])))
- (^.template [<type> <input> <output>]
+ (^.with_template [<type> <input> <output>]
[[location <input>]
(simple_pattern_analysis <type> :input: location {/pattern.#Simple <output>} next)])
([Bit {.#Bit pattern_value} {/simple.#Bit pattern_value}]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/complex.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/complex.lux
index 7e33dfdd9..0c16d0bc9 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/complex.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/complex.lux
@@ -43,7 +43,7 @@
(exception.report
"Type" (%.type type)))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [type Type
members (List Code)])
(exception.report
@@ -54,7 +54,7 @@
[cannot_analyse_tuple]
)
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [type Type
lefts Nat
right? Bit
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/simple.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/simple.lux
index 5a0806d79..a5e7a9d08 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/simple.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/simple.lux
@@ -11,7 +11,7 @@
[///
["[1]" phase]]]])
-(template [<name> <type> <tag>]
+(with_template [<name> <type> <tag>]
[(def: .public (<name> value)
(-> <type> (Operation Analysis))
(do ///.monad
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux
index 2b779791f..c5044dba6 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux
@@ -152,7 +152,7 @@
(getSuperclass [] "?" (java/lang/Class java/lang/Object))
(getInterfaces [] [(java/lang/Class java/lang/Object)]))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [class External
field Text])
(exception.report
@@ -195,9 +195,9 @@
External
"java.lang.Object")
-... TODO: Get rid of this template block and use the definition in
+... TODO: Get rid of this with_template block and use the definition in
... lux/ffi.jvm.lux ASAP
-(template [<name> <class>]
+(with_template [<name> <class>]
[(def: .public <name>
.Type
{.#Primitive <class> {.#End}})]
@@ -239,7 +239,7 @@
#deprecated? Bit
#throws (List .Type)]))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [type .Type])
(exception.report
"Type" (%.type type)))]
@@ -250,7 +250,7 @@
[non_jvm_type]
)
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [class External])
(exception.report
"Class/type" (%.text class)))]
@@ -260,7 +260,7 @@
[primitives_are_not_objects]
)
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [class_variables (List (Type Var))
class External
method Text
@@ -287,7 +287,7 @@
"To" (%.type to)
"Value" (%.code value)))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [message Text])
message)]
@@ -327,7 +327,7 @@
(///bundle.install "short-to-long" (//lux.unary ..short ..long))
)))
-(template [<name> <prefix> <type>]
+(with_template [<name> <prefix> <type>]
[(def: <name>
Bundle
(<| (///bundle.prefix (reflection.reflection <prefix>))
@@ -351,7 +351,7 @@
[bundle::long reflection.long ..long]
)
-(template [<name> <prefix> <type>]
+(with_template [<name> <prefix> <type>]
[(def: <name>
Bundle
(<| (///bundle.prefix (reflection.reflection <prefix>))
@@ -389,8 +389,9 @@
[(reflection.reflection reflection.char) [box.char jvm.char]])
(dictionary.of_list text.hash)))
-(template: (lux_array_type :read: :write:)
- [{.#Primitive (static array.type_name) (list {.#Apply :write: {.#Apply :read: _Mutable}})}])
+(def: lux_array_type
+ (template (_ :read: :write:)
+ [{.#Primitive (static array.type_name) (list {.#Apply :write: {.#Apply :read: _Mutable}})}]))
(def: (jvm_type luxT)
(-> .Type (Operation (Type Value)))
@@ -535,7 +536,7 @@
(/////analysis.except ..non_parameter objectT)
{.#Primitive name parameters}
- (`` (cond (or (~~ (template [<type>]
+ (`` (cond (or (~~ (with_template [<type>]
[(text#= (..reflection <type>) name)]
[jvm.boolean]
@@ -569,7 +570,7 @@
{.#Parameter id})
(phase#in (jvm.class ..object_class (list)))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> env unquantified}
(check_parameter unquantified)])
([.#UnivQ]
@@ -593,7 +594,7 @@
(-> .Type (Operation (Type Value)))
(case objectT
{.#Primitive name {.#End}}
- (`` (cond (~~ (template [<type>]
+ (`` (cond (~~ (with_template [<type>]
[(text#= (..reflection <type>) name)
(phase#in <type>)]
@@ -606,7 +607,7 @@
[jvm.double]
[jvm.char]))
- (~~ (template [<type>]
+ (~~ (with_template [<type>]
[(text#= (..reflection (jvm.array <type>)) name)
(phase#in (jvm.array <type>))]
@@ -640,7 +641,7 @@
{.#Named name anonymous}
(check_jvm anonymous)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> env unquantified}
(check_jvm unquantified)])
([.#UnivQ]
@@ -657,7 +658,7 @@
_
(check_parameter objectT)))
-(template [<name> <category> <parser>]
+(with_template [<name> <category> <parser>]
[(def: .public (<name> mapping typeJ)
(-> Mapping (Type <category>) (Operation .Type))
(case (|> typeJ ..signature (<text>.result (<parser> mapping)))
@@ -982,7 +983,7 @@
(analyse archive fromC))
source_name (at ! each ..reflection (check_jvm fromT))
can_cast? (is (Operation Bit)
- (`` (cond (~~ (template [<primitive> <object>]
+ (`` (cond (~~ (with_template [<primitive> <object>]
[(let [=primitive (reflection.reflection <primitive>)]
(or (and (text#= =primitive source_name)
(or (text#= <object> target_name)
@@ -1171,7 +1172,7 @@
(list#each (|>> again (as (Type Parameter))))
(jvm.class name))
{.#None})
- (~~ (template [<read> <as> <write>]
+ (~~ (with_template [<read> <as> <write>]
[(case (<read> it)
{.#Some :sub:}
(<write> (as (Type <as>) (again :sub:)))
@@ -1252,7 +1253,7 @@
(-> (java/lang/Class java/lang/Object) (Type Class))
(jvm.class (java/lang/Class::getName it) (list)))
-(template [<name> <type> <params>]
+(with_template [<name> <type> <params>]
[(`` (def: <name>
(-> (<type> (~~ (template.spliced <params>))) (List (Type Class)))
(|>> (~~ (template.symbol [<type> "::getExceptionTypes"]))
@@ -1359,7 +1360,7 @@
{#Pass Method_Signature}
{#Hint Method_Signature}))
-(template [<name> <tag>]
+(with_template [<name> <tag>]
[(def: <name>
(-> Evaluation (Maybe Method_Signature))
(|>> (pipe.case
@@ -1373,7 +1374,7 @@
[hint #Hint]
)
-(template [<name> <type> <method>]
+(with_template [<name> <type> <method>]
[(def: <name>
(-> <type> (List (Type Var)))
(|>> <method>
@@ -1488,7 +1489,7 @@
candidates
(/////analysis.except ..too_many_candidates [actual_class_tvars class_name ..constructor_method actual_method_tvars inputsJT candidates]))))
-(template [<name> <category> <parser>]
+(with_template [<name> <category> <parser>]
[(def: .public <name>
(Parser (Type <category>))
(<text>.then <parser> <code>.text))]
@@ -1674,7 +1675,7 @@
(/////analysis.tuple (partial_list (/////analysis.text name)
(list#each annotation_parameter_analysis parameters))))
-(template [<name> <category>]
+(with_template [<name> <category>]
[(def: <name>
(-> (Type <category>) Analysis)
(|>> ..signature /////analysis.text))]
@@ -1695,7 +1696,7 @@
(list (/////analysis.text argument)
(value_analysis argumentJT))))
-(template [<name> <only> <methods>]
+(with_template [<name> <only> <methods>]
[(def: (<name> [type class])
(-> [(Type Class) (java/lang/Class java/lang/Object)]
(Try (List [(Type Class) Text (Type Method)])))
@@ -1734,7 +1735,7 @@
(def: jvm_package_separator ".")
-(template [<name> <methods>]
+(with_template [<name> <methods>]
[(def: (<name> class_loader)
(-> java/lang/ClassLoader (List (Type Class)) (Try (List [(Type Class) Text (Type Method)])))
(|>> (monad.each try.monad (function (_ type)
@@ -1750,7 +1751,7 @@
[all_methods ..methods]
)
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [expected (List [(Type Class) Text (Type Method)])
actual (List [(Type Class) Text (Type Method)])])
(let [%method (is (%.Format [(Type Class) Text (Type Method)])
@@ -2421,7 +2422,7 @@
... TODO: Handle annotations.
{#Constant [name annotations type value]}
(case value
- (^.template [<tag> <type> <constant>]
+ (^.with_template [<tag> <type> <constant>]
[[_ {<tag> value}]
(do pool.monad
[constant (`` (|> value (~~ (template.spliced <constant>))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux
index 90ed93d25..39606222f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux
@@ -168,7 +168,7 @@
(bundle.install "nil?" (/.unary Any Bit))
)))
-(template [<name> <fromT> <toT>]
+(with_template [<name> <fromT> <toT>]
[(def: <name>
Handler
(custom
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux
index c4392ff2a..e6c308b21 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux
@@ -112,7 +112,7 @@
(def: visibility'
(<text>.Parser (Modifier field.Field))
(`` (all <>.either
- (~~ (template [<label> <modifier>]
+ (~~ (with_template [<label> <modifier>]
[(<>.after (<text>.this <label>) (<>#in <modifier>))]
["public" field.public]
@@ -127,7 +127,7 @@
(def: inheritance
(Parser (Modifier class.Class))
(`` (all <>.either
- (~~ (template [<label> <modifier>]
+ (~~ (with_template [<label> <modifier>]
[(<>.after (<code>.this_text <label>) (<>#in <modifier>))]
["final" class.final]
@@ -137,7 +137,7 @@
(def: state
(Parser (Modifier field.Field))
(`` (all <>.either
- (~~ (template [<label> <modifier>]
+ (~~ (with_template [<label> <modifier>]
[(<>.after (<code>.this_text <label>) (<>#in <modifier>))]
["volatile" field.volatile]
@@ -231,7 +231,7 @@
... TODO: Handle annotations.
{#Constant [name annotations type value]}
(case value
- (^.template [<tag> <type> <constant>]
+ (^.with_template [<tag> <type> <constant>]
[[_ {<tag> value}]
(do pool.monad
[constant (`` (|> value (~~ (template.spliced <constant>))))
@@ -270,7 +270,7 @@
(<synthesis>.Parser (jvm.Annotation Synthesis))
(<synthesis>.tuple (<>.and <synthesis>.text (<>.some ..annotation_parameter_synthesis))))
-(template [<name> <type> <text>]
+(with_template [<name> <type> <text>]
[(def: <name>
(<synthesis>.Parser (Type <type>))
(<text>.then <text> <synthesis>.text))]
@@ -430,7 +430,7 @@
(<load> jvm_register)
(value.wrap <type>)
(_.astore lux_register))]]]
- (`` (cond (~~ (template [<shift> <load> <type>]
+ (`` (cond (~~ (with_template [<shift> <load> <type>]
[(at type.equivalence = <type> argumentT)
(wrap_primitive <shift> <load> <type>)]
@@ -513,7 +513,7 @@
[(all _.composite
(value.unwrap <type>)
<return>)]]
- (`` (cond (~~ (template [<return> <type>]
+ (`` (cond (~~ (with_template [<return> <type>]
[(at type.equivalence = <type> returnT)
(unwrap_primitive <return> <type>)]
@@ -831,7 +831,7 @@
(list#each (..mock_method super) methods)
inheritance))
-(template [<name> <type> <parser>]
+(with_template [<name> <type> <parser>]
[(def: <name>
(Parser <type>)
(do [! <>.monad]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux
index b66e2cc05..2072d1a8e 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux
@@ -169,7 +169,7 @@
(synthesize archive codeA))]
(definition' archive generate name code//type codeS)))
-(template [<full> <partial> <learn>]
+(with_template [<full> <partial> <learn>]
[... TODO: Inline "<partial>" into "<full>" ASAP
(def: (<partial> archive generate extension codeT codeS)
(All (_ anchor expression directive)
@@ -376,7 +376,7 @@
(in /////directive.no_requirements)))]))
... TODO: Stop requiring these types and the "swapped" function below to make types line-up.
-(template [<name> <anonymous>]
+(with_template [<name> <anonymous>]
[(def: <name>
Type
(with_expansions [<original> binary.Binary]
@@ -397,7 +397,7 @@
{.#Primitive name parameters}
{.#Primitive name (list#each again parameters)}
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
{<tag> (again left) (again right)}])
([.#Sum]
@@ -410,7 +410,7 @@
{.#Ex _})
type
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> closure body}
{<tag> closure (again body)}])
([.#UnivQ]
@@ -419,7 +419,7 @@
{.#Named name anonymous}
{.#Named name (again anonymous)}))))
-(template [<description> <mame> <def_type> <type> <scope> <definer>]
+(with_template [<description> <mame> <def_type> <type> <scope> <definer>]
[(def: (<mame> [anchorT expressionT directiveT] extender)
(All (_ anchor expression directive)
(-> [Type Type Type] Extender
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux
index 111d1d4aa..1eeb12ede 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux
@@ -51,8 +51,9 @@
{try.#Failure error}
(/////.except extension.invalid_syntax [extension_name %synthesis input]))))
-(template: (!unary function)
- (|>> list _.apply (|> (_.constant function))))
+(def: !unary
+ (template (_ function)
+ (|>> list _.apply (|> (_.constant function)))))
... ... TODO: Get rid of this ASAP
... (def: lux::syntax_char_case!
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux
index db527fbd2..0b40aa0d3 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux
@@ -54,7 +54,7 @@
... [Procedures]
... [[Bits]]
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [paramG subjectG])
(Binary Expression)
(<op> subjectG (//runtime.i64::number paramG)))]
@@ -107,7 +107,7 @@
[body (expression archive synthesis)]
(in (as Statement body)))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern (<tag> value))
(/////#each _.return (expression archive synthesis))])
([synthesis.bit]
@@ -119,7 +119,7 @@
[synthesis.branch/get]
[synthesis.function/apply])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern {<tag> value})
(/////#each _.return (expression archive synthesis))])
([synthesis.#Reference]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux
index 44674faf0..da40355f3 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux
@@ -90,7 +90,7 @@
inputsG (monad.each ! (phase archive) inputsS)]
(in (_.do methodS inputsG objectG))))]))
-(template [<!> <?> <unit>]
+(with_template [<!> <?> <unit>]
[(def: <!> (Nullary Expression) (function.constant <unit>))
(def: <?> (Unary Expression) (_.= <unit>))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux
index cbae57e3c..7d035fe2f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux
@@ -159,7 +159,7 @@
(/////bundle.install "is" (binary ..lux::is))
(/////bundle.install "try" (unary ..lux::try))))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [maskG inputG])
(Binary (Bytecode Any))
(all _.composite
@@ -172,7 +172,7 @@
[i64::xor _.lxor]
)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [shiftG inputG])
(Binary (Bytecode Any))
(all _.composite
@@ -184,7 +184,7 @@
[i64::right_shifted _.lushr]
)
-(template [<name> <type> <op>]
+(with_template [<name> <type> <op>]
[(def: (<name> [paramG subjectG])
(Binary (Bytecode Any))
(all _.composite
@@ -205,8 +205,8 @@
[f64::% type.double _.drem]
)
-(template [<eq> <lt> <type> <cmp>]
- [(template [<name> <reference>]
+(with_template [<eq> <lt> <type> <cmp>]
+ [(with_template [<name> <reference>]
[(def: (<name> [paramG subjectG])
(Binary (Bytecode Any))
(all _.composite
@@ -227,7 +227,7 @@
(-> (Type Class) (Type Primitive) (Bytecode Any))
(_.invokestatic class "toString" (type.method [(list) (list from) ..$String (list)])))
-(template [<name> <prepare> <transform>]
+(with_template [<name> <prepare> <transform>]
[(def: (<name> inputG)
(Unary (Bytecode Any))
(all _.composite
@@ -307,7 +307,7 @@
(def: no_op (Bytecode Any) (_#in []))
-(template [<name> <pre_subject> <pre_param> <op> <post>]
+(with_template [<name> <pre_subject> <pre_param> <op> <post>]
[(def: (<name> [paramG subjectG])
(Binary (Bytecode Any))
(all _.composite
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux
index d9b809f6c..202f4b5e0 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux
@@ -79,7 +79,7 @@
[dependency
["[1]/[0]" artifact]]]]]]]])
-(template [<name> <0>]
+(with_template [<name> <0>]
[(def: <name>
(Bytecode Any)
(all _.composite
@@ -91,7 +91,7 @@
[l2c _.i2c]
)
-(template [<conversion> <name>]
+(with_template [<conversion> <name>]
[(def: (<name> inputG)
(Unary (Bytecode Any))
(if (same? _.nop <conversion>)
@@ -168,7 +168,7 @@
(/////bundle.install "short-to-long" (unary conversion::short_to_long))
)))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [parameter! subject!])
(Binary (Bytecode Any))
(all _.composite
@@ -217,7 +217,7 @@
(def: falseG (_.getstatic ..$Boolean "FALSE" ..$Boolean))
(def: trueG (_.getstatic ..$Boolean "TRUE" ..$Boolean))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [reference subject])
(Binary (Bytecode Any))
(do _.monad
@@ -240,7 +240,7 @@
[char::< _.if_icmplt]
)
-(template [<name> <op> <reference>]
+(with_template [<name> <op> <reference>]
[(def: (<name> [reference subject])
(Binary (Bytecode Any))
(do _.monad
@@ -340,7 +340,7 @@
(/////bundle.install "<" (binary char::<))
)))
-(template [<name> <category> <parser>]
+(with_template [<name> <category> <parser>]
[(def: .public <name>
(Parser (Type <category>))
(<text>.then <parser> <synthesis>.text))]
@@ -607,7 +607,7 @@
(function (_ extension_name generate archive [from to valueS])
(do //////.monad
[valueG (generate archive valueS)]
- (in (`` (cond (~~ (template [<object> <type>]
+ (in (`` (cond (~~ (with_template [<object> <type>]
[(and (text#= (..reflection <type>) from)
(text#= <object> to))
(all _.composite
@@ -751,7 +751,7 @@
(_.invokestatic class method (type.method [(list) (list#each product.left inputsTG) outputT (list)]))
(prepare_output outputT)))))]))
-(template [<check_cast?> <name> <invoke>]
+(with_template [<check_cast?> <name> <invoke>]
[(def: <name>
Handler
(..custom
@@ -878,13 +878,13 @@
(pattern (//////synthesis.path/then bodyS))
(//////synthesis.path/then (normalize bodyS))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern {<tag> leftP rightP})
{<tag> (again leftP) (again rightP)}])
([//////synthesis.#Alt]
[//////synthesis.#Seq])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> _}
path])
([//////synthesis.#Pop]
@@ -894,7 +894,7 @@
{//////synthesis.#Bit_Fork when then else}
{//////synthesis.#Bit_Fork when (again then) (maybe#each again else)}
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> [[exampleH nextH] tail]}
{<tag> [[exampleH (again nextH)]
(list#each (function (_ [example next])
@@ -911,7 +911,7 @@
(-> Mapping Synthesis Synthesis)
(function (again body)
(case body
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern <tag>)
body])
([{//////synthesis.#Simple _}]
@@ -1053,7 +1053,7 @@
[(all _.composite
(///value.unwrap <type>)
<return>)]]
- (`` (cond (~~ (template [<return> <type>]
+ (`` (cond (~~ (with_template [<return> <type>]
[(at type.equivalence = <type> returnT)
(unwrap_primitive <return> <type>)]
@@ -1108,7 +1108,7 @@
(<load> jvm_register)
(///value.wrap <type>)
(_.astore lux_register))]]]
- (`` (cond (~~ (template [<shift> <load> <type>]
+ (`` (cond (~~ (with_template [<shift> <load> <type>]
[(at type.equivalence = <type> argumentT)
(wrap_primitive <shift> <load> <type>)]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux
index 5d9753b87..334e7a924 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux
@@ -56,8 +56,9 @@
{try.#Failure error}
(/////.except extension.invalid_syntax [extension_name %synthesis input]))))
-(template: (!unary function)
- [(|>> list _.apply (|> (_.var function)))])
+(def: !unary
+ (template (_ function)
+ [(|>> list _.apply (|> (_.var function)))]))
(def: .public (statement expression archive synthesis)
Phase!
@@ -68,7 +69,7 @@
[body (expression archive synthesis)]
(in (as Statement body)))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern (<tag> value))
(/////#each _.return (expression archive synthesis))])
([synthesis.bit]
@@ -80,7 +81,7 @@
[synthesis.branch/get]
[synthesis.function/apply])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern {<tag> value})
(/////#each _.return (expression archive synthesis))])
([synthesis.#Reference]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux
index 365fbe663..9b292c7e7 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux
@@ -83,7 +83,7 @@
inputsG (monad.each ! (phase archive) inputsS)]
(in (_.do methodS inputsG objectG))))]))
-(template [<!> <?> <unit>]
+(with_template [<!> <?> <unit>]
[(def: <!> (Nullary Expression) (function.constant <unit>))
(def: <?> (Unary Expression) (_.= <unit>))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux
index 911e63531..422f9cd4d 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux
@@ -51,8 +51,9 @@
{try.#Failure error}
(/////.except extension.invalid_syntax [extension_name %synthesis input]))))
-(template: (!unary function)
- (|>> list _.apply (|> (_.constant function))))
+(def: !unary
+ (template (_ function)
+ (|>> list _.apply (|> (_.constant function)))))
... TODO: Get rid of this ASAP
(def: lux::syntax_char_case!
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux
index 073c49818..e6bfc780f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux
@@ -87,7 +87,7 @@
inputsG (monad.each ! (phase archive) inputsS)]
(in (_.do methodS inputsG objectG))))]))
-(template [<!> <?> <unit>]
+(with_template [<!> <?> <unit>]
[(def: <!> (Nullary Expression) (function.constant <unit>))
(def: <?> (Unary Expression) (_.=== <unit>))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux
index e48f139a3..adc889695 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux
@@ -54,7 +54,7 @@
[body (expression archive synthesis)]
(in (as (Statement Any) body)))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern (<tag> value))
(/////#each _.return (expression archive synthesis))])
([synthesis.bit]
@@ -66,7 +66,7 @@
[synthesis.branch/get]
[synthesis.function/apply])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern {<tag> value})
(/////#each _.return (expression archive synthesis))])
([synthesis.#Reference]
@@ -75,7 +75,7 @@
(pattern (synthesis.branch/case case))
(//case.case! false statement expression archive case)
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> statement expression archive value)])
([synthesis.branch/exec //case.exec!]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux
index 0b00fd778..ba6885829 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux
@@ -84,7 +84,7 @@
inputsG (monad.each ! (phase archive) inputsS)]
(in (_.do methodS inputsG objectG))))]))
-(template [<!> <?> <unit>]
+(with_template [<!> <?> <unit>]
[(def: <!> (Nullary (Expression Any)) (function.constant <unit>))
(def: <?> (Unary (Expression Any)) (_.= <unit>))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux
index 8f1a0c53e..345d82477 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux
@@ -51,8 +51,9 @@
{try.#Failure error}
(/////.except extension.invalid_syntax [extension_name %synthesis input]))))
-... (template: (!unary function)
-... (|>> list _.apply (|> (_.constant function))))
+... (def: !unary
+... (template (_ function)
+... (|>> list _.apply (|> (_.constant function)))))
... ... ... TODO: Get rid of this ASAP
... ... (def: lux::syntax_char_case!
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux
index bee06eb6a..695b5e1e7 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux
@@ -66,7 +66,7 @@
(in (as Statement
body)))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern (<tag> value))
(/////#each _.return (expression archive synthesis))])
([synthesis.bit]
@@ -78,7 +78,7 @@
[synthesis.branch/get]
[synthesis.function/apply])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern {<tag> value})
(/////#each _.return (expression archive synthesis))])
([synthesis.#Reference]
@@ -87,7 +87,7 @@
(pattern (synthesis.branch/case case))
(//case.case! false statement expression archive case)
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> statement expression archive value)])
([synthesis.branch/exec //case.exec!]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux
index 4895535d5..6decb3fcf 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux
@@ -83,7 +83,7 @@
inputsG (monad.each ! (phase archive) inputsS)]
(in (_.do methodS inputsG {.#None} objectG))))]))
-(template [<!> <?> <unit>]
+(with_template [<!> <?> <unit>]
[(def: <!> (Nullary Expression) (function.constant <unit>))
(def: <?> (Unary Expression) (_.= <unit>))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux
index a3235673f..18f902d29 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux
@@ -51,8 +51,9 @@
{try.#Failure error}
(/////.except extension.invalid_syntax [extension_name %synthesis input]))))
-(template: (!unary function)
- (|>> list _.apply (|> (_.constant function))))
+(def: !unary
+ (template (_ function)
+ (|>> list _.apply (|> (_.constant function)))))
... TODO: Get rid of this ASAP
(def: lux::syntax_char_case!
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux
index 8a1f1d824..bbec22567 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux
@@ -64,7 +64,7 @@
(/.install "delete" (binary array::delete))
)))
-(template [<!> <?> <unit>]
+(with_template [<!> <?> <unit>]
[(def: <!> (Nullary Expression) (function.constant <unit>))
(def: <?> (Unary Expression) (_.eq?/2 <unit>))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux
index 33572414f..e016f9109 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux
@@ -28,7 +28,7 @@
(def: .public (generate archive synthesis)
Phase
(case synthesis
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(//////phase#in (<generator> value))])
([////synthesis.bit /primitive.bit]
@@ -39,7 +39,7 @@
{////synthesis.#Reference value}
(//reference.reference /reference.system archive value)
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> generate archive value)])
([////synthesis.variant /structure.variant]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux
index 3a94f56d6..3e0aabf99 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux
@@ -67,7 +67,7 @@
[valueG (expression archive valueS)]
(in (list#mix (function (_ side source)
(.let [method (.case side
- (^.template [<side> <accessor>]
+ (^.with_template [<side> <accessor>]
[(<side> lefts)
(<accessor> (_.int (.int lefts)))])
([.#Left //runtime.tuple//left]
@@ -106,7 +106,7 @@
(-> Nat (Expression Any))
(_.setq @cursor (_.nthcdr/2 [(_.int (.int pops)) @cursor])))
-(template [<name> <flag> <prep>]
+(with_template [<name> <flag> <prep>]
[(def: (<name> @fail simple? idx next!)
(-> _.Tag Bit Nat (Maybe (Expression Any)) (Expression Any))
(.let [<failure_condition> (_.eq/2 [@variant @temp])]
@@ -172,7 +172,7 @@
else!
then!))))
- (^.template [<tag> <format> <=>]
+ (^.with_template [<tag> <format> <=>]
[{<tag> item}
(do [! ///////phase.monad]
[clauses (monad.each ! (function (_ [match then])
@@ -190,7 +190,7 @@
[/////synthesis.#F64_Fork //primitive.f64 _.=/2]
[/////synthesis.#Text_Fork //primitive.text _.string=/2])
- (^.template [<complex> <simple> <choice>]
+ (^.with_template [<complex> <simple> <choice>]
[(pattern (<complex> idx))
(///////phase#in (<choice> @fail false idx {.#None}))
@@ -204,7 +204,7 @@
(pattern (/////synthesis.member/left 0))
(///////phase#in (..push! (_.elt/2 [..peek (_.int +0)])))
- (^.template [<pm> <getter>]
+ (^.with_template [<pm> <getter>]
[(pattern (<pm> lefts))
(///////phase#in (|> ..peek (<getter> (_.int (.int lefts))) ..push!))])
([/////synthesis.member/left //runtime.tuple//left]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux
index bb9c5681f..6c484b274 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux
@@ -41,7 +41,7 @@
(def: module_id
0)
-(template [<name> <base>]
+(with_template [<name> <base>]
[(type: .public <name>
(<base> [_.Tag Register] (Expression Any) (Expression Any)))]
@@ -170,9 +170,10 @@
(with_expansions [<recur> (these (all _.then
(_.; (_.set lefts (_.-/2 [last_index_right lefts])))
(_.; (_.set tuple (_.nth last_index_right tuple)))))]
- (template: (!recur <side>)
- (<side> (_.-/2 [last_index_right lefts])
- (_.elt/2 [tuple last_index_right])))
+ (def: !recur
+ (template (_ <side>)
+ (<side> (_.-/2 [last_index_right lefts])
+ (_.elt/2 [tuple last_index_right]))))
(runtime: (tuple//left lefts tuple)
(with_vars [last_index_right]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux
index fa1cabf00..a5471f9b6 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux
@@ -37,7 +37,7 @@
(def: (expression archive synthesis)
Phase
(case synthesis
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(//////phase#in (<generator> value))])
([synthesis.bit /primitive.bit]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux
index 963d0574b..aa18b4348 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux
@@ -149,7 +149,7 @@
(_.statement (|> @cursor (_.do "splice" (list (|> @cursor ..length (_.- popsJS))
popsJS))))))
-(template [<name> <flag>]
+(with_template [<name> <flag>]
[(def: (<name> simple? idx)
(-> Bit Nat Statement)
(all _.then
@@ -181,7 +181,7 @@
(-> (-> Path (Operation Statement))
(-> Path (Operation (Maybe Statement))))
(.case pathP
- (^.template [<simple> <choice>]
+ (^.with_template [<simple> <choice>]
[(pattern (<simple> idx nextP))
(|> nextP
again
@@ -203,7 +203,7 @@
then!)}))
... Extra optimization
- (^.template [<pm> <getter>]
+ (^.with_template [<pm> <getter>]
[(pattern (/////synthesis.path/seq
(<pm> lefts)
(/////synthesis.!bind_top register thenP)))
@@ -285,7 +285,7 @@
..fail_pm!
clauses)))
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[{<tag> item}
(do [! ///////phase.monad]
[cases (monad.each ! (function (_ [match then])
@@ -297,19 +297,19 @@
([/////synthesis.#F64_Fork //primitive.f64]
[/////synthesis.#Text_Fork //primitive.text])
- (^.template [<complex> <choice>]
+ (^.with_template [<complex> <choice>]
[(pattern (<complex> idx))
(///////phase#in (<choice> false idx))])
([/////synthesis.side/left ..left_choice]
[/////synthesis.side/right ..right_choice])
- (^.template [<pm> <getter>]
+ (^.with_template [<pm> <getter>]
[(pattern (<pm> lefts))
(///////phase#in (push_cursor! (<getter> (_.i32 (.int lefts)) ..peek_cursor)))])
([/////synthesis.member/left //runtime.tuple//left]
[/////synthesis.member/right //runtime.tuple//right])
- (^.template [<tag> <combinator>]
+ (^.with_template [<tag> <combinator>]
[(pattern (<tag> leftP rightP))
(do ///////phase.monad
[left! (again leftP)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
index 444254018..b51c272d6 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
@@ -39,7 +39,7 @@
["[0]" registry (.only Registry)]
["[0]" unit]]]]]])
-(template [<name> <base>]
+(with_template [<name> <base>]
[(type: .public <name>
(<base> [Register Text] Expression Statement))]
@@ -281,7 +281,7 @@
(-> Expression Expression Computation)
(_.new ..i64::new (list high low)))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(runtime: (<name> subject parameter)
(_.return (..i64 (<op> (_.the ..i64_high_field subject)
(_.the ..i64_high_field parameter))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux
index c4b026541..a23f31e36 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux
@@ -24,7 +24,7 @@
(def: .public (generate archive synthesis)
Phase
(case synthesis
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(///#in (<generator> value))])
([synthesis.bit /primitive.bit]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux
index 6857dae20..e96a88889 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux
@@ -123,7 +123,7 @@
(_.set_label @else)
else!)))))
-(template [<name> <type> <unwrap> <dup> <pop> <test> <comparison> <if>]
+(with_template [<name> <type> <unwrap> <dup> <pop> <test> <comparison> <if>]
[(def: (<name> again @else cons)
(-> (-> Path (Operation (Bytecode Any)))
Label (Fork <type> Path)
@@ -167,7 +167,7 @@
{synthesis.#Bind register}
(..path|bind register)
- (^.template [<tag> <path>]
+ (^.with_template [<tag> <path>]
[{<tag> it}
(<path> again @else it)])
([synthesis.#Bit_Fork ..path|bit_fork]
@@ -200,7 +200,7 @@
(_.set_label @success)
//runtime.push)))
- (^.template [<pattern> <projection>]
+ (^.with_template [<pattern> <projection>]
[(pattern (<pattern> lefts))
(operation#in (all _.composite
..peek
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux
index 21c740700..90c3044ae 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux
@@ -34,7 +34,7 @@
(def: .public (i64 value)
(-> (I64 Any) (Bytecode Any))
(case (.int value)
- (^.template [<int> <instruction>]
+ (^.with_template [<int> <instruction>]
[<int>
(do _.monad
[_ <instruction>]
@@ -42,7 +42,7 @@
([+0 _.lconst_0]
[+1 _.lconst_1])
- (^.template [<int> <instruction>]
+ (^.with_template [<int> <instruction>]
[<int>
(do _.monad
[_ <instruction>
@@ -91,14 +91,14 @@
(def: .public (f64 value)
(-> Frac (Bytecode Any))
(case value
- (^.template [<int> <instruction>]
+ (^.with_template [<int> <instruction>]
[<int>
(do _.monad
[_ <instruction>]
..wrap_f64)])
([+1.0 _.dconst_1])
- (^.template [<int> <instruction>]
+ (^.with_template [<int> <instruction>]
[<int>
(do _.monad
[_ <instruction>
@@ -106,7 +106,7 @@
..wrap_f64)])
([+2.0 _.fconst_2])
- (^.template [<int> <instruction>]
+ (^.with_template [<int> <instruction>]
[<int>
(do _.monad
[_ <instruction>
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux
index 11db49aed..7f6ade8c6 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux
@@ -30,7 +30,7 @@
(Bytecode Any)
_.aload_0)
-(template [<name> <prefix>]
+(with_template [<name> <prefix>]
[(def: .public <name>
(-> Register Text)
(|>> %.nat (format <prefix>)))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux
index 4c6a232f9..13f09e66e 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux
@@ -73,7 +73,7 @@
(type: .public Anchor
[Label Register])
-(template [<name> <base>]
+(with_template [<name> <base>]
[(type: .public <name>
(<base> Anchor (Bytecode Any) Definition))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux
index a415f60fa..9cd5f6d93 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux
@@ -10,10 +10,10 @@
(def: .public field "value")
-(template [<name> <boolean> <byte> <short> <int> <long> <float> <double> <char>]
+(with_template [<name> <boolean> <byte> <short> <int> <long> <float> <double> <char>]
[(def: (<name> type)
(-> (Type Primitive) Text)
- (`` (cond (~~ (template [<type> <output>]
+ (`` (cond (~~ (with_template [<type> <output>]
[(type#= <type> type) <output>]
[type.boolean <boolean>]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux
index 8d861e382..e14772296 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux
@@ -37,7 +37,7 @@
(def: (expression archive synthesis)
Phase
(case synthesis
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(//////phase#in (<generator> value))])
([synthesis.bit /primitive.bit]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux
index fd878a2b7..725a1f82b 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux
@@ -151,7 +151,7 @@
(def: fail! _.break)
-(template [<name> <flag>]
+(with_template [<name> <flag>]
[(def: (<name> simple? idx)
(-> Bit Nat Statement)
(all _.then
@@ -209,7 +209,7 @@
else!
then!))))
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[{<tag> item}
(do [! ///////phase.monad]
[clauses (monad.each ! (function (_ [match then])
@@ -227,7 +227,7 @@
[/////synthesis.#F64_Fork _.float]
[/////synthesis.#Text_Fork _.string])
- (^.template [<complex> <simple> <choice>]
+ (^.with_template [<complex> <simple> <choice>]
[(pattern (<complex> idx))
(///////phase#in (<choice> false idx))
@@ -239,7 +239,7 @@
(pattern (/////synthesis.member/left 0))
(///////phase#in (|> ..peek (_.item (_.int +1)) ..push!))
- (^.template [<pm> <getter>]
+ (^.with_template [<pm> <getter>]
[(pattern (<pm> lefts))
(///////phase#in (|> ..peek (<getter> (_.int (.int lefts))) ..push!))])
([/////synthesis.member/left //runtime.tuple//left]
@@ -252,7 +252,7 @@
(_.local/1 (..register register) ..peek_and_pop)
then!)))
- (^.template [<tag> <combinator>]
+ (^.with_template [<tag> <combinator>]
[(pattern (<tag> preP postP))
(do ///////phase.monad
[pre! (again preP)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/primitive.lux
index 736dbb450..ff40f0f26 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/primitive.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/primitive.lux
@@ -4,7 +4,7 @@
[target
["_" lua (.only Literal)]]]])
-(template [<name> <type> <implementation>]
+(with_template [<name> <type> <implementation>]
[(def: .public <name>
(-> <type> Literal)
<implementation>)]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
index 93f3cb980..503638aeb 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
@@ -39,7 +39,7 @@
["[0]" registry (.only Registry)]
["[0]" unit]]]]]])
-(template [<name> <base>]
+(with_template [<name> <base>]
[(type: .public <name>
(<base> [Register Label] Expression Statement))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux
index 3d2107867..dea69708f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux
@@ -32,7 +32,7 @@
(def: (statement expression archive synthesis)
Phase!
(case synthesis
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern (<tag> value))
(//////phase#each _.return (expression archive synthesis))])
([////synthesis.bit]
@@ -44,7 +44,7 @@
[////synthesis.branch/get]
[////synthesis.function/apply])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[(pattern {<tag> value})
(//////phase#each _.return (expression archive synthesis))])
([////synthesis.#Reference]
@@ -53,7 +53,7 @@
(pattern (////synthesis.branch/case case))
(/case.case! statement expression archive case)
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> statement expression archive value)])
([////synthesis.branch/let /case.let!]
@@ -70,7 +70,7 @@
(def: .public (expression archive synthesis)
Phase
(case synthesis
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(//////phase#in (<generator> value))])
([////synthesis.bit /primitive.bit]
@@ -81,7 +81,7 @@
{////synthesis.#Reference value}
(//reference.reference /reference.system archive value)
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> expression archive value)])
([////synthesis.variant /structure.variant]
@@ -91,7 +91,7 @@
[////synthesis.branch/get /case.get]
[////synthesis.function/apply /function.apply])
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> statement expression archive value)])
([////synthesis.branch/case /case.case]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux
index c05a3813d..c4f5534ac 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux
@@ -87,7 +87,7 @@
[valueG (expression archive valueS)]
(in (list#mix (function (_ side source)
(.let [method (.case side
- (^.template [<side> <accessor>]
+ (^.with_template [<side> <accessor>]
[(<side> lefts)
(<accessor> (_.int (.int lefts)))])
([.#Left //runtime.tuple//left]
@@ -134,7 +134,7 @@
(_.int +0)
(_.int (i.* -1 (.int pops)))])))
-(template [<name> <flag> <prep>]
+(with_template [<name> <flag> <prep>]
[(def: (<name> simple? idx)
(-> Bit Nat Statement)
(all _.then
@@ -191,7 +191,7 @@
else!
then!))))
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[{<tag> item}
(do [! ///////phase.monad]
[clauses (monad.each ! (function (_ [match then])
@@ -206,7 +206,7 @@
[/////synthesis.#F64_Fork //primitive.f64]
[/////synthesis.#Text_Fork //primitive.text])
- (^.template [<complex> <simple> <choice>]
+ (^.with_template [<complex> <simple> <choice>]
[(pattern (<complex> idx))
(///////phase#in (<choice> false idx))
@@ -220,7 +220,7 @@
(pattern (/////synthesis.member/left 0))
(///////phase#in (|> ..peek (_.item (_.int +0)) ..push!))
- (^.template [<pm> <getter>]
+ (^.with_template [<pm> <getter>]
[(pattern (<pm> lefts))
(///////phase#in (|> ..peek (<getter> (_.int (.int lefts))) ..push!))])
([/////synthesis.member/left //runtime.tuple//left]
@@ -241,7 +241,7 @@
... (..multi_pop! (n.+ 2 extra_pops))
... next!))))
- (^.template [<tag> <combinator>]
+ (^.with_template [<tag> <combinator>]
[(pattern (<tag> preP postP))
(do ///////phase.monad
[pre! (again preP)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux
index 5c22acced..501c2ac3d 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux
@@ -38,7 +38,7 @@
[archive (.only Output Archive)
["[0]" artifact (.only Registry)]]]]]])
-(template [<name> <base>]
+(with_template [<name> <base>]
[(type: .public <name>
(<base> [Nat Label] Expression Statement))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux
index f3e8d85b8..054e84344 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux
@@ -37,7 +37,7 @@
(def: .public (expression archive synthesis)
Phase
(case synthesis
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(//////phase#in (<generator> value))])
([////synthesis.bit /primitive.bit]
@@ -45,7 +45,7 @@
[////synthesis.f64 /primitive.f64]
[////synthesis.text /primitive.text])
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> expression archive value)])
([////synthesis.variant /structure.variant]
@@ -58,7 +58,7 @@
[////synthesis.function/apply /function.apply])
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> ///extension/common.statement expression archive value)])
([////synthesis.branch/case /case.case]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux
index d05828a5f..0997c9a9b 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux
@@ -155,7 +155,7 @@
(-> Nat (Statement Any))
(_.delete (_.slice_from (_.int (i.* -1 (.int pops))) @cursor)))
-(template [<name> <flag>]
+(with_template [<name> <flag>]
[(def: (<name> simple? idx)
(-> Bit Nat (Statement Any))
(all _.then
@@ -218,7 +218,7 @@
else!
then!))}))
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[{<tag> item}
(do [! ///////phase.monad]
[clauses (monad.each ! (function (_ [match then])
@@ -258,7 +258,7 @@
{/////synthesis.#Bind register}
(///////phase#in (_.set (list (..register register)) ..peek))
- (^.template [<complex> <simple> <choice>]
+ (^.with_template [<complex> <simple> <choice>]
[(pattern (<complex> idx))
(///////phase#in (<choice> false idx))
@@ -272,7 +272,7 @@
(pattern (/////synthesis.member/left 0))
(///////phase#in (|> ..peek (_.item (_.int +0)) ..push!))
- (^.template [<pm> <getter>]
+ (^.with_template [<pm> <getter>]
[(pattern (<pm> lefts))
(///////phase#in (|> ..peek (<getter> (_.int (.int lefts))) ..push!))])
([/////synthesis.member/left //runtime.tuple::left]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/primitive.lux
index c9ff8d221..7afebeba8 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/primitive.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/primitive.lux
@@ -6,7 +6,7 @@
["[0]" //
["[1][0]" runtime]])
-(template [<type> <name> <implementation>]
+(with_template [<type> <name> <implementation>]
[(def: .public <name>
(-> <type> (Expression Any))
<implementation>)]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
index 8ed7f8bb8..12d1f65c7 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
@@ -41,7 +41,7 @@
["[0]" registry (.only Registry)]
["[0]" unit]]]]]])
-(template [<name> <base>]
+(with_template [<name> <base>]
[(type: .public <name>
(<base> Register (Expression Any) (Statement Any)))]
@@ -283,7 +283,7 @@
(runtime: (i64::64 input)
(with_vars [temp]
- (`` (<| (~~ (template [<scenario> <iteration> <cap> <entrance>]
+ (`` (<| (~~ (with_template [<scenario> <iteration> <cap> <entrance>]
[(_.if (|> input <scenario>)
(all _.then
(_.set (list temp) (_.% <iteration> input))
@@ -336,7 +336,7 @@
(_.return (_.- (|> subject (..i64#/ param) (_.* param))
subject)))
-(template [<runtime> <host>]
+(with_template [<runtime> <host>]
[(runtime: (<runtime> left right)
(_.return (..i64::64 (<host> (..as_nat left) (..as_nat right)))))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux
index 3e4cf4f0e..582d8dd42 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux
@@ -30,7 +30,7 @@
(def: .public (generate archive synthesis)
Phase
(case synthesis
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(//////phase#in (<generator> value))])
([////synthesis.bit /primitive.bit]
@@ -41,7 +41,7 @@
{////synthesis.#Reference value}
(//reference.reference /reference.system archive value)
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> generate archive value)])
([////synthesis.variant /structure.variant]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux
index 52626fefb..a587c3883 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux
@@ -69,7 +69,7 @@
[valueO (expression archive valueS)]
(in (list#mix (function (_ side source)
(.let [method (.case side
- (^.template [<side> <accessor>]
+ (^.with_template [<side> <accessor>]
[(<side> lefts)
(<accessor> (_.int (.int lefts)))])
([.#Left //runtime.tuple::left]
@@ -162,7 +162,7 @@
else!
then!))))
- (^.template [<tag> <format> <=>]
+ (^.with_template [<tag> <format> <=>]
[{<tag> item}
(do [! ///////phase.monad]
[clauses (monad.each ! (function (_ [match then])
@@ -180,7 +180,7 @@
[/////synthesis.#F64_Fork //primitive.f64 _.=]
[/////synthesis.#Text_Fork //primitive.text _.=])
- (^.template [<pm> <flag> <prep>]
+ (^.with_template [<pm> <flag> <prep>]
[(pattern (<pm> idx))
(///////phase#in (all _.then
(_.set! $temp (|> idx <prep> .int _.int (//runtime.sum::get ..peek (//runtime.flag <flag>))))
@@ -193,7 +193,7 @@
(pattern (/////synthesis.member/left 0))
(///////phase#in (_.item (_.int +1) ..peek))
- (^.template [<pm> <getter>]
+ (^.with_template [<pm> <getter>]
[(pattern (<pm> lefts))
(///////phase#in (|> ..peek (<getter> (_.int (.int lefts))) ..push_cursor!))])
([/////synthesis.member/left //runtime.tuple::left]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/primitive.lux
index c377bbcc0..ca30d7b84 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/primitive.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/primitive.lux
@@ -6,7 +6,7 @@
["[0]" //
["[1][0]" runtime]])
-(template [<name> <type> <code>]
+(with_template [<name> <type> <code>]
[(def: .public <name>
(-> <type> Expression)
<code>)]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux
index 025abf8f6..85f63171f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux
@@ -152,7 +152,7 @@
))
... [[Bits]]
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [subjectO paramO])
Binary
(<op> paramO subjectO))]
@@ -162,7 +162,7 @@
[bit//xor runtimeT.bit//xor]
)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [subjectO paramO])
Binary
(<op> (runtimeT.int64_low paramO) subjectO))]
@@ -189,7 +189,7 @@
("static" MIN_VALUE Double)
("static" MAX_VALUE Double))
-(template [<name> <const> <encode>]
+(with_template [<name> <const> <encode>]
[(def: (<name> _)
Nullary
(<encode> <const>))]
@@ -199,7 +199,7 @@
[frac//max Double::MAX_VALUE r.float]
)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [subjectO paramO])
Binary
(|> subjectO (<op> paramO)))]
@@ -211,7 +211,7 @@
[int//rem runtimeT.int//%]
)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [subjectO paramO])
Binary
(<op> paramO subjectO))]
@@ -228,7 +228,7 @@
[text//< r.<]
)
-(template [<name> <cmp>]
+(with_template [<name> <cmp>]
[(def: (<name> [subjectO paramO])
Binary
(<cmp> paramO subjectO))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux
index ece7d2035..1f79ef1d6 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux
@@ -15,7 +15,7 @@
(/// ["[0]T" runtime])
(// ["@" common]))
-... (template [<name> <lua>]
+... (with_template [<name> <lua>]
... [(def: (<name> _) @.Nullary <lua>)]
... [lua//nil "nil"]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux
index e44c646d7..fbd61560c 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux
@@ -44,7 +44,7 @@
(def: module_id
0)
-(template [<name> <base>]
+(with_template [<name> <base>]
[(type: .public <name>
(<base> _.SVar _.Expression _.Expression))]
@@ -165,7 +165,7 @@
(def: high_shift (_.bit_shl (_.int +32)))
-(template [<name> <power>]
+(with_template [<name> <power>]
[(runtime: <name> (|> (_.as::integer (_.int +2)) (_.** (_.as::integer (_.int <power>)))))]
[f2^32 +32]
@@ -219,7 +219,7 @@
(i64.left_shifted 32)
(i64.or low)))
-(template [<name> <value>]
+(with_template [<name> <value>]
[(runtime: <name>
(..i64 <value>))]
@@ -638,7 +638,7 @@
@adt::variant
))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(runtime: (<name> mask input)
(i64::new (<op> (i64_high mask)
(i64_high input))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux
index 94f243273..ef188574b 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux
@@ -67,7 +67,7 @@
(phase#each (|>> ..artifact (at system constant'))
(////generation.remember archive name)))
-(template [<sigil> <name>]
+(with_template [<sigil> <name>]
[(def: .public (<name> system)
(All (_ expression)
(-> (System expression)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux
index f0e8638e4..6a11d8996 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux
@@ -37,7 +37,7 @@
(def: (expression archive synthesis)
Phase
(case synthesis
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(//////phase#in (<generator> value))])
([////synthesis.bit /primitive.bit]
@@ -45,7 +45,7 @@
[////synthesis.f64 /primitive.f64]
[////synthesis.text /primitive.text])
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> expression archive value)])
([////synthesis.variant /structure.variant]
@@ -58,7 +58,7 @@
[////synthesis.function/apply /function.apply])
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> ///extension/common.statement expression archive value)])
([////synthesis.branch/case /case.case]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux
index 56b9b11f6..4c9de660a 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux
@@ -159,7 +159,7 @@
{.#None}
@cursor)))
-(template [<name> <flag>]
+(with_template [<name> <flag>]
[(def: (<name> simple? idx)
(-> Bit Nat Statement)
(all _.then
@@ -227,7 +227,7 @@
else!
then!))}))
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[{<tag> item}
(do [! ///////phase.monad]
[clauses (monad.each ! (function (_ [match then])
@@ -284,7 +284,7 @@
else!
then!))))
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[{<tag> item}
(do [! ///////phase.monad]
[clauses (monad.each ! (function (_ [match then])
@@ -301,7 +301,7 @@
[/////synthesis.#F64_Fork (<| //primitive.f64)]
[/////synthesis.#Text_Fork (<| //primitive.text)])
- (^.template [<complex> <simple> <choice>]
+ (^.with_template [<complex> <simple> <choice>]
[(pattern (<complex> idx))
(///////phase#in (<choice> false idx))
@@ -315,7 +315,7 @@
(pattern (/////synthesis.member/left 0))
(///////phase#in (|> ..peek (_.item (_.int +0)) ..push!))
- (^.template [<pm> <getter>]
+ (^.with_template [<pm> <getter>]
[(pattern (<pm> lefts))
(///////phase#in (|> ..peek (<getter> (_.int (.int lefts))) ..push!))])
([/////synthesis.member/left //runtime.tuple//left]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/primitive.lux
index c717441cb..162936972 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/primitive.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/primitive.lux
@@ -4,7 +4,7 @@
[target
["_" ruby (.only Literal)]]]])
-(template [<type> <name> <implementation>]
+(with_template [<type> <name> <implementation>]
[(def: .public <name>
(-> <type> Literal)
<implementation>)]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
index 85a7286c1..ca2346d95 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
@@ -40,7 +40,7 @@
["[0]" unit]
["[0]" registry (.only Registry)]]]]]])
-(template [<name> <base>]
+(with_template [<name> <base>]
[(type: .public <name>
(<base> Register Expression Statement))]
@@ -286,7 +286,7 @@
(runtime: (i64::i64 input)
[..mruby? (_.return input)]
(with_vars [temp]
- (`` (<| (~~ (template [<scenario> <iteration> <cap> <entrance>]
+ (`` (<| (~~ (with_template [<scenario> <iteration> <cap> <entrance>]
[(_.if (|> input <scenario>)
(all _.then
(_.set (list temp) (_.% <iteration> input))
@@ -313,19 +313,20 @@
(def: i32::up
(_.bit_shl (_.int +32)))
-(template: (i64 @high @low)
- [(|> (_.? (i32::positive? @high)
- @high
- (|> (_.manual "+0xFFFFFFFF")
- (_.- @high)
- _.bit_not))
- i32::up
- (_.bit_or @low))])
+(def: i64
+ (template (_ @high @low)
+ [(|> (_.? (i32::positive? @high)
+ @high
+ (|> (_.manual "+0xFFFFFFFF")
+ (_.- @high)
+ _.bit_not))
+ i32::up
+ (_.bit_or @low))]))
(def: as_nat
(_.% ..i64::+iteration))
-(template [<runtime> <host>]
+(with_template [<runtime> <host>]
[(runtime: (<runtime> left right)
[..normal_ruby? (_.return (..i64::i64 (<host> (..as_nat left) (..as_nat right))))]
(with_vars [high low]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux
index 061a5c26c..2702efa5e 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux
@@ -30,7 +30,7 @@
(def: .public (generate archive synthesis)
Phase
(case synthesis
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(//////phase#in (<generator> value))])
([////synthesis.bit /primitive.bit]
@@ -41,7 +41,7 @@
{////synthesis.#Reference value}
(//reference.reference /reference.system archive value)
- (^.template [<tag> <generator>]
+ (^.with_template [<tag> <generator>]
[(pattern (<tag> value))
(<generator> generate archive value)])
([////synthesis.variant /structure.variant]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux
index 9a7db7f48..bcaf13e2f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux
@@ -67,7 +67,7 @@
[valueO (expression archive valueS)]
(in (list#mix (function (_ side source)
(.let [method (.case side
- (^.template [<side> <accessor>]
+ (^.with_template [<side> <accessor>]
[(<side> lefts)
(<accessor> (_.int (.int lefts)))])
([.#Left //runtime.tuple//left]
@@ -156,7 +156,7 @@
else!
then!))))
- (^.template [<tag> <format> <=>]
+ (^.with_template [<tag> <format> <=>]
[{<tag> item}
(do [! ///////phase.monad]
[clauses (monad.each ! (function (_ [match then])
@@ -174,7 +174,7 @@
[/////synthesis.#F64_Fork //primitive.f64 _.=/2]
[/////synthesis.#Text_Fork //primitive.text _.string=?/2])
- (^.template [<pm> <flag> <prep>]
+ (^.with_template [<pm> <flag> <prep>]
[(pattern (<pm> idx))
(///////phase#in (_.let (list [@temp (|> idx <prep> .int _.int (//runtime.sum//get ..peek (_.bool <flag>)))])
(_.if (_.null?/1 @temp)
@@ -186,7 +186,7 @@
(pattern (/////synthesis.member/left 0))
(///////phase#in (..push_cursor! (_.vector_ref/2 ..peek (_.int +0))))
- (^.template [<pm> <getter>]
+ (^.with_template [<pm> <getter>]
[(pattern (<pm> lefts))
(///////phase#in (|> ..peek (<getter> (_.int (.int lefts))) ..push_cursor!))])
([/////synthesis.member/left //runtime.tuple//left]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux
index 0de2a275a..3bf0659ba 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux
@@ -80,7 +80,7 @@
(bundle.install "is?" (binary (product.uncurried _.eq?/2)))
(bundle.install "try" (unary ///runtime.lux//try))))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [subjectO paramO])
Binary
(<op> paramO subjectO))]
@@ -104,7 +104,7 @@
Binary
(///runtime.i64//logical_right_shifted (_.remainder/2 (_.int +64) paramO) subjectO))
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [subjectO paramO])
Binary
(|> subjectO (<op> paramO)))]
@@ -116,7 +116,7 @@
[i64::% _.remainder/2]
)
-(template [<name> <op>]
+(with_template [<name> <op>]
[(def: (<name> [subjectO paramO])
Binary
(<op> paramO subjectO))]
@@ -133,7 +133,7 @@
[text::< _.string<?/2]
)
-(template [<name> <cmp>]
+(with_template [<name> <cmp>]
[(def: (<name> [subjectO paramO])
Binary
(<cmp> paramO subjectO))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/primitive.lux
index 5cebadb2b..0772c64bc 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/primitive.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/primitive.lux
@@ -4,7 +4,7 @@
[target
["_" scheme (.only Expression)]]]])
-(template [<name> <type> <code>]
+(with_template [<name> <type> <code>]
[(def: .public <name>
(-> <type> Expression)
<code>)]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux
index 63c9ae0ab..ab4177125 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux
@@ -42,7 +42,7 @@
(def: module_id
0)
-(template [<name> <base>]
+(with_template [<name> <base>]
[(type: .public <name>
(<base> Var Expression Expression))]
@@ -255,7 +255,7 @@
(runtime: (i64//64 input)
(with_vars [temp]
- (`` (<| (~~ (template [<scenario> <iteration> <cap> <entrance>]
+ (`` (<| (~~ (with_template [<scenario> <iteration> <cap> <entrance>]
[(_.if (|> input <scenario>)
(_.let (list [temp (_.remainder/2 <iteration> input)])
(_.if (|> temp <scenario>)
@@ -283,7 +283,7 @@
..as_nat
(_.arithmetic_shift/2 (_.-/2 shift (_.int +0)))))))
-(template [<runtime> <host>]
+(with_template [<runtime> <host>]
[(runtime: (<runtime> left right)
(..i64//64 (<host> (..as_nat left) (..as_nat right))))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux
index 99db4589b..de5d4c9e4 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux
@@ -35,14 +35,14 @@
{///simple.#Unit}
{/simple.#Text /.unit}
- (^.template [<analysis> <synthesis>]
+ (^.with_template [<analysis> <synthesis>]
[{<analysis> value}
{<synthesis> value}])
([///simple.#Bit /simple.#Bit]
[///simple.#Frac /simple.#F64]
[///simple.#Text /simple.#Text])
- (^.template [<analysis> <synthesis>]
+ (^.with_template [<analysis> <synthesis>]
[{<analysis> value}
{<synthesis> (.i64 value)}])
([///simple.#Nat /simple.#I64]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux
index a24d6f7d4..fcd14c576 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux
@@ -54,7 +54,7 @@
{/.#Bit_Fork when then {.#None}})
thenC)
- (^.template [<from> <to> <conversion>]
+ (^.with_template [<from> <to> <conversion>]
[{<from> test}
(///#each (function (_ then)
{<to> [(<conversion> test) then] (list)})
@@ -172,14 +172,14 @@
{.#Some old_else}
(weave new_then old_else))}})
- (^.template [<tag> <equivalence>]
+ (^.with_template [<tag> <equivalence>]
[[{<tag> new_fork} {<tag> old_fork}]
{<tag> (..weave_fork weave <equivalence> new_fork old_fork)}])
([/.#I64_Fork i64.equivalence]
[/.#F64_Fork frac.equivalence]
[/.#Text_Fork text.equivalence])
- (^.template [<access> <side> <lefts> <right?>]
+ (^.with_template [<access> <side> <lefts> <right?>]
[[{/.#Access {<access> [<lefts> newL <right?> <side>]}}
{/.#Access {<access> [<lefts> oldL <right?> <side>]}}]
(if (n.= newL oldL)
@@ -243,10 +243,11 @@
tailSP+ (monad.each ! (product.uncurried (path archive synthesize)) tailPA+)]
(in (/.branch/case [input (list#mix weave headSP tailSP+)]))))
-(template: (!masking <variable> <output>)
- [[[{///pattern.#Bind <variable>}
- {///analysis.#Reference (///reference.local <output>)}]
- (list)]])
+(def: !masking
+ (template (_ <variable> <output>)
+ [[[{///pattern.#Bind <variable>}
+ {///analysis.#Reference (///reference.local <output>)}]
+ (list)]]))
(def: .public (synthesize_exec synthesize archive before after)
(-> Phase Archive Synthesis Analysis (Operation Synthesis))
@@ -274,10 +275,11 @@
else (synthesize archive else)]
(in (/.branch/if [test then else]))))
-(template: (!get <patterns> <output>)
- [[[(///pattern.tuple <patterns>)
- {///analysis.#Reference (///reference.local <output>)}]
- (.list)]])
+(def: !get
+ (template (_ <patterns> <output>)
+ [[[(///pattern.tuple <patterns>)
+ {///analysis.#Reference (///reference.local <output>)}]
+ (.list)]]))
(def: .public (synthesize_get synthesize archive input patterns @member)
(-> Phase Archive Synthesis (///complex.Tuple Pattern) Register (Operation Synthesis))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux
index ac7a81a73..81e10d318 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux
@@ -42,8 +42,9 @@
(enum.range n.enum 1)
(list#each (|>> /.variable/local))))
-(template: .public (self_reference)
- [(/.variable/local 0)])
+(def: .public self_reference
+ (template (self_reference)
+ [(/.variable/local 0)]))
(def: (expanded_nested_self_reference arity)
(-> Arity Synthesis)
@@ -100,7 +101,7 @@
{/.#Bind register}
(phase#in {/.#Bind (++ register)})
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
(do phase.monad
[left' (grow_path grow left)
@@ -119,7 +120,7 @@
(in {.#None}))]
(in {/.#Bit_Fork when then else}))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> [[test then] elses]}
(do [! phase.monad]
[then (grow_path grow then)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux
index d57b85be1..eeb412da4 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux
@@ -36,7 +36,7 @@
{/.#Bind register}
{.#Some {/.#Bind (register_optimization offset register)}}
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
(do maybe.monad
[left' (again left)
@@ -55,7 +55,7 @@
(in {.#None}))]
(in {/.#Bit_Fork when then else}))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> [[test then] elses]}
(do [! maybe.monad]
[then (again then)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
index 1ea006203..6cd117d2d 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
@@ -68,7 +68,7 @@
register)}
(again post)}})
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
{<tag> (again left) (again right)}])
([/.#Seq]
@@ -77,7 +77,7 @@
{/.#Bit_Fork when then else}
{/.#Bit_Fork when (again then) (maybe#each again else)}
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> [[test then] tail]}
{<tag> [[test (again then)]
(list#each (function (_ [test' then'])
@@ -216,7 +216,7 @@
(in [redundancy
{.#Item head tail}])))))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [register Register])
(exception.report
"Register" (%.nat register)))]
@@ -274,7 +274,7 @@
(in [redundancy {.#None}]))]
(in [redundancy {/.#Bit_Fork when then else}]))
- (^.template [<tag> <type>]
+ (^.with_template [<tag> <type>]
[{<tag> [[test then] elses]}
(do [! try.monad]
[[redundancy then] (again [redundancy then])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux
index 3b7d560b4..d0bc4dbdc 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux
@@ -33,8 +33,9 @@
[control
["[0]" maybe]
["[0]" exception (.only exception:)]
- [parser
- [text (.only Offset)]]]
+ ["<>" parser (.only)
+ [text (.only Offset)]
+ ["<[0]>" code]]]
[data
["[0]" text (.only)
["%" format (.only format)]]
@@ -42,6 +43,7 @@
["[0]" list]
["[0]" dictionary (.only Dictionary)]]]
[macro
+ [syntax (.only syntax)]
["[0]" template]]
[meta
["[0]" symbol]]
@@ -52,11 +54,18 @@
["[0]" rev]
["[0]" frac]]]]])
-(template: (inline: <declaration> <type> <body>)
- [(for @.python (def: <declaration> <type> <body>)
- ... TODO: No longer skip inlining Lua after Rembulan isn't being used anymore.
- @.lua (def: <declaration> <type> <body>)
- (template: <declaration> [<body>]))])
+(def: declaration_name
+ (syntax (_ [[name parameters] (<code>.form (<>.and <code>.any (<>.some <code>.any)))])
+ (in (list name))))
+
+(def: inline:
+ (template (_ <declaration> <type> <body>)
+ [(for @.python (def: <declaration> <type> <body>)
+ ... TODO: No longer skip inlining Lua after Rembulan isn't being used anymore.
+ @.lua (def: <declaration> <type> <body>)
+ (`` (def: (~~ (..declaration_name <declaration>))
+ (template <declaration>
+ [<body>]))))]))
... TODO: Implement "lux syntax char case!" as a custom extension.
... That way, it should be possible to obtain the char without wrapping
@@ -74,29 +83,33 @@
(type: Char
Nat)
-(template [<extension> <diff> <name>]
- [(template: (<name> value)
- [(<extension> <diff> value)])]
+(with_template [<extension> <diff> <name>]
+ [(def: <name>
+ (template (_ value)
+ [(<extension> <diff> value)]))]
["lux i64 +" 1 !++]
["lux i64 +" 2 !++/2]
["lux i64 -" 1 !--]
)
-(template: (!clip from to text)
- [("lux text clip" from (n.- from to) text)])
+(def: !clip
+ (template (_ from to text)
+ [("lux text clip" from (n.- from to) text)]))
-(template [<name> <extension>]
- [(template: (<name> reference subject)
- [(<extension> reference subject)])]
+(with_template [<name> <extension>]
+ [(def: <name>
+ (template (_ reference subject)
+ [(<extension> reference subject)]))]
[!n/= "lux i64 ="]
[!i/< "lux i64 <"]
)
-(template [<name> <extension>]
- [(template: (<name> param subject)
- [(<extension> param subject)])]
+(with_template [<name> <extension>]
+ [(def: <name>
+ (template (_ param subject)
+ [(<extension> param subject)]))]
[!n/+ "lux i64 +"]
[!n/- "lux i64 -"]
@@ -114,7 +127,7 @@
(def: .public text_delimiter text.double_quote)
-(template [<char> <definition>]
+(with_template [<char> <definition>]
[(def: .public <definition> <char>)]
... Form delimiters
@@ -174,40 +187,46 @@
(exception.report
"Text" (%.text text)))
-(template: (!failure parser where offset source_code)
- [{.#Left [[where offset source_code]
- (exception.error ..unrecognized_input [where (%.symbol (symbol parser)) source_code offset])]}])
+(def: !failure
+ (template (_ parser where offset source_code)
+ [{.#Left [[where offset source_code]
+ (exception.error ..unrecognized_input [where (%.symbol (symbol parser)) source_code offset])]}]))
-(template: (!end_of_file where offset source_code current_module)
- [{.#Left [[where offset source_code]
- (exception.error ..end_of_file current_module)]}])
+(def: !end_of_file
+ (template (_ where offset source_code current_module)
+ [{.#Left [[where offset source_code]
+ (exception.error ..end_of_file current_module)]}]))
(type: (Parser a)
(-> Source (Either [Source Text] [Source a])))
-(template: (!with_char+ @source_code_size @source_code @offset @char @else @body)
- [(if (!i/< (as Int @source_code_size)
- (as Int @offset))
- (let [@char ("lux text char" @offset @source_code)]
- @body)
- @else)])
-
-(template: (!with_char @source_code @offset @char @else @body)
- [(!with_char+ ("lux text size" @source_code) @source_code @offset @char @else @body)])
-
-(template: (!letE <binding> <computation> <body>)
- [(case <computation>
- {.#Right <binding>}
- <body>
-
- ... {.#Left error}
- <<otherwise>>
- (as_expected <<otherwise>>))])
-
-(template: (!horizontal where offset source_code)
- [[(revised .#column ++ where)
- (!++ offset)
- source_code]])
+(def: !with_char+
+ (template (_ @source_code_size @source_code @offset @char @else @body)
+ [(if (!i/< (as Int @source_code_size)
+ (as Int @offset))
+ (let [@char ("lux text char" @offset @source_code)]
+ @body)
+ @else)]))
+
+(def: !with_char
+ (template (_ @source_code @offset @char @else @body)
+ [(!with_char+ ("lux text size" @source_code) @source_code @offset @char @else @body)]))
+
+(def: !letE
+ (template (_ <binding> <computation> <body>)
+ [(case <computation>
+ {.#Right <binding>}
+ <body>
+
+ ... {.#Left error}
+ <<otherwise>>
+ (as_expected <<otherwise>>))]))
+
+(def: !horizontal
+ (template (_ where offset source_code)
+ [[(revised .#column ++ where)
+ (!++ offset)
+ source_code]]))
(inline: (!new_line where)
(-> Location Location)
@@ -219,12 +238,13 @@
(let [[where::file where::line where::column] where]
[where::file where::line (!n/+ length where::column)]))
-(template: (!vertical where offset source_code)
- [[(!new_line where)
- (!++ offset)
- source_code]])
+(def: !vertical
+ (template (_ where offset source_code)
+ [[(!new_line where)
+ (!++ offset)
+ source_code]]))
-(template [<name> <close> <tag>]
+(with_template [<name> <close> <tag>]
[(inline: (<name> parse where offset source_code)
(-> (Parser Code) Location Offset Text
(Either [Source Text] [Source Code]))
@@ -248,14 +268,15 @@
[tuple_parser ..close_tuple .#Tuple]
)
-(template: (!guarantee_no_new_lines where offset source_code content body)
- [(case ("lux text index" 0 (static text.new_line) content)
- {.#None}
- body
+(def: !guarantee_no_new_lines
+ (template (_ where offset source_code content body)
+ [(case ("lux text index" 0 (static text.new_line) content)
+ {.#None}
+ body
- g!_
- {.#Left [[where offset source_code]
- (exception.error ..text_cannot_contain_new_lines content)]})])
+ g!_
+ {.#Left [[where offset source_code]
+ (exception.error ..text_cannot_contain_new_lines content)]})]))
(def: (text_parser where offset source_code)
(-> Location Offset Text (Either [Source Text] [Source Code]))
@@ -274,7 +295,7 @@
(!failure ..text_parser where offset source_code)))
(with_expansions [<digits> (these "0" "1" "2" "3" "4" "5" "6" "7" "8" "9")
- <non_symbol_chars> (template [<char>]
+ <non_symbol_chars> (with_template [<char>]
[(~~ (static <char>))]
[text.space]
@@ -285,56 +306,61 @@
[..open_tuple] [..close_tuple]
[..text_delimiter])
<digit_separator> (static ..digit_separator)]
- (template: (!if_digit? @char @then @else)
- [("lux syntax char case!" @char
- [[<digits>]
- @then]
-
- ... else
- @else)])
-
- (template: (!if_digit?+ @char @then @else_options @else)
- [(`` ("lux syntax char case!" @char
- [[<digits> <digit_separator>]
- @then
-
- (~~ (template.spliced @else_options))]
-
- ... else
- @else))])
-
- (`` (template: (!if_symbol_char?|tail @char @then @else)
- [("lux syntax char case!" @char
- [[<non_symbol_chars>]
- @else]
-
- ... else
- @then)]))
-
- (`` (template: (!if_symbol_char?|head @char @then @else)
- [("lux syntax char case!" @char
- [[<non_symbol_chars> <digits>]
- @else]
-
- ... else
- @then)]))
+ (def: !if_digit?
+ (template (_ @char @then @else)
+ [("lux syntax char case!" @char
+ [[<digits>]
+ @then]
+
+ ... else
+ @else)]))
+
+ (def: !if_digit?+
+ (template (_ @char @then @else_options @else)
+ [(`` ("lux syntax char case!" @char
+ [[<digits> <digit_separator>]
+ @then
+
+ (~~ (template.spliced @else_options))]
+
+ ... else
+ @else))]))
+
+ (`` (def: !if_symbol_char?|tail
+ (template (_ @char @then @else)
+ [("lux syntax char case!" @char
+ [[<non_symbol_chars>]
+ @else]
+
+ ... else
+ @then)])))
+
+ (`` (def: !if_symbol_char?|head
+ (template (_ @char @then @else)
+ [("lux syntax char case!" @char
+ [[<non_symbol_chars> <digits>]
+ @else]
+
+ ... else
+ @then)])))
)
-(template: (!number_output <source_code> <start> <end> <codec> <tag>)
- [(case (|> <source_code>
- (!clip <start> <end>)
- (text.replaced ..digit_separator "")
- (at <codec> decoded))
- {.#Right output}
- {.#Right [[(let [[where::file where::line where::column] where]
- [where::file where::line (!n/+ (!n/- <start> <end>) where::column)])
- <end>
- <source_code>]
- [where {<tag> output}]]}
-
- {.#Left error}
- {.#Left [[where <start> <source_code>]
- error]})])
+(def: !number_output
+ (template (_ <source_code> <start> <end> <codec> <tag>)
+ [(case (|> <source_code>
+ (!clip <start> <end>)
+ (text.replaced ..digit_separator "")
+ (at <codec> decoded))
+ {.#Right output}
+ {.#Right [[(let [[where::file where::line where::column] where]
+ [where::file where::line (!n/+ (!n/- <start> <end>) where::column)])
+ <end>
+ <source_code>]
+ [where {<tag> output}]]}
+
+ {.#Left error}
+ {.#Left [[where <start> <source_code>]
+ error]})]))
(def: no_exponent
Offset
@@ -344,7 +370,7 @@
<frac_output> (these (!number_output source_code start end frac.decimal .#Frac))
<failure> (!failure ..frac_parser where offset source_code)
<frac_separator> (static ..frac_separator)
- <signs> (template [<sign>]
+ <signs> (with_template [<sign>]
[(~~ (static <sign>))]
[..positive_sign]
@@ -388,7 +414,7 @@
<int_output>))))
)
-(template [<parser> <codec> <tag>]
+(with_template [<parser> <codec> <tag>]
[(inline: (<parser> source_code//size start where offset source_code)
(-> Nat Nat Location Offset Text
(Either [Source Text] [Source Code]))
@@ -403,12 +429,13 @@
[rev_parser rev.decimal .#Rev]
)
-(template: (!signed_parser source_code//size offset where source_code @aliases @end)
- [(<| (let [g!offset/1 (!++ offset)])
- (!with_char+ source_code//size source_code g!offset/1 g!char/1 @end)
- (!if_digit? g!char/1
- (signed_parser source_code//size offset where (!++/2 offset) source_code)
- (!full_symbol_parser offset [where (!++ offset) source_code] where @aliases .#Symbol)))])
+(def: !signed_parser
+ (template (_ source_code//size offset where source_code @aliases @end)
+ [(<| (let [g!offset/1 (!++ offset)])
+ (!with_char+ source_code//size source_code g!offset/1 g!char/1 @end)
+ (!if_digit? g!char/1
+ (signed_parser source_code//size offset where (!++/2 offset) source_code)
+ (!full_symbol_parser offset [where (!++ offset) source_code] where @aliases .#Symbol)))]))
(with_expansions [<output> {.#Right [[(revised .#column (|>> (!n/+ (!n/- start end))) where)
end
@@ -424,11 +451,12 @@
(again (!++ end))
<output>))))))
-(template: (!half_symbol_parser @offset @char @module)
- [(!if_symbol_char?|head @char
- (!letE [source' symbol] (..symbol_part_parser @offset (!forward 1 where) (!++ @offset) source_code)
- {.#Right [source' [@module symbol]]})
- (!failure ..!half_symbol_parser where @offset source_code))])
+(def: !half_symbol_parser
+ (template (_ @offset @char @module)
+ [(!if_symbol_char?|head @char
+ (!letE [source' symbol] (..symbol_part_parser @offset (!forward 1 where) (!++ @offset) source_code)
+ {.#Right [source' [@module symbol]]})
+ (!failure ..!half_symbol_parser where @offset source_code))]))
(`` (def: (short_symbol_parser source_code//size current_module [where offset/0 source_code])
(-> Nat Text (Parser Symbol))
@@ -441,9 +469,10 @@
(!half_symbol_parser offset/1 char/1 current_module))
(!half_symbol_parser offset/0 char/0 (static ..prelude))))))
-(template: (!short_symbol_parser source_code//size @current_module @source @where @tag)
- [(!letE [source' symbol] (..short_symbol_parser source_code//size @current_module @source)
- {.#Right [source' [@where {@tag symbol}]]})])
+(def: !short_symbol_parser
+ (template (_ source_code//size @current_module @source @where @tag)
+ [(!letE [source' symbol] (..short_symbol_parser source_code//size @current_module @source)
+ {.#Right [source' [@where {@tag symbol}]]})]))
(with_expansions [<simple> (these {.#Right [source' ["" simple]]})]
(`` (def: (full_symbol_parser aliases start source)
@@ -464,9 +493,10 @@
complex]]}))
<simple>)))))
-(template: (!full_symbol_parser @offset @source @where @aliases @tag)
- [(!letE [source' full_symbol] (..full_symbol_parser @aliases @offset @source)
- {.#Right [source' [@where {@tag full_symbol}]]})])
+(def: !full_symbol_parser
+ (template (_ @offset @source @where @aliases @tag)
+ [(!letE [source' full_symbol] (..full_symbol_parser @aliases @offset @source)
+ {.#Right [source' [@where {@tag full_symbol}]]})]))
... TODO: Grammar macro for specifying syntax.
... (grammar: lux_grammar
@@ -478,8 +508,9 @@
<move_2> (these [(!forward 1 where) (!++/2 offset/0) source_code])
<again> (these (parse current_module aliases source_code//size))]
- (template: (!close closer)
- [{.#Left [<move_1> closer]}])
+ (def: !close
+ (template (_ closer)
+ [{.#Left [<move_1> closer]}]))
(def: (bit_syntax value [where offset/0 source_code])
(-> Bit (Parser Code))
@@ -497,7 +528,7 @@
(function (again [where offset/0 source_code])
(<| (!with_char+ source_code//size source_code offset/0 char/0
(!end_of_file where offset/0 source_code current_module))
- (with_expansions [<composites> (template [<open> <close> <parser>]
+ (with_expansions [<composites> (with_template [<open> <close> <parser>]
[[(~~ (static <open>))]
(<parser> <again> <consume_1>)
@@ -568,7 +599,7 @@
(!with_char+ source_code//size source_code offset/1 char/1
(!end_of_file where offset/1 source_code current_module))
("lux syntax char case!" char/1
- [(~~ (template [<char> <bit>]
+ [(~~ (with_template [<char> <bit>]
[[<char>]
(..bit_syntax <bit> [where offset/0 source_code])]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux
index 2f9b007dd..831374079 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux
@@ -125,7 +125,7 @@
{#Control (Control Synthesis)}
{#Extension (Extension Synthesis)})))
-(template [<special> <general>]
+(with_template [<special> <general>]
[(type: .public <special>
(<general> ..State Analysis Synthesis))]
@@ -143,30 +143,33 @@
Path
{#Pop})
-(template [<name> <kind>]
- [(template: .public (<name> content)
- [(.<| {..#Access}
- {<kind>}
- content)])]
+(with_template [<name> <kind>]
+ [(def: .public <name>
+ (template (<name> content)
+ [(.<| {..#Access}
+ {<kind>}
+ content)]))]
[path/side /access.#Side]
[path/member /access.#Member]
)
-(template [<name> <access> <lefts> <right?>]
- [(template: .public (<name> lefts right?)
- [(.<| {..#Access}
- {<access>}
- [<lefts> lefts
- <right?> right?])])]
+(with_template [<name> <access> <lefts> <right?>]
+ [(def: .public <name>
+ (template (<name> lefts right?)
+ [(.<| {..#Access}
+ {<access>}
+ [<lefts> lefts
+ <right?> right?])]))]
[side /access.#Side /side.#lefts /side.#right?]
[member /access.#Member /member.#lefts /member.#right?]
)
-(template [<access> <side> <name>]
- [(template: .public (<name> lefts)
- [(<access> lefts <side>)])]
+(with_template [<access> <side> <name>]
+ [(def: .public <name>
+ (template (<name> lefts)
+ [(<access> lefts <side>)]))]
[..side #0 side/left]
[..side #1 side/right]
@@ -175,17 +178,19 @@
[..member #1 member/right]
)
-(template [<name> <tag>]
- [(template: .public (<name> content)
- [{<tag> content}])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [{<tag> content}]))]
[path/bind ..#Bind]
[path/then ..#Then]
)
-(template [<name> <tag>]
- [(template: .public (<name> left right)
- [{<tag> left right}])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> left right)
+ [{<tag> left right}]))]
[path/alt ..#Alt]
[path/seq ..#Seq]
@@ -201,7 +206,7 @@
Text
"")
-(template [<with> <query> <tag> <type>]
+(with_template [<with> <query> <tag> <type>]
[(def: .public (<with> value)
(-> <type> (All (_ a) (-> (Operation a) (Operation a))))
(extension.temporary (has <tag> value)))
@@ -220,9 +225,10 @@
[locals ..locals])
(..with_locals (++ locals))))
-(template [<name> <tag>]
- [(template: .public (<name> content)
- [{..#Simple {<tag> content}}])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [{..#Simple {<tag> content}}]))]
[bit /simple.#Bit]
[i64 /simple.#I64]
@@ -230,21 +236,23 @@
[text /simple.#Text]
)
-(template [<name> <tag>]
- [(template: .public (<name> content)
- [(.<| {..#Structure}
- {<tag>}
- content)])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [(.<| {..#Structure}
+ {<tag>}
+ content)]))]
[variant analysis/complex.#Variant]
[tuple analysis/complex.#Tuple]
)
-(template [<name> <tag>]
- [(template: .public (<name> content)
- [(.<| {..#Reference}
- <tag>
- content)])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [(.<| {..#Reference}
+ <tag>
+ content)]))]
[variable reference.variable]
[constant reference.constant]
@@ -252,12 +260,13 @@
[variable/foreign reference.foreign]
)
-(template [<name> <family> <tag>]
- [(template: .public (<name> content)
- [(.<| {..#Control}
- {<family>}
- {<tag>}
- content)])]
+(with_template [<name> <family> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [(.<| {..#Control}
+ {<family>}
+ {<tag>}
+ content)]))]
[branch/case ..#Branch ..#Case]
[branch/exec ..#Branch ..#Exec]
@@ -289,7 +298,7 @@
"")
")")
- (^.template [<tag> <format>]
+ (^.with_template [<tag> <format>]
[{<tag> item}
(|> {.#Item item}
(list#each (function (_ [test then])
@@ -422,7 +431,7 @@
(= reference_then sample_then)
(at (maybe.equivalence =) = reference_else sample_else))
- (^.template [<tag> <equivalence>]
+ (^.with_template [<tag> <equivalence>]
[[{<tag> reference_item}
{<tag> sample_item}]
(at (list.equivalence (product.equivalence <equivalence> =)) =
@@ -432,7 +441,7 @@
[#F64_Fork f.equivalence]
[#Text_Fork text.equivalence])
- (^.template [<tag> <equivalence>]
+ (^.with_template [<tag> <equivalence>]
[[{<tag> reference'} {<tag> sample'}]
(at <equivalence> = reference' sample')])
([#Access /access.equivalence]
@@ -441,7 +450,7 @@
[{#Bind reference'} {#Bind sample'}]
(n.= reference' sample')
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag> leftR rightR} {<tag> leftS rightS}]
(and (= leftR leftS)
(= rightR rightS))])
@@ -474,7 +483,7 @@
(hash then)
(at (maybe.hash (path'_hash super)) hash else))
- (^.template [<factor> <tag> <hash>]
+ (^.with_template [<factor> <tag> <hash>]
[{<tag> item}
(let [case_hash (product.hash <hash>
(path'_hash super))
@@ -484,7 +493,7 @@
[13 #F64_Fork f.hash]
[17 #Text_Fork text.hash])
- (^.template [<factor> <tag>]
+ (^.with_template [<factor> <tag>]
[{<tag> fork}
(let [again_hash (path'_hash super)
fork_hash (product.hash again_hash again_hash)]
@@ -642,7 +651,7 @@
(def: (= reference sample)
(case [reference sample]
- (^.template [<tag> <equivalence>]
+ (^.with_template [<tag> <equivalence>]
[[{<tag> reference} {<tag> sample}]
(at (<equivalence> #=) = reference sample)])
([#Branch ..branch_equivalence]
@@ -660,7 +669,7 @@
(def: (hash value)
(case value
- (^.template [<factor> <tag> <hash>]
+ (^.with_template [<factor> <tag> <hash>]
[{<tag> value}
(n.* <factor> (at (<hash> super) hash value))])
([2 #Branch ..branch_hash]
@@ -673,7 +682,7 @@
(def: (= reference sample)
(case [reference sample]
- (^.template [<tag> <equivalence>]
+ (^.with_template [<tag> <equivalence>]
[[{<tag> reference'} {<tag> sample'}]
(at <equivalence> = reference' sample')])
([#Simple /simple.equivalence]
@@ -697,7 +706,7 @@
(def: (hash value)
(let [again_hash [..equivalence hash]]
(case value
- (^.template [<tag> <hash>]
+ (^.with_template [<tag> <hash>]
[{<tag> value}
(at <hash> hash value)])
([#Simple /simple.hash]
@@ -706,17 +715,19 @@
[#Control (..control_hash again_hash)]
[#Extension (extension.hash again_hash)])))))
-(template: .public (!bind_top register thenP)
- [(all ..path/seq
- {..#Bind register}
- {..#Pop}
- thenP)])
+(def: .public !bind_top
+ (template (!bind_top register thenP)
+ [(all ..path/seq
+ {..#Bind register}
+ {..#Pop}
+ thenP)]))
-(template: .public (!multi_pop nextP)
- [(all ..path/seq
- {..#Pop}
- {..#Pop}
- nextP)])
+(def: .public !multi_pop
+ (template (!multi_pop nextP)
+ [(all ..path/seq
+ {..#Pop}
+ {..#Pop}
+ nextP)]))
... TODO: There are sister patterns to the simple side checks for tuples.
... These correspond to the situation where tuple members are accessed
@@ -725,12 +736,13 @@
... After re-implementing unused-variable-elimination, must add those
... pattern-optimizations again, since a lot of BINDs will become POPs
... and thus will result in useless code being generated.
-(template [<name> <side>]
- [(template: .public (<name> idx nextP)
- [(all ..path/seq
- (<side> idx)
- {..#Pop}
- nextP)])]
+(with_template [<name> <side>]
+ [(def: .public <name>
+ (template (<name> idx nextP)
+ [(all ..path/seq
+ (<side> idx)
+ {..#Pop}
+ nextP)]))]
[simple_left_side ..side/left]
[simple_right_side ..side/right]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/simple.lux b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/simple.lux
index a0fdb6e67..6a6e4b3b0 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/simple.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/simple.lux
@@ -29,7 +29,7 @@
(def: .public (format it)
(%.Format Simple)
(case it
- (^.template [<pattern> <format>]
+ (^.with_template [<pattern> <format>]
[{<pattern> value}
(<format> value)])
([#Bit %.bit]
@@ -44,7 +44,7 @@
(def: (= reference sample)
(case [reference sample]
- (^.template [<tag> <eq> <format>]
+ (^.with_template [<tag> <eq> <format>]
[[{<tag> reference'} {<tag> sample'}]
(<eq> reference' sample')])
([#Bit bit#= %.bit]
@@ -64,7 +64,7 @@
(def: hash
(|>> (pipe.case
- (^.template [<factor> <tag> <hash>]
+ (^.with_template [<factor> <tag> <hash>]
[{<tag> value'}
(n.* <factor> (at <hash> hash value'))])
([2 #Bit bit.hash]
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/archive.lux
index cf56ab7f3..1f12940df 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive.lux
@@ -56,7 +56,7 @@
"Old key" (signature.description (document.signature old))
"New key" (signature.description (document.signature new))))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [it descriptor.Module])
(exception.report
"Module" (%.text it)))]
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux
index d6dc3c74f..a3780a1b8 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux
@@ -51,7 +51,7 @@
[{#Definition left} {#Definition right}]
(at definition_equivalence = left right)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag> left} {<tag> right}]
(text#= left right)])
([#Analyser]
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux
index dade0e5d8..bc35ee361 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux
@@ -41,7 +41,7 @@
(def: (= left right)
(case [left right]
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag>} {<tag>}]
true])
([.#Active]
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux
index 7206a2f6c..dc0ed11fc 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux
@@ -59,7 +59,7 @@
dependencies]))
abstraction)]))
- (template [<tag> <create> <fetch> <type> <name> <+resolver>]
+ (with_template [<tag> <create> <fetch> <type> <name> <+resolver>]
[(def: .public (<create> it mandatory? dependencies registry)
(-> <type> Bit (Set unit.ID) Registry [ID Registry])
(let [id (..next registry)]
@@ -119,7 +119,7 @@
category (is (Writer Category)
(function (_ value)
(case value
- (^.template [<nat> <tag> <writer>]
+ (^.with_template [<nat> <tag> <writer>]
[{<tag> value}
((binary.and binary.nat <writer>) [<nat> value])])
([0 //category.#Anonymous binary.any]
@@ -164,7 +164,7 @@
(do [! <>.monad]
[tag <binary>.nat]
(case tag
- (^.template [<nat> <tag> <parser>]
+ (^.with_template [<nat> <tag> <parser>]
[<nat>
(at ! each (|>> {<tag>}) <parser>)])
([0 //category.#Anonymous <binary>.any]
@@ -188,7 +188,7 @@
{//category.#Anonymous}
(..resource mandatory? dependencies registry)
- (^.template [<tag> <create>]
+ (^.with_template [<tag> <create>]
[{<tag> name}
(<create> name mandatory? dependencies registry)])
([//category.#Definition ..definition]
diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux
index 6e5f46df9..160c23890 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux
@@ -45,7 +45,7 @@
{synthesis.#Bind _})
(list)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
(.all list#composite
(again left)
@@ -63,7 +63,7 @@
{.#None}
(again then))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> fork}
(|> {.#Item fork}
(list#each (|>> product.right again))
diff --git a/stdlib/source/library/lux/tool/compiler/meta/cli.lux b/stdlib/source/library/lux/tool/compiler/meta/cli.lux
index d611dde33..40ae2eb84 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/cli.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/cli.lux
@@ -70,7 +70,7 @@
{#Interpretation Interpretation}
{#Export Export}))
-(template [<name> <long> <type> <parser>]
+(with_template [<name> <long> <type> <parser>]
[(def: <name>
(Parser <type>)
(<cli>.named <long> <parser>))]
diff --git a/stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux b/stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux
index 1d37314b6..84107e91d 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux
@@ -30,7 +30,7 @@
(list.equivalence text.equivalence)
))
-(template [<ascii> <name>]
+(with_template [<ascii> <name>]
[(def: <name>
Text
(text.of_char (hex <ascii>)))]
diff --git a/stdlib/source/library/lux/tool/compiler/meta/context.lux b/stdlib/source/library/lux/tool/compiler/meta/context.lux
index b65bfc16e..cfacb3fe9 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/context.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/context.lux
@@ -15,7 +15,7 @@
#target Path
#artifact_extension Extension]))
-(template [<name> <host> <host_module_extension> <artifact_extension>]
+(with_template [<name> <host> <host_module_extension> <artifact_extension>]
[(def: .public (<name> target)
(-> Path Context)
[#host <host>
diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
index ff44f3258..4935aae78 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
@@ -221,7 +221,7 @@
content (document.content $.key document)
definitions (monad.each ! (function (_ [def_name def_global])
(case def_global
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> payload}
(in [def_name {<tag> payload}])])
([.#Alias]
diff --git a/stdlib/source/library/lux/tool/compiler/phase.lux b/stdlib/source/library/lux/tool/compiler/phase.lux
index 480ad7380..48b08b54b 100644
--- a/stdlib/source/library/lux/tool/compiler/phase.lux
+++ b/stdlib/source/library/lux/tool/compiler/phase.lux
@@ -106,10 +106,11 @@
(function (_ state)
(try#each (|>> [state]) error)))
-(template: .public (assertion exception message test)
- [(if test
- (at ..monad in [])
- (..except exception message))])
+(def: .public assertion
+ (template (assertion exception message test)
+ [(if test
+ (at ..monad in [])
+ (..except exception message))]))
(def: .public identity
(All (_ s a) (Phase s a a))
diff --git a/stdlib/source/library/lux/tool/compiler/reference.lux b/stdlib/source/library/lux/tool/compiler/reference.lux
index c20c13688..cd028073c 100644
--- a/stdlib/source/library/lux/tool/compiler/reference.lux
+++ b/stdlib/source/library/lux/tool/compiler/reference.lux
@@ -32,7 +32,7 @@
(def: (= reference sample)
(case [reference sample]
- (^.template [<tag> <equivalence>]
+ (^.with_template [<tag> <equivalence>]
[[{<tag> reference} {<tag> sample}]
(at <equivalence> = reference sample)])
([#Variable /variable.equivalence]
@@ -49,7 +49,7 @@
(def: (hash value)
(case value
- (^.template [<factor> <tag> <hash>]
+ (^.with_template [<factor> <tag> <hash>]
[{<tag> value}
(|> value
(at <hash> hash)
@@ -58,27 +58,30 @@
[3 #Constant symbol.hash])
)))
-(template [<name> <family> <tag>]
- [(template: .public (<name> content)
- [(<| {<family>}
- {<tag>}
- content)])]
+(with_template [<name> <family> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [(<| {<family>}
+ {<tag>}
+ content)]))]
[local ..#Variable /variable.#Local]
[foreign ..#Variable /variable.#Foreign]
)
-(template [<name> <tag>]
- [(template: .public (<name> content)
- [(<| {<tag>}
- content)])]
+(with_template [<name> <tag>]
+ [(def: .public <name>
+ (template (<name> content)
+ [(<| {<tag>}
+ content)]))]
[variable ..#Variable]
[constant ..#Constant]
)
-(`` (template: .public self
- [(..variable (~~ (/variable.self)))]))
+(`` (def: .public self
+ (template (self)
+ [(..variable (~~ (/variable.self)))])))
(def: .public format
(Format Reference)
diff --git a/stdlib/source/library/lux/tool/compiler/reference/variable.lux b/stdlib/source/library/lux/tool/compiler/reference/variable.lux
index 488901fff..ad3be0e06 100644
--- a/stdlib/source/library/lux/tool/compiler/reference/variable.lux
+++ b/stdlib/source/library/lux/tool/compiler/reference/variable.lux
@@ -29,7 +29,7 @@
(def: (= reference sample)
(case [reference sample]
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag> reference'} {<tag> sample'}]
(n.= reference' sample')])
([#Local] [#Foreign])
@@ -45,7 +45,7 @@
(def: hash
(|>> (pipe.case
- (^.template [<factor> <tag>]
+ (^.with_template [<factor> <tag>]
[{<tag> register}
(|> register
(at n.hash hash)
@@ -53,8 +53,9 @@
([2 #Local]
[3 #Foreign])))))
-(template: .public (self)
- [{..#Local 0}])
+(def: .public self
+ (template (self)
+ [{..#Local 0}]))
(def: .public self?
(-> Variable Bit)
diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux
index 643b86923..fd506820d 100644
--- a/stdlib/source/library/lux/type.lux
+++ b/stdlib/source/library/lux/type.lux
@@ -28,7 +28,7 @@
["[0]" location]
["[0]" symbol (.open: "[1]#[0]" equivalence codec)]]]])
-(template [<name> <tag>]
+(with_template [<name> <tag>]
[(def: .public (<name> type)
(-> Type [Nat Type])
(loop (again [num_args 0
@@ -64,7 +64,7 @@
_
[type (list)]))
-(template [<name> <tag>]
+(with_template [<name> <tag>]
[(def: .public (<name> type)
(-> Type (List Type))
(case type
@@ -90,7 +90,7 @@
(list#mix (function.flipped text#composite) ""))
")")
- (^.template [<tag> <open> <close> <flat>]
+ (^.with_template [<tag> <open> <close> <flat>]
[{<tag> _}
(all text#composite <open>
(|> (<flat> type)
@@ -125,7 +125,7 @@
(.let [[type_func type_args] (flat_application type)]
(all text#composite "(" (format type_func) " " (|> type_args (list#each format) list.reversed (list.interposed " ") (list#mix text#composite "")) ")"))
- (^.template [<tag> <desc>]
+ (^.with_template [<tag> <desc>]
[{<tag> env body}
(all text#composite "(" <desc> " {" (|> env (list#each format) (text.interposed " ")) "} " (format body) ")")])
([.#UnivQ "All"]
@@ -142,13 +142,13 @@
{.#Primitive name params}
{.#Primitive name (list#each (reduced env) params)}
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
{<tag> (reduced env left) (reduced env right)}])
([.#Sum] [.#Product]
[.#Function] [.#Apply])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> old_env def}
(case old_env
{.#End}
@@ -192,7 +192,7 @@
#1
(list.zipped_2 xparams yparams)))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag> xid} {<tag> yid}]
(n.= yid xid)])
([.#Var] [.#Ex] [.#Parameter])
@@ -206,7 +206,7 @@
(and (symbol#= xname yname)
(= xtype ytype))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[[{<tag> xL xR} {<tag> yL yR}]
(and (= xL yL) (= xR yR))])
([.#Sum] [.#Product])
@@ -231,7 +231,7 @@
{.#Item param params'}
(case func
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> env body}
(|> body
(reduced (partial_list func param env))
@@ -254,12 +254,12 @@
(` {.#Primitive (~ (code.text name))
(.list (~+ (list#each code params)))})
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> idx}
(` {<tag> (~ (code.nat idx))})])
([.#Var] [.#Ex] [.#Parameter])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
(` {<tag> (~ (code left))
(~ (code right))})])
@@ -268,7 +268,7 @@
{.#Named name sub_type}
(code.symbol name)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> env body}
(` {<tag> (.list (~+ (list#each code env)))
(~ (code body))})])
@@ -293,7 +293,7 @@
_
type))
-(template [<name> <base> <ctor>]
+(with_template [<name> <base> <ctor>]
[(def: .public (<name> types)
(-> (List Type) Type)
(case types
@@ -328,7 +328,7 @@
{.#Item param params'}
(application params' {.#Apply param quant})))
-(template [<name> <tag>]
+(with_template [<name> <tag>]
[(def: .public (<name> size body)
(-> Nat Type Type)
(case size
@@ -483,7 +483,7 @@
{.#Primitive name co_variant}
{.#Primitive name (list#each again co_variant)}
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
{<tag> (again left) (again right)}])
([.#Sum]
@@ -491,7 +491,7 @@
[.#Function]
[.#Apply])
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> env body}
{<tag> (list#each again env) (again body)}])
([.#UnivQ]
diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux
index 4e9a81e48..f494749f2 100644
--- a/stdlib/source/library/lux/type/check.lux
+++ b/stdlib/source/library/lux/type/check.lux
@@ -23,11 +23,13 @@
["n" nat (.open: "[1]#[0]" decimal)]]]]]
["[0]" // (.open: "[1]#[0]" equivalence)])
-(template: (!n#= reference subject)
- [("lux i64 =" reference subject)])
+(def: !n#=
+ (template (_ reference subject)
+ [("lux i64 =" reference subject)]))
-(template: (!text#= reference subject)
- [("lux text =" reference subject)])
+(def: !text#=
+ (template (_ reference subject)
+ [("lux text =" reference subject)]))
(exception: .public (unknown_type_var [id Nat])
(exception.report
@@ -194,7 +196,7 @@
{try.#Success [(revised .#ex_counter ++ context)
[id {.#Ex id}]]})))
-(template [<name> <outputT> <fail> <succeed>]
+(with_template [<name> <outputT> <fail> <succeed>]
[(def: .public (<name> id)
(-> Var (Check <outputT>))
(function (_ context)
@@ -527,7 +529,7 @@
(set.list ringA))]
(in assumptions))))
- (^.template [<pattern> <id> <type>]
+ (^.with_template [<pattern> <id> <type>]
[<pattern>
(do !
[ring (..ring <id>)
@@ -661,7 +663,7 @@
(function (_ bound)
(check' assumptions expected bound)))
- (^.template [<fE> <fA>]
+ (^.with_template [<fE> <fA>]
[[{.#Apply aE <fE>} {.#Apply aA <fA>}]
(check_apply check' assumptions [aE <fE>] [aA <fA>])])
([F1 {.#Ex ex}]
@@ -683,7 +685,7 @@
(check' assumptions expected actual'))
... TODO: Refactor-away as cold-code
- (^.template [<tag> <instancer>]
+ (^.with_template [<tag> <instancer>]
[[{<tag> _} _]
(do ..monad
[[_ paramT] <instancer>
@@ -693,7 +695,7 @@
[.#ExQ ..var])
... TODO: Refactor-away as cold-code
- (^.template [<tag> <instancer>]
+ (^.with_template [<tag> <instancer>]
[[_ {<tag> _}]
(do ..monad
[[_ paramT] <instancer>
@@ -720,7 +722,7 @@
..silent_failure!))
..silent_failure!)
- (^.template [<composite>]
+ (^.with_template [<composite>]
[[{<composite> eL eR} {<composite> aL aR}]
(do ..monad
[assumptions (check' assumptions eL aL)]
@@ -782,7 +784,7 @@
(^.or {.#Parameter _} {.#Ex _} {.#Named _})
(check#in inputT)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> leftT rightT}
(do ..monad
[leftT' (clean aliases leftT)]
@@ -817,7 +819,7 @@
failure
(in inputT))))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> envT+ unquantifiedT}
(do [! ..monad]
[envT+' (monad.each ! (clean aliases) envT+)
diff --git a/stdlib/source/library/lux/type/poly.lux b/stdlib/source/library/lux/type/poly.lux
index 59d94e85f..fa27e032b 100644
--- a/stdlib/source/library/lux/type/poly.lux
+++ b/stdlib/source/library/lux/type/poly.lux
@@ -58,7 +58,7 @@
(` {.#Primitive (~ (code.text name))
(.list (~+ (list#each (code env) params)))})
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> idx}
(` {<tag> (~ (code.nat idx))})])
([.#Var] [.#Ex])
@@ -75,13 +75,13 @@
0 (|> env (dictionary.value 0) maybe.trusted product.left (code env))
idx (undefined))
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> left right}
(` {<tag> (~ (code env left))
(~ (code env right))})])
([.#Function] [.#Apply])
- (^.template [<macro> <tag> <flattener>]
+ (^.with_template [<macro> <tag> <flattener>]
[{<tag> left right}
(` (<macro> (~+ (list#each (code env) (<flattener> type)))))])
([.Union .#Sum type.flat_variant]
@@ -90,7 +90,7 @@
{.#Named name sub_type}
(code.symbol name)
- (^.template [<tag>]
+ (^.with_template [<tag>]
[{<tag> scope body}
(` {<tag> (.list (~+ (list#each (code env) scope)))
(~ (code env body))})])
diff --git a/stdlib/source/library/lux/type/primitive.lux b/stdlib/source/library/lux/type/primitive.lux
index 739afa0cd..5825cdf92 100644
--- a/stdlib/source/library/lux/type/primitive.lux
+++ b/stdlib/source/library/lux/type/primitive.lux
@@ -47,16 +47,17 @@
(Stack Frame)
{.#End})
-(template: (!peek <source> <reference> <then>)
- [(loop (again [entries <source>])
- (case entries
- {.#Item [head_name head] tail}
- (if (text#= <reference> head_name)
- <then>
- (again tail))
-
- {.#End}
- (undefined)))])
+(def: !peek
+ (template (_ <source> <reference> <then>)
+ [(loop (again [entries <source>])
+ (case entries
+ {.#Item [head_name head] tail}
+ (if (text#= <reference> head_name)
+ <then>
+ (again tail))
+
+ {.#End}
+ (undefined)))]))
(def: (peek_frames_definition reference source)
(-> Text (List [Text Global]) (Stack Frame))
@@ -105,18 +106,19 @@
(-> Text (Meta Frame))
(..peek! {.#Some name}))
-(template: (!push <source> <reference> <then>)
- [(loop (again [entries <source>])
- (case entries
- {.#Item [head_name head] tail}
- (if (text#= <reference> head_name)
- {.#Item [head_name <then>]
- tail}
- {.#Item [head_name head]
- (again tail)})
+(def: !push
+ (template (_ <source> <reference> <then>)
+ [(loop (again [entries <source>])
+ (case entries
+ {.#Item [head_name head] tail}
+ (if (text#= <reference> head_name)
+ {.#Item [head_name <then>]
+ tail}
+ {.#Item [head_name head]
+ (again tail)})
- {.#End}
- (undefined)))])
+ {.#End}
+ (undefined)))]))
(def: (push_frame_definition reference frame source)
(-> Text Frame (List [Text Global]) (List [Text Global]))
@@ -185,7 +187,7 @@
(<>.either (<>.and (<>.maybe <code>.local) <code>.any)
(<>.and (<>#in {.#None}) <code>.any)))
-(template [<name> <from> <to>]
+(with_template [<name> <from> <to>]
[(def: .public <name>
(syntax (_ [[frame value] ..cast])
(do meta.monad
diff --git a/stdlib/source/library/lux/type/quotient.lux b/stdlib/source/library/lux/type/quotient.lux
index c9e37a60d..0382c5e1f 100644
--- a/stdlib/source/library/lux/type/quotient.lux
+++ b/stdlib/source/library/lux/type/quotient.lux
@@ -32,7 +32,7 @@
(abstraction [#value value
#label ((representation Class class) value)]))
- (template [<name> <output> <slot>]
+ (with_template [<name> <output> <slot>]
[(def: .public <name>
(All (_ t c %) (-> (Quotient t c %) <output>))
(|>> representation (the <slot>)))]
diff --git a/stdlib/source/library/lux/type/refinement.lux b/stdlib/source/library/lux/type/refinement.lux
index fd571bc68..6eefbe2fb 100644
--- a/stdlib/source/library/lux/type/refinement.lux
+++ b/stdlib/source/library/lux/type/refinement.lux
@@ -29,7 +29,7 @@
#predicate predicate])}
{.#None})))
- (template [<name> <output> <slot>]
+ (with_template [<name> <output> <slot>]
[(def: .public <name>
(All (_ t %) (-> (Refined t %) <output>))
(|>> representation (the <slot>)))]
diff --git a/stdlib/source/library/lux/type/resource.lux b/stdlib/source/library/lux/type/resource.lux
index 66556b724..d6150bdf6 100644
--- a/stdlib/source/library/lux/type/resource.lux
+++ b/stdlib/source/library/lux/type/resource.lux
@@ -72,7 +72,7 @@
(primitive: .public (Key mode key)
Any
- (template [<name> <mode>]
+ (with_template [<name> <mode>]
[(def: <name>
(Ex (_ k) (-> Any (Key <mode> k)))
(|>> abstraction))]
@@ -84,7 +84,7 @@
(primitive: .public (Res key value)
value
- (template [<name> <mode> <key>]
+ (with_template [<name> <mode> <key>]
[(def: .public (<name> monad value)
(All (_ ! v) (Ex (_ k) (-> (Monad !) v (Affine ! (Key <mode> k) (Res k v)))))
(function (_ keys)
@@ -165,7 +165,7 @@
(n.> 0 raw))]
(in raw)))
-(template [<name> <from> <to>]
+(with_template [<name> <from> <to>]
[(def: .public <name>
(syntax (_ [amount ..amount])
(macro.with_symbols [g!_ g!context g!!]
diff --git a/stdlib/source/library/lux/type/unit.lux b/stdlib/source/library/lux/type/unit.lux
index 2b31de229..8dbda8dd2 100644
--- a/stdlib/source/library/lux/type/unit.lux
+++ b/stdlib/source/library/lux/type/unit.lux
@@ -37,7 +37,7 @@
(All (_ unit) (-> (Qty unit) Int))
(|>> representation))
- (template [<name> <op>]
+ (with_template [<name> <op>]
[(def: .public (<name> param subject)
(All (_ unit) (-> (Qty unit) (Qty unit) (Qty unit)))
(abstraction (<op> (representation param)
@@ -47,7 +47,7 @@
[- i.-]
)
- (template [<name> <op> <p> <s> <p*s>]
+ (with_template [<name> <op> <p> <s> <p*s>]
[(def: .public (<name> param subject)
(All (_ p s) (-> (Qty <p>) (Qty <s>) (Qty <p*s>)))
(abstraction (<op> (representation param)
@@ -161,7 +161,7 @@
(syntax (_ [type_name <code>.local])
(in (list (code.local (text.lower_cased type_name))))))
-(template [<type> <from> <to>]
+(with_template [<type> <from> <to>]
[(`` (scale: .public <type>
(~~ (implementation_name <type>))
[<from> <to>]))]
@@ -175,7 +175,7 @@
[Nano 1,000,000,000 1]
)
-(template [<type>]
+(with_template [<type>]
[(`` (unit: .public <type>
(~~ (implementation_name <type>))))]
diff --git a/stdlib/source/library/lux/type/variance.lux b/stdlib/source/library/lux/type/variance.lux
index b4fe87431..49563c465 100644
--- a/stdlib/source/library/lux/type/variance.lux
+++ b/stdlib/source/library/lux/type/variance.lux
@@ -16,11 +16,12 @@
(type: .public (Mutable r w)
(Primitive "#Mutable" [(-> w r)]))
-(template [<name> <type>]
- [(template: .public (<name> it)
- [((.is (.All (_ r w) <type>)
- (.|>> .as_expected))
- it)])]
+(with_template [<name> <type>]
+ [(def: .public <name>
+ (template (<name> it)
+ [((.is (.All (_ r w) <type>)
+ (.|>> .as_expected))
+ it)]))]
[read (.-> (..Mutable r w) r)]
[write (.-> w (..Mutable r w))]
@@ -32,11 +33,12 @@
(type: .public (Write_Only a)
(Mutable Any a))
-(template [<name> <type>]
- [(template: .public (<name> it)
- [((.is (.All (_ r w) <type>)
- (.|>>))
- it)])]
+(with_template [<name> <type>]
+ [(def: .public <name>
+ (template (<name> it)
+ [((.is (.All (_ r w) <type>)
+ (.|>>))
+ it)]))]
[read_only (.-> (..Mutable r w) (..Read_Only r))]
[write_only (.-> (..Mutable r w) (..Write_Only w))]
diff --git a/stdlib/source/library/lux/world/console.lux b/stdlib/source/library/lux/world/console.lux
index a996fc3ea..ab9149b92 100644
--- a/stdlib/source/library/lux/world/console.lux
+++ b/stdlib/source/library/lux/world/console.lux
@@ -31,7 +31,7 @@
(def: .public (async console)
(-> (Console IO) (Console Async))
(`` (implementation
- (~~ (template [<capability>]
+ (~~ (with_template [<capability>]
[(def: <capability>
(|>> (at console <capability>) async.future))]
@@ -118,25 +118,26 @@
(exception: .public cannot_read)
- (template: (!read <type> <query>)
- [(let [it (process::stdin)]
- (case (Readable_Stream::read it)
- {.#Some buffer}
- (let [input (Buffer::toString buffer)]
- (case (is (Maybe [<type> Text])
- <query>)
- {.#Some [head tail]}
- (exec
- (Readable_Stream::unshift|String tail it)
- (async#in {try.#Success head}))
-
- {.#None}
- (exec
- (Readable_Stream::unshift|Buffer buffer it)
- (async#in (exception.except ..cannot_read [])))))
-
- {.#None}
- (async#in (exception.except ..cannot_read []))))])
+ (def: !read
+ (template (_ <type> <query>)
+ [(let [it (process::stdin)]
+ (case (Readable_Stream::read it)
+ {.#Some buffer}
+ (let [input (Buffer::toString buffer)]
+ (case (is (Maybe [<type> Text])
+ <query>)
+ {.#Some [head tail]}
+ (exec
+ (Readable_Stream::unshift|String tail it)
+ (async#in {try.#Success head}))
+
+ {.#None}
+ (exec
+ (Readable_Stream::unshift|Buffer buffer it)
+ (async#in (exception.except ..cannot_read [])))))
+
+ {.#None}
+ (async#in (exception.except ..cannot_read []))))]))
(def: .public default
(Maybe (Console Async))
@@ -183,7 +184,7 @@
(All (_ s) (-> (Mock s) s (Console IO)))
(let [state (atom.atom init)]
(`` (implementation
- (~~ (template [<method> <mock>]
+ (~~ (with_template [<method> <mock>]
[(def: (<method> _)
(do [! io.monad]
[|state| (atom.read! state)]
diff --git a/stdlib/source/library/lux/world/db/jdbc.lux b/stdlib/source/library/lux/world/db/jdbc.lux
index 9c64494ad..e051f65bb 100644
--- a/stdlib/source/library/lux/world/db/jdbc.lux
+++ b/stdlib/source/library/lux/world/db/jdbc.lux
@@ -65,7 +65,7 @@
#input (Input input)
#value input]))
-(template [<name> <forge> <output>]
+(with_template [<name> <forge> <output>]
[(capability: .public (<name> ! i)
(<forge> (Statement i) (! (Try <output>))))]
@@ -107,7 +107,7 @@
(def: .public (async db)
(-> (DB IO) (DB Async))
(`` (implementation
- (~~ (template [<name> <forge>]
+ (~~ (with_template [<name> <forge>]
[(def: <name> (<forge> (|>> (!.use (at db <name>)) async.future)))]
[execute can_execute]
diff --git a/stdlib/source/library/lux/world/db/jdbc/input.lux b/stdlib/source/library/lux/world/db/jdbc/input.lux
index cf29414bd..19272665f 100644
--- a/stdlib/source/library/lux/world/db/jdbc/input.lux
+++ b/stdlib/source/library/lux/world/db/jdbc/input.lux
@@ -14,7 +14,7 @@
(import java/lang/String)
-(template [<class>]
+(with_template [<class>]
[(import <class>
(new [long]))]
@@ -22,7 +22,7 @@
)
(`` (import java/sql/PreparedStatement
- (~~ (template [<name> <type>]
+ (~~ (with_template [<name> <type>]
[(<name> [int <type>] "try" void)]
[setBoolean boolean]
@@ -71,7 +71,7 @@
(function (_ value context)
{try.#Success context}))
-(template [<function> <type> <setter>]
+(with_template [<function> <type> <setter>]
[(def: .public <function>
(Input <type>)
(function (_ value [idx statement])
@@ -93,7 +93,7 @@
[bytes Binary java/sql/PreparedStatement::setBytes]
)
-(template [<function> <setter> <constructor>]
+(with_template [<function> <setter> <constructor>]
[(def: .public <function>
(Input Instant)
(function (_ value [idx statement])
diff --git a/stdlib/source/library/lux/world/db/jdbc/output.lux b/stdlib/source/library/lux/world/db/jdbc/output.lux
index 73d96d9f3..65feaba99 100644
--- a/stdlib/source/library/lux/world/db/jdbc/output.lux
+++ b/stdlib/source/library/lux/world/db/jdbc/output.lux
@@ -24,7 +24,7 @@
(import java/sql/Timestamp)
(`` (import java/sql/ResultSet
- (~~ (template [<method_name> <return_class>]
+ (~~ (with_template [<method_name> <return_class>]
[(<method_name> [int] "try" <return_class>)]
[getBoolean boolean]
@@ -112,7 +112,7 @@
=right right]
(in [=left =right])))
-(template [<func_name> <method_name> <type>]
+(with_template [<func_name> <method_name> <type>]
[(def: .public <func_name>
(Output <type>)
(function (_ [idx result_set])
@@ -137,7 +137,7 @@
[bytes java/sql/ResultSet::getBytes Binary]
)
-(template [<func_name> <method_name>]
+(with_template [<func_name> <method_name>]
[(def: .public <func_name>
(Output Instant)
(function (_ [idx result_set])
diff --git a/stdlib/source/library/lux/world/db/sql.lux b/stdlib/source/library/lux/world/db/sql.lux
index 084ef671f..dba1f3c1a 100644
--- a/stdlib/source/library/lux/world/db/sql.lux
+++ b/stdlib/source/library/lux/world/db/sql.lux
@@ -20,7 +20,7 @@
(text.enclosed ["(" ")"]))
... Kind
-(template [<declaration>]
+(with_template [<declaration>]
[(primitive: .public <declaration> Any)]
[Literal']
@@ -66,7 +66,7 @@
Text
... SQL
- (template [<declaration> <kind>]
+ (with_template [<declaration> <kind>]
[(type: .public <declaration>
(SQL <kind>))]
@@ -140,7 +140,7 @@
(..parenthesize (..listing parameters)))))
... Condition
- (template [<name> <sql_op>]
+ (with_template [<name> <sql_op>]
[(def: .public (<name> reference sample)
(-> Value Value Condition)
(abstraction
@@ -175,7 +175,7 @@
" IN "
(..parenthesize (listing options)))))
- (template [<func_name> <sql_op>]
+ (with_template [<func_name> <sql_op>]
[(def: .public (<func_name> left right)
(-> Condition Condition Condition)
(abstraction
@@ -187,7 +187,7 @@
[or "OR"]
)
- (template [<name> <type> <sql>]
+ (with_template [<name> <type> <sql>]
[(def: .public <name>
(-> <type> Condition)
(|>> representation ..parenthesize (format <sql> " ") abstraction))]
@@ -197,7 +197,7 @@
)
... Query
- (template [<name> <type> <decoration>]
+ (with_template [<name> <type> <decoration>]
[(def: .public <name>
(-> <type> Source)
(|>> representation <decoration> abstraction))]
@@ -207,7 +207,7 @@
[from_query Any_Query ..parenthesize]
)
- (template [<func_name> <op>]
+ (with_template [<func_name> <op>]
[(def: .public (<func_name> columns source)
(-> (List [Column Alias]) Source Base_Query)
(abstraction
@@ -231,7 +231,7 @@
[select_distinct "SELECT DISTINCT"]
)
- (template [<name> <join_text>]
+ (with_template [<name> <join_text>]
[(def: .public (<name> table condition prev)
(-> Table Condition Base_Query Base_Query)
(abstraction
@@ -246,7 +246,7 @@
[full_outer_join "FULL OUTER JOIN"]
)
- (template [<function> <sql_op>]
+ (with_template [<function> <sql_op>]
[(def: .public (<function> left right)
(-> Any_Query Any_Query (Query Without_Where Without_Having No_Order No_Group No_Limit No_Offset))
(abstraction
@@ -259,7 +259,7 @@
[intersect "INTERSECT"]
)
- (template [<name> <sql> <variables> <input> <output>]
+ (with_template [<name> <sql> <variables> <input> <output>]
[(`` (def: .public (<name> value query)
(All (_ (~~ (template.spliced <variables>)))
(-> Nat <input> <output>))
@@ -277,7 +277,7 @@
(Query where having order group limit With_Offset)]
)
- (template [<name> <sql>]
+ (with_template [<name> <sql>]
[(def: .public <name>
Order
(abstraction <sql>))]
@@ -370,7 +370,7 @@
(-> Text (Schema Value))
(|>> abstraction))
- (template [<name> <attr>]
+ (with_template [<name> <attr>]
[(def: .public (<name> attr)
(-> (Schema Value) (Schema Value))
(abstraction
@@ -410,7 +410,7 @@
(abstraction
(format "CREATE TABLE " (representation table) " AS " (representation query))))
- (template [<name> <sql>]
+ (with_template [<name> <sql>]
[(def: .public (<name> table)
(-> Table Definition)
(abstraction
@@ -430,7 +430,7 @@
(abstraction
(format "ALTER TABLE " (representation table) " DROP COLUMN " (representation column))))
- (template [<name> <type>]
+ (with_template [<name> <type>]
[(def: .public (<name> name)
(-> Text <type>)
(abstraction name))]
@@ -442,7 +442,7 @@
[db DB]
)
- (template [<name> <type> <sql>]
+ (with_template [<name> <type> <sql>]
[(def: .public <name>
(-> <type> Definition)
(|>> representation (format <sql> " ") abstraction))]
@@ -452,7 +452,7 @@
[drop_view View "DROP VIEW"]
)
- (template [<name> <sql>]
+ (with_template [<name> <sql>]
[(def: .public (<name> view query)
(-> View Any_Query Definition)
(abstraction
diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux
index e88322775..697621578 100644
--- a/stdlib/source/library/lux/world/file.lux
+++ b/stdlib/source/library/lux/world/file.lux
@@ -46,7 +46,7 @@
(is Text
separator)
- (~~ (template [<name> <output>]
+ (~~ (with_template [<name> <output>]
[(is (-> Path (! <output>))
<name>)]
@@ -54,7 +54,7 @@
[directory? Bit]
))
- (~~ (template [<name> <output>]
+ (~~ (with_template [<name> <output>]
[(is (-> Path (! (Try <output>)))
<name>)]
@@ -69,7 +69,7 @@
[delete Any]
))
- (~~ (template [<name> <input>]
+ (~~ (with_template [<name> <input>]
[(is (-> Path <input> (! (Try Any)))
<name>)]
@@ -112,7 +112,7 @@
(def: separator
(at fs separator))
- (~~ (template [<name>]
+ (~~ (with_template [<name>]
[(def: <name>
(|>> (at fs <name>)
async.future))]
@@ -130,7 +130,7 @@
[read]
[delete]))
- (~~ (template [<name>]
+ (~~ (with_template [<name>]
[(def: (<name> path input)
(async.future (at fs <name> path input)))]
@@ -144,7 +144,7 @@
(All (_ !) (-> (System !) Path Text Path))
(format parent (at fs separator) child))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [file Path])
(exception.report
"Path" file))]
@@ -163,7 +163,7 @@
(`` (ffi.import java/io/File
"[1]::[0]"
(new [java/lang/String])
- (~~ (template [<name>]
+ (~~ (with_template [<name>]
[(<name> [] "io" "try" boolean)]
[createNewFile] [mkdir]
@@ -206,7 +206,7 @@
(def: separator
(ffi.of_string (java/io/File::separator)))
- (~~ (template [<name> <method>]
+ (~~ (with_template [<name> <method>]
[(def: <name>
(|>> ffi.as_string
java/io/File::new
@@ -222,7 +222,7 @@
java/io/File::new
java/io/File::mkdir))
- (~~ (template [<name> <method>]
+ (~~ (with_template [<name> <method>]
[(def: (<name> path)
(do [! (try.with io.monad)]
[?children (java/io/File::listFiles (java/io/File::new (ffi.as_string path)))]
@@ -281,7 +281,7 @@
java/io/File::new
(java/io/File::setLastModified (|> time_stamp instant.relative duration.millis ffi.as_long))))
- (~~ (template [<flag> <name>]
+ (~~ (with_template [<flag> <name>]
[(def: (<name> path data)
(do (try.with io.monad)
[stream (java/io/FileOutputStream::new (java/io/File::new (ffi.as_string path)) (ffi.as_boolean <flag>))
@@ -328,13 +328,14 @@
"[1]::[0]"
(toString [] ffi.String))
- (template: (with_async <write> <type> <body>)
- [(template.with_locals [<read>]
- (let [[<read> <write>] (is [(Async <type>) (async.Resolver <type>)]
- (async.async []))]
- (exec
- <body>
- <read>)))])
+ (def: with_async
+ (template (_ <write> <type> <body>)
+ [(template.with_locals [<read>]
+ (let [[<read> <write>] (is [(Async <type>) (async.Resolver <type>)]
+ (async.async []))]
+ (exec
+ <body>
+ <read>)))]))
(ffi.import Fs
"[1]::[0]"
@@ -387,7 +388,7 @@
(def: separator
js_separator)
- (~~ (template [<name> <method>]
+ (~~ (with_template [<name> <method>]
[(def: (<name> path)
(do async.monad
[?stats (with_async write! (Try Stats)
@@ -419,7 +420,7 @@
(with_async write! (Try Any)
(Fs::mkdir path (..any_callback write!) node_fs)))))
- (~~ (template [<name> <method>]
+ (~~ (with_template [<name> <method>]
[(def: (<name> path)
(do [! (try.with async.monad)]
[subs (with_async write! (Try (Array ffi.String))
@@ -493,7 +494,7 @@
(Fs::utimes path when when (..any_callback write!)
node_fs))))
- (~~ (template [<name> <method>]
+ (~~ (with_template [<name> <method>]
[(def: (<name> path data)
(with_async write! (Try Any)
(<method> path (Buffer::from data) (..any_callback write!)
@@ -553,7 +554,7 @@
(def: separator
..python_separator)
- (~~ (template [<name> <method>]
+ (~~ (with_template [<name> <method>]
[(def: <name>
(|>> <method>
(io#each (|>> (try.else false)))))]
@@ -565,7 +566,7 @@
(def: make_directory
os::mkdir)
- (~~ (template [<name> <method>]
+ (~~ (with_template [<name> <method>]
[(def: (<name> path)
(let [! (try.with io.monad)]
(|> path
@@ -614,7 +615,7 @@
(let [when (|> time_stamp instant.relative duration.millis (i./ +1,000))]
(os::utime path (..tuple [when when]))))
- (~~ (template [<name> <mode>]
+ (~~ (with_template [<name> <mode>]
[(def: (<name> path data)
(do (try.with io.monad)
[file (..open path <mode>)
@@ -679,7 +680,7 @@
(def: separator
..ruby_separator)
- (~~ (template [<name> <test>]
+ (~~ (with_template [<name> <test>]
[(def: <name>
(|>> <test>
(io#each (|>> (try.else false)))))]
@@ -691,7 +692,7 @@
(def: make_directory
FileUtils::mkdir)
- (~~ (template [<name> <test>]
+ (~~ (with_template [<name> <test>]
[(def: (<name> path)
(do [! (try.with io.monad)]
[self (Dir::open path)
@@ -718,7 +719,7 @@
[sub_directories RubyFile::directory?]
))
- (~~ (template [<name> <pipeline>]
+ (~~ (with_template [<name> <pipeline>]
[(def: <name>
(let [! (try.with io.monad)]
(|>> RubyFile::stat
@@ -757,7 +758,7 @@
Time::at)]
(RubyFile::utime moment moment path)))
- (~~ (template [<mode> <name>]
+ (~~ (with_template [<mode> <name>]
[(def: (<name> path data)
(do [! (try.with io.monad)]
[file (RubyFile::open path <mode>)
@@ -809,7 +810,7 @@
... (def: byte_array_format "C*")
... (def: default_separator (..DIRECTORY_SEPARATOR))
- ... (template [<name>]
+ ... (with_template [<name>]
... [(exception: .public (<name> [file Path])
... (exception.report
... "Path" file))]
@@ -820,7 +821,7 @@
... (`` (implementation: (file path)
... (-> Path (File IO))
- ... (~~ (template [<name> <mode>]
+ ... (~~ (with_template [<name> <mode>]
... [(def: (<name> data)
... (do [! (try.with io.monad)]
... [outcome (..file_put_contents [path ("php pack" ..byte_array_format data) <mode>])]
@@ -842,7 +843,7 @@
... (def: path
... path)
- ... (~~ (template [<name> <ffi> <pipeline>]
+ ... (~~ (with_template [<name> <ffi> <pipeline>]
... [(def: (<name> _)
... (do [! (try.with io.monad)]
... [value (<ffi> [path])]
@@ -885,7 +886,7 @@
... (def: scope
... path)
- ... (~~ (template [<name> <test> <constructor> <capability>]
+ ... (~~ (with_template [<name> <test> <constructor> <capability>]
... [(def: (<name> _)
... (do [! (try.with io.monad)]
... [children (..scandir [path])]
@@ -922,7 +923,7 @@
... (`` (implementation: .public default
... (System IO)
- ... (~~ (template [<name> <test> <constructor> <exception>]
+ ... (~~ (with_template [<name> <test> <constructor> <exception>]
... [(def: (<name> path)
... (do [! (try.with io.monad)]
... [verdict (<test> path)]
@@ -1152,7 +1153,7 @@
(def: separator
separator)
- (~~ (template [<method> <retrieve>]
+ (~~ (with_template [<method> <retrieve>]
[(def: (<method> path)
(|> store
stm.read
@@ -1178,7 +1179,7 @@
{try.#Failure error}
(in {try.#Failure error})))))
- (~~ (template [<method> <tag>]
+ (~~ (with_template [<method> <tag>]
[(def: (<method> path)
(stm.commit!
(do stm.monad
diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux
index 5b23bf373..9ae49eb74 100644
--- a/stdlib/source/library/lux/world/file/watch.lux
+++ b/stdlib/source/library/lux/world/file/watch.lux
@@ -45,7 +45,7 @@
#modification false
#deletion false]))
- (template [<concern> <predicate> <event> <create> <modify> <delete>]
+ (with_template [<concern> <predicate> <event> <create> <modify> <delete>]
[(def: .public <concern>
Concern
(abstraction
@@ -92,7 +92,7 @@
(is (-> [] (! (Try (List [Concern //.Path]))))
poll)))
-(template [<name>]
+(with_template [<name>]
[(exception: .public (<name> [path //.Path])
(exception.report
"Path" (%.text path)))]
diff --git a/stdlib/source/library/lux/world/input/keyboard.lux b/stdlib/source/library/lux/world/input/keyboard.lux
index 87aee8ece..79685c797 100644
--- a/stdlib/source/library/lux/world/input/keyboard.lux
+++ b/stdlib/source/library/lux/world/input/keyboard.lux
@@ -5,7 +5,7 @@
(type: .public Key
Nat)
-(template [<code> <name>]
+(with_template [<code> <name>]
[(def: .public <name> Key <code>)]
[00008 back_space]
@@ -102,7 +102,7 @@
[#pressed? Bit
#input Key]))
-(template [<bit> <name>]
+(with_template [<bit> <name>]
[(def: .public (<name> key)
(-> Key Press)
[#pressed? <bit>
diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux
index b424265f2..b7fd25d65 100644
--- a/stdlib/source/library/lux/world/net/http/client.lux
+++ b/stdlib/source/library/lux/world/net/http/client.lux
@@ -40,7 +40,7 @@
(syntax (_ [[_ name] <code>.symbol])
(in (list (code.local (text.replaced "#" "" (text.lower_cased name)))))))
-(template [<method>]
+(with_template [<method>]
[(with_expansions [<name> (method_function <method>)]
(def: .public (<name> url headers data client)
(All (_ !)
diff --git a/stdlib/source/library/lux/world/net/http/cookie.lux b/stdlib/source/library/lux/world/net/http/cookie.lux
index bb09b61ee..f35f4fa36 100644
--- a/stdlib/source/library/lux/world/net/http/cookie.lux
+++ b/stdlib/source/library/lux/world/net/http/cookie.lux
@@ -39,7 +39,7 @@
(%.int seconds)
(%.nat (.nat seconds)))))))
-(template [<name> <prefix>]
+(with_template [<name> <prefix>]
[(def: .public (<name> value)
(-> Text Directive)
(..directive (format <prefix> "=" value)))]
@@ -48,7 +48,7 @@
[path "Path"]
)
-(template [<name> <tag>]
+(with_template [<name> <tag>]
[(def: .public <name>
Directive
(..directive <tag>))]
diff --git a/stdlib/source/library/lux/world/net/http/mime.lux b/stdlib/source/library/lux/world/net/http/mime.lux
index fc62a7723..372a19b8f 100644
--- a/stdlib/source/library/lux/world/net/http/mime.lux
+++ b/stdlib/source/library/lux/world/net/http/mime.lux
@@ -21,7 +21,7 @@
)
... https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types
-(template [<name> <type>]
+(with_template [<name> <type>]
[(def: .public <name> MIME (..mime <type>))]
[aac_audio "audio/aac"]
diff --git a/stdlib/source/library/lux/world/net/http/response.lux b/stdlib/source/library/lux/world/net/http/response.lux
index 04cd4a695..db54411cc 100644
--- a/stdlib/source/library/lux/world/net/http/response.lux
+++ b/stdlib/source/library/lux/world/net/http/response.lux
@@ -62,7 +62,7 @@
(-> MIME Binary Response)
(content status.ok))
-(template [<name> <type> <mime> <pre>]
+(with_template [<name> <type> <mime> <pre>]
[(def: .public <name>
(-> <type> Response)
(|>> <pre> (at encoding.utf8 encoded) (..ok <mime>)))]
diff --git a/stdlib/source/library/lux/world/net/http/route.lux b/stdlib/source/library/lux/world/net/http/route.lux
index ec935d71e..b4f31b525 100644
--- a/stdlib/source/library/lux/world/net/http/route.lux
+++ b/stdlib/source/library/lux/world/net/http/route.lux
@@ -16,7 +16,7 @@
["[1][0]" status]
["[1][0]" response]])
-(template [<scheme> <name>]
+(with_template [<scheme> <name>]
[(def: .public (<name> server)
(-> Server Server)
(function (_ (^.let request [identification protocol resource message]))
@@ -31,7 +31,7 @@
[//.#HTTPS https]
)
-(template [<method> <name>]
+(with_template [<method> <name>]
[(def: .public (<name> server)
(-> Server Server)
(function (_ (^.let request [identification protocol resource message]))
diff --git a/stdlib/source/library/lux/world/net/http/status.lux b/stdlib/source/library/lux/world/net/http/status.lux
index 3c3966a33..2752b8651 100644
--- a/stdlib/source/library/lux/world/net/http/status.lux
+++ b/stdlib/source/library/lux/world/net/http/status.lux
@@ -4,7 +4,7 @@
[// (.only Status)])
... https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
-(template [<status> <name>]
+(with_template [<status> <name>]
[(def: .public <name>
Status
<status>)]
diff --git a/stdlib/source/library/lux/world/net/http/version.lux b/stdlib/source/library/lux/world/net/http/version.lux
index abfc20a0e..b56ddf052 100644
--- a/stdlib/source/library/lux/world/net/http/version.lux
+++ b/stdlib/source/library/lux/world/net/http/version.lux
@@ -3,7 +3,7 @@
[lux (.except)]]
[// (.only Version)])
-(template [<name> <version>]
+(with_template [<name> <version>]
[(def: .public <name> Version <version>)]
[v0_9 "0.9"]
diff --git a/stdlib/source/library/lux/world/output/video/resolution.lux b/stdlib/source/library/lux/world/output/video/resolution.lux
index 08b1c9939..fd6a1a9de 100644
--- a/stdlib/source/library/lux/world/output/video/resolution.lux
+++ b/stdlib/source/library/lux/world/output/video/resolution.lux
@@ -24,7 +24,7 @@
(at ..hash equivalence))
... https://en.wikipedia.org/wiki/Display_resolution#Common_display_resolutions
-(template [<name> <width> <height>]
+(with_template [<name> <width> <height>]
[(def: .public <name>
Resolution
[#width <width>
diff --git a/stdlib/source/library/lux/world/program.lux b/stdlib/source/library/lux/world/program.lux
index 9afde4c87..4c2a210b8 100644
--- a/stdlib/source/library/lux/world/program.lux
+++ b/stdlib/source/library/lux/world/program.lux
@@ -73,7 +73,7 @@
(`` (implementation: .public (async program)
(-> (Program IO) (Program Async))
- (~~ (template [<method>]
+ (~~ (with_template [<method>]
[(def: <method>
(at program <method>))]
@@ -81,7 +81,7 @@
[directory]
))
- (~~ (template [<method>]
+ (~~ (with_template [<method>]
[(def: <method>
(|>> (at program <method>) async.future))]
diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux
index f65320c2d..0c648c17d 100644
--- a/stdlib/source/library/lux/world/shell.lux
+++ b/stdlib/source/library/lux/world/shell.lux
@@ -36,7 +36,7 @@
(type: .public Exit
Int)
-(template [<code> <name>]
+(with_template [<code> <name>]
[(def: .public <name>
Exit
<code>)]
@@ -61,7 +61,7 @@
(def: (async_process process)
(-> (Process IO) (Process Async))
(`` (implementation
- (~~ (template [<method>]
+ (~~ (with_template [<method>]
[(def: <method>
(|>> (at process <method>)
async.future))]
@@ -245,7 +245,7 @@
java/io/BufferedReader::new)]]
(in (is (Process IO)
(`` (implementation
- (~~ (template [<name> <stream>]
+ (~~ (with_template [<name> <stream>]
[(def: (<name> _)
(do !
[output (java/io/BufferedReader::readLine <stream>)]
@@ -261,7 +261,7 @@
))
(def: (write message)
(java/io/OutputStream::write (at utf8.codec encoded message) jvm_output))
- (~~ (template [<name> <method>]
+ (~~ (with_template [<name> <method>]
[(def: (<name> _)
(|> process <method>))]
@@ -327,7 +327,7 @@
(`` (implementation: (mock_process state mock)
(All (_ s) (-> (Atom s) (Mock s) (Process IO)))
- (~~ (template [<name> <mock>]
+ (~~ (with_template [<name> <mock>]
[(def: (<name> _)
(do [! io.monad]
[|state| (atom.read! state)]