From 9e2f1e76f2c8df01ed7687d934c3210fcf676bd6 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 16 Jun 2022 00:48:19 -0400 Subject: De-sigil-ification: suffix : [Part 13] --- stdlib/source/documentation/lux.lux | 52 +- stdlib/source/documentation/lux/abstract.lux | 2 +- stdlib/source/documentation/lux/abstract/apply.lux | 17 +- stdlib/source/documentation/lux/abstract/codec.lux | 27 +- .../source/documentation/lux/abstract/comonad.lux | 27 +- .../documentation/lux/abstract/comonad/cofree.lux | 10 +- stdlib/source/documentation/lux/abstract/enum.lux | 19 +- .../documentation/lux/abstract/equivalence.lux | 20 +- .../source/documentation/lux/abstract/functor.lux | 2 +- .../lux/abstract/functor/contravariant.lux | 10 +- stdlib/source/documentation/lux/abstract/hash.lux | 2 +- .../source/documentation/lux/abstract/interval.lux | 2 +- stdlib/source/documentation/lux/abstract/mix.lux | 2 +- stdlib/source/documentation/lux/abstract/monad.lux | 2 +- .../documentation/lux/abstract/monad/free.lux | 2 +- .../source/documentation/lux/abstract/monoid.lux | 2 +- stdlib/source/documentation/lux/abstract/order.lux | 2 +- .../documentation/lux/abstract/predicate.lux | 2 +- stdlib/source/documentation/lux/control.lux | 2 +- .../documentation/lux/control/concatenative.lux | 2 +- .../documentation/lux/control/concurrency.lux | 2 +- .../lux/control/concurrency/actor.lux | 2 +- .../lux/control/concurrency/async.lux | 2 +- .../documentation/lux/control/concurrency/atom.lux | 2 +- .../documentation/lux/control/concurrency/frp.lux | 2 +- .../lux/control/concurrency/semaphore.lux | 2 +- .../documentation/lux/control/concurrency/stm.lux | 2 +- .../lux/control/concurrency/thread.lux | 2 +- .../documentation/lux/control/continuation.lux | 2 +- .../source/documentation/lux/control/exception.lux | 2 +- .../source/documentation/lux/control/function.lux | 2 +- .../lux/control/function/contract.lux | 2 +- .../documentation/lux/control/function/memo.lux | 2 +- .../documentation/lux/control/function/mixin.lux | 2 +- .../documentation/lux/control/function/mutual.lux | 10 +- stdlib/source/documentation/lux/control/io.lux | 2 +- stdlib/source/documentation/lux/control/lazy.lux | 2 +- stdlib/source/documentation/lux/control/maybe.lux | 2 +- stdlib/source/documentation/lux/control/parser.lux | 2 +- .../documentation/lux/control/parser/analysis.lux | 2 +- .../documentation/lux/control/parser/binary.lux | 2 +- .../documentation/lux/control/parser/cli.lux | 2 +- .../documentation/lux/control/parser/code.lux | 2 +- .../lux/control/parser/environment.lux | 2 +- .../documentation/lux/control/parser/json.lux | 2 +- .../documentation/lux/control/parser/synthesis.lux | 2 +- .../documentation/lux/control/parser/text.lux | 2 +- .../documentation/lux/control/parser/tree.lux | 2 +- .../documentation/lux/control/parser/type.lux | 2 +- .../documentation/lux/control/parser/xml.lux | 2 +- stdlib/source/documentation/lux/control/pipe.lux | 2 +- stdlib/source/documentation/lux/control/reader.lux | 2 +- stdlib/source/documentation/lux/control/region.lux | 2 +- .../source/documentation/lux/control/remember.lux | 2 +- .../source/documentation/lux/control/security.lux | 2 +- .../lux/control/security/capability.lux | 2 +- .../documentation/lux/control/security/policy.lux | 8 +- stdlib/source/documentation/lux/control/state.lux | 2 +- stdlib/source/documentation/lux/control/thread.lux | 2 +- stdlib/source/documentation/lux/control/try.lux | 2 +- stdlib/source/documentation/lux/control/writer.lux | 2 +- stdlib/source/documentation/lux/data.lux | 2 +- stdlib/source/documentation/lux/data/binary.lux | 2 +- stdlib/source/documentation/lux/data/bit.lux | 2 +- .../source/documentation/lux/data/collection.lux | 2 +- .../documentation/lux/data/collection/array.lux | 2 +- .../documentation/lux/data/collection/bits.lux | 2 +- .../lux/data/collection/dictionary.lux | 2 +- .../lux/data/collection/dictionary/ordered.lux | 2 +- .../lux/data/collection/dictionary/plist.lux | 2 +- .../documentation/lux/data/collection/list.lux | 10 +- .../documentation/lux/data/collection/queue.lux | 2 +- .../lux/data/collection/queue/priority.lux | 2 +- .../documentation/lux/data/collection/sequence.lux | 2 +- .../documentation/lux/data/collection/set.lux | 2 +- .../lux/data/collection/set/multi.lux | 2 +- .../lux/data/collection/set/ordered.lux | 2 +- .../documentation/lux/data/collection/stack.lux | 2 +- .../documentation/lux/data/collection/stream.lux | 2 +- .../documentation/lux/data/collection/tree.lux | 2 +- .../lux/data/collection/tree/finger.lux | 2 +- .../lux/data/collection/tree/zipper.lux | 2 +- stdlib/source/documentation/lux/data/color.lux | 4 +- .../source/documentation/lux/data/color/named.lux | 2 +- stdlib/source/documentation/lux/data/format.lux | 2 +- .../documentation/lux/data/format/binary.lux | 2 +- .../source/documentation/lux/data/format/json.lux | 2 +- .../source/documentation/lux/data/format/tar.lux | 2 +- .../source/documentation/lux/data/format/xml.lux | 2 +- stdlib/source/documentation/lux/data/identity.lux | 2 +- stdlib/source/documentation/lux/data/product.lux | 2 +- stdlib/source/documentation/lux/data/sum.lux | 2 +- stdlib/source/documentation/lux/data/text.lux | 2 +- .../source/documentation/lux/data/text/buffer.lux | 2 +- .../documentation/lux/data/text/encoding.lux | 2 +- .../documentation/lux/data/text/encoding/utf8.lux | 2 +- .../source/documentation/lux/data/text/escape.lux | 2 +- .../source/documentation/lux/data/text/format.lux | 2 +- .../source/documentation/lux/data/text/regex.lux | 2 +- .../source/documentation/lux/data/text/unicode.lux | 2 +- .../documentation/lux/data/text/unicode/block.lux | 2 +- .../documentation/lux/data/text/unicode/set.lux | 2 +- stdlib/source/documentation/lux/debug.lux | 4 +- stdlib/source/documentation/lux/documentation.lux | 2 +- stdlib/source/documentation/lux/extension.lux | 2 +- stdlib/source/documentation/lux/ffi.js.lux | 2 +- stdlib/source/documentation/lux/ffi.jvm.lux | 2 +- stdlib/source/documentation/lux/ffi.lua.lux | 2 +- stdlib/source/documentation/lux/ffi.old.lux | 2 +- stdlib/source/documentation/lux/ffi.py.lux | 2 +- stdlib/source/documentation/lux/ffi.rb.lux | 2 +- stdlib/source/documentation/lux/locale.lux | 2 +- .../source/documentation/lux/locale/language.lux | 56 +- .../source/documentation/lux/locale/territory.lux | 16 +- stdlib/source/documentation/lux/macro.lux | 16 +- stdlib/source/documentation/lux/macro/code.lux | 2 +- stdlib/source/documentation/lux/macro/local.lux | 2 +- stdlib/source/documentation/lux/macro/syntax.lux | 4 +- .../documentation/lux/macro/syntax/check.lux | 2 +- .../documentation/lux/macro/syntax/declaration.lux | 2 +- .../documentation/lux/macro/syntax/definition.lux | 2 +- .../documentation/lux/macro/syntax/export.lux | 2 +- .../documentation/lux/macro/syntax/input.lux | 2 +- .../lux/macro/syntax/type/variable.lux | 2 +- stdlib/source/documentation/lux/macro/template.lux | 4 +- stdlib/source/documentation/lux/math.lux | 2 +- stdlib/source/documentation/lux/math/infix.lux | 2 +- stdlib/source/documentation/lux/math/logic.lux | 2 +- .../documentation/lux/math/logic/continuous.lux | 2 +- .../source/documentation/lux/math/logic/fuzzy.lux | 2 +- stdlib/source/documentation/lux/math/modular.lux | 2 +- stdlib/source/documentation/lux/math/modulus.lux | 2 +- stdlib/source/documentation/lux/math/number.lux | 2 +- .../documentation/lux/math/number/complex.lux | 2 +- .../source/documentation/lux/math/number/frac.lux | 2 +- .../source/documentation/lux/math/number/i16.lux | 2 +- .../source/documentation/lux/math/number/i32.lux | 2 +- .../source/documentation/lux/math/number/i64.lux | 2 +- stdlib/source/documentation/lux/math/number/i8.lux | 2 +- .../source/documentation/lux/math/number/int.lux | 2 +- .../source/documentation/lux/math/number/nat.lux | 2 +- .../source/documentation/lux/math/number/ratio.lux | 2 +- .../source/documentation/lux/math/number/rev.lux | 2 +- stdlib/source/documentation/lux/math/random.lux | 2 +- stdlib/source/documentation/lux/meta.lux | 2 +- stdlib/source/documentation/lux/meta/location.lux | 2 +- stdlib/source/documentation/lux/meta/symbol.lux | 2 +- stdlib/source/documentation/lux/program.lux | 2 +- stdlib/source/documentation/lux/static.lux | 2 +- stdlib/source/documentation/lux/target.lux | 2 +- stdlib/source/documentation/lux/target/js.lux | 2 +- stdlib/source/documentation/lux/target/jvm.lux | 2 +- .../source/documentation/lux/target/jvm/type.lux | 2 +- .../documentation/lux/target/jvm/type/alias.lux | 2 +- .../documentation/lux/target/jvm/type/box.lux | 2 +- .../documentation/lux/target/jvm/type/category.lux | 2 +- .../lux/target/jvm/type/descriptor.lux | 2 +- .../documentation/lux/target/jvm/type/lux.lux | 2 +- .../documentation/lux/target/jvm/type/parser.lux | 2 +- .../lux/target/jvm/type/reflection.lux | 2 +- .../lux/target/jvm/type/signature.lux | 2 +- stdlib/source/documentation/lux/target/lua.lux | 2 +- stdlib/source/documentation/lux/target/python.lux | 2 +- stdlib/source/documentation/lux/target/ruby.lux | 2 +- stdlib/source/documentation/lux/test.lux | 2 +- stdlib/source/documentation/lux/time.lux | 2 +- stdlib/source/documentation/lux/time/date.lux | 2 +- stdlib/source/documentation/lux/time/day.lux | 2 +- stdlib/source/documentation/lux/time/duration.lux | 2 +- stdlib/source/documentation/lux/time/instant.lux | 2 +- stdlib/source/documentation/lux/time/month.lux | 2 +- stdlib/source/documentation/lux/time/year.lux | 2 +- stdlib/source/documentation/lux/tool.lux | 2 +- .../lux/tool/compiler/language/lux/analysis.lux | 2 +- .../lux/tool/compiler/language/lux/directive.lux | 2 +- .../lux/tool/compiler/language/lux/generation.lux | 2 +- .../lux/tool/compiler/language/lux/synthesis.lux | 2 +- .../documentation/lux/tool/compiler/phase.lux | 2 +- stdlib/source/documentation/lux/type.lux | 2 +- stdlib/source/documentation/lux/type/check.lux | 2 +- stdlib/source/documentation/lux/type/dynamic.lux | 2 +- stdlib/source/documentation/lux/type/implicit.lux | 2 +- stdlib/source/documentation/lux/type/poly.lux | 2 +- stdlib/source/documentation/lux/type/primitive.lux | 22 +- stdlib/source/documentation/lux/type/quotient.lux | 6 +- .../source/documentation/lux/type/refinement.lux | 6 +- stdlib/source/documentation/lux/type/resource.lux | 2 +- stdlib/source/documentation/lux/type/unit.lux | 6 +- stdlib/source/documentation/lux/type/variance.lux | 2 +- stdlib/source/documentation/lux/world.lux | 2 +- stdlib/source/documentation/lux/world/console.lux | 2 +- stdlib/source/documentation/lux/world/file.lux | 2 +- .../source/documentation/lux/world/file/watch.lux | 2 +- .../documentation/lux/world/input/keyboard.lux | 2 +- stdlib/source/documentation/lux/world/net.lux | 2 +- .../documentation/lux/world/net/http/client.lux | 2 +- .../documentation/lux/world/net/http/status.lux | 2 +- stdlib/source/documentation/lux/world/net/uri.lux | 2 +- .../lux/world/output/video/resolution.lux | 2 +- stdlib/source/documentation/lux/world/program.lux | 2 +- stdlib/source/documentation/lux/world/shell.lux | 2 +- stdlib/source/experiment/compiler.lux | 2 +- stdlib/source/format/lux/data/binary.lux | 56 +- stdlib/source/format/lux/data/text.lux | 16 +- stdlib/source/library/lux.lux | 3988 ++++++++++---------- stdlib/source/library/lux/abstract/apply.lux | 6 +- stdlib/source/library/lux/abstract/codec.lux | 6 +- stdlib/source/library/lux/abstract/comonad.lux | 2 +- .../source/library/lux/abstract/comonad/free.lux | 12 +- stdlib/source/library/lux/abstract/enum.lux | 2 +- stdlib/source/library/lux/abstract/equivalence.lux | 10 +- stdlib/source/library/lux/abstract/functor.lux | 12 +- stdlib/source/library/lux/abstract/hash.lux | 8 +- stdlib/source/library/lux/abstract/interval.lux | 68 +- stdlib/source/library/lux/abstract/mix.lux | 2 +- stdlib/source/library/lux/abstract/monad.lux | 20 +- stdlib/source/library/lux/abstract/monad/free.lux | 18 +- .../source/library/lux/abstract/monad/indexed.lux | 12 +- stdlib/source/library/lux/abstract/monoid.lux | 6 +- stdlib/source/library/lux/abstract/order.lux | 18 +- stdlib/source/library/lux/abstract/predicate.lux | 20 +- .../source/library/lux/control/concatenative.lux | 60 +- .../library/lux/control/concurrency/actor.lux | 26 +- .../library/lux/control/concurrency/async.lux | 46 +- .../library/lux/control/concurrency/atom.lux | 10 +- .../source/library/lux/control/concurrency/frp.lux | 52 +- .../library/lux/control/concurrency/semaphore.lux | 26 +- .../source/library/lux/control/concurrency/stm.lux | 58 +- .../library/lux/control/concurrency/thread.lux | 14 +- stdlib/source/library/lux/control/continuation.lux | 32 +- stdlib/source/library/lux/control/exception.lux | 30 +- stdlib/source/library/lux/control/function.lux | 16 +- .../library/lux/control/function/contract.lux | 6 +- .../source/library/lux/control/function/inline.lux | 8 +- .../source/library/lux/control/function/memo.lux | 8 +- .../source/library/lux/control/function/mixin.lux | 20 +- .../source/library/lux/control/function/mutual.lux | 20 +- stdlib/source/library/lux/control/io.lux | 28 +- stdlib/source/library/lux/control/lazy.lux | 28 +- stdlib/source/library/lux/control/maybe.lux | 52 +- stdlib/source/library/lux/control/parser.lux | 70 +- stdlib/source/library/lux/control/parser/cli.lux | 16 +- stdlib/source/library/lux/control/parser/code.lux | 34 +- .../library/lux/control/parser/environment.lux | 6 +- stdlib/source/library/lux/control/parser/json.lux | 20 +- stdlib/source/library/lux/control/parser/tree.lux | 8 +- stdlib/source/library/lux/control/parser/type.lux | 50 +- stdlib/source/library/lux/control/parser/xml.lux | 16 +- stdlib/source/library/lux/control/pipe.lux | 24 +- stdlib/source/library/lux/control/reader.lux | 34 +- stdlib/source/library/lux/control/region.lux | 32 +- stdlib/source/library/lux/control/remember.lux | 6 +- .../library/lux/control/security/capability.lux | 10 +- .../source/library/lux/control/security/policy.lux | 26 +- stdlib/source/library/lux/control/state.lux | 56 +- stdlib/source/library/lux/control/thread.lux | 30 +- stdlib/source/library/lux/control/try.lux | 42 +- stdlib/source/library/lux/control/writer.lux | 30 +- stdlib/source/library/lux/data/binary.lux | 26 +- stdlib/source/library/lux/data/bit.lux | 28 +- .../source/library/lux/data/collection/array.lux | 60 +- stdlib/source/library/lux/data/collection/bits.lux | 28 +- .../library/lux/data/collection/dictionary.lux | 122 +- .../lux/data/collection/dictionary/ordered.lux | 46 +- .../lux/data/collection/dictionary/plist.lux | 28 +- stdlib/source/library/lux/data/collection/list.lux | 132 +- .../source/library/lux/data/collection/queue.lux | 26 +- .../library/lux/data/collection/queue/priority.lux | 22 +- .../library/lux/data/collection/sequence.lux | 112 +- stdlib/source/library/lux/data/collection/set.lux | 46 +- .../library/lux/data/collection/set/multi.lux | 42 +- .../library/lux/data/collection/set/ordered.lux | 28 +- .../source/library/lux/data/collection/stack.lux | 20 +- .../source/library/lux/data/collection/stream.lux | 34 +- stdlib/source/library/lux/data/collection/tree.lux | 22 +- .../library/lux/data/collection/tree/finger.lux | 18 +- .../library/lux/data/collection/tree/zipper.lux | 60 +- stdlib/source/library/lux/data/color.lux | 82 +- stdlib/source/library/lux/data/color/named.lux | 2 +- stdlib/source/library/lux/data/format/css.lux | 32 +- .../source/library/lux/data/format/css/class.lux | 6 +- stdlib/source/library/lux/data/format/css/id.lux | 6 +- .../library/lux/data/format/css/property.lux | 8 +- .../source/library/lux/data/format/css/query.lux | 18 +- .../library/lux/data/format/css/selector.lux | 28 +- .../source/library/lux/data/format/css/style.lux | 8 +- .../source/library/lux/data/format/css/value.lux | 166 +- stdlib/source/library/lux/data/format/html.lux | 100 +- stdlib/source/library/lux/data/format/json.lux | 72 +- stdlib/source/library/lux/data/format/markdown.lux | 46 +- stdlib/source/library/lux/data/format/tar.lux | 176 +- stdlib/source/library/lux/data/format/xml.lux | 58 +- stdlib/source/library/lux/data/identity.lux | 26 +- stdlib/source/library/lux/data/product.lux | 22 +- stdlib/source/library/lux/data/store.lux | 22 +- stdlib/source/library/lux/data/sum.lux | 20 +- stdlib/source/library/lux/data/text.lux | 90 +- stdlib/source/library/lux/data/text/buffer.lux | 8 +- stdlib/source/library/lux/data/text/encoding.lux | 4 +- .../source/library/lux/data/text/encoding/utf8.lux | 12 +- stdlib/source/library/lux/data/text/escape.lux | 36 +- stdlib/source/library/lux/data/text/regex.lux | 80 +- .../source/library/lux/data/text/unicode/block.lux | 26 +- .../source/library/lux/data/text/unicode/set.lux | 34 +- stdlib/source/library/lux/data/trace.lux | 14 +- stdlib/source/library/lux/debug.lux | 30 +- stdlib/source/library/lux/documentation.lux | 80 +- stdlib/source/library/lux/extension.lux | 4 +- stdlib/source/library/lux/ffi.jvm.lux | 256 +- stdlib/source/library/lux/ffi.lux | 122 +- stdlib/source/library/lux/ffi.old.lux | 248 +- stdlib/source/library/lux/ffi.php.lux | 52 +- stdlib/source/library/lux/ffi.scm.lux | 40 +- stdlib/source/library/lux/ffi/export.js.lux | 4 +- stdlib/source/library/lux/ffi/export.jvm.lux | 10 +- stdlib/source/library/lux/ffi/export.lua.lux | 4 +- stdlib/source/library/lux/ffi/export.py.lux | 4 +- stdlib/source/library/lux/ffi/export.rb.lux | 18 +- stdlib/source/library/lux/ffi/node_js.js.lux | 4 +- stdlib/source/library/lux/locale.lux | 12 +- stdlib/source/library/lux/locale/language.lux | 16 +- stdlib/source/library/lux/locale/territory.lux | 16 +- stdlib/source/library/lux/macro.lux | 26 +- stdlib/source/library/lux/macro/code.lux | 12 +- stdlib/source/library/lux/macro/local.lux | 14 +- stdlib/source/library/lux/macro/pattern.lux | 26 +- stdlib/source/library/lux/macro/syntax.lux | 8 +- stdlib/source/library/lux/macro/syntax/check.lux | 8 +- .../library/lux/macro/syntax/declaration.lux | 6 +- .../source/library/lux/macro/syntax/definition.lux | 12 +- stdlib/source/library/lux/macro/syntax/export.lux | 6 +- stdlib/source/library/lux/macro/syntax/input.lux | 6 +- .../library/lux/macro/syntax/type/variable.lux | 6 +- stdlib/source/library/lux/macro/template.lux | 24 +- stdlib/source/library/lux/math.lux | 8 +- stdlib/source/library/lux/math/infix.lux | 8 +- .../source/library/lux/math/logic/continuous.lux | 18 +- stdlib/source/library/lux/math/logic/fuzzy.lux | 34 +- stdlib/source/library/lux/math/modular.lux | 38 +- stdlib/source/library/lux/math/modulus.lux | 10 +- stdlib/source/library/lux/math/number.lux | 8 +- stdlib/source/library/lux/math/number/complex.lux | 74 +- stdlib/source/library/lux/math/number/frac.lux | 180 +- stdlib/source/library/lux/math/number/i16.lux | 12 +- stdlib/source/library/lux/math/number/i32.lux | 12 +- stdlib/source/library/lux/math/number/i64.lux | 64 +- stdlib/source/library/lux/math/number/i8.lux | 12 +- stdlib/source/library/lux/math/number/int.lux | 88 +- stdlib/source/library/lux/math/number/nat.lux | 102 +- stdlib/source/library/lux/math/number/ratio.lux | 54 +- stdlib/source/library/lux/math/number/rev.lux | 122 +- stdlib/source/library/lux/math/random.lux | 84 +- stdlib/source/library/lux/meta.lux | 108 +- stdlib/source/library/lux/meta/configuration.lux | 20 +- stdlib/source/library/lux/meta/location.lux | 14 +- stdlib/source/library/lux/meta/symbol.lux | 20 +- stdlib/source/library/lux/meta/version.lux | 6 +- stdlib/source/library/lux/program.lux | 4 +- stdlib/source/library/lux/static.lux | 22 +- stdlib/source/library/lux/target.lux | 6 +- stdlib/source/library/lux/target/common_lisp.lux | 98 +- stdlib/source/library/lux/target/js.lux | 112 +- stdlib/source/library/lux/target/jvm/attribute.lux | 24 +- .../library/lux/target/jvm/attribute/code.lux | 6 +- .../lux/target/jvm/attribute/code/exception.lux | 6 +- .../library/lux/target/jvm/attribute/constant.lux | 6 +- stdlib/source/library/lux/target/jvm/bytecode.lux | 134 +- .../library/lux/target/jvm/bytecode/address.lux | 20 +- .../lux/target/jvm/bytecode/environment.lux | 20 +- .../lux/target/jvm/bytecode/environment/limit.lux | 8 +- .../jvm/bytecode/environment/limit/registry.lux | 20 +- .../jvm/bytecode/environment/limit/stack.lux | 16 +- .../lux/target/jvm/bytecode/instruction.lux | 58 +- .../library/lux/target/jvm/bytecode/jump.lux | 6 +- stdlib/source/library/lux/target/jvm/class.lux | 8 +- stdlib/source/library/lux/target/jvm/constant.lux | 34 +- .../library/lux/target/jvm/constant/pool.lux | 42 +- .../source/library/lux/target/jvm/constant/tag.lux | 8 +- .../library/lux/target/jvm/encoding/name.lux | 14 +- .../library/lux/target/jvm/encoding/signed.lux | 26 +- .../library/lux/target/jvm/encoding/unsigned.lux | 28 +- stdlib/source/library/lux/target/jvm/field.lux | 6 +- stdlib/source/library/lux/target/jvm/index.lux | 10 +- stdlib/source/library/lux/target/jvm/loader.lux | 12 +- stdlib/source/library/lux/target/jvm/magic.lux | 4 +- stdlib/source/library/lux/target/jvm/method.lux | 6 +- stdlib/source/library/lux/target/jvm/modifier.lux | 28 +- .../source/library/lux/target/jvm/reflection.lux | 22 +- stdlib/source/library/lux/target/jvm/type.lux | 42 +- .../source/library/lux/target/jvm/type/alias.lux | 24 +- stdlib/source/library/lux/target/jvm/type/box.lux | 2 +- .../library/lux/target/jvm/type/descriptor.lux | 32 +- stdlib/source/library/lux/target/jvm/type/lux.lux | 36 +- .../source/library/lux/target/jvm/type/parser.lux | 60 +- .../library/lux/target/jvm/type/reflection.lux | 22 +- .../library/lux/target/jvm/type/signature.lux | 44 +- stdlib/source/library/lux/target/jvm/version.lux | 6 +- stdlib/source/library/lux/target/lua.lux | 100 +- stdlib/source/library/lux/target/php.lux | 132 +- stdlib/source/library/lux/target/python.lux | 112 +- stdlib/source/library/lux/target/r.lux | 92 +- stdlib/source/library/lux/target/ruby.lux | 114 +- stdlib/source/library/lux/target/scheme.lux | 84 +- stdlib/source/library/lux/test.lux | 78 +- stdlib/source/library/lux/time.lux | 56 +- stdlib/source/library/lux/time/date.lux | 80 +- stdlib/source/library/lux/time/day.lux | 38 +- stdlib/source/library/lux/time/duration.lux | 60 +- stdlib/source/library/lux/time/instant.lux | 56 +- stdlib/source/library/lux/time/month.lux | 40 +- stdlib/source/library/lux/time/year.lux | 42 +- stdlib/source/library/lux/tool/compiler/arity.lux | 2 +- .../library/lux/tool/compiler/default/init.lux | 26 +- .../library/lux/tool/compiler/default/platform.lux | 82 +- .../library/lux/tool/compiler/language/lux.lux | 6 +- .../lux/tool/compiler/language/lux/analysis.lux | 60 +- .../compiler/language/lux/analysis/complex.lux | 18 +- .../compiler/language/lux/analysis/coverage.lux | 20 +- .../compiler/language/lux/analysis/evaluation.lux | 4 +- .../compiler/language/lux/analysis/inference.lux | 12 +- .../tool/compiler/language/lux/analysis/macro.lux | 4 +- .../tool/compiler/language/lux/analysis/module.lux | 20 +- .../compiler/language/lux/analysis/pattern.lux | 14 +- .../tool/compiler/language/lux/analysis/scope.lux | 26 +- .../tool/compiler/language/lux/analysis/simple.lux | 6 +- .../tool/compiler/language/lux/analysis/type.lux | 20 +- .../lux/tool/compiler/language/lux/directive.lux | 10 +- .../lux/tool/compiler/language/lux/generation.lux | 50 +- .../tool/compiler/language/lux/phase/analysis.lux | 10 +- .../compiler/language/lux/phase/analysis/case.lux | 12 +- .../language/lux/phase/analysis/complex.lux | 18 +- .../language/lux/phase/analysis/function.lux | 4 +- .../language/lux/phase/analysis/reference.lux | 6 +- .../language/lux/phase/analysis/simple.lux | 4 +- .../tool/compiler/language/lux/phase/directive.lux | 6 +- .../tool/compiler/language/lux/phase/extension.lux | 26 +- .../language/lux/phase/extension/analysis.lux | 2 +- .../lux/phase/extension/analysis/common_lisp.lux | 2 +- .../language/lux/phase/extension/analysis/js.lux | 30 +- .../language/lux/phase/extension/analysis/jvm.lux | 262 +- .../language/lux/phase/extension/analysis/lua.lux | 40 +- .../language/lux/phase/extension/analysis/lux.lux | 44 +- .../language/lux/phase/extension/analysis/php.lux | 34 +- .../lux/phase/extension/analysis/python.lux | 38 +- .../language/lux/phase/extension/analysis/r.lux | 2 +- .../language/lux/phase/extension/analysis/ruby.lux | 32 +- .../lux/phase/extension/analysis/scheme.lux | 24 +- .../language/lux/phase/extension/bundle.lux | 6 +- .../language/lux/phase/extension/directive/jvm.lux | 106 +- .../language/lux/phase/extension/directive/lux.lux | 76 +- .../lux/phase/extension/generation/common_lisp.lux | 2 +- .../extension/generation/common_lisp/common.lux | 28 +- .../extension/generation/common_lisp/host.lux | 2 +- .../language/lux/phase/extension/generation/js.lux | 2 +- .../lux/phase/extension/generation/js/common.lux | 32 +- .../lux/phase/extension/generation/js/host.lux | 32 +- .../lux/phase/extension/generation/jvm.lux | 2 +- .../lux/phase/extension/generation/jvm/common.lux | 78 +- .../lux/phase/extension/generation/jvm/host.lux | 148 +- .../lux/phase/extension/generation/lua.lux | 2 +- .../lux/phase/extension/generation/lua/common.lux | 30 +- .../lux/phase/extension/generation/lua/host.lux | 42 +- .../lux/phase/extension/generation/php.lux | 2 +- .../lux/phase/extension/generation/php/common.lux | 28 +- .../lux/phase/extension/generation/php/host.lux | 30 +- .../lux/phase/extension/generation/python.lux | 2 +- .../phase/extension/generation/python/common.lux | 24 +- .../lux/phase/extension/generation/python/host.lux | 34 +- .../language/lux/phase/extension/generation/r.lux | 2 +- .../lux/phase/extension/generation/r/common.lux | 28 +- .../lux/phase/extension/generation/r/host.lux | 2 +- .../lux/phase/extension/generation/ruby.lux | 2 +- .../lux/phase/extension/generation/ruby/common.lux | 28 +- .../lux/phase/extension/generation/ruby/host.lux | 30 +- .../lux/phase/extension/generation/scheme.lux | 2 +- .../phase/extension/generation/scheme/common.lux | 26 +- .../lux/phase/extension/generation/scheme/host.lux | 24 +- .../language/lux/phase/extension/synthesis.lux | 2 +- .../language/lux/phase/generation/common_lisp.lux | 2 +- .../lux/phase/generation/common_lisp/case.lux | 40 +- .../lux/phase/generation/common_lisp/extension.lux | 2 +- .../generation/common_lisp/extension/common.lux | 26 +- .../lux/phase/generation/common_lisp/function.lux | 10 +- .../lux/phase/generation/common_lisp/loop.lux | 4 +- .../lux/phase/generation/common_lisp/primitive.lux | 8 +- .../lux/phase/generation/common_lisp/reference.lux | 6 +- .../lux/phase/generation/common_lisp/runtime.lux | 48 +- .../lux/phase/generation/common_lisp/structure.lux | 4 +- .../language/lux/phase/generation/extension.lux | 10 +- .../compiler/language/lux/phase/generation/js.lux | 4 +- .../language/lux/phase/generation/js/case.lux | 56 +- .../language/lux/phase/generation/js/function.lux | 16 +- .../language/lux/phase/generation/js/loop.lux | 14 +- .../language/lux/phase/generation/js/primitive.lux | 8 +- .../language/lux/phase/generation/js/reference.lux | 6 +- .../language/lux/phase/generation/js/runtime.lux | 82 +- .../language/lux/phase/generation/js/structure.lux | 4 +- .../compiler/language/lux/phase/generation/jvm.lux | 2 +- .../language/lux/phase/generation/jvm/case.lux | 36 +- .../language/lux/phase/generation/jvm/debug.lux | 4 +- .../language/lux/phase/generation/jvm/function.lux | 20 +- .../lux/phase/generation/jvm/function/abstract.lux | 6 +- .../generation/jvm/function/field/constant.lux | 4 +- .../jvm/function/field/constant/arity.lux | 6 +- .../generation/jvm/function/field/variable.lux | 12 +- .../jvm/function/field/variable/count.lux | 10 +- .../jvm/function/field/variable/foreign.lux | 8 +- .../jvm/function/field/variable/partial.lux | 10 +- .../lux/phase/generation/jvm/function/method.lux | 2 +- .../phase/generation/jvm/function/method/apply.lux | 10 +- .../jvm/function/method/implementation.lux | 10 +- .../phase/generation/jvm/function/method/init.lux | 14 +- .../phase/generation/jvm/function/method/new.lux | 6 +- .../phase/generation/jvm/function/method/reset.lux | 8 +- .../language/lux/phase/generation/jvm/host.lux | 30 +- .../language/lux/phase/generation/jvm/loop.lux | 8 +- .../lux/phase/generation/jvm/primitive.lux | 20 +- .../language/lux/phase/generation/jvm/program.lux | 32 +- .../lux/phase/generation/jvm/reference.lux | 10 +- .../language/lux/phase/generation/jvm/runtime.lux | 132 +- .../lux/phase/generation/jvm/structure.lux | 8 +- .../language/lux/phase/generation/jvm/type.lux | 22 +- .../language/lux/phase/generation/jvm/value.lux | 8 +- .../compiler/language/lux/phase/generation/lua.lux | 4 +- .../language/lux/phase/generation/lua/case.lux | 52 +- .../language/lux/phase/generation/lua/function.lux | 12 +- .../language/lux/phase/generation/lua/loop.lux | 10 +- .../lux/phase/generation/lua/primitive.lux | 2 +- .../lux/phase/generation/lua/reference.lux | 6 +- .../language/lux/phase/generation/lua/runtime.lux | 68 +- .../lux/phase/generation/lua/structure.lux | 4 +- .../compiler/language/lux/phase/generation/php.lux | 6 +- .../language/lux/phase/generation/php/case.lux | 50 +- .../lux/phase/generation/php/extension.lux | 2 +- .../lux/phase/generation/php/extension/common.lux | 16 +- .../language/lux/phase/generation/php/function.lux | 12 +- .../language/lux/phase/generation/php/loop.lux | 12 +- .../lux/phase/generation/php/primitive.lux | 8 +- .../lux/phase/generation/php/reference.lux | 6 +- .../language/lux/phase/generation/php/runtime.lux | 72 +- .../lux/phase/generation/php/structure.lux | 4 +- .../language/lux/phase/generation/python.lux | 4 +- .../language/lux/phase/generation/python/case.lux | 60 +- .../lux/phase/generation/python/function.lux | 10 +- .../language/lux/phase/generation/python/loop.lux | 10 +- .../lux/phase/generation/python/primitive.lux | 2 +- .../lux/phase/generation/python/reference.lux | 6 +- .../lux/phase/generation/python/runtime.lux | 76 +- .../lux/phase/generation/python/structure.lux | 4 +- .../compiler/language/lux/phase/generation/r.lux | 2 +- .../language/lux/phase/generation/r/case.lux | 48 +- .../language/lux/phase/generation/r/function.lux | 12 +- .../language/lux/phase/generation/r/loop.lux | 4 +- .../language/lux/phase/generation/r/primitive.lux | 2 +- .../lux/phase/generation/r/procedure/common.lux | 60 +- .../lux/phase/generation/r/procedure/host.lux | 18 +- .../language/lux/phase/generation/r/reference.lux | 6 +- .../language/lux/phase/generation/r/runtime.lux | 104 +- .../language/lux/phase/generation/r/structure.lux | 4 +- .../language/lux/phase/generation/reference.lux | 14 +- .../language/lux/phase/generation/ruby.lux | 4 +- .../language/lux/phase/generation/ruby/case.lux | 58 +- .../lux/phase/generation/ruby/function.lux | 10 +- .../language/lux/phase/generation/ruby/loop.lux | 12 +- .../lux/phase/generation/ruby/primitive.lux | 2 +- .../lux/phase/generation/ruby/reference.lux | 6 +- .../language/lux/phase/generation/ruby/runtime.lux | 98 +- .../lux/phase/generation/ruby/structure.lux | 4 +- .../language/lux/phase/generation/scheme.lux | 2 +- .../language/lux/phase/generation/scheme/case.lux | 44 +- .../lux/phase/generation/scheme/extension.lux | 2 +- .../phase/generation/scheme/extension/common.lux | 36 +- .../lux/phase/generation/scheme/function.lux | 14 +- .../language/lux/phase/generation/scheme/loop.lux | 6 +- .../lux/phase/generation/scheme/primitive.lux | 2 +- .../lux/phase/generation/scheme/reference.lux | 6 +- .../lux/phase/generation/scheme/runtime.lux | 60 +- .../lux/phase/generation/scheme/structure.lux | 4 +- .../tool/compiler/language/lux/phase/synthesis.lux | 6 +- .../compiler/language/lux/phase/synthesis/case.lux | 40 +- .../language/lux/phase/synthesis/function.lux | 16 +- .../compiler/language/lux/phase/synthesis/loop.lux | 8 +- .../language/lux/phase/synthesis/variable.lux | 32 +- .../lux/tool/compiler/language/lux/program.lux | 4 +- .../lux/tool/compiler/language/lux/syntax.lux | 94 +- .../lux/tool/compiler/language/lux/synthesis.lux | 106 +- .../compiler/language/lux/synthesis/access.lux | 6 +- .../language/lux/synthesis/access/member.lux | 6 +- .../language/lux/synthesis/access/side.lux | 6 +- .../compiler/language/lux/synthesis/simple.lux | 12 +- stdlib/source/library/lux/tool/compiler/meta.lux | 2 +- .../library/lux/tool/compiler/meta/archive.lux | 34 +- .../lux/tool/compiler/meta/archive/artifact.lux | 2 +- .../compiler/meta/archive/artifact/category.lux | 6 +- .../library/lux/tool/compiler/meta/archive/key.lux | 4 +- .../lux/tool/compiler/meta/archive/module.lux | 2 +- .../compiler/meta/archive/module/descriptor.lux | 12 +- .../tool/compiler/meta/archive/module/document.lux | 12 +- .../lux/tool/compiler/meta/archive/registry.lux | 20 +- .../lux/tool/compiler/meta/archive/signature.lux | 8 +- .../lux/tool/compiler/meta/archive/unit.lux | 8 +- .../library/lux/tool/compiler/meta/cache.lux | 6 +- .../lux/tool/compiler/meta/cache/archive.lux | 4 +- .../lux/tool/compiler/meta/cache/artifact.lux | 6 +- .../compiler/meta/cache/dependency/artifact.lux | 14 +- .../tool/compiler/meta/cache/dependency/module.lux | 14 +- .../lux/tool/compiler/meta/cache/module.lux | 16 +- .../library/lux/tool/compiler/meta/cache/purge.lux | 8 +- .../source/library/lux/tool/compiler/meta/cli.lux | 6 +- .../lux/tool/compiler/meta/cli/compiler.lux | 10 +- .../library/lux/tool/compiler/meta/context.lux | 2 +- .../library/lux/tool/compiler/meta/export.lux | 10 +- .../library/lux/tool/compiler/meta/import.lux | 6 +- .../source/library/lux/tool/compiler/meta/io.lux | 4 +- .../library/lux/tool/compiler/meta/io/archive.lux | 30 +- .../library/lux/tool/compiler/meta/io/context.lux | 24 +- .../library/lux/tool/compiler/meta/packager.lux | 2 +- .../lux/tool/compiler/meta/packager/jvm.lux | 24 +- .../lux/tool/compiler/meta/packager/ruby.lux | 14 +- .../lux/tool/compiler/meta/packager/scheme.lux | 16 +- .../lux/tool/compiler/meta/packager/script.lux | 4 +- stdlib/source/library/lux/tool/compiler/phase.lux | 34 +- .../source/library/lux/tool/compiler/reference.lux | 18 +- .../lux/tool/compiler/reference/variable.lux | 16 +- .../source/library/lux/tool/compiler/version.lux | 18 +- stdlib/source/library/lux/tool/interpreter.lux | 28 +- stdlib/source/library/lux/type.lux | 60 +- stdlib/source/library/lux/type/check.lux | 100 +- stdlib/source/library/lux/type/dynamic.lux | 10 +- stdlib/source/library/lux/type/implicit.lux | 54 +- stdlib/source/library/lux/type/poly.lux | 4 +- stdlib/source/library/lux/type/primitive.lux | 52 +- stdlib/source/library/lux/type/quotient.lux | 12 +- stdlib/source/library/lux/type/refinement.lux | 12 +- stdlib/source/library/lux/type/resource.lux | 26 +- stdlib/source/library/lux/type/unit.lux | 36 +- stdlib/source/library/lux/type/unit/scale.lux | 16 +- stdlib/source/library/lux/type/variance.lux | 4 +- stdlib/source/library/lux/world/console.lux | 36 +- stdlib/source/library/lux/world/db/jdbc.lux | 20 +- stdlib/source/library/lux/world/db/jdbc/input.lux | 14 +- stdlib/source/library/lux/world/db/jdbc/output.lux | 28 +- stdlib/source/library/lux/world/db/sql.lux | 92 +- stdlib/source/library/lux/world/file.lux | 216 +- stdlib/source/library/lux/world/file/watch.lux | 52 +- stdlib/source/library/lux/world/input/keyboard.lux | 4 +- stdlib/source/library/lux/world/net/http.lux | 2 +- .../source/library/lux/world/net/http/client.lux | 26 +- .../source/library/lux/world/net/http/cookie.lux | 18 +- .../source/library/lux/world/net/http/header.lux | 8 +- stdlib/source/library/lux/world/net/http/mime.lux | 10 +- stdlib/source/library/lux/world/net/http/query.lux | 6 +- .../source/library/lux/world/net/http/request.lux | 16 +- .../source/library/lux/world/net/http/response.lux | 16 +- stdlib/source/library/lux/world/net/http/route.lux | 8 +- .../source/library/lux/world/net/http/status.lux | 2 +- .../source/library/lux/world/net/http/version.lux | 2 +- stdlib/source/library/lux/world/net/uri.lux | 2 +- .../library/lux/world/output/video/resolution.lux | 6 +- stdlib/source/library/lux/world/program.lux | 42 +- stdlib/source/library/lux/world/shell.lux | 56 +- stdlib/source/parser/lux/data/binary.lux | 58 +- stdlib/source/parser/lux/data/text.lux | 80 +- .../lux/tool/compiler/language/lux/analysis.lux | 16 +- .../lux/tool/compiler/language/lux/synthesis.lux | 18 +- .../source/polytypic/lux/abstract/equivalence.lux | 2 +- stdlib/source/polytypic/lux/abstract/functor.lux | 4 +- stdlib/source/polytypic/lux/data/format/json.lux | 38 +- stdlib/source/program/aedifex.lux | 22 +- stdlib/source/program/aedifex/action.lux | 2 +- stdlib/source/program/aedifex/artifact.lux | 24 +- .../source/program/aedifex/artifact/extension.lux | 8 +- .../source/program/aedifex/artifact/snapshot.lux | 18 +- .../program/aedifex/artifact/snapshot/build.lux | 8 +- .../program/aedifex/artifact/snapshot/stamp.lux | 12 +- .../program/aedifex/artifact/snapshot/time.lux | 8 +- .../program/aedifex/artifact/snapshot/version.lux | 12 +- .../aedifex/artifact/snapshot/version/value.lux | 8 +- stdlib/source/program/aedifex/artifact/time.lux | 12 +- .../source/program/aedifex/artifact/time/date.lux | 20 +- .../source/program/aedifex/artifact/time/time.lux | 4 +- stdlib/source/program/aedifex/artifact/type.lux | 2 +- .../source/program/aedifex/artifact/versioning.lux | 16 +- stdlib/source/program/aedifex/cli.lux | 14 +- stdlib/source/program/aedifex/command/auto.lux | 8 +- stdlib/source/program/aedifex/command/build.lux | 46 +- stdlib/source/program/aedifex/command/clean.lux | 6 +- stdlib/source/program/aedifex/command/deploy.lux | 4 +- .../program/aedifex/command/deploy/release.lux | 20 +- .../program/aedifex/command/deploy/snapshot.lux | 4 +- stdlib/source/program/aedifex/command/deps.lux | 4 +- stdlib/source/program/aedifex/command/install.lux | 6 +- stdlib/source/program/aedifex/command/pom.lux | 4 +- stdlib/source/program/aedifex/command/test.lux | 8 +- stdlib/source/program/aedifex/command/version.lux | 2 +- stdlib/source/program/aedifex/dependency.lux | 10 +- .../program/aedifex/dependency/deployment.lux | 10 +- .../program/aedifex/dependency/resolution.lux | 16 +- .../source/program/aedifex/dependency/status.lux | 8 +- stdlib/source/program/aedifex/format.lux | 38 +- stdlib/source/program/aedifex/hash.lux | 30 +- stdlib/source/program/aedifex/input.lux | 6 +- stdlib/source/program/aedifex/local.lux | 6 +- stdlib/source/program/aedifex/metadata.lux | 12 +- .../source/program/aedifex/metadata/artifact.lux | 36 +- .../source/program/aedifex/metadata/snapshot.lux | 18 +- stdlib/source/program/aedifex/package.lux | 10 +- stdlib/source/program/aedifex/parser.lux | 54 +- stdlib/source/program/aedifex/pom.lux | 68 +- stdlib/source/program/aedifex/profile.lux | 32 +- stdlib/source/program/aedifex/project.lux | 16 +- stdlib/source/program/aedifex/repository.lux | 16 +- .../source/program/aedifex/repository/identity.lux | 4 +- stdlib/source/program/aedifex/repository/local.lux | 14 +- .../source/program/aedifex/repository/origin.lux | 2 +- .../source/program/aedifex/repository/remote.lux | 14 +- stdlib/source/program/aedifex/runtime.lux | 6 +- stdlib/source/program/compositor.lux | 10 +- stdlib/source/specification/aedifex/repository.lux | 2 +- stdlib/source/specification/compositor.lux | 4 +- .../specification/compositor/analysis/type.lux | 6 +- stdlib/source/specification/compositor/common.lux | 6 +- .../specification/compositor/generation/case.lux | 28 +- .../specification/compositor/generation/common.lux | 16 +- .../compositor/generation/function.lux | 10 +- .../compositor/generation/primitive.lux | 4 +- .../compositor/generation/reference.lux | 8 +- .../compositor/generation/structure.lux | 6 +- stdlib/source/specification/lux/abstract/apply.lux | 10 +- stdlib/source/specification/lux/abstract/codec.lux | 2 +- .../source/specification/lux/abstract/comonad.lux | 8 +- stdlib/source/specification/lux/abstract/enum.lux | 2 +- .../specification/lux/abstract/equivalence.lux | 2 +- .../source/specification/lux/abstract/functor.lux | 8 +- .../lux/abstract/functor/contravariant.lux | 4 +- stdlib/source/specification/lux/abstract/hash.lux | 2 +- .../source/specification/lux/abstract/interval.lux | 2 +- stdlib/source/specification/lux/abstract/mix.lux | 2 +- stdlib/source/specification/lux/abstract/monad.lux | 8 +- .../source/specification/lux/abstract/monoid.lux | 2 +- stdlib/source/specification/lux/abstract/order.lux | 2 +- stdlib/source/specification/lux/world/console.lux | 2 +- stdlib/source/specification/lux/world/file.lux | 26 +- stdlib/source/specification/lux/world/program.lux | 2 +- stdlib/source/specification/lux/world/shell.lux | 10 +- stdlib/source/test/aedifex.lux | 4 +- stdlib/source/test/aedifex/artifact.lux | 4 +- stdlib/source/test/aedifex/artifact/extension.lux | 2 +- stdlib/source/test/aedifex/artifact/snapshot.lux | 4 +- .../test/aedifex/artifact/snapshot/build.lux | 4 +- .../test/aedifex/artifact/snapshot/stamp.lux | 4 +- .../source/test/aedifex/artifact/snapshot/time.lux | 4 +- .../test/aedifex/artifact/snapshot/version.lux | 4 +- .../aedifex/artifact/snapshot/version/value.lux | 4 +- stdlib/source/test/aedifex/artifact/time.lux | 4 +- stdlib/source/test/aedifex/artifact/time/date.lux | 4 +- stdlib/source/test/aedifex/artifact/time/time.lux | 4 +- stdlib/source/test/aedifex/artifact/type.lux | 4 +- stdlib/source/test/aedifex/artifact/versioning.lux | 4 +- stdlib/source/test/aedifex/cache.lux | 16 +- stdlib/source/test/aedifex/cli.lux | 14 +- stdlib/source/test/aedifex/command.lux | 2 +- stdlib/source/test/aedifex/command/auto.lux | 4 +- stdlib/source/test/aedifex/command/build.lux | 42 +- stdlib/source/test/aedifex/command/clean.lux | 16 +- stdlib/source/test/aedifex/command/deploy.lux | 4 +- stdlib/source/test/aedifex/command/deps.lux | 2 +- stdlib/source/test/aedifex/command/install.lux | 6 +- stdlib/source/test/aedifex/command/pom.lux | 2 +- stdlib/source/test/aedifex/command/test.lux | 12 +- stdlib/source/test/aedifex/command/version.lux | 14 +- stdlib/source/test/aedifex/dependency.lux | 4 +- .../source/test/aedifex/dependency/deployment.lux | 12 +- .../source/test/aedifex/dependency/resolution.lux | 58 +- stdlib/source/test/aedifex/dependency/status.lux | 4 +- stdlib/source/test/aedifex/hash.lux | 4 +- stdlib/source/test/aedifex/input.lux | 6 +- stdlib/source/test/aedifex/local.lux | 2 +- stdlib/source/test/aedifex/metadata.lux | 2 +- stdlib/source/test/aedifex/metadata/artifact.lux | 4 +- stdlib/source/test/aedifex/metadata/snapshot.lux | 8 +- stdlib/source/test/aedifex/package.lux | 4 +- stdlib/source/test/aedifex/parser.lux | 16 +- stdlib/source/test/aedifex/pom.lux | 2 +- stdlib/source/test/aedifex/profile.lux | 34 +- stdlib/source/test/aedifex/project.lux | 6 +- stdlib/source/test/aedifex/repository.lux | 18 +- stdlib/source/test/aedifex/repository/identity.lux | 4 +- stdlib/source/test/aedifex/repository/local.lux | 2 +- stdlib/source/test/aedifex/repository/origin.lux | 4 +- stdlib/source/test/aedifex/repository/remote.lux | 12 +- stdlib/source/test/aedifex/runtime.lux | 4 +- stdlib/source/test/lux.lux | 102 +- stdlib/source/test/lux/abstract.lux | 8 +- stdlib/source/test/lux/abstract/apply.lux | 2 +- stdlib/source/test/lux/abstract/codec.lux | 10 +- stdlib/source/test/lux/abstract/comonad.lux | 2 +- stdlib/source/test/lux/abstract/comonad/free.lux | 8 +- stdlib/source/test/lux/abstract/enum.lux | 2 +- stdlib/source/test/lux/abstract/equivalence.lux | 14 +- stdlib/source/test/lux/abstract/functor.lux | 12 +- .../test/lux/abstract/functor/contravariant.lux | 2 +- stdlib/source/test/lux/abstract/hash.lux | 4 +- stdlib/source/test/lux/abstract/interval.lux | 26 +- stdlib/source/test/lux/abstract/mix.lux | 2 +- stdlib/source/test/lux/abstract/monad.lux | 2 +- stdlib/source/test/lux/abstract/monad/free.lux | 8 +- stdlib/source/test/lux/abstract/monoid.lux | 2 +- stdlib/source/test/lux/abstract/order.lux | 4 +- stdlib/source/test/lux/abstract/predicate.lux | 6 +- stdlib/source/test/lux/control.lux | 6 +- stdlib/source/test/lux/control/concatenative.lux | 14 +- .../source/test/lux/control/concurrency/actor.lux | 8 +- .../source/test/lux/control/concurrency/async.lux | 8 +- .../source/test/lux/control/concurrency/atom.lux | 2 +- stdlib/source/test/lux/control/concurrency/frp.lux | 8 +- .../test/lux/control/concurrency/semaphore.lux | 12 +- stdlib/source/test/lux/control/concurrency/stm.lux | 6 +- .../source/test/lux/control/concurrency/thread.lux | 2 +- stdlib/source/test/lux/control/continuation.lux | 6 +- stdlib/source/test/lux/control/exception.lux | 4 +- stdlib/source/test/lux/control/function.lux | 4 +- .../source/test/lux/control/function/contract.lux | 2 +- stdlib/source/test/lux/control/function/inline.lux | 8 +- stdlib/source/test/lux/control/function/memo.lux | 10 +- stdlib/source/test/lux/control/function/mixin.lux | 4 +- stdlib/source/test/lux/control/function/mutual.lux | 10 +- stdlib/source/test/lux/control/io.lux | 6 +- stdlib/source/test/lux/control/lazy.lux | 8 +- stdlib/source/test/lux/control/maybe.lux | 2 +- stdlib/source/test/lux/control/parser.lux | 22 +- stdlib/source/test/lux/control/parser/cli.lux | 4 +- stdlib/source/test/lux/control/parser/code.lux | 10 +- .../source/test/lux/control/parser/environment.lux | 2 +- stdlib/source/test/lux/control/parser/json.lux | 6 +- stdlib/source/test/lux/control/parser/tree.lux | 8 +- stdlib/source/test/lux/control/parser/type.lux | 16 +- stdlib/source/test/lux/control/parser/xml.lux | 12 +- stdlib/source/test/lux/control/pipe.lux | 2 +- stdlib/source/test/lux/control/reader.lux | 6 +- stdlib/source/test/lux/control/region.lux | 10 +- stdlib/source/test/lux/control/remember.lux | 16 +- .../test/lux/control/security/capability.lux | 2 +- stdlib/source/test/lux/control/security/policy.lux | 20 +- stdlib/source/test/lux/control/state.lux | 16 +- stdlib/source/test/lux/control/thread.lux | 6 +- stdlib/source/test/lux/control/try.lux | 8 +- stdlib/source/test/lux/control/writer.lux | 6 +- stdlib/source/test/lux/data.lux | 12 +- stdlib/source/test/lux/data/binary.lux | 56 +- stdlib/source/test/lux/data/bit.lux | 2 +- stdlib/source/test/lux/data/collection.lux | 10 +- stdlib/source/test/lux/data/collection/array.lux | 16 +- stdlib/source/test/lux/data/collection/bits.lux | 6 +- .../source/test/lux/data/collection/dictionary.lux | 12 +- .../lux/data/collection/dictionary/ordered.lux | 4 +- .../test/lux/data/collection/dictionary/plist.lux | 4 +- stdlib/source/test/lux/data/collection/list.lux | 20 +- stdlib/source/test/lux/data/collection/queue.lux | 4 +- .../test/lux/data/collection/queue/priority.lux | 4 +- .../source/test/lux/data/collection/sequence.lux | 8 +- stdlib/source/test/lux/data/collection/set.lux | 8 +- .../source/test/lux/data/collection/set/multi.lux | 10 +- .../test/lux/data/collection/set/ordered.lux | 6 +- stdlib/source/test/lux/data/collection/stack.lux | 4 +- stdlib/source/test/lux/data/collection/stream.lux | 8 +- stdlib/source/test/lux/data/collection/tree.lux | 4 +- .../test/lux/data/collection/tree/finger.lux | 6 +- .../test/lux/data/collection/tree/zipper.lux | 4 +- stdlib/source/test/lux/data/color.lux | 24 +- stdlib/source/test/lux/data/color/named.lux | 10 +- stdlib/source/test/lux/data/format/json.lux | 22 +- stdlib/source/test/lux/data/format/tar.lux | 20 +- stdlib/source/test/lux/data/format/xml.lux | 14 +- stdlib/source/test/lux/data/identity.lux | 6 +- stdlib/source/test/lux/data/product.lux | 2 +- stdlib/source/test/lux/data/sum.lux | 2 +- stdlib/source/test/lux/data/text.lux | 40 +- stdlib/source/test/lux/data/text/buffer.lux | 4 +- stdlib/source/test/lux/data/text/encoding.lux | 12 +- stdlib/source/test/lux/data/text/encoding/utf8.lux | 2 +- stdlib/source/test/lux/data/text/escape.lux | 18 +- stdlib/source/test/lux/data/text/regex.lux | 30 +- stdlib/source/test/lux/data/text/unicode/block.lux | 6 +- stdlib/source/test/lux/data/text/unicode/set.lux | 4 +- stdlib/source/test/lux/debug.lux | 16 +- stdlib/source/test/lux/documentation.lux | 10 +- stdlib/source/test/lux/extension.lux | 6 +- stdlib/source/test/lux/ffi.js.lux | 2 +- stdlib/source/test/lux/ffi.jvm.lux | 20 +- stdlib/source/test/lux/ffi.lua.lux | 2 +- stdlib/source/test/lux/ffi.old.lux | 12 +- stdlib/source/test/lux/ffi.php.lux | 2 +- stdlib/source/test/lux/ffi.py.lux | 2 +- stdlib/source/test/lux/ffi.rb.lux | 2 +- stdlib/source/test/lux/ffi.scm.lux | 2 +- stdlib/source/test/lux/ffi/export.js.lux | 6 +- stdlib/source/test/lux/ffi/export.jvm.lux | 24 +- stdlib/source/test/lux/ffi/export.lua.lux | 6 +- stdlib/source/test/lux/ffi/export.py.lux | 6 +- stdlib/source/test/lux/ffi/export.rb.lux | 10 +- stdlib/source/test/lux/locale.lux | 10 +- stdlib/source/test/lux/locale/language.lux | 20 +- stdlib/source/test/lux/locale/territory.lux | 16 +- stdlib/source/test/lux/macro.lux | 24 +- stdlib/source/test/lux/macro/code.lux | 16 +- stdlib/source/test/lux/macro/local.lux | 10 +- stdlib/source/test/lux/macro/pattern.lux | 4 +- stdlib/source/test/lux/macro/syntax.lux | 4 +- stdlib/source/test/lux/macro/syntax/check.lux | 4 +- .../source/test/lux/macro/syntax/declaration.lux | 4 +- stdlib/source/test/lux/macro/syntax/definition.lux | 6 +- stdlib/source/test/lux/macro/syntax/export.lux | 4 +- stdlib/source/test/lux/macro/syntax/input.lux | 4 +- .../source/test/lux/macro/syntax/type/variable.lux | 4 +- stdlib/source/test/lux/macro/template.lux | 6 +- stdlib/source/test/lux/math.lux | 6 +- stdlib/source/test/lux/math/infix.lux | 2 +- stdlib/source/test/lux/math/logic/continuous.lux | 2 +- stdlib/source/test/lux/math/logic/fuzzy.lux | 18 +- stdlib/source/test/lux/math/modular.lux | 4 +- stdlib/source/test/lux/math/modulus.lux | 6 +- stdlib/source/test/lux/math/number.lux | 4 +- stdlib/source/test/lux/math/number/complex.lux | 30 +- stdlib/source/test/lux/math/number/frac.lux | 18 +- stdlib/source/test/lux/math/number/i16.lux | 4 +- stdlib/source/test/lux/math/number/i32.lux | 4 +- stdlib/source/test/lux/math/number/i64.lux | 12 +- stdlib/source/test/lux/math/number/i8.lux | 4 +- stdlib/source/test/lux/math/number/int.lux | 6 +- stdlib/source/test/lux/math/number/nat.lux | 6 +- stdlib/source/test/lux/math/number/ratio.lux | 6 +- stdlib/source/test/lux/math/number/rev.lux | 4 +- stdlib/source/test/lux/meta.lux | 30 +- stdlib/source/test/lux/meta/configuration.lux | 6 +- stdlib/source/test/lux/meta/location.lux | 4 +- stdlib/source/test/lux/meta/symbol.lux | 4 +- stdlib/source/test/lux/meta/version.lux | 4 +- stdlib/source/test/lux/program.lux | 4 +- stdlib/source/test/lux/static.lux | 2 +- stdlib/source/test/lux/target.lux | 8 +- stdlib/source/test/lux/target/js.lux | 44 +- stdlib/source/test/lux/target/jvm.lux | 160 +- stdlib/source/test/lux/target/lua.lux | 44 +- stdlib/source/test/lux/target/python.lux | 44 +- stdlib/source/test/lux/target/ruby.lux | 58 +- stdlib/source/test/lux/test.lux | 16 +- stdlib/source/test/lux/time.lux | 8 +- stdlib/source/test/lux/time/date.lux | 2 +- stdlib/source/test/lux/time/day.lux | 4 +- stdlib/source/test/lux/time/duration.lux | 2 +- stdlib/source/test/lux/time/instant.lux | 2 +- stdlib/source/test/lux/time/month.lux | 4 +- stdlib/source/test/lux/time/year.lux | 4 +- stdlib/source/test/lux/tool.lux | 2 +- stdlib/source/test/lux/tool/compiler/arity.lux | 2 +- .../lux/tool/compiler/language/lux/analysis.lux | 30 +- .../compiler/language/lux/analysis/complex.lux | 6 +- .../compiler/language/lux/analysis/coverage.lux | 26 +- .../compiler/language/lux/analysis/inference.lux | 22 +- .../tool/compiler/language/lux/analysis/macro.lux | 6 +- .../tool/compiler/language/lux/analysis/module.lux | 16 +- .../compiler/language/lux/analysis/pattern.lux | 4 +- .../tool/compiler/language/lux/analysis/scope.lux | 4 +- .../tool/compiler/language/lux/analysis/simple.lux | 4 +- .../tool/compiler/language/lux/analysis/type.lux | 6 +- .../tool/compiler/language/lux/phase/analysis.lux | 26 +- .../compiler/language/lux/phase/analysis/case.lux | 18 +- .../language/lux/phase/analysis/complex.lux | 26 +- .../language/lux/phase/analysis/function.lux | 12 +- .../language/lux/phase/analysis/reference.lux | 2 +- .../language/lux/phase/analysis/simple.lux | 6 +- .../tool/compiler/language/lux/phase/extension.lux | 16 +- .../language/lux/phase/extension/analysis/lux.lux | 18 +- .../tool/compiler/language/lux/phase/synthesis.lux | 2 +- .../compiler/language/lux/phase/synthesis/case.lux | 34 +- .../language/lux/phase/synthesis/function.lux | 60 +- .../compiler/language/lux/phase/synthesis/loop.lux | 26 +- .../language/lux/phase/synthesis/primitive.lux | 6 +- .../language/lux/phase/synthesis/structure.lux | 6 +- .../language/lux/phase/synthesis/variable.lux | 52 +- .../test/lux/tool/compiler/language/lux/syntax.lux | 16 +- .../lux/tool/compiler/language/lux/synthesis.lux | 16 +- .../compiler/language/lux/synthesis/access.lux | 2 +- .../language/lux/synthesis/access/member.lux | 4 +- .../language/lux/synthesis/access/side.lux | 4 +- .../compiler/language/lux/synthesis/simple.lux | 4 +- .../source/test/lux/tool/compiler/meta/archive.lux | 6 +- .../lux/tool/compiler/meta/archive/artifact.lux | 4 +- .../compiler/meta/archive/artifact/category.lux | 6 +- .../test/lux/tool/compiler/meta/archive/key.lux | 2 +- .../test/lux/tool/compiler/meta/archive/module.lux | 4 +- .../compiler/meta/archive/module/descriptor.lux | 6 +- .../tool/compiler/meta/archive/module/document.lux | 2 +- .../lux/tool/compiler/meta/archive/registry.lux | 8 +- .../lux/tool/compiler/meta/archive/signature.lux | 4 +- .../test/lux/tool/compiler/meta/archive/unit.lux | 4 +- .../source/test/lux/tool/compiler/meta/cache.lux | 2 +- .../test/lux/tool/compiler/meta/cache/archive.lux | 2 +- .../test/lux/tool/compiler/meta/cache/artifact.lux | 2 +- .../test/lux/tool/compiler/meta/cache/module.lux | 8 +- .../test/lux/tool/compiler/meta/cache/purge.lux | 2 +- stdlib/source/test/lux/tool/compiler/meta/cli.lux | 2 +- .../test/lux/tool/compiler/meta/cli/compiler.lux | 4 +- .../source/test/lux/tool/compiler/meta/context.lux | 4 +- .../source/test/lux/tool/compiler/meta/export.lux | 2 +- .../source/test/lux/tool/compiler/meta/import.lux | 2 +- stdlib/source/test/lux/tool/compiler/phase.lux | 14 +- stdlib/source/test/lux/tool/compiler/reference.lux | 6 +- .../test/lux/tool/compiler/reference/variable.lux | 4 +- stdlib/source/test/lux/tool/compiler/version.lux | 4 +- stdlib/source/test/lux/type.lux | 10 +- stdlib/source/test/lux/type/check.lux | 84 +- stdlib/source/test/lux/type/dynamic.lux | 2 +- stdlib/source/test/lux/type/implicit.lux | 2 +- stdlib/source/test/lux/type/primitive.lux | 6 +- stdlib/source/test/lux/type/quotient.lux | 8 +- stdlib/source/test/lux/type/refinement.lux | 6 +- stdlib/source/test/lux/type/resource.lux | 10 +- stdlib/source/test/lux/type/unit.lux | 14 +- stdlib/source/test/lux/type/unit/scale.lux | 12 +- stdlib/source/test/lux/type/variance.lux | 2 +- stdlib/source/test/lux/world.lux | 2 +- stdlib/source/test/lux/world/console.lux | 12 +- stdlib/source/test/lux/world/file.lux | 46 +- stdlib/source/test/lux/world/file/watch.lux | 16 +- stdlib/source/test/lux/world/input/keyboard.lux | 12 +- stdlib/source/test/lux/world/net/http/client.lux | 6 +- stdlib/source/test/lux/world/net/http/status.lux | 10 +- .../test/lux/world/output/video/resolution.lux | 8 +- stdlib/source/test/lux/world/program.lux | 6 +- stdlib/source/test/lux/world/shell.lux | 28 +- stdlib/source/unsafe/lux/data/binary.lux | 30 +- stdlib/source/unsafe/lux/data/collection/array.lux | 56 +- 1034 files changed, 11201 insertions(+), 11219 deletions(-) (limited to 'stdlib') diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index 1d675d339..e8906c6c0 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -39,7 +39,7 @@ ["[1][0]" type] ["[1][0]" world]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" @@ -146,7 +146,7 @@ (format "Throws away any code given to it." \n "Great for commenting-out code, while retaining syntax high-lighting and formatting in your text editor.") [(comment - (def: (this will not) + (def (this will not) (Be Defined) (because it will be (commented out))))]) @@ -239,14 +239,14 @@ (format "Hygienic quasi-quotation as a macro." \n "Unquote (~) and unquote-splice (~+) must also be used as forms." \n "All unprefixed macros will receive their parent module's prefix if imported; otherwise will receive the prefix of the module on which the quasi-quote is being used.") - [(` (def: (~ name) + [(` (def (~ name) (function ((~' _) (~+ args)) (~ body))))]) (documentation /.`' (format "Unhygienic quasi-quotation as a macro." \n "Unquote (~) and unquote-splice (~+) must also be used as forms.") - [(`' (def: (~ name) + [(`' (def (~ name) (function (_ (~+ args)) (~ body))))]) @@ -282,7 +282,7 @@ "" ["By specifying a pattern (with holes), and the input data to fill those holes, repeats the pattern as many times as necessary." (with_template [ ] - [(def: .public + [(def .public (-> Int Int) (+ ))] @@ -379,7 +379,7 @@ ... {#Saturday} ... {#Sunday})) - ... (def: (weekend? day) + ... (def (weekend? day) ... (-> Weekday Bit) ... (case day ... (^or {#Saturday} {#Sunday}) @@ -408,26 +408,26 @@ 0 1 _ (* n (factorial (-- n))))))]) - (documentation /.def: + (documentation /.def "Defines global constants/functions." - [(def: branching_exponent + [(def branching_exponent Int +5)] ["The type is optional." - (def: branching_exponent + (def branching_exponent +5)] - [(def: (pair_list pair) + [(def (pair_list pair) (-> [Code Code] (List Code)) (let [[left right] pair] (list left right)))] ["Can pattern-match on the inputs to functions." - (def: (pair_list [left right]) + (def (pair_list [left right]) (-> [Code Code] (List Code)) (list left right))]) (documentation /.macro "Macro-definition macro." - [(def: .public symbol + [(def .public symbol (macro (_ tokens) (case tokens (^with_template [] @@ -464,9 +464,9 @@ "Express a value that implements an interface." [(is (Order Int) (implementation - (def: equivalence + (def equivalence equivalence) - (def: (< reference subject) + (def (< reference subject) (< reference subject)) ))]) @@ -521,7 +521,7 @@ (documentation /.open (format "Same as the 'open' macro, but meant to be used as a pattern-matching macro for generating local bindings." \n "Takes an 'alias' text for the generated local bindings.") - [(def: .public (range enum from to) + [(def .public (range enum from to) (All (_ a) (-> (Enum a) a a (List a))) (let [(open "[0]") enum] (loop (again [end to @@ -554,8 +554,8 @@ "Opens a implementation and generates a definition for each of its members (including nested members)." [(open: "i:[0]" order) "=>" - (def: i:= (at order =)) - (def: i:< (at order <))]) + (def i:= (at order =)) + (def i:< (at order <))]) (documentation /.|>> "Similar to the piping macro, but rather than taking an initial object to work on, creates a function for taking it." @@ -624,7 +624,7 @@ ... (documentation /.^template ... "It's similar to template, but meant to be used during pattern-matching." - ... [(def: (reduced env type) + ... [(def (reduced env type) ... (-> (List Type) Type Type) ... (case type ... {.#Primitive name params} @@ -684,7 +684,7 @@ (format "Controlled macro-expansion." \n "Bind an arbitraty number of Code nodes resulting from macro-expansion to local bindings." \n "Wherever a binding appears, the bound Code nodes will be spliced in there.") - [(def: test + [(def test Test (with_expansions [ (with_template [ ] @@ -712,8 +712,8 @@ \n "* Rev" \n "* Frac" \n "* Text") - [(def: my_nat 123) - (def: my_text "456") + [(def my_nat 123) + (def my_text "456") (and (case [my_nat my_text] (pattern (static [..my_nat ..my_text])) true @@ -757,7 +757,7 @@ (format "WARNING: Please stay away from this macro; it's very likely to be removed in a future version of Lux." "Allows you to refer to the type-variables in a polymorphic function's type, by their index.") ["In the example below, 0 corresponds to the 'a' variable." - (def: .public (of_list list) + (def .public (of_list list) (All (_ a) (-> (List a) (Sequence a))) (list#mix add (is (Sequence (parameter 0)) @@ -776,7 +776,7 @@ ... (documentation /.^let ... "Allows you to simultaneously bind and de-structure a value." - ... [(def: (hash (^let set [member_hash _])) + ... [(def (hash (^let set [member_hash _])) ... (list#mix (function (_ elem acc) ... (+ acc ... (at member_hash hash elem))) @@ -799,7 +799,7 @@ (format "Meant to be used as a stand-in for functions with undefined implementations." \n "Undefined expressions will type-check against everything, so they make good dummy implementations." \n "However, if an undefined expression is ever evaluated, it will raise a runtime error.") - [(def: (square x) + [(def (square x) (-> Int Int) (undefined))]) @@ -816,7 +816,7 @@ (documentation /.template (format "Define macros in the style of with_template." \n "For simple macros that do not need any fancy features.") - [(def: square + [(def square (template (square x) (* x x)))]) @@ -839,7 +839,7 @@ (documentation /.for (format "Selects the appropriate code for a given target-platform when compiling Lux to it." \n "Look-up the available targets in library/lux/target.") - [(def: js + [(def js "JavaScript") (for "JVM" (do jvm stuff) diff --git a/stdlib/source/documentation/lux/abstract.lux b/stdlib/source/documentation/lux/abstract.lux index ea29bec24..f970c8ea4 100644 --- a/stdlib/source/documentation/lux/abstract.lux +++ b/stdlib/source/documentation/lux/abstract.lux @@ -22,7 +22,7 @@ ["[1][0]" order] ["[1][0]" predicate]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) (list.together (list /apply.documentation diff --git a/stdlib/source/documentation/lux/abstract/apply.lux b/stdlib/source/documentation/lux/abstract/apply.lux index 7f18dbdc2..80028da18 100644 --- a/stdlib/source/documentation/lux/abstract/apply.lux +++ b/stdlib/source/documentation/lux/abstract/apply.lux @@ -1,20 +1,17 @@ (.using [library [lux - ["$" documentation (.only documentation:)]]] + ["$" documentation (.only documentation)]]] [\\library ["[0]" /]]) -(documentation: (/.Apply f) - "Applicative functors.") - -(documentation: /.composite - "Applicative functor composition.") - -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" - [..Apply - ..composite] + [(documentation (/.Apply f) + "Applicative functors.") + + (documentation /.composite + "Applicative functor composition.")] [])) diff --git a/stdlib/source/documentation/lux/abstract/codec.lux b/stdlib/source/documentation/lux/abstract/codec.lux index 630e0e504..c6c97876d 100644 --- a/stdlib/source/documentation/lux/abstract/codec.lux +++ b/stdlib/source/documentation/lux/abstract/codec.lux @@ -1,25 +1,22 @@ (.using [library [lux - ["$" documentation (.only documentation:)]]] + ["$" documentation (.only documentation)]]] [\\library ["[0]" /]]) -(documentation: (/.Codec medium value) - "A way to move back-and-forth between a type and an alternative representation for it.") - -(documentation: /.composite - "Codec composition." - [(is (Codec c a) - (composite (is (Codec c b) - cb_codec) - (is (Codec b a) - ba_codec)))]) - -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" - [..Codec - ..composite] + [(documentation (/.Codec medium value) + "A way to move back-and-forth between a type and an alternative representation for it.") + + (documentation /.composite + "Codec composition." + [(is (Codec c a) + (composite (is (Codec c b) + cb_codec) + (is (Codec b a) + ba_codec)))])] [])) diff --git a/stdlib/source/documentation/lux/abstract/comonad.lux b/stdlib/source/documentation/lux/abstract/comonad.lux index d37ba5d68..e634ad2b2 100644 --- a/stdlib/source/documentation/lux/abstract/comonad.lux +++ b/stdlib/source/documentation/lux/abstract/comonad.lux @@ -1,7 +1,7 @@ (.using [library [lux - ["$" documentation (.only documentation:)] + ["$" documentation (.only documentation)] [data [text (.only \n) ["%" \\format (.only format)]]]]] @@ -10,21 +10,18 @@ ["[0]" / ["[1][0]" cofree]]) -(documentation: (/.CoMonad !) - (format "Co-monads are the opposite/complement to monads." - \n "Co-monadic structures are often infinite in size and built upon lazily-evaluated functions.")) - -(documentation: /.be - "A co-monadic parallel to the 'do' macro." - [(let [square (function (_ n) (* n n))] - (be comonad - [inputs (iterate ++ +2)] - (square (out inputs))))]) - -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" - [..CoMonad - ..be] + [(documentation (/.CoMonad !) + (format "Co-monads are the opposite/complement to monads." + \n "Co-monadic structures are often infinite in size and built upon lazily-evaluated functions.")) + + (documentation /.be + "A co-monadic parallel to the 'do' macro." + [(let [square (function (_ n) (* n n))] + (be comonad + [inputs (iterate ++ +2)] + (square (out inputs))))])] [/cofree.documentation])) diff --git a/stdlib/source/documentation/lux/abstract/comonad/cofree.lux b/stdlib/source/documentation/lux/abstract/comonad/cofree.lux index 644357230..739431ae4 100644 --- a/stdlib/source/documentation/lux/abstract/comonad/cofree.lux +++ b/stdlib/source/documentation/lux/abstract/comonad/cofree.lux @@ -1,18 +1,16 @@ (.using [library [lux - ["$" documentation (.only documentation:)]]] + ["$" documentation (.only documentation)]]] [\\library ["[0]" /]]) -(documentation: (/.CoFree ! it) - "The CoFree CoMonad.") - -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" - [..CoFree + [(documentation (/.CoFree ! it) + "The CoFree CoMonad.") ($.default /.functor) ($.default /.comonad)] [])) diff --git a/stdlib/source/documentation/lux/abstract/enum.lux b/stdlib/source/documentation/lux/abstract/enum.lux index 225a36a1e..53a1d2dd8 100644 --- a/stdlib/source/documentation/lux/abstract/enum.lux +++ b/stdlib/source/documentation/lux/abstract/enum.lux @@ -1,21 +1,18 @@ (.using [library [lux - ["$" documentation (.only documentation:)]]] + ["$" documentation (.only documentation)]]] [\\library ["[0]" /]]) -(documentation: (/.Enum it) - "Enumerable types, with a notion of moving forward and backwards through a type's instances.") - -(documentation: /.range - "An inclusive [from, to] range of values." - [(range enum from to)]) - -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" - [..Enum - ..range] + [(documentation (/.Enum it) + "Enumerable types, with a notion of moving forward and backwards through a type's instances.") + + (documentation /.range + "An inclusive [from, to] range of values." + [(range enum from to)])] [])) diff --git a/stdlib/source/documentation/lux/abstract/equivalence.lux b/stdlib/source/documentation/lux/abstract/equivalence.lux index 254626d62..87be00b09 100644 --- a/stdlib/source/documentation/lux/abstract/equivalence.lux +++ b/stdlib/source/documentation/lux/abstract/equivalence.lux @@ -1,25 +1,23 @@ (.using [library [lux - ["$" documentation (.only documentation:)] + ["$" documentation (.only documentation)] [data [text (.only \n) ["%" \\format (.only format)]]]]] [\\library ["[0]" /]]) -(documentation: (/.Equivalence it) - "Equivalence for a type's instances.") - -(documentation: /.rec - "A recursive equivalence combinator." - [(rec recursive_equivalence)]) - -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" - [..Equivalence - ..rec + [(documentation (/.Equivalence it) + "Equivalence for a type's instances.") + + (documentation /.rec + "A recursive equivalence combinator." + [(rec recursive_equivalence)]) + ($.default /.functor)] [])) diff --git a/stdlib/source/documentation/lux/abstract/functor.lux b/stdlib/source/documentation/lux/abstract/functor.lux index 05c9cef0d..9c817c6a3 100644 --- a/stdlib/source/documentation/lux/abstract/functor.lux +++ b/stdlib/source/documentation/lux/abstract/functor.lux @@ -19,7 +19,7 @@ (documentation: /.composite "Functor composition.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/abstract/functor/contravariant.lux b/stdlib/source/documentation/lux/abstract/functor/contravariant.lux index 72c873f4c..39d52f679 100644 --- a/stdlib/source/documentation/lux/abstract/functor/contravariant.lux +++ b/stdlib/source/documentation/lux/abstract/functor/contravariant.lux @@ -1,16 +1,14 @@ (.using [library [lux - ["$" documentation (.only documentation:)]]] + ["$" documentation (.only documentation)]]] [\\library ["[0]" /]]) -(documentation: (/.Functor !) - "The contravariant functor.") - -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" - [..Functor] + [(documentation (/.Functor !) + "The contravariant functor.")] [])) diff --git a/stdlib/source/documentation/lux/abstract/hash.lux b/stdlib/source/documentation/lux/abstract/hash.lux index af7584ead..98b73f40f 100644 --- a/stdlib/source/documentation/lux/abstract/hash.lux +++ b/stdlib/source/documentation/lux/abstract/hash.lux @@ -11,7 +11,7 @@ (documentation: (/.Hash it) "A way to produce hash-codes for a type's instances.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/abstract/interval.lux b/stdlib/source/documentation/lux/abstract/interval.lux index 4e7db1093..88d50e897 100644 --- a/stdlib/source/documentation/lux/abstract/interval.lux +++ b/stdlib/source/documentation/lux/abstract/interval.lux @@ -30,7 +30,7 @@ (documentation: /.meets? "Whether an interval meets another one on its bottom/lower side.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/abstract/mix.lux b/stdlib/source/documentation/lux/abstract/mix.lux index 83767d6af..da8fb5738 100644 --- a/stdlib/source/documentation/lux/abstract/mix.lux +++ b/stdlib/source/documentation/lux/abstract/mix.lux @@ -15,7 +15,7 @@ "Mix a mixable structure using the monoid's identity as the initial value." [(with_monoid monoid mix value)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/abstract/monad.lux b/stdlib/source/documentation/lux/abstract/monad.lux index e5a40d680..f883137fa 100644 --- a/stdlib/source/documentation/lux/abstract/monad.lux +++ b/stdlib/source/documentation/lux/abstract/monad.lux @@ -41,7 +41,7 @@ "Mix a list with a monadic function." [(mix monad function initial_value items)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/abstract/monad/free.lux b/stdlib/source/documentation/lux/abstract/monad/free.lux index fc97271f6..6174c73d3 100644 --- a/stdlib/source/documentation/lux/abstract/monad/free.lux +++ b/stdlib/source/documentation/lux/abstract/monad/free.lux @@ -8,7 +8,7 @@ (documentation: (/.Free ! it) "The Free Monad.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/abstract/monoid.lux b/stdlib/source/documentation/lux/abstract/monoid.lux index e34a18ac5..804dc2d95 100644 --- a/stdlib/source/documentation/lux/abstract/monoid.lux +++ b/stdlib/source/documentation/lux/abstract/monoid.lux @@ -12,7 +12,7 @@ (format "A way to compose values." \n "Includes an identity value which does not alter any other value when combined with.")) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/abstract/order.lux b/stdlib/source/documentation/lux/abstract/order.lux index fcd311241..19271b940 100644 --- a/stdlib/source/documentation/lux/abstract/order.lux +++ b/stdlib/source/documentation/lux/abstract/order.lux @@ -32,7 +32,7 @@ (documentation: /.max "Maximum.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/abstract/predicate.lux b/stdlib/source/documentation/lux/abstract/predicate.lux index e321be043..321df427f 100644 --- a/stdlib/source/documentation/lux/abstract/predicate.lux +++ b/stdlib/source/documentation/lux/abstract/predicate.lux @@ -32,7 +32,7 @@ (documentation: /.rec "Ties the knot for a recursive predicate.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control.lux b/stdlib/source/documentation/lux/control.lux index 917a99bcf..d88a8169f 100644 --- a/stdlib/source/documentation/lux/control.lux +++ b/stdlib/source/documentation/lux/control.lux @@ -28,7 +28,7 @@ ["[1][0]" writer] ]) -(.def: .public documentation +(.def .public documentation (.List $.Module) (list.together (list /concatenative.documentation diff --git a/stdlib/source/documentation/lux/control/concatenative.lux b/stdlib/source/documentation/lux/control/concatenative.lux index 7fa084004..3beae22cb 100644 --- a/stdlib/source/documentation/lux/control/concatenative.lux +++ b/stdlib/source/documentation/lux/control/concatenative.lux @@ -187,7 +187,7 @@ (documentation: /.? "Choose the top value when #0 and the second-to-top when #1.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/concurrency.lux b/stdlib/source/documentation/lux/control/concurrency.lux index 820841408..5dc85c5cd 100644 --- a/stdlib/source/documentation/lux/control/concurrency.lux +++ b/stdlib/source/documentation/lux/control/concurrency.lux @@ -16,7 +16,7 @@ ["[1][0]" stm] ["[1][0]" thread]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) (list.together (list /actor.documentation diff --git a/stdlib/source/documentation/lux/control/concurrency/actor.lux b/stdlib/source/documentation/lux/control/concurrency/actor.lux index 96211d7ba..4a25c2f77 100644 --- a/stdlib/source/documentation/lux/control/concurrency/actor.lux +++ b/stdlib/source/documentation/lux/control/concurrency/actor.lux @@ -52,7 +52,7 @@ \n "flowing through the channel into mail the actor can process." \n "Can stop observing the channel by executing the Stop value.")) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "The actor model of concurrency." diff --git a/stdlib/source/documentation/lux/control/concurrency/async.lux b/stdlib/source/documentation/lux/control/concurrency/async.lux index ab064d322..e5aa49b2e 100644 --- a/stdlib/source/documentation/lux/control/concurrency/async.lux +++ b/stdlib/source/documentation/lux/control/concurrency/async.lux @@ -71,7 +71,7 @@ "Wait for an async to be resolved within the specified amount of milli-seconds." [(within milli_seconds async)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/concurrency/atom.lux b/stdlib/source/documentation/lux/control/concurrency/atom.lux index 03ed4c603..a18adabcf 100644 --- a/stdlib/source/documentation/lux/control/concurrency/atom.lux +++ b/stdlib/source/documentation/lux/control/concurrency/atom.lux @@ -26,7 +26,7 @@ (format "Writes the given value to an atom." \n "If it fails to write it (because some other process wrote to it first), it will retry until it succeeds.")) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/concurrency/frp.lux b/stdlib/source/documentation/lux/control/concurrency/frp.lux index a2cd11b36..5365585a3 100644 --- a/stdlib/source/documentation/lux/control/concurrency/frp.lux +++ b/stdlib/source/documentation/lux/control/concurrency/frp.lux @@ -40,7 +40,7 @@ "Transforms the given list into a channel with the same elements." [(sequential milli_seconds values)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/concurrency/semaphore.lux b/stdlib/source/documentation/lux/control/concurrency/semaphore.lux index 74b441df0..c825074c7 100644 --- a/stdlib/source/documentation/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/documentation/lux/control/concurrency/semaphore.lux @@ -49,7 +49,7 @@ (documentation: /.block! "Wait on a barrier until all processes have arrived and met the barrier's limit.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/concurrency/stm.lux b/stdlib/source/documentation/lux/control/concurrency/stm.lux index ee362e0c5..60c1eb06e 100644 --- a/stdlib/source/documentation/lux/control/concurrency/stm.lux +++ b/stdlib/source/documentation/lux/control/concurrency/stm.lux @@ -34,7 +34,7 @@ \n "For this reason, it's important to note that transactions must be free from side-effects, such as I/O.") [(commit! procedure)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/concurrency/thread.lux b/stdlib/source/documentation/lux/control/concurrency/thread.lux index 3d32de720..e856ee64b 100644 --- a/stdlib/source/documentation/lux/control/concurrency/thread.lux +++ b/stdlib/source/documentation/lux/control/concurrency/thread.lux @@ -17,7 +17,7 @@ "Executes an I/O procedure after some milli-seconds." [(schedule! milli_seconds action)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/continuation.lux b/stdlib/source/documentation/lux/control/continuation.lux index 77308f7b8..f7b729cd8 100644 --- a/stdlib/source/documentation/lux/control/continuation.lux +++ b/stdlib/source/documentation/lux/control/continuation.lux @@ -35,7 +35,7 @@ "Turns any expression into a function that is pending a continuation." [(pending (some_function some_input))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/exception.lux b/stdlib/source/documentation/lux/control/exception.lux index bfc5cb7b3..240cc8267 100644 --- a/stdlib/source/documentation/lux/control/exception.lux +++ b/stdlib/source/documentation/lux/control/exception.lux @@ -61,7 +61,7 @@ "If a computation fails, prepends the exception to the error." [(with exception message computation)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "Pure-Lux exception-handling functionality." diff --git a/stdlib/source/documentation/lux/control/function.lux b/stdlib/source/documentation/lux/control/function.lux index d6a406a40..c681ad77a 100644 --- a/stdlib/source/documentation/lux/control/function.lux +++ b/stdlib/source/documentation/lux/control/function.lux @@ -40,7 +40,7 @@ "Simple 1-argument function application." [(on input function)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/function/contract.lux b/stdlib/source/documentation/lux/control/function/contract.lux index 036f1ac8c..f7586f66f 100644 --- a/stdlib/source/documentation/lux/control/function/contract.lux +++ b/stdlib/source/documentation/lux/control/function/contract.lux @@ -25,7 +25,7 @@ [(post i.even? (i.+ +2 +2))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/function/memo.lux b/stdlib/source/documentation/lux/control/function/memo.lux index 90a43fede..1b24efe3a 100644 --- a/stdlib/source/documentation/lux/control/function/memo.lux +++ b/stdlib/source/documentation/lux/control/function/memo.lux @@ -24,7 +24,7 @@ \n "This is useful as a test control when measuring the effect of using memoization.") [(none hash memo)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/function/mixin.lux b/stdlib/source/documentation/lux/control/function/mixin.lux index c0024dac4..6ad2e8657 100644 --- a/stdlib/source/documentation/lux/control/function/mixin.lux +++ b/stdlib/source/documentation/lux/control/function/mixin.lux @@ -43,7 +43,7 @@ "Transform an indirectly recursive function into a mixin." [(of_recursive recursive)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/function/mutual.lux b/stdlib/source/documentation/lux/control/function/mutual.lux index 010178e9f..f8f19255e 100644 --- a/stdlib/source/documentation/lux/control/function/mutual.lux +++ b/stdlib/source/documentation/lux/control/function/mutual.lux @@ -1,6 +1,6 @@ (.using [library - [lux (.except let def:) + [lux (.except let def) ["$" documentation (.only documentation:)] [data [text (.only \n) @@ -26,9 +26,9 @@ (and (even? 4) (odd? 5)))]) -(documentation: /.def: +(documentation: /.def "Globally-defined mutually-recursive functions." - [(def: + [(def [.public (even? number) (-> Nat Bit) (case number @@ -41,10 +41,10 @@ 0 false _ (even? (-- number)))])]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" [..let - ..def:] + ..def] [])) diff --git a/stdlib/source/documentation/lux/control/io.lux b/stdlib/source/documentation/lux/control/io.lux index 12cd8e918..afd9ad60d 100644 --- a/stdlib/source/documentation/lux/control/io.lux +++ b/stdlib/source/documentation/lux/control/io.lux @@ -23,7 +23,7 @@ (documentation: /.run! "A way to execute IO computations and perform their side-effects.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "A method for abstracting I/O and effectful computations to make it safe while writing pure functional code." diff --git a/stdlib/source/documentation/lux/control/lazy.lux b/stdlib/source/documentation/lux/control/lazy.lux index f360be55f..d54b67d99 100644 --- a/stdlib/source/documentation/lux/control/lazy.lux +++ b/stdlib/source/documentation/lux/control/lazy.lux @@ -18,7 +18,7 @@ "Specifies a lazy value by providing the expression that computes it." [(lazy eager_computation)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/maybe.lux b/stdlib/source/documentation/lux/control/maybe.lux index ea19c8ef9..f8f5754a1 100644 --- a/stdlib/source/documentation/lux/control/maybe.lux +++ b/stdlib/source/documentation/lux/control/maybe.lux @@ -38,7 +38,7 @@ .when (passes_test? value)] (do_something_else 4 5 6))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/parser.lux b/stdlib/source/documentation/lux/control/parser.lux index dc03628bf..44d3fc8f9 100644 --- a/stdlib/source/documentation/lux/control/parser.lux +++ b/stdlib/source/documentation/lux/control/parser.lux @@ -131,7 +131,7 @@ "Decode the output of a parser using a codec." [(codec codec parser)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/parser/analysis.lux b/stdlib/source/documentation/lux/control/parser/analysis.lux index 3e718fbb6..dbabe20a9 100644 --- a/stdlib/source/documentation/lux/control/parser/analysis.lux +++ b/stdlib/source/documentation/lux/control/parser/analysis.lux @@ -47,7 +47,7 @@ "Parses only within the context of a tuple's contents." [(tuple parser)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/parser/binary.lux b/stdlib/source/documentation/lux/control/parser/binary.lux index bab961505..b4b17d0f5 100644 --- a/stdlib/source/documentation/lux/control/parser/binary.lux +++ b/stdlib/source/documentation/lux/control/parser/binary.lux @@ -80,7 +80,7 @@ "" [(set hash value)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/parser/cli.lux b/stdlib/source/documentation/lux/control/parser/cli.lux index 2fd3b326e..bb301507e 100644 --- a/stdlib/source/documentation/lux/control/parser/cli.lux +++ b/stdlib/source/documentation/lux/control/parser/cli.lux @@ -43,7 +43,7 @@ "Parses a parameter that can have either a short or a long name." [(parameter [short long] value)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/parser/code.lux b/stdlib/source/documentation/lux/control/parser/code.lux index e6ce57d82..aee121e73 100644 --- a/stdlib/source/documentation/lux/control/parser/code.lux +++ b/stdlib/source/documentation/lux/control/parser/code.lux @@ -74,7 +74,7 @@ (documentation: /.next "Yields the next Code token without consuming it from the input stream.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/parser/environment.lux b/stdlib/source/documentation/lux/control/parser/environment.lux index 57e3a2f3d..a7f49a386 100644 --- a/stdlib/source/documentation/lux/control/parser/environment.lux +++ b/stdlib/source/documentation/lux/control/parser/environment.lux @@ -31,7 +31,7 @@ \n "Does not check whether all environment variables were parsed, since they're usually an open set.") [(result parser environment)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/parser/json.lux b/stdlib/source/documentation/lux/control/parser/json.lux index bc328bf75..5ef5a2a31 100644 --- a/stdlib/source/documentation/lux/control/parser/json.lux +++ b/stdlib/source/documentation/lux/control/parser/json.lux @@ -63,7 +63,7 @@ (documentation: /.dictionary "Parses a dictionary-like JSON object.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/parser/synthesis.lux b/stdlib/source/documentation/lux/control/parser/synthesis.lux index 14c2c0281..010515394 100644 --- a/stdlib/source/documentation/lux/control/parser/synthesis.lux +++ b/stdlib/source/documentation/lux/control/parser/synthesis.lux @@ -54,7 +54,7 @@ "Parses the initial values and the body of a loop." [(loop init_parsers iteration_parser)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/parser/text.lux b/stdlib/source/documentation/lux/control/parser/text.lux index e78663df3..3cd6e24de 100644 --- a/stdlib/source/documentation/lux/control/parser/text.lux +++ b/stdlib/source/documentation/lux/control/parser/text.lux @@ -153,7 +153,7 @@ "Embeds a text parser into an arbitrary parser that yields text." [(then structured text)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/parser/tree.lux b/stdlib/source/documentation/lux/control/parser/tree.lux index 721c10101..75c2b1674 100644 --- a/stdlib/source/documentation/lux/control/parser/tree.lux +++ b/stdlib/source/documentation/lux/control/parser/tree.lux @@ -44,7 +44,7 @@ [/.start "Move to the root node."] ) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/parser/type.lux b/stdlib/source/documentation/lux/control/parser/type.lux index 547c2df0a..b7cb421e6 100644 --- a/stdlib/source/documentation/lux/control/parser/type.lux +++ b/stdlib/source/documentation/lux/control/parser/type.lux @@ -88,7 +88,7 @@ "" [(recursive poly)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ (format "Parsing of Lux types." diff --git a/stdlib/source/documentation/lux/control/parser/xml.lux b/stdlib/source/documentation/lux/control/parser/xml.lux index 4f6957788..fbfa711f4 100644 --- a/stdlib/source/documentation/lux/control/parser/xml.lux +++ b/stdlib/source/documentation/lux/control/parser/xml.lux @@ -39,7 +39,7 @@ "Applies the parser somewhere among the remaining inputs; instead of demanding that the parser succeeds against the immediate inputs." [(somewhere parser)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/pipe.lux b/stdlib/source/documentation/lux/control/pipe.lux index 70b3e50c0..3d80b5ade 100644 --- a/stdlib/source/documentation/lux/control/pipe.lux +++ b/stdlib/source/documentation/lux/control/pipe.lux @@ -101,7 +101,7 @@ +9 "nine" _ "???"))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "Composable extensions to the piping macros (|> and <|) that enhance them with various abilities." diff --git a/stdlib/source/documentation/lux/control/reader.lux b/stdlib/source/documentation/lux/control/reader.lux index 83bf3a768..907fb33c2 100644 --- a/stdlib/source/documentation/lux/control/reader.lux +++ b/stdlib/source/documentation/lux/control/reader.lux @@ -31,7 +31,7 @@ (documentation: /.lifted "Lift monadic values to the Reader wrapper.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/region.lux b/stdlib/source/documentation/lux/control/region.lux index 26e9f2332..9d9824fa9 100644 --- a/stdlib/source/documentation/lux/control/region.lux +++ b/stdlib/source/documentation/lux/control/region.lux @@ -34,7 +34,7 @@ "Lift an effectful computation into a region-based computation." [(lifted monad operation)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/remember.lux b/stdlib/source/documentation/lux/control/remember.lux index df879c0ce..dd71c07b7 100644 --- a/stdlib/source/documentation/lux/control/remember.lux +++ b/stdlib/source/documentation/lux/control/remember.lux @@ -37,7 +37,7 @@ "Improve the performace." (some (complicated (computation 123))))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/security.lux b/stdlib/source/documentation/lux/control/security.lux index 61842bc88..74a30b278 100644 --- a/stdlib/source/documentation/lux/control/security.lux +++ b/stdlib/source/documentation/lux/control/security.lux @@ -11,7 +11,7 @@ ["[1][0]" capability] ["[1][0]" policy]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) (list.together (list /policy.documentation diff --git a/stdlib/source/documentation/lux/control/security/capability.lux b/stdlib/source/documentation/lux/control/security/capability.lux index a392fa250..06d06bde3 100644 --- a/stdlib/source/documentation/lux/control/security/capability.lux +++ b/stdlib/source/documentation/lux/control/security/capability.lux @@ -33,7 +33,7 @@ "Converts a synchronous I/O-based capability into an asynchronous capability." [(async capability)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/security/policy.lux b/stdlib/source/documentation/lux/control/security/policy.lux index 6e8d5ec93..86ab3fced 100644 --- a/stdlib/source/documentation/lux/control/security/policy.lux +++ b/stdlib/source/documentation/lux/control/security/policy.lux @@ -44,15 +44,15 @@ (is (-> (Password %) Text) unsafe))) - (def: (policy _) + (def (policy _) (Ex (_ %) (-> Any (Policy %))) (with_policy (is (Context Privacy Policy) (function (_ (open "%::.")) (implementation - (def: (password value) + (def (password value) (%::can_upgrade value)) - (def: (unsafe password) + (def (unsafe password) (%::can_downgrade password)))))))] [(with_policy context)]) @@ -64,7 +64,7 @@ (format "A security context for safety." \n "Safe data is data coming from outside the program which can be trusted to be properly formatted and lacking injections.")) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/state.lux b/stdlib/source/documentation/lux/control/state.lux index ab9cf3d5f..564deb012 100644 --- a/stdlib/source/documentation/lux/control/state.lux +++ b/stdlib/source/documentation/lux/control/state.lux @@ -59,7 +59,7 @@ "Lift monadic values to the +State wrapper." [(lifted monad ma)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/thread.lux b/stdlib/source/documentation/lux/control/thread.lux index bc4062c10..1af1a0293 100644 --- a/stdlib/source/documentation/lux/control/thread.lux +++ b/stdlib/source/documentation/lux/control/thread.lux @@ -39,7 +39,7 @@ "Update a box's value by applying a function to it." [(update! f box)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/try.lux b/stdlib/source/documentation/lux/control/try.lux index f1f2cb0dc..9320a2d3b 100644 --- a/stdlib/source/documentation/lux/control/try.lux +++ b/stdlib/source/documentation/lux/control/try.lux @@ -44,7 +44,7 @@ [(= "foo" (else "foo" {/.#Failure "KABOOM!"}))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/control/writer.lux b/stdlib/source/documentation/lux/control/writer.lux index cb546cb51..f692d626f 100644 --- a/stdlib/source/documentation/lux/control/writer.lux +++ b/stdlib/source/documentation/lux/control/writer.lux @@ -25,7 +25,7 @@ "Wraps a monadic value with Writer machinery." [(lifted monoid monad)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data.lux b/stdlib/source/documentation/lux/data.lux index 908891b19..965b68a5a 100644 --- a/stdlib/source/documentation/lux/data.lux +++ b/stdlib/source/documentation/lux/data.lux @@ -18,7 +18,7 @@ ["[1][0]" sum] ["[1][0]" text]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) (list.together (list /binary.documentation diff --git a/stdlib/source/documentation/lux/data/binary.lux b/stdlib/source/documentation/lux/data/binary.lux index f1b5b2f18..11939678d 100644 --- a/stdlib/source/documentation/lux/data/binary.lux +++ b/stdlib/source/documentation/lux/data/binary.lux @@ -65,7 +65,7 @@ "Yields a binary BLOB with at most the specified number of bytes removed." [(after bytes binary)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/bit.lux b/stdlib/source/documentation/lux/data/bit.lux index 08412b9d9..d235f4dbe 100644 --- a/stdlib/source/documentation/lux/data/bit.lux +++ b/stdlib/source/documentation/lux/data/bit.lux @@ -14,7 +14,7 @@ (format "Generates the complement of a predicate." \n "That is a predicate that returns the oposite of the original predicate.")) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/collection.lux b/stdlib/source/documentation/lux/data/collection.lux index 4cd97968d..5c83211a1 100644 --- a/stdlib/source/documentation/lux/data/collection.lux +++ b/stdlib/source/documentation/lux/data/collection.lux @@ -19,7 +19,7 @@ ["[1][0]" set] ["[1][0]" tree]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) (list.together (list /array.documentation diff --git a/stdlib/source/documentation/lux/data/collection/array.lux b/stdlib/source/documentation/lux/data/collection/array.lux index ee54af7e1..40ae33059 100644 --- a/stdlib/source/documentation/lux/data/collection/array.lux +++ b/stdlib/source/documentation/lux/data/collection/array.lux @@ -88,7 +88,7 @@ [(list {.#None} array) (list {.#Some default} array)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/collection/bits.lux b/stdlib/source/documentation/lux/data/collection/bits.lux index 7a5862da3..1dadf4ad6 100644 --- a/stdlib/source/documentation/lux/data/collection/bits.lux +++ b/stdlib/source/documentation/lux/data/collection/bits.lux @@ -37,7 +37,7 @@ "" [(not input)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/collection/dictionary.lux b/stdlib/source/documentation/lux/data/collection/dictionary.lux index f3bdae2de..efa3a49ce 100644 --- a/stdlib/source/documentation/lux/data/collection/dictionary.lux +++ b/stdlib/source/documentation/lux/data/collection/dictionary.lux @@ -75,7 +75,7 @@ "A sub-dictionary, with only the specified keys." [(sub keys dict)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux b/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux index 8cd086024..339bbb6b4 100644 --- a/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux @@ -57,7 +57,7 @@ "" [(of_list order list)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux b/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux index 83856e697..7ece01888 100644 --- a/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux @@ -38,7 +38,7 @@ "" [(lacks key properties)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/collection/list.lux b/stdlib/source/documentation/lux/data/collection/list.lux index 438278685..62b316db8 100644 --- a/stdlib/source/documentation/lux/data/collection/list.lux +++ b/stdlib/source/documentation/lux/data/collection/list.lux @@ -104,15 +104,15 @@ (documentation: /.zipped "Create list zippers with the specified number of input lists." - [(def: zipped_2 (zipped 2)) - (def: zipped_3 (zipped 3)) + [(def zipped_2 (zipped 2)) + (def zipped_3 (zipped 3)) (zipped_3 xs ys zs) ((zipped 3) xs ys zs)]) (documentation: /.zipped_with "Create list zippers with the specified number of input lists." - [(def: zipped_with_2 (zipped_with 2)) - (def: zipped_with_3 (zipped_with 3)) + [(def zipped_with_2 (zipped_with 2)) + (def zipped_with_3 (zipped_with 3)) (zipped_with_2 + xs ys) ((zipped_with 2) + xs ys)]) @@ -147,7 +147,7 @@ .when (passes_test? value)] (do_something_else 4 5 6))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/collection/queue.lux b/stdlib/source/documentation/lux/data/collection/queue.lux index 159ea8f33..6385fb451 100644 --- a/stdlib/source/documentation/lux/data/collection/queue.lux +++ b/stdlib/source/documentation/lux/data/collection/queue.lux @@ -42,7 +42,7 @@ "" [(end val queue)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/collection/queue/priority.lux b/stdlib/source/documentation/lux/data/collection/queue/priority.lux index 0a1384ac4..2e24d32eb 100644 --- a/stdlib/source/documentation/lux/data/collection/queue/priority.lux +++ b/stdlib/source/documentation/lux/data/collection/queue/priority.lux @@ -22,7 +22,7 @@ "" [(end priority value queue)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/collection/sequence.lux b/stdlib/source/documentation/lux/data/collection/sequence.lux index 8961d114c..66f3955af 100644 --- a/stdlib/source/documentation/lux/data/collection/sequence.lux +++ b/stdlib/source/documentation/lux/data/collection/sequence.lux @@ -54,7 +54,7 @@ [(is (Sequence Nat) (sequence 12 34 56 78 90))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/collection/set.lux b/stdlib/source/documentation/lux/data/collection/set.lux index fd87feaa3..4e64b2ec6 100644 --- a/stdlib/source/documentation/lux/data/collection/set.lux +++ b/stdlib/source/documentation/lux/data/collection/set.lux @@ -36,7 +36,7 @@ "" [(super? sub super)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/collection/set/multi.lux b/stdlib/source/documentation/lux/data/collection/set/multi.lux index 6a9cdc1ed..20f750d8a 100644 --- a/stdlib/source/documentation/lux/data/collection/set/multi.lux +++ b/stdlib/source/documentation/lux/data/collection/set/multi.lux @@ -43,7 +43,7 @@ (documentation: /.super? "Is 'subject' a super-set of 'reference'?") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/collection/set/ordered.lux b/stdlib/source/documentation/lux/data/collection/set/ordered.lux index 22222e4c5..47dbc2e08 100644 --- a/stdlib/source/documentation/lux/data/collection/set/ordered.lux +++ b/stdlib/source/documentation/lux/data/collection/set/ordered.lux @@ -40,7 +40,7 @@ "Is 'super' a super-set of 'sub'?" [(super? sub super)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/collection/stack.lux b/stdlib/source/documentation/lux/data/collection/stack.lux index 542fe3c49..ceb9b09d7 100644 --- a/stdlib/source/documentation/lux/data/collection/stack.lux +++ b/stdlib/source/documentation/lux/data/collection/stack.lux @@ -28,7 +28,7 @@ "" [(top value stack)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/collection/stream.lux b/stdlib/source/documentation/lux/data/collection/stream.lux index 172018407..7623c806c 100644 --- a/stdlib/source/documentation/lux/data/collection/stream.lux +++ b/stdlib/source/documentation/lux/data/collection/stream.lux @@ -49,7 +49,7 @@ [(let [(pattern x y z _tail) (some_stream_func +1 +2 +3)] (func x y z))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/collection/tree.lux b/stdlib/source/documentation/lux/data/collection/tree.lux index bc798d523..c34d4b8e9 100644 --- a/stdlib/source/documentation/lux/data/collection/tree.lux +++ b/stdlib/source/documentation/lux/data/collection/tree.lux @@ -39,7 +39,7 @@ 56 {} 78 {90 {}}}))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/collection/tree/finger.lux b/stdlib/source/documentation/lux/data/collection/tree/finger.lux index b87de0cfd..de79adfec 100644 --- a/stdlib/source/documentation/lux/data/collection/tree/finger.lux +++ b/stdlib/source/documentation/lux/data/collection/tree/finger.lux @@ -43,7 +43,7 @@ "Verifies that a value exists which meets the predicate." [(exists? predicate tree)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/collection/tree/zipper.lux b/stdlib/source/documentation/lux/data/collection/tree/zipper.lux index 63a52b5f8..24cdd66d6 100644 --- a/stdlib/source/documentation/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/documentation/lux/data/collection/tree/zipper.lux @@ -32,7 +32,7 @@ "" [(adopt value zipper)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/color.lux b/stdlib/source/documentation/lux/data/color.lux index f68e4ed89..e15945e44 100644 --- a/stdlib/source/documentation/lux/data/color.lux +++ b/stdlib/source/documentation/lux/data/color.lux @@ -40,7 +40,7 @@ "" [(interpolated ratio end start)]) -(def: palette_documentation +(def palette_documentation (syntax (_ [[_ name] .symbol]) (in (list (code.text (format "A " (text.replaced "_" "-" name) " palette.")))))) @@ -80,7 +80,7 @@ [/.tetradic] ) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/color/named.lux b/stdlib/source/documentation/lux/data/color/named.lux index 37b6b93a4..960f00f4d 100644 --- a/stdlib/source/documentation/lux/data/color/named.lux +++ b/stdlib/source/documentation/lux/data/color/named.lux @@ -170,7 +170,7 @@ [/.yellow_green] ) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/format.lux b/stdlib/source/documentation/lux/data/format.lux index 645502ef2..a67936e66 100644 --- a/stdlib/source/documentation/lux/data/format.lux +++ b/stdlib/source/documentation/lux/data/format.lux @@ -13,7 +13,7 @@ ["[1][0]" tar] ["[1][0]" xml]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) (list.together (list /binary.documentation diff --git a/stdlib/source/documentation/lux/data/format/binary.lux b/stdlib/source/documentation/lux/data/format/binary.lux index 9d313aab0..311dd602d 100644 --- a/stdlib/source/documentation/lux/data/format/binary.lux +++ b/stdlib/source/documentation/lux/data/format/binary.lux @@ -45,7 +45,7 @@ "Writes at most 'size' bytes of an input binary blob." [(segment size)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/format/json.lux b/stdlib/source/documentation/lux/data/format/json.lux index fb843637b..8d90c1735 100644 --- a/stdlib/source/documentation/lux/data/format/json.lux +++ b/stdlib/source/documentation/lux/data/format/json.lux @@ -48,7 +48,7 @@ [/.object_field "objects"] ) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ (format "Functionality for reading and writing values in the JSON format." diff --git a/stdlib/source/documentation/lux/data/format/tar.lux b/stdlib/source/documentation/lux/data/format/tar.lux index 82f3d37dd..6a25ed15f 100644 --- a/stdlib/source/documentation/lux/data/format/tar.lux +++ b/stdlib/source/documentation/lux/data/format/tar.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/format/xml.lux b/stdlib/source/documentation/lux/data/format/xml.lux index e3240d85a..ab00554ce 100644 --- a/stdlib/source/documentation/lux/data/format/xml.lux +++ b/stdlib/source/documentation/lux/data/format/xml.lux @@ -20,7 +20,7 @@ (documentation: /.attribute "The text format of a XML attribute.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/identity.lux b/stdlib/source/documentation/lux/data/identity.lux index c6eb4922b..efc58cdcf 100644 --- a/stdlib/source/documentation/lux/data/identity.lux +++ b/stdlib/source/documentation/lux/data/identity.lux @@ -13,7 +13,7 @@ (documentation: (/.Identity it) "A value, as is, without any extra structure super-imposed on it.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/product.lux b/stdlib/source/documentation/lux/data/product.lux index d599f3706..33df94c59 100644 --- a/stdlib/source/documentation/lux/data/product.lux +++ b/stdlib/source/documentation/lux/data/product.lux @@ -36,7 +36,7 @@ "Yields a pair by applying both functions to a single value." [(forked f g)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "Functionality for working with tuples (particularly 2-tuples/pairs)." diff --git a/stdlib/source/documentation/lux/data/sum.lux b/stdlib/source/documentation/lux/data/sum.lux index dd398e250..9d38d8230 100644 --- a/stdlib/source/documentation/lux/data/sum.lux +++ b/stdlib/source/documentation/lux/data/sum.lux @@ -24,7 +24,7 @@ "Applies functions to both sides of a 2-variant." [(then on_left on_right)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "Functionality for working with variants (particularly 2-variants)." diff --git a/stdlib/source/documentation/lux/data/text.lux b/stdlib/source/documentation/lux/data/text.lux index 41ba31e83..a13b2839a 100644 --- a/stdlib/source/documentation/lux/data/text.lux +++ b/stdlib/source/documentation/lux/data/text.lux @@ -107,7 +107,7 @@ "Checks whether the character is white-space." [(space? char)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/text/buffer.lux b/stdlib/source/documentation/lux/data/text/buffer.lux index 6fa90504b..79722d05b 100644 --- a/stdlib/source/documentation/lux/data/text/buffer.lux +++ b/stdlib/source/documentation/lux/data/text/buffer.lux @@ -13,7 +13,7 @@ (documentation: /.Buffer "Immutable text buffer for efficient text concatenation.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/text/encoding.lux b/stdlib/source/documentation/lux/data/text/encoding.lux index 0cda057b4..e4c624a05 100644 --- a/stdlib/source/documentation/lux/data/text/encoding.lux +++ b/stdlib/source/documentation/lux/data/text/encoding.lux @@ -164,7 +164,7 @@ [/.koi8_u] ) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/text/encoding/utf8.lux b/stdlib/source/documentation/lux/data/text/encoding/utf8.lux index 9727adac3..e9aed460d 100644 --- a/stdlib/source/documentation/lux/data/text/encoding/utf8.lux +++ b/stdlib/source/documentation/lux/data/text/encoding/utf8.lux @@ -13,7 +13,7 @@ (documentation: /.codec "A codec for binary encoding of text as UTF-8.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/text/escape.lux b/stdlib/source/documentation/lux/data/text/escape.lux index dd56ccf4b..112aa7b25 100644 --- a/stdlib/source/documentation/lux/data/text/escape.lux +++ b/stdlib/source/documentation/lux/data/text/escape.lux @@ -26,7 +26,7 @@ (format "Line 1" \n "Line 2")]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/text/format.lux b/stdlib/source/documentation/lux/data/text/format.lux index 53f70bac3..97d12c1fa 100644 --- a/stdlib/source/documentation/lux/data/text/format.lux +++ b/stdlib/source/documentation/lux/data/text/format.lux @@ -14,7 +14,7 @@ "Text interpolation." [(format "Static part " (text static) " does not match URI: " uri)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/text/regex.lux b/stdlib/source/documentation/lux/data/text/regex.lux index 718a76ca1..5f95326a4 100644 --- a/stdlib/source/documentation/lux/data/text/regex.lux +++ b/stdlib/source/documentation/lux/data/text/regex.lux @@ -69,7 +69,7 @@ _ do_something_else)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/text/unicode.lux b/stdlib/source/documentation/lux/data/text/unicode.lux index ab47ca744..5e4aff2e1 100644 --- a/stdlib/source/documentation/lux/data/text/unicode.lux +++ b/stdlib/source/documentation/lux/data/text/unicode.lux @@ -11,7 +11,7 @@ ["[1][0]" block] ["[1][0]" set]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) (list.together (list /block.documentation diff --git a/stdlib/source/documentation/lux/data/text/unicode/block.lux b/stdlib/source/documentation/lux/data/text/unicode/block.lux index bcf101d5c..3bce030f0 100644 --- a/stdlib/source/documentation/lux/data/text/unicode/block.lux +++ b/stdlib/source/documentation/lux/data/text/unicode/block.lux @@ -141,7 +141,7 @@ [/.lower_case] ) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/data/text/unicode/set.lux b/stdlib/source/documentation/lux/data/text/unicode/set.lux index 53de02b6b..1ebb9bdd3 100644 --- a/stdlib/source/documentation/lux/data/text/unicode/set.lux +++ b/stdlib/source/documentation/lux/data/text/unicode/set.lux @@ -18,7 +18,7 @@ "" [(member? set character)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/debug.lux b/stdlib/source/documentation/lux/debug.lux index e8f5527c0..91fc034f9 100644 --- a/stdlib/source/documentation/lux/debug.lux +++ b/stdlib/source/documentation/lux/debug.lux @@ -21,7 +21,7 @@ (documentation: /.private "Allows access to un-exported definitions in other modules." ["Module A" - (def: .private (secret_definition input) + (def .private (secret_definition input) (-> ??? ???) (foo (bar (baz input)))) "Module B" @@ -64,7 +64,7 @@ "baz: +789.0" []]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/documentation.lux b/stdlib/source/documentation/lux/documentation.lux index ccc18909a..683b259b2 100644 --- a/stdlib/source/documentation/lux/documentation.lux +++ b/stdlib/source/documentation/lux/documentation.lux @@ -35,7 +35,7 @@ (/.default /.documentation)] []))]) -(.def: .public documentation +(.def .public documentation (.List /.Module) (/.module /._ "" diff --git a/stdlib/source/documentation/lux/extension.lux b/stdlib/source/documentation/lux/extension.lux index 9b27ebc33..3a88c9a83 100644 --- a/stdlib/source/documentation/lux/extension.lux +++ b/stdlib/source/documentation/lux/extension.lux @@ -51,7 +51,7 @@ [.let [_ (debug.log! (format "Successfully installed directive " (%.text self) "!"))]] (in directive.no_requirements)))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/ffi.js.lux b/stdlib/source/documentation/lux/ffi.js.lux index 83ba87089..2e6003722 100644 --- a/stdlib/source/documentation/lux/ffi.js.lux +++ b/stdlib/source/documentation/lux/ffi.js.lux @@ -50,7 +50,7 @@ (closure [left right] (do_something (as Foo left) (as Bar right))))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/ffi.jvm.lux b/stdlib/source/documentation/lux/ffi.jvm.lux index 71e0c95a9..265b1bd35 100644 --- a/stdlib/source/documentation/lux/ffi.jvm.lux +++ b/stdlib/source/documentation/lux/ffi.jvm.lux @@ -254,7 +254,7 @@ (is java/lang/String ???))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/ffi.lua.lux b/stdlib/source/documentation/lux/ffi.lua.lux index 37cdf1c6a..bd38a77b5 100644 --- a/stdlib/source/documentation/lux/ffi.lua.lux +++ b/stdlib/source/documentation/lux/ffi.lua.lux @@ -21,7 +21,7 @@ (closure [left right] (do_something (as Foo left) (as Bar right))))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/ffi.old.lux b/stdlib/source/documentation/lux/ffi.old.lux index 99f6a6c5b..a1771a53f 100644 --- a/stdlib/source/documentation/lux/ffi.old.lux +++ b/stdlib/source/documentation/lux/ffi.old.lux @@ -212,7 +212,7 @@ [(is .Type (type java/lang/String))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/ffi.py.lux b/stdlib/source/documentation/lux/ffi.py.lux index b4549abc2..99fb157ed 100644 --- a/stdlib/source/documentation/lux/ffi.py.lux +++ b/stdlib/source/documentation/lux/ffi.py.lux @@ -42,7 +42,7 @@ (do_something (as Foo left) (as Bar right))))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/ffi.rb.lux b/stdlib/source/documentation/lux/ffi.rb.lux index 578a9211f..75e5229a4 100644 --- a/stdlib/source/documentation/lux/ffi.rb.lux +++ b/stdlib/source/documentation/lux/ffi.rb.lux @@ -31,7 +31,7 @@ (flush [] "io" "try" "?" Any) (close [] "io" "try" "?" Any))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/locale.lux b/stdlib/source/documentation/lux/locale.lux index e0958143f..b4990b991 100644 --- a/stdlib/source/documentation/lux/locale.lux +++ b/stdlib/source/documentation/lux/locale.lux @@ -20,7 +20,7 @@ "" [(locale language territory encoding)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/locale/language.lux b/stdlib/source/documentation/lux/locale/language.lux index d47b66d8c..1de51a886 100644 --- a/stdlib/source/documentation/lux/locale/language.lux +++ b/stdlib/source/documentation/lux/locale/language.lux @@ -13,14 +13,14 @@ (documentation: /.Language "An ISO 639 language.") -(def: items/~ +(def items/~ (list.together (list ($.default /.uncoded) ($.default /.multiple) ($.default /.undetermined) ($.default /.not_applicable)))) -(def: items/a +(def items/a (list.together (list ($.default /.afar) ($.default /.abkhazian) @@ -62,7 +62,7 @@ ($.default /.aymara) ($.default /.azerbaijani)))) -(def: items/b +(def items/b (list.together (list ($.default /.banda) ($.default /.bamileke) @@ -96,7 +96,7 @@ ($.default /.blin) ($.default /.bilin)))) -(def: items/c +(def items/c (list.together (list ($.default /.caddo) ($.default /.central_american_indian) @@ -139,7 +139,7 @@ ($.default /.cushitic) ($.default /.welsh)))) -(def: items/d +(def items/d (list.together (list ($.default /.dakota) ($.default /.danish) @@ -160,7 +160,7 @@ ($.default /.dyula) ($.default /.dzongkha)))) -(def: items/e +(def items/e (list.together (list ($.default /.efik) ($.default /.egyptian) @@ -175,7 +175,7 @@ ($.default /.ewe) ($.default /.ewondo)))) -(def: items/f +(def items/f (list.together (list ($.default /.fang) ($.default /.faroese) @@ -195,7 +195,7 @@ ($.default /.fulah) ($.default /.friulian)))) -(def: items/g +(def items/g (list.together (list ($.default /.ga) ($.default /.gayo) @@ -221,7 +221,7 @@ ($.default /.gujarati) ($.default /.gwich'in)))) -(def: items/h +(def items/h (list.together (list ($.default /.haida) ($.default /.haitian) @@ -241,7 +241,7 @@ ($.default /.hupa) ($.default /.armenian)))) -(def: items/i +(def items/i (list.together (list ($.default /.iban) ($.default /.igbo) @@ -263,7 +263,7 @@ ($.default /.icelandic) ($.default /.italian)))) -(def: items/j +(def items/j (list.together (list ($.default /.javanese) ($.default /.lojban) @@ -271,7 +271,7 @@ ($.default /.judeo_persian) ($.default /.judeo_arabic)))) -(def: items/k +(def items/k (list.together (list ($.default /.kara_kalpak) ($.default /.kabyle) @@ -312,7 +312,7 @@ ($.default /.kurdish) ($.default /.kutenai)))) -(def: items/l +(def items/l (list.together (list ($.default /.ladino) ($.default /.lahnda) @@ -335,7 +335,7 @@ ($.default /.luo) ($.default /.lushai)))) -(def: items/m +(def items/m (list.together (list ($.default /.madurese) ($.default /.magahi) @@ -374,7 +374,7 @@ ($.default /.mayan) ($.default /.erzya)))) -(def: items/n +(def items/n (list.together (list ($.default /.nahuatl) ($.default /.north_american_indian) @@ -414,7 +414,7 @@ ($.default /.nyoro) ($.default /.nzima)))) -(def: items/o +(def items/o (list.together (list ($.default /.occitan) ($.default /.provencal) @@ -426,7 +426,7 @@ ($.default /.ottoman_turkish) ($.default /.otomian)))) -(def: items/p +(def items/p (list.together (list ($.default /.papuan) ($.default /.pangasinan) @@ -447,11 +447,11 @@ ($.default /.old_provencal) ($.default /.pashto)))) -(def: items/q +(def items/q (list.together (list ($.default /.quechua)))) -(def: items/r +(def items/r (list.together (list ($.default /.rajasthani) ($.default /.rapanui) @@ -469,7 +469,7 @@ ($.default /.macedo_romanian) ($.default /.russian)))) -(def: items/s +(def items/s (list.together (list ($.default /.sandawe) ($.default /.sango) @@ -526,7 +526,7 @@ ($.default /.classical_syriac) ($.default /.syriac)))) -(def: items/t +(def items/t (list.together (list ($.default /.tahitian) ($.default /.tai) @@ -561,7 +561,7 @@ ($.default /.twi) ($.default /.tuvinian)))) -(def: items/u +(def items/u (list.together (list ($.default /.udmurt) ($.default /.ugaritic) @@ -571,7 +571,7 @@ ($.default /.urdu) ($.default /.uzbek)))) -(def: items/v +(def items/v (list.together (list ($.default /.vai) ($.default /.venda) @@ -579,7 +579,7 @@ ($.default /.volapük) ($.default /.votic)))) -(def: items/w +(def items/w (list.together (list ($.default /.wakashan) ($.default /.walamo) @@ -589,13 +589,13 @@ ($.default /.walloon) ($.default /.wolof)))) -(def: items/x +(def items/x (list.together (list ($.default /.kalmyk) ($.default /.oirat) ($.default /.xhosa)))) -(def: items/y +(def items/y (list.together (list ($.default /.yao) ($.default /.yapese) @@ -603,7 +603,7 @@ ($.default /.yoruba) ($.default /.yupik)))) -(def: items/z +(def items/z (list.together (list ($.default /.zapotec) ($.default /.blissymbols) @@ -621,7 +621,7 @@ ($.default /.kirmanjki) ($.default /.zazaki)))) -(.def: .public documentation +(.def .public documentation (.List $.Module) (`` ($.module /._ "" diff --git a/stdlib/source/documentation/lux/locale/territory.lux b/stdlib/source/documentation/lux/locale/territory.lux index 4240d134d..187d9c5e7 100644 --- a/stdlib/source/documentation/lux/locale/territory.lux +++ b/stdlib/source/documentation/lux/locale/territory.lux @@ -13,7 +13,7 @@ (documentation: /.Territory "An ISO 3166 territory.") -(def: items/ab +(def items/ab (list.together (list ($.default /.afghanistan) ($.default /.aland_islands) @@ -57,7 +57,7 @@ ($.default /.burkina_faso) ($.default /.burundi)))) -(def: items/cd +(def items/cd (list.together (list ($.default /.cape_verde) ($.default /.cambodia) @@ -87,7 +87,7 @@ ($.default /.dominica) ($.default /.dominican_republic)))) -(def: items/efg +(def items/efg (list.together (list ($.default /.ecuador) ($.default /.egypt) @@ -122,7 +122,7 @@ ($.default /.guinea_bissau) ($.default /.guyana)))) -(def: items/hijkl +(def items/hijkl (list.together (list ($.default /.haiti) ($.default /.heard_island) @@ -161,7 +161,7 @@ ($.default /.lithuania) ($.default /.luxembourg)))) -(def: items/mno +(def items/mno (list.together (list ($.default /.macau) ($.default /.macedonia) @@ -201,7 +201,7 @@ ($.default /.norway) ($.default /.oman)))) -(def: items/pqrs +(def items/pqrs (list.together (list ($.default /.pakistan) ($.default /.palau) @@ -261,7 +261,7 @@ ($.default /.switzerland) ($.default /.syria)))) -(def: items/tuvwxyz +(def items/tuvwxyz (list.together (list ($.default /.taiwan) ($.default /.tajikistan) @@ -300,7 +300,7 @@ ($.default /.zambia) ($.default /.zimbabwe)))) -(.def: .public documentation +(.def .public documentation (.List $.Module) (`` ($.module /._ "" diff --git a/stdlib/source/documentation/lux/macro.lux b/stdlib/source/documentation/lux/macro.lux index 318540278..0df20d2b7 100644 --- a/stdlib/source/documentation/lux/macro.lux +++ b/stdlib/source/documentation/lux/macro.lux @@ -39,7 +39,7 @@ (documentation: /.with_symbols "Creates new symbols and offers them to the body expression." - [(def: synchronized + [(def synchronized (syntax (_ [lock any body any]) (with_symbols [g!lock g!body g!_] @@ -58,11 +58,11 @@ \n "You can either use the resulting code, or omit them." \n "By omitting them, this macro produces nothing (just like the lux.comment macro).") [(log_single_expansion! - (def: (foo bar baz) + (def (foo bar baz) (-> Int Int Int) (int.+ bar baz))) (log_single_expansion! "omit" - (def: (foo bar baz) + (def (foo bar baz) (-> Int Int Int) (int.+ bar baz)))]) @@ -71,11 +71,11 @@ \n "You can either use the resulting code, or omit them." \n "By omitting them, this macro produces nothing (just like the lux.comment macro).") [(log_expansion! - (def: (foo bar baz) + (def (foo bar baz) (-> Int Int Int) (int.+ bar baz))) (log_expansion! "omit" - (def: (foo bar baz) + (def (foo bar baz) (-> Int Int Int) (int.+ bar baz)))]) @@ -84,15 +84,15 @@ \n "You can either use the resulting code, or omit them." \n "By omitting them, this macro produces nothing (just like the lux.comment macro).") [(log_full_expansion! - (def: (foo bar baz) + (def (foo bar baz) (-> Int Int Int) (int.+ bar baz))) (log_full_expansion! "omit" - (def: (foo bar baz) + (def (foo bar baz) (-> Int Int Int) (int.+ bar baz)))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/macro/code.lux b/stdlib/source/documentation/lux/macro/code.lux index e1a0f8058..7a4e26199 100644 --- a/stdlib/source/documentation/lux/macro/code.lux +++ b/stdlib/source/documentation/lux/macro/code.lux @@ -17,7 +17,7 @@ "" [(replaced original substitute ast)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/macro/local.lux b/stdlib/source/documentation/lux/macro/local.lux index dafb8f498..f171af782 100644 --- a/stdlib/source/documentation/lux/macro/local.lux +++ b/stdlib/source/documentation/lux/macro/local.lux @@ -17,7 +17,7 @@ \n "NOTE: Always use this code once to clean-up..") [(push macros)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/macro/syntax.lux b/stdlib/source/documentation/lux/macro/syntax.lux index 191b929d2..828ede9eb 100644 --- a/stdlib/source/documentation/lux/macro/syntax.lux +++ b/stdlib/source/documentation/lux/macro/syntax.lux @@ -23,7 +23,7 @@ \n "The inputs to the macro can be parsed in complex ways through the use of syntax parsers." \n "The macro body is also (implicitly) run in the Meta monad, to save some typing." \n "Also, the compiler state can be accessed through a special binding.") - [(def: .public object + [(def .public object (syntax (_ lux_state [.let [imports (class_imports lux_state)] .let [class_vars (list)] super (opt (super_class_decl^ imports class_vars)) @@ -37,7 +37,7 @@ (with_brackets (spaced (list#each (method_def$ id) methods))))))] (in (list (` ((~ (code.text def_code)))))))))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/macro/syntax/check.lux b/stdlib/source/documentation/lux/macro/syntax/check.lux index 38785fefd..7a2f630c6 100644 --- a/stdlib/source/documentation/lux/macro/syntax/check.lux +++ b/stdlib/source/documentation/lux/macro/syntax/check.lux @@ -13,7 +13,7 @@ (documentation: /.Check "A type annotation for an expression.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/macro/syntax/declaration.lux b/stdlib/source/documentation/lux/macro/syntax/declaration.lux index f649cbb6c..91e3e232c 100644 --- a/stdlib/source/documentation/lux/macro/syntax/declaration.lux +++ b/stdlib/source/documentation/lux/macro/syntax/declaration.lux @@ -19,7 +19,7 @@ quux (foo bar baz)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/macro/syntax/definition.lux b/stdlib/source/documentation/lux/macro/syntax/definition.lux index aad057c03..08706e55c 100644 --- a/stdlib/source/documentation/lux/macro/syntax/definition.lux +++ b/stdlib/source/documentation/lux/macro/syntax/definition.lux @@ -21,7 +21,7 @@ "Only works for typed definitions." [(typed compiler)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/macro/syntax/export.lux b/stdlib/source/documentation/lux/macro/syntax/export.lux index c5bd4ad1d..b0cfb422c 100644 --- a/stdlib/source/documentation/lux/macro/syntax/export.lux +++ b/stdlib/source/documentation/lux/macro/syntax/export.lux @@ -14,7 +14,7 @@ "" [(parser un_exported)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "Syntax for marking a definition as an export." diff --git a/stdlib/source/documentation/lux/macro/syntax/input.lux b/stdlib/source/documentation/lux/macro/syntax/input.lux index 13ee20488..3362c356a 100644 --- a/stdlib/source/documentation/lux/macro/syntax/input.lux +++ b/stdlib/source/documentation/lux/macro/syntax/input.lux @@ -16,7 +16,7 @@ (documentation: /.parser "Parser for the common typed-argument syntax used by many macros.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/macro/syntax/type/variable.lux b/stdlib/source/documentation/lux/macro/syntax/type/variable.lux index 6de691019..3b12b4970 100644 --- a/stdlib/source/documentation/lux/macro/syntax/type/variable.lux +++ b/stdlib/source/documentation/lux/macro/syntax/type/variable.lux @@ -16,7 +16,7 @@ (documentation: /.parser "Parser for the common type variable/parameter used by many macros.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/macro/template.lux b/stdlib/source/documentation/lux/macro/template.lux index 0a0191099..1054515f1 100644 --- a/stdlib/source/documentation/lux/macro/template.lux +++ b/stdlib/source/documentation/lux/macro/template.lux @@ -53,11 +53,11 @@ "Lexically-bound templates." [(let [(!square ) [(* )]] - (def: (square root) + (def (square root) (-> Nat Nat) (!square root)))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "Utilities commonly used while templating." diff --git a/stdlib/source/documentation/lux/math.lux b/stdlib/source/documentation/lux/math.lux index fe8e075b2..36251af9b 100644 --- a/stdlib/source/documentation/lux/math.lux +++ b/stdlib/source/documentation/lux/math.lux @@ -17,7 +17,7 @@ [\\library ["[0]" /]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/math/infix.lux b/stdlib/source/documentation/lux/math/infix.lux index f0f2302fc..e2c1f0706 100644 --- a/stdlib/source/documentation/lux/math/infix.lux +++ b/stdlib/source/documentation/lux/math/infix.lux @@ -38,7 +38,7 @@ "=>" (gcd 450 (* 3 9))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/math/logic.lux b/stdlib/source/documentation/lux/math/logic.lux index bf76966ca..d850565dd 100644 --- a/stdlib/source/documentation/lux/math/logic.lux +++ b/stdlib/source/documentation/lux/math/logic.lux @@ -11,7 +11,7 @@ ["[1][0]" continuous] ["[1][0]" fuzzy]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) (all list#composite /continuous.documentation diff --git a/stdlib/source/documentation/lux/math/logic/continuous.lux b/stdlib/source/documentation/lux/math/logic/continuous.lux index a9cffa38b..3a5edbb3f 100644 --- a/stdlib/source/documentation/lux/math/logic/continuous.lux +++ b/stdlib/source/documentation/lux/math/logic/continuous.lux @@ -14,7 +14,7 @@ "" [(implies consequent antecedent)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ (format "Continuous logic using Rev values." diff --git a/stdlib/source/documentation/lux/math/logic/fuzzy.lux b/stdlib/source/documentation/lux/math/logic/fuzzy.lux index 38abc15e7..7698285e7 100644 --- a/stdlib/source/documentation/lux/math/logic/fuzzy.lux +++ b/stdlib/source/documentation/lux/math/logic/fuzzy.lux @@ -45,7 +45,7 @@ "" [(cut treshold set)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "Fuzzy logic, implemented on top of the Rev type." diff --git a/stdlib/source/documentation/lux/math/modular.lux b/stdlib/source/documentation/lux/math/modular.lux index d05597f38..4d6be1904 100644 --- a/stdlib/source/documentation/lux/math/modular.lux +++ b/stdlib/source/documentation/lux/math/modular.lux @@ -21,7 +21,7 @@ "" [(adapter reference subject)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/math/modulus.lux b/stdlib/source/documentation/lux/math/modulus.lux index a1496c4d1..bdf5c1552 100644 --- a/stdlib/source/documentation/lux/math/modulus.lux +++ b/stdlib/source/documentation/lux/math/modulus.lux @@ -25,7 +25,7 @@ ["Failure!" (literal 0)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/math/number.lux b/stdlib/source/documentation/lux/math/number.lux index 2920e4f44..c8c1804b8 100644 --- a/stdlib/source/documentation/lux/math/number.lux +++ b/stdlib/source/documentation/lux/math/number.lux @@ -33,7 +33,7 @@ [/.hex "hexadecimal" (hex "deadBEEF") (hex "dead,BEEF")] ) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/math/number/complex.lux b/stdlib/source/documentation/lux/math/number/complex.lux index 86757d1f3..14e598384 100644 --- a/stdlib/source/documentation/lux/math/number/complex.lux +++ b/stdlib/source/documentation/lux/math/number/complex.lux @@ -19,7 +19,7 @@ ["The imaginary part can be omitted if it's +0.0." (complex real)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "Complex arithmetic." diff --git a/stdlib/source/documentation/lux/math/number/frac.lux b/stdlib/source/documentation/lux/math/number/frac.lux index 80c7543c0..ca9f8eda0 100644 --- a/stdlib/source/documentation/lux/math/number/frac.lux +++ b/stdlib/source/documentation/lux/math/number/frac.lux @@ -95,7 +95,7 @@ "" [(log_by base it)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/math/number/i16.lux b/stdlib/source/documentation/lux/math/number/i16.lux index 9f5c6d51f..a57c0763c 100644 --- a/stdlib/source/documentation/lux/math/number/i16.lux +++ b/stdlib/source/documentation/lux/math/number/i16.lux @@ -13,7 +13,7 @@ (documentation: /.I16 "A 16-bit integer.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/math/number/i32.lux b/stdlib/source/documentation/lux/math/number/i32.lux index ff8550c4f..8c6449332 100644 --- a/stdlib/source/documentation/lux/math/number/i32.lux +++ b/stdlib/source/documentation/lux/math/number/i32.lux @@ -13,7 +13,7 @@ (documentation: /.I32 "A 32-bit integer.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/math/number/i64.lux b/stdlib/source/documentation/lux/math/number/i64.lux index bfd9f7bc8..a37f45f3c 100644 --- a/stdlib/source/documentation/lux/math/number/i64.lux +++ b/stdlib/source/documentation/lux/math/number/i64.lux @@ -71,7 +71,7 @@ "Given a width in the interval (0,64), yields an implementation for integers of that width." [(sub width)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/math/number/i8.lux b/stdlib/source/documentation/lux/math/number/i8.lux index 96995abed..12990d0cd 100644 --- a/stdlib/source/documentation/lux/math/number/i8.lux +++ b/stdlib/source/documentation/lux/math/number/i8.lux @@ -13,7 +13,7 @@ (documentation: /.I8 "A 8-bit integer.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/math/number/int.lux b/stdlib/source/documentation/lux/math/number/int.lux index 8e3e737f9..3a92c5b59 100644 --- a/stdlib/source/documentation/lux/math/number/int.lux +++ b/stdlib/source/documentation/lux/math/number/int.lux @@ -77,7 +77,7 @@ "Signed/arithmetic bitwise right-shift." [(right_shifted parameter subject)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/math/number/nat.lux b/stdlib/source/documentation/lux/math/number/nat.lux index 04da382fa..b2069e97d 100644 --- a/stdlib/source/documentation/lux/math/number/nat.lux +++ b/stdlib/source/documentation/lux/math/number/nat.lux @@ -41,7 +41,7 @@ (documentation: /.lcm "Least Common Multiple.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/math/number/ratio.lux b/stdlib/source/documentation/lux/math/number/ratio.lux index f74bf908d..2b5a80908 100644 --- a/stdlib/source/documentation/lux/math/number/ratio.lux +++ b/stdlib/source/documentation/lux/math/number/ratio.lux @@ -19,7 +19,7 @@ ["The denominator can be omitted if it is 1." (ratio numerator)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "Rational numbers." diff --git a/stdlib/source/documentation/lux/math/number/rev.lux b/stdlib/source/documentation/lux/math/number/rev.lux index 67d9a74a6..53f534a92 100644 --- a/stdlib/source/documentation/lux/math/number/rev.lux +++ b/stdlib/source/documentation/lux/math/number/rev.lux @@ -62,7 +62,7 @@ "Rev(olution) reciprocal of a Nat(ural)." [(reciprocal numerator)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/math/random.lux b/stdlib/source/documentation/lux/math/random.lux index 2a76a9395..b20f61853 100644 --- a/stdlib/source/documentation/lux/math/random.lux +++ b/stdlib/source/documentation/lux/math/random.lux @@ -78,7 +78,7 @@ (documentation: /.split_mix_64 "An implementation of the SplitMix64 algorithm.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "Pseudo-random number generation (PRNG) algorithms." diff --git a/stdlib/source/documentation/lux/meta.lux b/stdlib/source/documentation/lux/meta.lux index 76d2e02c7..038576f0d 100644 --- a/stdlib/source/documentation/lux/meta.lux +++ b/stdlib/source/documentation/lux/meta.lux @@ -153,7 +153,7 @@ "" [(eval type code)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "Functions for extracting information from the state of the compiler." diff --git a/stdlib/source/documentation/lux/meta/location.lux b/stdlib/source/documentation/lux/meta/location.lux index 05c46e5a8..3a46da914 100644 --- a/stdlib/source/documentation/lux/meta/location.lux +++ b/stdlib/source/documentation/lux/meta/location.lux @@ -18,7 +18,7 @@ "" [(with location error)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/meta/symbol.lux b/stdlib/source/documentation/lux/meta/symbol.lux index 167295b35..1f43f3bc2 100644 --- a/stdlib/source/documentation/lux/meta/symbol.lux +++ b/stdlib/source/documentation/lux/meta/symbol.lux @@ -16,7 +16,7 @@ (documentation: /.short "The short part of a symbol.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/program.lux b/stdlib/source/documentation/lux/program.lux index fd7a1aa9a..ba3248150 100644 --- a/stdlib/source/documentation/lux/program.lux +++ b/stdlib/source/documentation/lux/program.lux @@ -25,7 +25,7 @@ [data (initialize program with config)] (do_something_with data)))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/static.lux b/stdlib/source/documentation/lux/static.lux index ce5778831..340ce505a 100644 --- a/stdlib/source/documentation/lux/static.lux +++ b/stdlib/source/documentation/lux/static.lux @@ -50,7 +50,7 @@ (is (Random ???) (random data generator)))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/target.lux b/stdlib/source/documentation/lux/target.lux index 80110f427..57de0714a 100644 --- a/stdlib/source/documentation/lux/target.lux +++ b/stdlib/source/documentation/lux/target.lux @@ -20,7 +20,7 @@ (format "The name/ID of a platform targetted by a Lux compiler." \n "This information can be used to generate code targetting specific platforms, and to make programs cross-platform.")) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/target/js.lux b/stdlib/source/documentation/lux/target/js.lux index bb18ca694..97e7e1f46 100644 --- a/stdlib/source/documentation/lux/target/js.lux +++ b/stdlib/source/documentation/lux/target/js.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/target/jvm.lux b/stdlib/source/documentation/lux/target/jvm.lux index 6736fa255..4f0bde18a 100644 --- a/stdlib/source/documentation/lux/target/jvm.lux +++ b/stdlib/source/documentation/lux/target/jvm.lux @@ -12,7 +12,7 @@ ["[0]" / ["[1][0]" type]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/target/jvm/type.lux b/stdlib/source/documentation/lux/target/jvm/type.lux index d71e945e4..ca6ebf997 100644 --- a/stdlib/source/documentation/lux/target/jvm/type.lux +++ b/stdlib/source/documentation/lux/target/jvm/type.lux @@ -19,7 +19,7 @@ ["[1][0]" reflection] ["[1][0]" signature]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/target/jvm/type/alias.lux b/stdlib/source/documentation/lux/target/jvm/type/alias.lux index 8331296ba..94499cbd9 100644 --- a/stdlib/source/documentation/lux/target/jvm/type/alias.lux +++ b/stdlib/source/documentation/lux/target/jvm/type/alias.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/target/jvm/type/box.lux b/stdlib/source/documentation/lux/target/jvm/type/box.lux index f50af3403..c3caaf93a 100644 --- a/stdlib/source/documentation/lux/target/jvm/type/box.lux +++ b/stdlib/source/documentation/lux/target/jvm/type/box.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/target/jvm/type/category.lux b/stdlib/source/documentation/lux/target/jvm/type/category.lux index b40c83fb2..01e125b85 100644 --- a/stdlib/source/documentation/lux/target/jvm/type/category.lux +++ b/stdlib/source/documentation/lux/target/jvm/type/category.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/target/jvm/type/descriptor.lux b/stdlib/source/documentation/lux/target/jvm/type/descriptor.lux index 3aef9988a..6d81713a6 100644 --- a/stdlib/source/documentation/lux/target/jvm/type/descriptor.lux +++ b/stdlib/source/documentation/lux/target/jvm/type/descriptor.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/target/jvm/type/lux.lux b/stdlib/source/documentation/lux/target/jvm/type/lux.lux index c5d35237e..156d9757b 100644 --- a/stdlib/source/documentation/lux/target/jvm/type/lux.lux +++ b/stdlib/source/documentation/lux/target/jvm/type/lux.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/target/jvm/type/parser.lux b/stdlib/source/documentation/lux/target/jvm/type/parser.lux index bb8b8f823..d92da573a 100644 --- a/stdlib/source/documentation/lux/target/jvm/type/parser.lux +++ b/stdlib/source/documentation/lux/target/jvm/type/parser.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/target/jvm/type/reflection.lux b/stdlib/source/documentation/lux/target/jvm/type/reflection.lux index fea87d9e4..44439aa2d 100644 --- a/stdlib/source/documentation/lux/target/jvm/type/reflection.lux +++ b/stdlib/source/documentation/lux/target/jvm/type/reflection.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/target/jvm/type/signature.lux b/stdlib/source/documentation/lux/target/jvm/type/signature.lux index 47004cd58..f5cdaaf85 100644 --- a/stdlib/source/documentation/lux/target/jvm/type/signature.lux +++ b/stdlib/source/documentation/lux/target/jvm/type/signature.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/target/lua.lux b/stdlib/source/documentation/lux/target/lua.lux index ea7505684..ce850522c 100644 --- a/stdlib/source/documentation/lux/target/lua.lux +++ b/stdlib/source/documentation/lux/target/lua.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/target/python.lux b/stdlib/source/documentation/lux/target/python.lux index 7bfd72284..3fa6f0a6a 100644 --- a/stdlib/source/documentation/lux/target/python.lux +++ b/stdlib/source/documentation/lux/target/python.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/target/ruby.lux b/stdlib/source/documentation/lux/target/ruby.lux index 1a8752cc5..0422b06f0 100644 --- a/stdlib/source/documentation/lux/target/ruby.lux +++ b/stdlib/source/documentation/lux/target/ruby.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/test.lux b/stdlib/source/documentation/lux/test.lux index 535deb2a8..f6064a13c 100644 --- a/stdlib/source/documentation/lux/test.lux +++ b/stdlib/source/documentation/lux/test.lux @@ -100,7 +100,7 @@ "Executes multiple tests in parallel (if the host platform supports it) to take advantage of multiple cores." [(in_parallel tests)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "Tools for unit & property-based/generative testing." diff --git a/stdlib/source/documentation/lux/time.lux b/stdlib/source/documentation/lux/time.lux index dbec1208c..8e38a8ee9 100644 --- a/stdlib/source/documentation/lux/time.lux +++ b/stdlib/source/documentation/lux/time.lux @@ -55,7 +55,7 @@ (format "Based on ISO 8601." \n "For example: 21:14:51.827")) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/time/date.lux b/stdlib/source/documentation/lux/time/date.lux index 56727b114..7c79001e0 100644 --- a/stdlib/source/documentation/lux/time/date.lux +++ b/stdlib/source/documentation/lux/time/date.lux @@ -24,7 +24,7 @@ (format "Based on ISO 8601." \n "For example: 2017-01-15")) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/time/day.lux b/stdlib/source/documentation/lux/time/day.lux index 5d9a5191a..dad5e72d3 100644 --- a/stdlib/source/documentation/lux/time/day.lux +++ b/stdlib/source/documentation/lux/time/day.lux @@ -19,7 +19,7 @@ (documentation: /.week "All the days, ordered by when they come in a week.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/time/duration.lux b/stdlib/source/documentation/lux/time/duration.lux index bdff85dfa..e55d85bcf 100644 --- a/stdlib/source/documentation/lux/time/duration.lux +++ b/stdlib/source/documentation/lux/time/duration.lux @@ -20,7 +20,7 @@ "" [(difference from to)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/time/instant.lux b/stdlib/source/documentation/lux/time/instant.lux index 742d4de59..431722137 100644 --- a/stdlib/source/documentation/lux/time/instant.lux +++ b/stdlib/source/documentation/lux/time/instant.lux @@ -46,7 +46,7 @@ "" [(of_date_time date time)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/time/month.lux b/stdlib/source/documentation/lux/time/month.lux index a8a04a2c1..8012bf0a4 100644 --- a/stdlib/source/documentation/lux/time/month.lux +++ b/stdlib/source/documentation/lux/time/month.lux @@ -27,7 +27,7 @@ (documentation: /.year "All the months, ordered by when they come in a year.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/time/year.lux b/stdlib/source/documentation/lux/time/year.lux index 7c138c422..ae9b14fb2 100644 --- a/stdlib/source/documentation/lux/time/year.lux +++ b/stdlib/source/documentation/lux/time/year.lux @@ -36,7 +36,7 @@ (format "Based on ISO 8601." \n "For example: 2017")) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/tool.lux b/stdlib/source/documentation/lux/tool.lux index c29d10467..347781dc6 100644 --- a/stdlib/source/documentation/lux/tool.lux +++ b/stdlib/source/documentation/lux/tool.lux @@ -17,7 +17,7 @@ ["[1][0]" generation] ["[1][0]" synthesis]]]]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) (list.together (list /phase.documentation diff --git a/stdlib/source/documentation/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/documentation/lux/tool/compiler/language/lux/analysis.lux index a227efcaf..40b8c3673 100644 --- a/stdlib/source/documentation/lux/tool/compiler/language/lux/analysis.lux +++ b/stdlib/source/documentation/lux/tool/compiler/language/lux/analysis.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/tool/compiler/language/lux/directive.lux b/stdlib/source/documentation/lux/tool/compiler/language/lux/directive.lux index 0b7ea6e61..52533cbb9 100644 --- a/stdlib/source/documentation/lux/tool/compiler/language/lux/directive.lux +++ b/stdlib/source/documentation/lux/tool/compiler/language/lux/directive.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/tool/compiler/language/lux/generation.lux b/stdlib/source/documentation/lux/tool/compiler/language/lux/generation.lux index 1582f45d7..e318c61e7 100644 --- a/stdlib/source/documentation/lux/tool/compiler/language/lux/generation.lux +++ b/stdlib/source/documentation/lux/tool/compiler/language/lux/generation.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/tool/compiler/language/lux/synthesis.lux b/stdlib/source/documentation/lux/tool/compiler/language/lux/synthesis.lux index 20ff65682..a831b31d4 100644 --- a/stdlib/source/documentation/lux/tool/compiler/language/lux/synthesis.lux +++ b/stdlib/source/documentation/lux/tool/compiler/language/lux/synthesis.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/tool/compiler/phase.lux b/stdlib/source/documentation/lux/tool/compiler/phase.lux index fbe76ea4c..a91acdeb0 100644 --- a/stdlib/source/documentation/lux/tool/compiler/phase.lux +++ b/stdlib/source/documentation/lux/tool/compiler/phase.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/type.lux b/stdlib/source/documentation/lux/type.lux index 3c913198a..c05db6d1e 100644 --- a/stdlib/source/documentation/lux/type.lux +++ b/stdlib/source/documentation/lux/type.lux @@ -153,7 +153,7 @@ [(let [side (Either Int Frac)] (List [side side]))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "Basic functionality for working with types." diff --git a/stdlib/source/documentation/lux/type/check.lux b/stdlib/source/documentation/lux/type/check.lux index c0bef5b1b..e65a1ccd6 100644 --- a/stdlib/source/documentation/lux/type/check.lux +++ b/stdlib/source/documentation/lux/type/check.lux @@ -64,7 +64,7 @@ "Resolves every bound type-variable to yield a new type that is as resolved as possible." [(clean inputT)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "Type-checking functionality." diff --git a/stdlib/source/documentation/lux/type/dynamic.lux b/stdlib/source/documentation/lux/type/dynamic.lux index 613fb0167..511642334 100644 --- a/stdlib/source/documentation/lux/type/dynamic.lux +++ b/stdlib/source/documentation/lux/type/dynamic.lux @@ -26,7 +26,7 @@ [(is (try.Try Nat) (static Nat (dynamic 123)))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/type/implicit.lux b/stdlib/source/documentation/lux/type/implicit.lux index 95cafb20a..869295b0e 100644 --- a/stdlib/source/documentation/lux/type/implicit.lux +++ b/stdlib/source/documentation/lux/type/implicit.lux @@ -50,7 +50,7 @@ (n.= (at n.multiplication composite left right) (a/an composite left right))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/type/poly.lux b/stdlib/source/documentation/lux/type/poly.lux index 92183f398..5bcc6ceb2 100644 --- a/stdlib/source/documentation/lux/type/poly.lux +++ b/stdlib/source/documentation/lux/type/poly.lux @@ -21,7 +21,7 @@ "" [(code env type)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/type/primitive.lux b/stdlib/source/documentation/lux/type/primitive.lux index cbb9ac7bf..d8d651188 100644 --- a/stdlib/source/documentation/lux/type/primitive.lux +++ b/stdlib/source/documentation/lux/type/primitive.lux @@ -41,36 +41,36 @@ [(primitive String Text - (def: (string value) + (def (string value) (-> Text String) (abstraction value)) - (def: (text value) + (def (text value) (-> String Text) (representation value)))] ["Type-parameters are optional." (primitive (Duplicate a) [a a] - (def: (duplicate value) + (def (duplicate value) (All (_ a) (-> a (Duplicate a))) (abstraction [value value])))] ["Definitions can be nested." (primitive (Single a) a - (def: (single value) + (def (single value) (All (_ a) (-> a (Single a))) (abstraction value)) (primitive (Double a) [a a] - (def: (double value) + (def (double value) (All (_ a) (-> a (Double a))) (abstraction [value value])) - (def: (single' value) + (def (single' value) (All (_ a) (-> a (Single a))) (abstraction Single [value value])) @@ -89,12 +89,12 @@ (primitive Expression Any) (primitive Statement Any) - (def: (+ x y) + (def (+ x y) (-> (JavaScript Expression) (JavaScript Expression) (JavaScript Expression)) (abstraction (format "(" (representation x) "+" (representation y) ")"))) - (def: (while test body) + (def (while test body) (-> (JavaScript Expression) (JavaScript Statement) (JavaScript Statement)) (abstraction (format "while(" (representation test) ") {" @@ -109,15 +109,15 @@ (primitive Expression Any) (primitive Statement Any) - (def: (statement expression) + (def (statement expression) (-> (JavaScript Expression) (JavaScript Statement)) (transmutation expression)) - (def: (statement' expression) + (def (statement' expression) (-> (JavaScript Expression) (JavaScript Statement)) (transmutation JavaScript expression)))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/type/quotient.lux b/stdlib/source/documentation/lux/type/quotient.lux index ffa3075ff..573d9bdfd 100644 --- a/stdlib/source/documentation/lux/type/quotient.lux +++ b/stdlib/source/documentation/lux/type/quotient.lux @@ -27,17 +27,17 @@ (documentation: /.type "The Quotient type associated with a Class type." - [(def: even + [(def even (class even?)) - (def: Even + (def Even Type (type even)) (is Even (quotient even 123))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/type/refinement.lux b/stdlib/source/documentation/lux/type/refinement.lux index ddeee3c95..b663e9f41 100644 --- a/stdlib/source/documentation/lux/type/refinement.lux +++ b/stdlib/source/documentation/lux/type/refinement.lux @@ -38,17 +38,17 @@ (documentation: /.type "The Refined type associated with a Refiner type." - [(def: even + [(def even (refiner even?)) - (def: Even + (def Even Type (type even)) (is (Maybe Even) (even 123))]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/type/resource.lux b/stdlib/source/documentation/lux/type/resource.lux index 439fbbbce..1fbd8997e 100644 --- a/stdlib/source/documentation/lux/type/resource.lux +++ b/stdlib/source/documentation/lux/type/resource.lux @@ -91,7 +91,7 @@ [/.un_group] ) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/type/unit.lux b/stdlib/source/documentation/lux/type/unit.lux index fd518779f..fafcdf14a 100644 --- a/stdlib/source/documentation/lux/type/unit.lux +++ b/stdlib/source/documentation/lux/type/unit.lux @@ -31,11 +31,11 @@ (documentation: /.unit (format "Define a unit of measurement." \n "Both the name of the type, and the name of the Unit implementation must be specified.") - [(def: feet (unit []))]) + [(def feet (unit []))]) (documentation: /.scale "Define a scale of magnitude." - [(def: bajillion (scale [1 1,234,567,890]))]) + [(def bajillion (scale [1 1,234,567,890]))]) (documentation: /.re_scaled "" @@ -66,7 +66,7 @@ [/.second] ) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/type/variance.lux b/stdlib/source/documentation/lux/type/variance.lux index 6501ab999..4a504d3dd 100644 --- a/stdlib/source/documentation/lux/type/variance.lux +++ b/stdlib/source/documentation/lux/type/variance.lux @@ -22,7 +22,7 @@ (documentation: (/.In it) "A constraint for invariant types.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/world.lux b/stdlib/source/documentation/lux/world.lux index afbd6447b..46a62d977 100644 --- a/stdlib/source/documentation/lux/world.lux +++ b/stdlib/source/documentation/lux/world.lux @@ -21,7 +21,7 @@ ["[1][0]" program] ["[1][0]" shell]]) -(.def: .public documentation +(.def .public documentation (.List $.Module) (all list#composite /console.documentation diff --git a/stdlib/source/documentation/lux/world/console.lux b/stdlib/source/documentation/lux/world/console.lux index d601e2012..909f6b665 100644 --- a/stdlib/source/documentation/lux/world/console.lux +++ b/stdlib/source/documentation/lux/world/console.lux @@ -29,7 +29,7 @@ "" [(mock mock init)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) (`` (`` ($.module /._ "" diff --git a/stdlib/source/documentation/lux/world/file.lux b/stdlib/source/documentation/lux/world/file.lux index 6dacba4eb..b3c4d4a58 100644 --- a/stdlib/source/documentation/lux/world/file.lux +++ b/stdlib/source/documentation/lux/world/file.lux @@ -52,7 +52,7 @@ "Creates a new file with the given content if-and-only-if the file does not already exist." [(make_file monad fs content path)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) (`` (`` ($.module /._ "" diff --git a/stdlib/source/documentation/lux/world/file/watch.lux b/stdlib/source/documentation/lux/world/file/watch.lux index c25efe7fc..405f88b90 100644 --- a/stdlib/source/documentation/lux/world/file/watch.lux +++ b/stdlib/source/documentation/lux/world/file/watch.lux @@ -38,7 +38,7 @@ "The default watcher for the default file-system.")) (these)) -(.def: .public documentation +(.def .public documentation (.List $.Module) (`` (`` ($.module /._ "" diff --git a/stdlib/source/documentation/lux/world/input/keyboard.lux b/stdlib/source/documentation/lux/world/input/keyboard.lux index a5c4fc1da..3a691b94b 100644 --- a/stdlib/source/documentation/lux/world/input/keyboard.lux +++ b/stdlib/source/documentation/lux/world/input/keyboard.lux @@ -19,7 +19,7 @@ (documentation: /.Press "A key-press for a key.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/world/net.lux b/stdlib/source/documentation/lux/world/net.lux index b0f152785..5cc8b9773 100644 --- a/stdlib/source/documentation/lux/world/net.lux +++ b/stdlib/source/documentation/lux/world/net.lux @@ -23,7 +23,7 @@ (documentation: /.URL "A Uniform Resource Locator.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/world/net/http/client.lux b/stdlib/source/documentation/lux/world/net/http/client.lux index 866adba7d..653285514 100644 --- a/stdlib/source/documentation/lux/world/net/http/client.lux +++ b/stdlib/source/documentation/lux/world/net/http/client.lux @@ -32,7 +32,7 @@ [/.trace] ) -(.def: .public documentation +(.def .public documentation (.List $.Module) (`` (`` ($.module /._ "" diff --git a/stdlib/source/documentation/lux/world/net/http/status.lux b/stdlib/source/documentation/lux/world/net/http/status.lux index 9a6e18691..a320efe02 100644 --- a/stdlib/source/documentation/lux/world/net/http/status.lux +++ b/stdlib/source/documentation/lux/world/net/http/status.lux @@ -93,7 +93,7 @@ [/.network_authentication_required] ) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/world/net/uri.lux b/stdlib/source/documentation/lux/world/net/uri.lux index ccaafada9..955eec57c 100644 --- a/stdlib/source/documentation/lux/world/net/uri.lux +++ b/stdlib/source/documentation/lux/world/net/uri.lux @@ -15,7 +15,7 @@ (documentation: /.separator "A separator for the pieces of a URI.") -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/world/output/video/resolution.lux b/stdlib/source/documentation/lux/world/output/video/resolution.lux index 66c3a8dff..39dcfdba5 100644 --- a/stdlib/source/documentation/lux/world/output/video/resolution.lux +++ b/stdlib/source/documentation/lux/world/output/video/resolution.lux @@ -43,7 +43,7 @@ [/.uhd_4k] ) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/world/program.lux b/stdlib/source/documentation/lux/world/program.lux index 0d7ab4d1a..52235985e 100644 --- a/stdlib/source/documentation/lux/world/program.lux +++ b/stdlib/source/documentation/lux/world/program.lux @@ -24,7 +24,7 @@ "" [(mock environment home directory)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) ($.module /._ "" diff --git a/stdlib/source/documentation/lux/world/shell.lux b/stdlib/source/documentation/lux/world/shell.lux index f0e7fbfe2..a38d28158 100644 --- a/stdlib/source/documentation/lux/world/shell.lux +++ b/stdlib/source/documentation/lux/world/shell.lux @@ -36,7 +36,7 @@ "" [(mock mock init)]) -(.def: .public documentation +(.def .public documentation (.List $.Module) (`` (`` ($.module /._ "" diff --git a/stdlib/source/experiment/compiler.lux b/stdlib/source/experiment/compiler.lux index 99acd4249..4f9e58377 100644 --- a/stdlib/source/experiment/compiler.lux +++ b/stdlib/source/experiment/compiler.lux @@ -6,7 +6,7 @@ [tool ["[0]" compiler (.only Custom)]]]]) -(def: .public (dummy parameters) +(def .public (dummy parameters) (Custom Nat [] []) {try.#Success [0 (function (_ input) diff --git a/stdlib/source/format/lux/data/binary.lux b/stdlib/source/format/lux/data/binary.lux index a0b96a581..ed497dd3f 100644 --- a/stdlib/source/format/lux/data/binary.lux +++ b/stdlib/source/format/lux/data/binary.lux @@ -33,7 +33,7 @@ ["" \\parser (.only Offset Size Parser)]) (with_template [ ] - [(def: + [(def (template ( ) [( ( (.int ) (.int )))]))] @@ -42,7 +42,7 @@ [n#* "lux i64 *" .nat] ) -(def: mask +(def mask (-> Size (I64 Any)) (|>> (n#* i64.bits_per_byte) i64.mask)) @@ -52,33 +52,33 @@ (type: .public Specification [Size Mutation]) -(def: .public no_op +(def .public no_op Specification [0 function.identity]) -(def: .public (instance [size mutation]) +(def .public (instance [size mutation]) (-> Specification Binary) (|> size \\unsafe.empty [0] mutation product.right)) -(def: .public monoid +(def .public monoid (Monoid Specification) (implementation - (def: identity + (def identity ..no_op) - (def: (composite [sizeL mutL] [sizeR mutR]) + (def (composite [sizeL mutL] [sizeR mutR]) [(n#+ sizeL sizeR) (|>> mutL mutR)]))) (type: .public (Writer a) (-> a Specification)) -(def: .public (result writer value) +(def .public (result writer value) (All (_ a) (-> (Writer a) a Binary)) (..instance (writer value))) (with_template [ ] - [(def: .public + [(def .public (Writer (I64 Any)) (function (_ value) [ @@ -92,7 +92,7 @@ [bits_64 .size_64 \\unsafe.has_64!] ) -(def: .public (or left right) +(def .public (or left right) (All (_ l r) (-> (Writer l) (Writer r) (Writer (Or l r)))) (function (_ altV) (case altV @@ -109,37 +109,37 @@ [1 .#Right right]) ))) -(def: .public (and pre post) +(def .public (and pre post) (All (_ a b) (-> (Writer a) (Writer b) (Writer [a b]))) (function (_ [preV postV]) (at ..monoid composite (pre preV) (post postV)))) -(def: .public (rec body) +(def .public (rec body) (All (_ a) (-> (-> (Writer a) (Writer a)) (Writer a))) (function (again value) (body again value))) -(def: .public any +(def .public any (Writer Any) (function.constant ..no_op)) -(def: .public bit +(def .public bit (Writer Bit) (|>> (pipe.case #0 0 #1 1) ..bits_8)) (with_template [ ] - [(def: .public (Writer ) ..bits_64)] + [(def .public (Writer ) ..bits_64)] [nat Nat] [int Int] [rev Rev] ) -(def: .public frac +(def .public frac (Writer Frac) (|>> frac.bits ..bits_64)) -(def: .public (segment size) +(def .public (segment size) (-> Nat (Writer Binary)) (function (_ value) [size @@ -152,7 +152,7 @@ binary)])])) (with_template [ ] - [(def: .public + [(def .public (Writer Binary) (let [mask (..mask )] (function (_ value) @@ -172,7 +172,7 @@ ) (with_template [ ] - [(def: .public + [(def .public (Writer Text) (|>> (at utf8.codec encoded) ))] @@ -182,10 +182,10 @@ [utf8_64 ..binary_64] ) -(def: .public text ..utf8_64) +(def .public text ..utf8_64) (with_template [ ] - [(def: .public ( valueW) + [(def .public ( valueW) (All (_ v) (-> (Writer v) (Writer (Sequence v)))) (function (_ value) (let [original_count (sequence.size value) @@ -214,25 +214,25 @@ [sequence_64 .size_64 \\unsafe.has_64!] ) -(def: .public maybe +(def .public maybe (All (_ a) (-> (Writer a) (Writer (Maybe a)))) (..or ..any)) -(def: .public (list value) +(def .public (list value) (All (_ a) (-> (Writer a) (Writer (List a)))) (..rec (|>> (..and value) (..or ..any)))) -(def: .public (set value) +(def .public (set value) (All (_ a) (-> (Writer a) (Writer (Set a)))) (|>> set.list (..list value))) -(def: .public symbol +(def .public symbol (Writer Symbol) (..and ..text ..text)) -(def: .public type +(def .public type (Writer Type) (..rec (function (_ again) @@ -263,11 +263,11 @@ [10 .#Named (..and ..symbol again)]) )))))) -(def: .public location +(def .public location (Writer Location) (all ..and ..text ..nat ..nat)) -(def: .public code +(def .public code (Writer Code) (..rec (function (_ again) diff --git a/stdlib/source/format/lux/data/text.lux b/stdlib/source/format/lux/data/text.lux index 606cace14..e5b3a005c 100644 --- a/stdlib/source/format/lux/data/text.lux +++ b/stdlib/source/format/lux/data/text.lux @@ -42,18 +42,18 @@ (type: .public (Format a) (-> a Text)) -(def: .public functor +(def .public functor (contravariant.Functor Format) (implementation - (def: (each f fb) + (def (each f fb) (|>> f fb)))) -(def: .public format +(def .public format (syntax (_ [fragments (<>.many .any)]) (in (.list (` (all "lux text concat" (~+ fragments))))))) (with_template [ ] - [(def: .public + [(def .public (Format ) )] @@ -83,7 +83,7 @@ (with_template [ ,] [(`` (with_template [ ] - [(def: .public + [(def .public (Format ) (at encoded))] @@ -111,18 +111,18 @@ [frac_16 frac.hex]]] ) -(def: .public (mod modular) +(def .public (mod modular) (All (_ m) (Format (modular.Mod m))) (let [codec (modular.codec (modular.modulus modular))] (at codec encoded modular))) -(def: .public (list formatter) +(def .public (list formatter) (All (_ a) (-> (Format a) (Format (List a)))) (|>> (list#each (|>> formatter (format " "))) text.together (text.enclosed ["(list" ")"]))) -(def: .public (maybe format) +(def .public (maybe format) (All (_ a) (-> (Format a) (Format (Maybe a)))) (function (_ value) (case value diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 483362c7d..28507c829 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -823,7 +823,7 @@ {#End}}}))) #0) -("lux def" def:'' +("lux def" def'' ("lux macro" (function'' [tokens] ({{#Item [export_policy @@ -840,7 +840,7 @@ {#End}]}) _ - (failure "Wrong syntax for def:''")} + (failure "Wrong syntax for def''")} tokens))) #0) @@ -856,580 +856,580 @@ tokens))) #1) -(def:'' .public comment - Macro - (macro (_ tokens) - (meta#in {#End}))) +(def'' .public comment + Macro + (macro (_ tokens) + (meta#in {#End}))) -(def:'' .private $' - Macro - (macro (_ tokens) - ({{#Item x {#End}} - (meta#in tokens) +(def'' .private $' + Macro + (macro (_ tokens) + ({{#Item x {#End}} + (meta#in tokens) - {#Item x {#Item y xs}} - (meta#in {#Item (form$ {#Item (symbol$ [..prelude "$'"]) - {#Item (variant$ {#Item (symbol$ [..prelude "#Apply"]) - {#Item y {#Item x {#End}}}}) - xs}}) - {#End}}) + {#Item x {#Item y xs}} + (meta#in {#Item (form$ {#Item (symbol$ [..prelude "$'"]) + {#Item (variant$ {#Item (symbol$ [..prelude "#Apply"]) + {#Item y {#Item x {#End}}}}) + xs}}) + {#End}}) - _ - (failure "Wrong syntax for $'")} - tokens))) - -(def:'' .private (list#mix f init xs) - ... (All (_ a b) (-> (-> b a a) a (List b) a)) - {#UnivQ {#End} {#UnivQ {#End} {#Function {#Function {#Parameter 1} - {#Function {#Parameter 3} - {#Parameter 3}}} - {#Function {#Parameter 3} - {#Function ($' List {#Parameter 1}) - {#Parameter 3}}}}}} - ({{#End} - init + _ + (failure "Wrong syntax for $'")} + tokens))) + +(def'' .private (list#mix f init xs) + ... (All (_ a b) (-> (-> b a a) a (List b) a)) + {#UnivQ {#End} {#UnivQ {#End} {#Function {#Function {#Parameter 1} + {#Function {#Parameter 3} + {#Parameter 3}}} + {#Function {#Parameter 3} + {#Function ($' List {#Parameter 1}) + {#Parameter 3}}}}}} + ({{#End} + init + + {#Item x xs'} + (list#mix f (f x init) xs')} + xs)) + +(def'' .private (list#reversed list) + {#UnivQ {#End} + {#Function ($' List {#Parameter 1}) ($' List {#Parameter 1})}} + (list#mix ("lux type check" {#UnivQ {#End} + {#Function {#Parameter 1} {#Function ($' List {#Parameter 1}) ($' List {#Parameter 1})}}} + (function'' [head tail] {#Item head tail})) + {#End} + list)) + +(def'' .private (list#each f xs) + {#UnivQ {#End} + {#UnivQ {#End} + {#Function {#Function {#Parameter 3} {#Parameter 1}} + {#Function ($' List {#Parameter 3}) + ($' List {#Parameter 1})}}}} + (list#mix (function'' [head tail] {#Item (f head) tail}) + {#End} + (list#reversed xs))) + +(def'' .private Replacement_Environment + Type + ($' List {#Product Text Code})) - {#Item x xs'} - (list#mix f (f x init) xs')} - xs)) +(def'' .private (replacement_environment xs ys) + {#Function ($' List Text) {#Function ($' List Code) Replacement_Environment}} + ({[{#Item x xs'} {#Item y ys'}] + {#Item [x y] (replacement_environment xs' ys')} -(def:'' .private (list#reversed list) - {#UnivQ {#End} - {#Function ($' List {#Parameter 1}) ($' List {#Parameter 1})}} - (list#mix ("lux type check" {#UnivQ {#End} - {#Function {#Parameter 1} {#Function ($' List {#Parameter 1}) ($' List {#Parameter 1})}}} - (function'' [head tail] {#Item head tail})) - {#End} - list)) - -(def:'' .private (list#each f xs) - {#UnivQ {#End} - {#UnivQ {#End} - {#Function {#Function {#Parameter 3} {#Parameter 1}} - {#Function ($' List {#Parameter 3}) - ($' List {#Parameter 1})}}}} - (list#mix (function'' [head tail] {#Item (f head) tail}) - {#End} - (list#reversed xs))) + _ + {#End}} + [xs ys])) -(def:'' .private Replacement_Environment - Type - ($' List {#Product Text Code})) +(def'' .private (text#= reference sample) + {#Function Text {#Function Text Bit}} + ("lux text =" reference sample)) -(def:'' .private (replacement_environment xs ys) - {#Function ($' List Text) {#Function ($' List Code) Replacement_Environment}} - ({[{#Item x xs'} {#Item y ys'}] - {#Item [x y] (replacement_environment xs' ys')} +(def'' .private (replacement for environment) + {#Function Text {#Function Replacement_Environment ($' Maybe Code)}} + ({{#End} + {#None} - _ - {#End}} - [xs ys])) + {#Item [k v] environment'} + ({[#1] {#Some v} + [#0] (replacement for environment')} + (text#= k for))} + environment)) -(def:'' .private (text#= reference sample) - {#Function Text {#Function Text Bit}} - ("lux text =" reference sample)) +(def'' .private (with_replacements reps syntax) + {#Function Replacement_Environment {#Function Code Code}} + ({[_ {#Symbol "" name}] + ({{#Some replacement} + replacement -(def:'' .private (replacement for environment) - {#Function Text {#Function Replacement_Environment ($' Maybe Code)}} - ({{#End} - {#None} + {#None} + syntax} + (..replacement name reps)) - {#Item [k v] environment'} - ({[#1] {#Some v} - [#0] (replacement for environment')} - (text#= k for))} - environment)) + [meta {#Form parts}] + [meta {#Form (list#each (with_replacements reps) parts)}] -(def:'' .private (with_replacements reps syntax) - {#Function Replacement_Environment {#Function Code Code}} - ({[_ {#Symbol "" name}] - ({{#Some replacement} - replacement + [meta {#Variant members}] + [meta {#Variant (list#each (with_replacements reps) members)}] - {#None} - syntax} - (..replacement name reps)) + [meta {#Tuple members}] + [meta {#Tuple (list#each (with_replacements reps) members)}] + + _ + syntax} + syntax)) + +(def'' .private (n/* param subject) + {#Function Nat {#Function Nat Nat}} + ("lux type as" Nat + ("lux i64 *" + ("lux type as" Int param) + ("lux type as" Int subject)))) + +(def'' .private (list#size list) + {#UnivQ {#End} + {#Function ($' List {#Parameter 1}) Nat}} + (list#mix (function'' [_ acc] ("lux i64 +" 1 acc)) 0 list)) + +(def'' .private (let$ binding value body) + {#Function Code {#Function Code {#Function Code Code}}} + (form$ {#Item (variant$ {#Item binding {#Item body {#End}}}) + {#Item value {#End}}})) + +(def'' .private |#End| + Code + (variant$ {#Item (symbol$ [..prelude "#End"]) {#End}})) + +(def'' .private (|#Item| head tail) + {#Function Code {#Function Code Code}} + (variant$ {#Item (symbol$ [..prelude "#Item"]) + {#Item head + {#Item tail + {#End}}}})) + +(def'' .private (UnivQ$ body) + {#Function Code Code} + (variant$ {#Item (symbol$ [..prelude "#UnivQ"]) {#Item ..|#End| {#Item body {#End}}}})) + +(def'' .private (ExQ$ body) + {#Function Code Code} + (variant$ {#Item (symbol$ [..prelude "#ExQ"]) {#Item ..|#End| {#Item body {#End}}}})) + +(def'' .private quantification_level + Text + ("lux text concat" double_quote + ("lux text concat" "quantification_level" + double_quote))) + +(def'' .private quantified + {#Function Code Code} + (let$ (local$ ..quantification_level) (nat$ 0))) + +(def'' .private (quantified_type_parameter idx) + {#Function Nat Code} + (variant$ {#Item (symbol$ [..prelude "#Parameter"]) + {#Item (form$ {#Item (text$ "lux i64 +") + {#Item (local$ ..quantification_level) + {#Item (nat$ idx) + {#End}}}}) + {#End}}})) + +(def'' .private (next_level depth) + {#Function Nat Nat} + ("lux i64 +" 2 depth)) + +(def'' .private (self_id? id) + {#Function Nat Bit} + ("lux i64 =" id ("lux type as" Nat + ("lux i64 *" +2 + ("lux i64 /" +2 + ("lux type as" Int + id)))))) + +(def'' .public (__adjusted_quantified_type__ permission depth type) + {#Function Nat {#Function Nat {#Function Type Type}}} + ({0 + ({... Jackpot! + {#Parameter id} + ({id' + ({[#0] {#Parameter id'} + [#1] {#Parameter ("lux i64 -" 2 id')}} + (self_id? id))} + ("lux i64 -" ("lux i64 -" depth id) 0)) + + ... Recur + {#Primitive name parameters} + {#Primitive name (list#each (__adjusted_quantified_type__ permission depth) + parameters)} + + {#Sum left right} + {#Sum (__adjusted_quantified_type__ permission depth left) + (__adjusted_quantified_type__ permission depth right)} + + {#Product left right} + {#Product (__adjusted_quantified_type__ permission depth left) + (__adjusted_quantified_type__ permission depth right)} + + {#Function input output} + {#Function (__adjusted_quantified_type__ permission depth input) + (__adjusted_quantified_type__ permission depth output)} + + {#UnivQ environment body} + {#UnivQ environment + (__adjusted_quantified_type__ permission (next_level depth) body)} + + {#ExQ environment body} + {#ExQ environment + (__adjusted_quantified_type__ permission (next_level depth) body)} + + {#Apply parameter function} + {#Apply (__adjusted_quantified_type__ permission depth parameter) + (__adjusted_quantified_type__ permission depth function)} - [meta {#Form parts}] - [meta {#Form (list#each (with_replacements reps) parts)}] + ... Leave these alone. + {#Named name anonymous} type + {#Var id} type + {#Ex id} type} + type) - [meta {#Variant members}] - [meta {#Variant (list#each (with_replacements reps) members)}] + _ + type} + permission)) + +(def'' .private (with_correct_quantification body) + {#Function Code Code} + (form$ {#Item (symbol$ [prelude "__adjusted_quantified_type__"]) + {#Item (local$ ..quantification_level) + {#Item (nat$ 0) + {#Item body + {#End}}}}})) + +(def'' .private (with_quantification depth body) + {#Function Nat {#Function Code Code}} + ({g!level + (let$ g!level + (form$ {#Item (text$ "lux i64 +") + {#Item g!level + {#Item (nat$ ("lux type as" Nat + ("lux i64 *" +2 + ("lux type as" Int + depth)))) + {#End}}}}) + body)} + (local$ ..quantification_level))) + +(def'' .private (initialized_quantification? lux) + {#Function Lux Bit} + ({[..#info _ ..#source _ ..#current_module _ ..#modules _ + ..#scopes scopes ..#type_context _ ..#host _ + ..#seed _ ..#expected _ ..#location _ ..#extensions _ + ..#scope_type_vars _ ..#eval _] + (list#mix (function'' [scope verdict] + ({[#1] #1 + _ ({[..#name _ ..#inner _ ..#captured _ + ..#locals [..#counter _ + ..#mappings locals]] + (list#mix (function'' [local verdict] + ({[local _] + ({[#1] #1 + _ ("lux text =" ..quantification_level local)} + verdict)} + local)) + #0 + locals)} + scope)} + verdict)) + #0 + scopes)} + lux)) + +(def'' .public All + Macro + (macro (_ tokens lux) + ({{#Item [_ {#Form {#Item self_name args}}] + {#Item body {#End}}} + {#Right [lux + {#Item ({raw + ({[#1] raw + [#0] (..quantified raw)} + (initialized_quantification? lux))} + ({{#End} + body + + {#Item head tail} + (with_correct_quantification + (let$ self_name (quantified_type_parameter 0) + ({[_ raw] + raw} + (list#mix (function'' [parameter offset,body'] + ({[offset body'] + [("lux i64 +" 2 offset) + (let$ parameter (quantified_type_parameter ("lux i64 +" offset 1)) + (UnivQ$ body'))]} + offset,body')) + [0 (with_quantification (list#size args) + body)] + args))))} + args)) + {#End}}]} + + _ + {#Left "Wrong syntax for All"}} + tokens))) + +(def'' .public Ex + Macro + (macro (_ tokens lux) + ({{#Item [_ {#Form {#Item self_name args}}] + {#Item body {#End}}} + {#Right [lux + {#Item ({raw + ({[#1] raw + [#0] (..quantified raw)} + (initialized_quantification? lux))} + ({{#End} + body + + {#Item head tail} + (with_correct_quantification + (let$ self_name (quantified_type_parameter 0) + ({[_ raw] + raw} + (list#mix (function'' [parameter offset,body'] + ({[offset body'] + [("lux i64 +" 2 offset) + (let$ parameter (quantified_type_parameter ("lux i64 +" offset 1)) + (ExQ$ body'))]} + offset,body')) + [0 (with_quantification (list#size args) + body)] + args))))} + args)) + {#End}}]} + + _ + {#Left "Wrong syntax for Ex"}} + tokens))) + +(def'' .public -> + Macro + (macro (_ tokens) + ({{#Item output inputs} + (meta#in {#Item (list#mix ("lux type check" {#Function Code {#Function Code Code}} + (function'' [i o] (variant$ {#Item (symbol$ [..prelude "#Function"]) {#Item i {#Item o {#End}}}}))) + output + inputs) + {#End}}) + + _ + (failure "Wrong syntax for ->")} + (list#reversed tokens)))) - [meta {#Tuple members}] - [meta {#Tuple (list#each (with_replacements reps) members)}] - - _ - syntax} - syntax)) - -(def:'' .private (n/* param subject) - {#Function Nat {#Function Nat Nat}} - ("lux type as" Nat - ("lux i64 *" - ("lux type as" Int param) - ("lux type as" Int subject)))) - -(def:'' .private (list#size list) - {#UnivQ {#End} - {#Function ($' List {#Parameter 1}) Nat}} - (list#mix (function'' [_ acc] ("lux i64 +" 1 acc)) 0 list)) - -(def:'' .private (let$ binding value body) - {#Function Code {#Function Code {#Function Code Code}}} - (form$ {#Item (variant$ {#Item binding {#Item body {#End}}}) - {#Item value {#End}}})) - -(def:'' .private |#End| - Code - (variant$ {#Item (symbol$ [..prelude "#End"]) {#End}})) - -(def:'' .private (|#Item| head tail) - {#Function Code {#Function Code Code}} - (variant$ {#Item (symbol$ [..prelude "#Item"]) - {#Item head - {#Item tail - {#End}}}})) - -(def:'' .private (UnivQ$ body) - {#Function Code Code} - (variant$ {#Item (symbol$ [..prelude "#UnivQ"]) {#Item ..|#End| {#Item body {#End}}}})) - -(def:'' .private (ExQ$ body) - {#Function Code Code} - (variant$ {#Item (symbol$ [..prelude "#ExQ"]) {#Item ..|#End| {#Item body {#End}}}})) - -(def:'' .private quantification_level - Text - ("lux text concat" double_quote - ("lux text concat" "quantification_level" - double_quote))) - -(def:'' .private quantified - {#Function Code Code} - (let$ (local$ ..quantification_level) (nat$ 0))) - -(def:'' .private (quantified_type_parameter idx) - {#Function Nat Code} - (variant$ {#Item (symbol$ [..prelude "#Parameter"]) - {#Item (form$ {#Item (text$ "lux i64 +") - {#Item (local$ ..quantification_level) - {#Item (nat$ idx) - {#End}}}}) - {#End}}})) - -(def:'' .private (next_level depth) - {#Function Nat Nat} - ("lux i64 +" 2 depth)) - -(def:'' .private (self_id? id) - {#Function Nat Bit} - ("lux i64 =" id ("lux type as" Nat - ("lux i64 *" +2 - ("lux i64 /" +2 - ("lux type as" Int - id)))))) - -(def:'' .public (__adjusted_quantified_type__ permission depth type) - {#Function Nat {#Function Nat {#Function Type Type}}} - ({0 - ({... Jackpot! - {#Parameter id} - ({id' - ({[#0] {#Parameter id'} - [#1] {#Parameter ("lux i64 -" 2 id')}} - (self_id? id))} - ("lux i64 -" ("lux i64 -" depth id) 0)) - - ... Recur - {#Primitive name parameters} - {#Primitive name (list#each (__adjusted_quantified_type__ permission depth) - parameters)} - - {#Sum left right} - {#Sum (__adjusted_quantified_type__ permission depth left) - (__adjusted_quantified_type__ permission depth right)} - - {#Product left right} - {#Product (__adjusted_quantified_type__ permission depth left) - (__adjusted_quantified_type__ permission depth right)} - - {#Function input output} - {#Function (__adjusted_quantified_type__ permission depth input) - (__adjusted_quantified_type__ permission depth output)} - - {#UnivQ environment body} - {#UnivQ environment - (__adjusted_quantified_type__ permission (next_level depth) body)} - - {#ExQ environment body} - {#ExQ environment - (__adjusted_quantified_type__ permission (next_level depth) body)} - - {#Apply parameter function} - {#Apply (__adjusted_quantified_type__ permission depth parameter) - (__adjusted_quantified_type__ permission depth function)} +(def'' .public list + Macro + (macro (_ xs) + (meta#in {#Item (list#mix |#Item| |#End| (list#reversed xs)) + {#End}}))) - ... Leave these alone. - {#Named name anonymous} type - {#Var id} type - {#Ex id} type} - type) +(def'' .private partial_list + Macro + (macro (_ xs) + ({{#Item last init} + (meta#in (list (list#mix |#Item| last init))) - _ - type} - permission)) - -(def:'' .private (with_correct_quantification body) - {#Function Code Code} - (form$ {#Item (symbol$ [prelude "__adjusted_quantified_type__"]) - {#Item (local$ ..quantification_level) - {#Item (nat$ 0) - {#Item body - {#End}}}}})) - -(def:'' .private (with_quantification depth body) - {#Function Nat {#Function Code Code}} - ({g!level - (let$ g!level - (form$ {#Item (text$ "lux i64 +") - {#Item g!level - {#Item (nat$ ("lux type as" Nat - ("lux i64 *" +2 - ("lux type as" Int - depth)))) - {#End}}}}) - body)} - (local$ ..quantification_level))) - -(def:'' .private (initialized_quantification? lux) - {#Function Lux Bit} - ({[..#info _ ..#source _ ..#current_module _ ..#modules _ - ..#scopes scopes ..#type_context _ ..#host _ - ..#seed _ ..#expected _ ..#location _ ..#extensions _ - ..#scope_type_vars _ ..#eval _] - (list#mix (function'' [scope verdict] - ({[#1] #1 - _ ({[..#name _ ..#inner _ ..#captured _ - ..#locals [..#counter _ - ..#mappings locals]] - (list#mix (function'' [local verdict] - ({[local _] - ({[#1] #1 - _ ("lux text =" ..quantification_level local)} - verdict)} - local)) - #0 - locals)} - scope)} - verdict)) - #0 - scopes)} - lux)) - -(def:'' .public All - Macro - (macro (_ tokens lux) - ({{#Item [_ {#Form {#Item self_name args}}] - {#Item body {#End}}} - {#Right [lux - {#Item ({raw - ({[#1] raw - [#0] (..quantified raw)} - (initialized_quantification? lux))} - ({{#End} - body - - {#Item head tail} - (with_correct_quantification - (let$ self_name (quantified_type_parameter 0) - ({[_ raw] - raw} - (list#mix (function'' [parameter offset,body'] - ({[offset body'] - [("lux i64 +" 2 offset) - (let$ parameter (quantified_type_parameter ("lux i64 +" offset 1)) - (UnivQ$ body'))]} - offset,body')) - [0 (with_quantification (list#size args) - body)] - args))))} - args)) - {#End}}]} - - _ - {#Left "Wrong syntax for All"}} - tokens))) + _ + (failure "Wrong syntax for partial_list")} + (list#reversed xs)))) -(def:'' .public Ex - Macro - (macro (_ tokens lux) - ({{#Item [_ {#Form {#Item self_name args}}] - {#Item body {#End}}} - {#Right [lux - {#Item ({raw - ({[#1] raw - [#0] (..quantified raw)} - (initialized_quantification? lux))} - ({{#End} - body - - {#Item head tail} - (with_correct_quantification - (let$ self_name (quantified_type_parameter 0) - ({[_ raw] - raw} - (list#mix (function'' [parameter offset,body'] - ({[offset body'] - [("lux i64 +" 2 offset) - (let$ parameter (quantified_type_parameter ("lux i64 +" offset 1)) - (ExQ$ body'))]} - offset,body')) - [0 (with_quantification (list#size args) - body)] - args))))} - args)) - {#End}}]} - - _ - {#Left "Wrong syntax for Ex"}} - tokens))) +(def'' .public Union + Macro + (macro (_ tokens) + ({{#End} + (meta#in (list (symbol$ [..prelude "Nothing"]))) -(def:'' .public -> - Macro - (macro (_ tokens) - ({{#Item output inputs} - (meta#in {#Item (list#mix ("lux type check" {#Function Code {#Function Code Code}} - (function'' [i o] (variant$ {#Item (symbol$ [..prelude "#Function"]) {#Item i {#Item o {#End}}}}))) - output - inputs) - {#End}}) - - _ - (failure "Wrong syntax for ->")} - (list#reversed tokens)))) + {#Item last prevs} + (meta#in (list (list#mix (function'' [left right] (variant$ (list (symbol$ [..prelude "#Sum"]) left right))) + last + prevs)))} + (list#reversed tokens)))) -(def:'' .public list - Macro - (macro (_ xs) - (meta#in {#Item (list#mix |#Item| |#End| (list#reversed xs)) - {#End}}))) +(def'' .public Tuple + Macro + (macro (_ tokens) + ({{#End} + (meta#in (list (symbol$ [..prelude "Any"]))) -(def:'' .private partial_list - Macro - (macro (_ xs) - ({{#Item last init} - (meta#in (list (list#mix |#Item| last init))) + {#Item last prevs} + (meta#in (list (list#mix (function'' [left right] (variant$ (list (symbol$ [..prelude "#Product"]) left right))) + last + prevs)))} + (list#reversed tokens)))) - _ - (failure "Wrong syntax for partial_list")} - (list#reversed xs)))) +(def'' .private function' + Macro + (macro (_ tokens) + (let'' [name tokens'] ({{#Item [[_ {#Symbol ["" name]}] tokens']} + [name tokens'] -(def:'' .public Union - Macro - (macro (_ tokens) - ({{#End} - (meta#in (list (symbol$ [..prelude "Nothing"]))) + _ + ["" tokens]} + tokens) + ({{#Item [[_ {#Tuple args}] {#Item [body {#End}]}]} + ({{#End} + (failure "function' requires a non-empty arguments tuple.") + + {#Item [harg targs]} + (meta#in (list (form$ (list (tuple$ (list (local$ name) + harg)) + (list#mix (function'' [arg body'] + (form$ (list (tuple$ (list (local$ "") + arg)) + body'))) + body + (list#reversed targs))))))} + args) - {#Item last prevs} - (meta#in (list (list#mix (function'' [left right] (variant$ (list (symbol$ [..prelude "#Sum"]) left right))) - last - prevs)))} - (list#reversed tokens)))) + _ + (failure "Wrong syntax for function'")} + tokens')))) + +(def'' .private def''' + Macro + (macro (_ tokens) + ({{#Item [export_policy + {#Item [[_ {#Form {#Item [name args]}}] + {#Item [type {#Item [body {#End}]}]}]}]} + (meta#in (list (form$ (list (text$ "lux def") + name + (form$ (list (text$ "lux type check") + type + (form$ (list (symbol$ [..prelude "function'"]) + name + (tuple$ args) + body)))) + export_policy)))) + + {#Item [export_policy {#Item [name {#Item [type {#Item [body {#End}]}]}]}]} + (meta#in (list (form$ (list (text$ "lux def") + name + (form$ (list (text$ "lux type check") + type + body)) + export_policy)))) -(def:'' .public Tuple - Macro - (macro (_ tokens) - ({{#End} - (meta#in (list (symbol$ [..prelude "Any"]))) + _ + (failure "Wrong syntax for def'''")} + tokens))) - {#Item last prevs} - (meta#in (list (list#mix (function'' [left right] (variant$ (list (symbol$ [..prelude "#Product"]) left right))) - last - prevs)))} - (list#reversed tokens)))) +(def''' .public Or + Macro + ..Union) -(def:'' .private function' +(def''' .public And Macro - (macro (_ tokens) - (let'' [name tokens'] ({{#Item [[_ {#Symbol ["" name]}] tokens']} - [name tokens'] + ..Tuple) - _ - ["" tokens]} - tokens) - ({{#Item [[_ {#Tuple args}] {#Item [body {#End}]}]} - ({{#End} - (failure "function' requires a non-empty arguments tuple.") - - {#Item [harg targs]} - (meta#in (list (form$ (list (tuple$ (list (local$ name) - harg)) - (list#mix (function'' [arg body'] - (form$ (list (tuple$ (list (local$ "") - arg)) - body'))) - body - (list#reversed targs))))))} - args) +(def''' .private (pairs xs) + (All (_ a) (-> ($' List a) ($' Maybe ($' List (Tuple a a))))) + ({{#Item x {#Item y xs'}} + ({{#Some tail} + {#Some {#Item [x y] tail}} + + {#None} + {#None}} + (pairs xs')) - _ - (failure "Wrong syntax for function'")} - tokens')))) + {#End} + {#Some {#End}} -(def:'' .private def:''' - Macro - (macro (_ tokens) - ({{#Item [export_policy - {#Item [[_ {#Form {#Item [name args]}}] - {#Item [type {#Item [body {#End}]}]}]}]} - (meta#in (list (form$ (list (text$ "lux def") - name - (form$ (list (text$ "lux type check") - type - (form$ (list (symbol$ [..prelude "function'"]) - name - (tuple$ args) - body)))) - export_policy)))) - - {#Item [export_policy {#Item [name {#Item [type {#Item [body {#End}]}]}]}]} - (meta#in (list (form$ (list (text$ "lux def") - name - (form$ (list (text$ "lux type check") - type - body)) - export_policy)))) + _ + {#None}} + xs)) - _ - (failure "Wrong syntax for def:'''")} - tokens))) - -(def:''' .public Or - Macro - ..Union) - -(def:''' .public And - Macro - ..Tuple) - -(def:''' .private (pairs xs) - (All (_ a) (-> ($' List a) ($' Maybe ($' List (Tuple a a))))) - ({{#Item x {#Item y xs'}} - ({{#Some tail} - {#Some {#Item [x y] tail}} +(def'' .private let' + Macro + (macro (_ tokens) + ({{#Item [_ {#Tuple bindings}] {#Item body {#End}}} + ({{#Some bindings} + (meta#in (list (list#mix ("lux type check" (-> (Tuple Code Code) Code + Code) + (function' [binding body] + ({[label value] + (form$ (list (variant$ (list label body)) value))} + binding))) + body + (list#reversed bindings)))) {#None} - {#None}} - (pairs xs')) - - {#End} - {#Some {#End}} + (failure "Wrong syntax for let'")} + (pairs bindings)) _ - {#None}} - xs)) - -(def:'' .private let' - Macro - (macro (_ tokens) - ({{#Item [_ {#Tuple bindings}] {#Item body {#End}}} - ({{#Some bindings} - (meta#in (list (list#mix ("lux type check" (-> (Tuple Code Code) Code - Code) - (function' [binding body] - ({[label value] - (form$ (list (variant$ (list label body)) value))} - binding))) - body - (list#reversed bindings)))) - - {#None} - (failure "Wrong syntax for let'")} - (pairs bindings)) + (failure "Wrong syntax for let'")} + tokens))) - _ - (failure "Wrong syntax for let'")} - tokens))) +(def''' .private (any? p xs) + (All (_ a) + (-> (-> a Bit) ($' List a) Bit)) + ({{#End} + #0 -(def:''' .private (any? p xs) - (All (_ a) - (-> (-> a Bit) ($' List a) Bit)) - ({{#End} - #0 + {#Item x xs'} + ({[#1] #1 + [#0] (any? p xs')} + (p x))} + xs)) - {#Item x xs'} - ({[#1] #1 - [#0] (any? p xs')} - (p x))} - xs)) +(def''' .private (with_location content) + (-> Code Code) + (tuple$ (list (tuple$ (list (text$ "") (nat$ 0) (nat$ 0))) + content))) -(def:''' .private (with_location content) - (-> Code Code) - (tuple$ (list (tuple$ (list (text$ "") (nat$ 0) (nat$ 0))) - content))) +(def''' .private (untemplated_list tokens) + (-> ($' List Code) Code) + ({{#End} + |#End| -(def:''' .private (untemplated_list tokens) - (-> ($' List Code) Code) - ({{#End} - |#End| + {#Item token tokens'} + (|#Item| token (untemplated_list tokens'))} + tokens)) - {#Item token tokens'} - (|#Item| token (untemplated_list tokens'))} - tokens)) +(def''' .private (list#composite xs ys) + (All (_ a) (-> ($' List a) ($' List a) ($' List a))) + (list#mix (function' [head tail] {#Item head tail}) + ys + (list#reversed xs))) -(def:''' .private (list#composite xs ys) - (All (_ a) (-> ($' List a) ($' List a) ($' List a))) - (list#mix (function' [head tail] {#Item head tail}) - ys - (list#reversed xs))) +(def''' .private (right_associativity op a1 a2) + (-> Code Code Code Code) + ({[_ {#Form parts}] + (form$ (list#composite parts (list a1 a2))) -(def:''' .private (right_associativity op a1 a2) - (-> Code Code Code Code) - ({[_ {#Form parts}] - (form$ (list#composite parts (list a1 a2))) + _ + (form$ (list op a1 a2))} + op)) + +(def''' .private (function#flipped func) + (All (_ a b c) + (-> (-> a b c) (-> b a c))) + (function' [right left] + (func left right))) + +(def'' .public left + Macro + (macro (_ tokens) + ({{#Item op tokens'} + ({{#Item first nexts} + (meta#in (list (list#mix (function#flipped (right_associativity op)) first nexts))) + _ + (failure "Wrong syntax for left")} + tokens') + _ - (form$ (list op a1 a2))} - op)) - -(def:''' .private (function#flipped func) - (All (_ a b c) - (-> (-> a b c) (-> b a c))) - (function' [right left] - (func left right))) + (failure "Wrong syntax for left")} + tokens))) -(def:'' .public left - Macro - (macro (_ tokens) - ({{#Item op tokens'} - ({{#Item first nexts} - (meta#in (list (list#mix (function#flipped (right_associativity op)) first nexts))) - - _ - (failure "Wrong syntax for left")} - tokens') - - _ - (failure "Wrong syntax for left")} - tokens))) +(def'' .public right + Macro + (macro (_ tokens) + ({{#Item op tokens'} + ({{#Item last prevs} + (meta#in (list (list#mix (right_associativity op) last prevs))) -(def:'' .public right - Macro - (macro (_ tokens) - ({{#Item op tokens'} - ({{#Item last prevs} - (meta#in (list (list#mix (right_associativity op) last prevs))) - - _ - (failure "Wrong syntax for right")} - (list#reversed tokens')) - - _ - (failure "Wrong syntax for right")} - tokens))) + _ + (failure "Wrong syntax for right")} + (list#reversed tokens')) + + _ + (failure "Wrong syntax for right")} + tokens))) -(def:''' .public all Macro ..right) +(def''' .public all Macro ..right) ... (type: (Monad m) ... (Interface @@ -1449,1499 +1449,1499 @@ ["#in" "#then"] #0) -(def:''' .private maybe#monad - ($' Monad Maybe) - [#in - (function' [x] {#Some x}) - - #then - (function' [f ma] - ({{#None} {#None} - {#Some a} (f a)} - ma))]) - -(def:''' .private meta#monad - ($' Monad Meta) - [#in - (function' [x] - (function' [state] - {#Right state x})) - - #then - (function' [f ma] - (function' [state] - ({{#Left msg} - {#Left msg} +(def''' .private maybe#monad + ($' Monad Maybe) + [#in + (function' [x] {#Some x}) + + #then + (function' [f ma] + ({{#None} {#None} + {#Some a} (f a)} + ma))]) + +(def''' .private meta#monad + ($' Monad Meta) + [#in + (function' [x] + (function' [state] + {#Right state x})) + + #then + (function' [f ma] + (function' [state] + ({{#Left msg} + {#Left msg} + + {#Right [state' a]} + (f a state')} + (ma state))))]) + +(def'' .private do + Macro + (macro (_ tokens) + ({{#Item monad {#Item [_ {#Tuple bindings}] {#Item body {#End}}}} + ({{#Some bindings} + (let' [g!in (local$ "in") + g!then (local$ " then ") + body' (list#mix ("lux type check" (-> (Tuple Code Code) Code Code) + (function' [binding body'] + (let' [[var value] binding] + ({[_ {#Symbol [module short]}] + ({"" + (form$ (list g!then + (form$ (list (tuple$ (list (local$ "") var)) body')) + value)) + + _ + (form$ (list var value body'))} + module) + + + _ + (form$ (list g!then + (form$ (list (tuple$ (list (local$ "") var)) body')) + value))} + var)))) + body + (list#reversed bindings))] + (meta#in (list (form$ (list (variant$ (list (tuple$ (list g!in g!then)) + body')) + monad))))) + + {#None} + (failure "Wrong syntax for do")} + (pairs bindings)) - {#Right [state' a]} - (f a state')} - (ma state))))]) + _ + (failure "Wrong syntax for do")} + tokens))) + +(def''' .private (monad#each m f xs) + (All (_ m a b) + (-> ($' Monad m) + (-> a ($' m b)) + ($' List a) + ($' m ($' List b)))) + (let' [[..#in in ..#then _] m] + ({{#End} + (in {#End}) + + {#Item x xs'} + (do m + [y (f x) + ys (monad#each m f xs')] + (in {#Item y ys}))} + xs))) + +(def''' .private (monad#mix m f y xs) + (All (_ m a b) + (-> ($' Monad m) + (-> a b ($' m b)) + b + ($' List a) + ($' m b))) + (let' [[..#in in ..#then _] m] + ({{#End} + (in y) + + {#Item x xs'} + (do m + [y' (f x y)] + (monad#mix m f y' xs'))} + xs))) + +(def'' .public if + Macro + (macro (_ tokens) + ({{#Item test {#Item then {#Item else {#End}}}} + (meta#in (list (form$ (list (variant$ (list (bit$ #1) then + (bit$ #0) else)) + test)))) -(def:'' .private do - Macro - (macro (_ tokens) - ({{#Item monad {#Item [_ {#Tuple bindings}] {#Item body {#End}}}} - ({{#Some bindings} - (let' [g!in (local$ "in") - g!then (local$ " then ") - body' (list#mix ("lux type check" (-> (Tuple Code Code) Code Code) - (function' [binding body'] - (let' [[var value] binding] - ({[_ {#Symbol [module short]}] - ({"" - (form$ (list g!then - (form$ (list (tuple$ (list (local$ "") var)) body')) - value)) - - _ - (form$ (list var value body'))} - module) - + _ + (failure "Wrong syntax for if")} + tokens))) - _ - (form$ (list g!then - (form$ (list (tuple$ (list (local$ "") var)) body')) - value))} - var)))) - body - (list#reversed bindings))] - (meta#in (list (form$ (list (variant$ (list (tuple$ (list g!in g!then)) - body')) - monad))))) - - {#None} - (failure "Wrong syntax for do")} - (pairs bindings)) +(def''' .private PList + Type + (All (_ a) ($' List (Tuple Text a)))) + +(def''' .private (plist#value k plist) + (All (_ a) + (-> Text ($' PList a) ($' Maybe a))) + ({{#Item [[k' v] plist']} + (if (text#= k k') + {#Some v} + (plist#value k plist')) + + {#End} + {#None}} + plist)) + +(def''' .private (plist#with k v plist) + (All (_ a) + (-> Text a ($' PList a) ($' PList a))) + ({{#Item [k' v'] plist'} + (if (text#= k k') + (partial_list [k v] plist') + (partial_list [k' v'] (plist#with k v plist'))) + + {#End} + (list [k v])} + plist)) + +(def''' .private (global_symbol full_name state) + (-> Symbol ($' Meta Symbol)) + (let' [[module name] full_name + [..#info info ..#source source ..#current_module _ ..#modules modules + ..#scopes scopes ..#type_context types ..#host host + ..#seed seed ..#expected expected ..#location location ..#extensions extensions + ..#scope_type_vars scope_type_vars ..#eval _eval] state] + ({{#Some [..#module_hash _ ..#module_aliases _ ..#definitions definitions ..#imports _ ..#module_state _]} + ({{#Some constant} + ({{#Definition _} {#Right [state full_name]} + {#Tag _} {#Right [state full_name]} + {#Slot _} {#Right [state full_name]} + {#Type _} {#Right [state full_name]} + + {#Alias real_name} + {#Right [state real_name]}} + constant) - _ - (failure "Wrong syntax for do")} - tokens))) - -(def:''' .private (monad#each m f xs) - (All (_ m a b) - (-> ($' Monad m) - (-> a ($' m b)) - ($' List a) - ($' m ($' List b)))) - (let' [[..#in in ..#then _] m] - ({{#End} - (in {#End}) - - {#Item x xs'} - (do m - [y (f x) - ys (monad#each m f xs')] - (in {#Item y ys}))} - xs))) - -(def:''' .private (monad#mix m f y xs) - (All (_ m a b) - (-> ($' Monad m) - (-> a b ($' m b)) - b - ($' List a) - ($' m b))) - (let' [[..#in in ..#then _] m] - ({{#End} - (in y) + {#None} + {#Left (all text#composite "Unknown definition: " (symbol#encoded full_name))}} + (plist#value name definitions)) + + {#None} + {#Left (all text#composite "Unknown module: " module " @ " (symbol#encoded full_name))}} + (plist#value module modules)))) + +(def''' .private (:List expression) + (-> Code Code) + (let' [type (variant$ (list (symbol$ [..prelude "#Apply"]) + (symbol$ [..prelude "Code"]) + (symbol$ [..prelude "List"])))] + (form$ (list (text$ "lux type check") type expression)))) + +(def''' .private (spliced replace? untemplated elems) + (-> Bit (-> Code ($' Meta Code)) ($' List Code) ($' Meta Code)) + ({[#1] ({{#End} + (meta#in |#End|) - {#Item x xs'} - (do m - [y' (f x y)] - (monad#mix m f y' xs'))} - xs))) + {#Item lastI inits} + (do meta#monad + [lastO ({[_ {#Form {#Item [[_ {#Symbol ["" "~+"]}] {#Item [spliced {#End}]}]}}] + (in (:List spliced)) -(def:'' .public if - Macro - (macro (_ tokens) - ({{#Item test {#Item then {#Item else {#End}}}} - (meta#in (list (form$ (list (variant$ (list (bit$ #1) then - (bit$ #0) else)) - test)))) + _ + (do meta#monad + [lastO (untemplated lastI)] + (in (:List (|#Item| lastO |#End|))))} + lastI)] + (monad#mix meta#monad + (function' [leftI rightO] + ({[_ {#Form {#Item [[_ {#Symbol ["" "~+"]}] {#Item [spliced {#End}]}]}}] + (let' [g!in-module (form$ (list (text$ "lux in-module") + (text$ ..prelude) + (symbol$ [..prelude "list#composite"])))] + (in (form$ (list g!in-module (:List spliced) rightO)))) + + _ + (do meta#monad + [leftO (untemplated leftI)] + (in (|#Item| leftO rightO)))} + leftI)) + lastO + inits))} + (list#reversed elems)) + [#0] (do meta#monad + [=elems (monad#each meta#monad untemplated elems)] + (in (untemplated_list =elems)))} + replace?)) + +(def''' .private (untemplated_text value) + (-> Text Code) + (with_location (variant$ (list (symbol$ [..prelude "#Text"]) (text$ value))))) + +(def''' .private (untemplated replace? subst token) + (-> Bit Text Code ($' Meta Code)) + ({[_ [_ {#Bit value}]] + (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Bit"]) (bit$ value))))) + + [_ [_ {#Nat value}]] + (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Nat"]) (nat$ value))))) + + [_ [_ {#Int value}]] + (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Int"]) (int$ value))))) + + [_ [_ {#Rev value}]] + (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Rev"]) (rev$ value))))) + + [_ [_ {#Frac value}]] + (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Frac"]) (frac$ value))))) - _ - (failure "Wrong syntax for if")} - tokens))) + [_ [_ {#Text value}]] + (meta#in (untemplated_text value)) -(def:''' .private PList - Type - (All (_ a) ($' List (Tuple Text a)))) + [#1 [_ {#Symbol [module name]}]] + (do meta#monad + [real_name ({"" + (if (text#= "" subst) + (in [module name]) + (global_symbol [subst name])) -(def:''' .private (plist#value k plist) - (All (_ a) - (-> Text ($' PList a) ($' Maybe a))) - ({{#Item [[k' v] plist']} - (if (text#= k k') - {#Some v} - (plist#value k plist')) + _ + (in [module name])} + module) + .let' [[module name] real_name]] + (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Symbol"]) (tuple$ (list (text$ module) (text$ name)))))))) - {#End} - {#None}} - plist)) + [#0 [_ {#Symbol [module name]}]] + (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Symbol"]) (tuple$ (list (text$ module) (text$ name))))))) -(def:''' .private (plist#with k v plist) - (All (_ a) - (-> Text a ($' PList a) ($' PList a))) - ({{#Item [k' v'] plist'} - (if (text#= k k') - (partial_list [k v] plist') - (partial_list [k' v'] (plist#with k v plist'))) + [#1 [_ {#Form {#Item [[_ {#Symbol ["" "~"]}] {#Item [unquoted {#End}]}]}}]] + (meta#in (form$ (list (text$ "lux type check") + (symbol$ [..prelude "Code"]) + unquoted))) - {#End} - (list [k v])} - plist)) - -(def:''' .private (global_symbol full_name state) - (-> Symbol ($' Meta Symbol)) - (let' [[module name] full_name - [..#info info ..#source source ..#current_module _ ..#modules modules - ..#scopes scopes ..#type_context types ..#host host - ..#seed seed ..#expected expected ..#location location ..#extensions extensions - ..#scope_type_vars scope_type_vars ..#eval _eval] state] - ({{#Some [..#module_hash _ ..#module_aliases _ ..#definitions definitions ..#imports _ ..#module_state _]} - ({{#Some constant} - ({{#Definition _} {#Right [state full_name]} - {#Tag _} {#Right [state full_name]} - {#Slot _} {#Right [state full_name]} - {#Type _} {#Right [state full_name]} - - {#Alias real_name} - {#Right [state real_name]}} - constant) - - {#None} - {#Left (all text#composite "Unknown definition: " (symbol#encoded full_name))}} - (plist#value name definitions)) - - {#None} - {#Left (all text#composite "Unknown module: " module " @ " (symbol#encoded full_name))}} - (plist#value module modules)))) - -(def:''' .private (:List expression) - (-> Code Code) - (let' [type (variant$ (list (symbol$ [..prelude "#Apply"]) - (symbol$ [..prelude "Code"]) - (symbol$ [..prelude "List"])))] - (form$ (list (text$ "lux type check") type expression)))) - -(def:''' .private (spliced replace? untemplated elems) - (-> Bit (-> Code ($' Meta Code)) ($' List Code) ($' Meta Code)) - ({[#1] ({{#End} - (meta#in |#End|) - - {#Item lastI inits} - (do meta#monad - [lastO ({[_ {#Form {#Item [[_ {#Symbol ["" "~+"]}] {#Item [spliced {#End}]}]}}] - (in (:List spliced)) + [#1 [_ {#Form {#Item [[_ {#Symbol ["" "~!"]}] {#Item [dependent {#End}]}]}}]] + (do meta#monad + [independent (untemplated replace? subst dependent)] + (in (with_location (variant$ (list (symbol$ [..prelude "#Form"]) + (untemplated_list (list (untemplated_text "lux in-module") + (untemplated_text subst) + independent))))))) - _ - (do meta#monad - [lastO (untemplated lastI)] - (in (:List (|#Item| lastO |#End|))))} - lastI)] - (monad#mix meta#monad - (function' [leftI rightO] - ({[_ {#Form {#Item [[_ {#Symbol ["" "~+"]}] {#Item [spliced {#End}]}]}}] - (let' [g!in-module (form$ (list (text$ "lux in-module") - (text$ ..prelude) - (symbol$ [..prelude "list#composite"])))] - (in (form$ (list g!in-module (:List spliced) rightO)))) - - _ - (do meta#monad - [leftO (untemplated leftI)] - (in (|#Item| leftO rightO)))} - leftI)) - lastO - inits))} - (list#reversed elems)) - [#0] (do meta#monad - [=elems (monad#each meta#monad untemplated elems)] - (in (untemplated_list =elems)))} - replace?)) - -(def:''' .private (untemplated_text value) - (-> Text Code) - (with_location (variant$ (list (symbol$ [..prelude "#Text"]) (text$ value))))) - -(def:''' .private (untemplated replace? subst token) - (-> Bit Text Code ($' Meta Code)) - ({[_ [_ {#Bit value}]] - (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Bit"]) (bit$ value))))) - - [_ [_ {#Nat value}]] - (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Nat"]) (nat$ value))))) - - [_ [_ {#Int value}]] - (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Int"]) (int$ value))))) - - [_ [_ {#Rev value}]] - (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Rev"]) (rev$ value))))) - - [_ [_ {#Frac value}]] - (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Frac"]) (frac$ value))))) + [#1 [_ {#Form {#Item [[_ {#Symbol ["" "~'"]}] {#Item [keep_quoted {#End}]}]}}]] + (untemplated #0 subst keep_quoted) - [_ [_ {#Text value}]] - (meta#in (untemplated_text value)) + [_ [meta {#Form elems}]] + (do meta#monad + [output (spliced replace? (untemplated replace? subst) elems) + .let' [[_ output'] (with_location (variant$ (list (symbol$ [..prelude "#Form"]) output)))]] + (in [meta output'])) - [#1 [_ {#Symbol [module name]}]] - (do meta#monad - [real_name ({"" - (if (text#= "" subst) - (in [module name]) - (global_symbol [subst name])) + [_ [meta {#Variant elems}]] + (do meta#monad + [output (spliced replace? (untemplated replace? subst) elems) + .let' [[_ output'] (with_location (variant$ (list (symbol$ [..prelude "#Variant"]) output)))]] + (in [meta output'])) - _ - (in [module name])} - module) - .let' [[module name] real_name]] - (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Symbol"]) (tuple$ (list (text$ module) (text$ name)))))))) + [_ [meta {#Tuple elems}]] + (do meta#monad + [output (spliced replace? (untemplated replace? subst) elems) + .let' [[_ output'] (with_location (variant$ (list (symbol$ [..prelude "#Tuple"]) output)))]] + (in [meta output']))} + [replace? token])) - [#0 [_ {#Symbol [module name]}]] - (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Symbol"]) (tuple$ (list (text$ module) (text$ name))))))) +(def'' .public Primitive + Macro + (macro (_ tokens) + ({{#Item [_ {#Text class_name}] {#End}} + (meta#in (list (variant$ (list (symbol$ [..prelude "#Primitive"]) (text$ class_name) |#End|)))) - [#1 [_ {#Form {#Item [[_ {#Symbol ["" "~"]}] {#Item [unquoted {#End}]}]}}]] - (meta#in (form$ (list (text$ "lux type check") - (symbol$ [..prelude "Code"]) - unquoted))) + {#Item [_ {#Text class_name}] {#Item [_ {#Tuple params}] {#End}}} + (meta#in (list (variant$ (list (symbol$ [..prelude "#Primitive"]) (text$ class_name) (untemplated_list params))))) - [#1 [_ {#Form {#Item [[_ {#Symbol ["" "~!"]}] {#Item [dependent {#End}]}]}}]] + _ + (failure "Wrong syntax for Primitive")} + tokens))) + +(def'' .private (current_module_name state) + ($' Meta Text) + ({[..#info info ..#source source ..#current_module current_module ..#modules modules + ..#scopes scopes ..#type_context types ..#host host + ..#seed seed ..#expected expected ..#location location ..#extensions extensions + ..#scope_type_vars scope_type_vars ..#eval _eval] + ({{#Some module_name} + {#Right [state module_name]} + + _ + {#Left "Cannot get the module name without a module!"}} + current_module)} + state)) + +(def'' .public ` + Macro + (macro (_ tokens) + ({{#Item template {#End}} (do meta#monad - [independent (untemplated replace? subst dependent)] - (in (with_location (variant$ (list (symbol$ [..prelude "#Form"]) - (untemplated_list (list (untemplated_text "lux in-module") - (untemplated_text subst) - independent))))))) + [current_module current_module_name + =template (untemplated #1 current_module template)] + (in (list (form$ (list (text$ "lux type check") + (symbol$ [..prelude "Code"]) + =template))))) - [#1 [_ {#Form {#Item [[_ {#Symbol ["" "~'"]}] {#Item [keep_quoted {#End}]}]}}]] - (untemplated #0 subst keep_quoted) + _ + (failure "Wrong syntax for `")} + tokens))) - [_ [meta {#Form elems}]] +(def'' .public `' + Macro + (macro (_ tokens) + ({{#Item template {#End}} (do meta#monad - [output (spliced replace? (untemplated replace? subst) elems) - .let' [[_ output'] (with_location (variant$ (list (symbol$ [..prelude "#Form"]) output)))]] - (in [meta output'])) + [=template (untemplated #1 "" template)] + (in (list (form$ (list (text$ "lux type check") (symbol$ [..prelude "Code"]) =template))))) - [_ [meta {#Variant elems}]] - (do meta#monad - [output (spliced replace? (untemplated replace? subst) elems) - .let' [[_ output'] (with_location (variant$ (list (symbol$ [..prelude "#Variant"]) output)))]] - (in [meta output'])) + _ + (failure "Wrong syntax for `")} + tokens))) - [_ [meta {#Tuple elems}]] +(def'' .public ' + Macro + (macro (_ tokens) + ({{#Item template {#End}} (do meta#monad - [output (spliced replace? (untemplated replace? subst) elems) - .let' [[_ output'] (with_location (variant$ (list (symbol$ [..prelude "#Tuple"]) output)))]] - (in [meta output']))} - [replace? token])) + [=template (untemplated #0 "" template)] + (in (list (form$ (list (text$ "lux type check") (symbol$ [..prelude "Code"]) =template))))) -(def:'' .public Primitive - Macro - (macro (_ tokens) - ({{#Item [_ {#Text class_name}] {#End}} - (meta#in (list (variant$ (list (symbol$ [..prelude "#Primitive"]) (text$ class_name) |#End|)))) - - {#Item [_ {#Text class_name}] {#Item [_ {#Tuple params}] {#End}}} - (meta#in (list (variant$ (list (symbol$ [..prelude "#Primitive"]) (text$ class_name) (untemplated_list params))))) + _ + (failure "Wrong syntax for '")} + tokens))) - _ - (failure "Wrong syntax for Primitive")} - tokens))) +(def'' .public |> + Macro + (macro (_ tokens) + ({{#Item [init apps]} + (meta#in (list (list#mix ("lux type check" (-> Code Code Code) + (function' [app acc] + ({[_ {#Variant parts}] + (variant$ (list#composite parts (list acc))) -(def:'' .private (current_module_name state) - ($' Meta Text) - ({[..#info info ..#source source ..#current_module current_module ..#modules modules - ..#scopes scopes ..#type_context types ..#host host - ..#seed seed ..#expected expected ..#location location ..#extensions extensions - ..#scope_type_vars scope_type_vars ..#eval _eval] - ({{#Some module_name} - {#Right [state module_name]} + [_ {#Tuple parts}] + (tuple$ (list#composite parts (list acc))) - _ - {#Left "Cannot get the module name without a module!"}} - current_module)} - state)) + [_ {#Form parts}] + (form$ (list#composite parts (list acc))) -(def:'' .public ` - Macro - (macro (_ tokens) - ({{#Item template {#End}} - (do meta#monad - [current_module current_module_name - =template (untemplated #1 current_module template)] - (in (list (form$ (list (text$ "lux type check") - (symbol$ [..prelude "Code"]) - =template))))) + _ + (` ((~ app) (~ acc)))} + app))) + init + apps))) - _ - (failure "Wrong syntax for `")} - tokens))) + _ + (failure "Wrong syntax for |>")} + tokens))) -(def:'' .public `' - Macro - (macro (_ tokens) - ({{#Item template {#End}} - (do meta#monad - [=template (untemplated #1 "" template)] - (in (list (form$ (list (text$ "lux type check") (symbol$ [..prelude "Code"]) =template))))) +(def'' .public <| + Macro + (macro (_ tokens) + ({{#Item [init apps]} + (meta#in (list (list#mix ("lux type check" (-> Code Code Code) + (function' [app acc] + ({[_ {#Variant parts}] + (variant$ (list#composite parts (list acc))) - _ - (failure "Wrong syntax for `")} - tokens))) + [_ {#Tuple parts}] + (tuple$ (list#composite parts (list acc))) -(def:'' .public ' - Macro - (macro (_ tokens) - ({{#Item template {#End}} - (do meta#monad - [=template (untemplated #0 "" template)] - (in (list (form$ (list (text$ "lux type check") (symbol$ [..prelude "Code"]) =template))))) + [_ {#Form parts}] + (form$ (list#composite parts (list acc))) - _ - (failure "Wrong syntax for '")} - tokens))) + _ + (` ((~ app) (~ acc)))} + app))) + init + apps))) -(def:'' .public |> - Macro - (macro (_ tokens) - ({{#Item [init apps]} - (meta#in (list (list#mix ("lux type check" (-> Code Code Code) - (function' [app acc] - ({[_ {#Variant parts}] - (variant$ (list#composite parts (list acc))) + _ + (failure "Wrong syntax for <|")} + (list#reversed tokens)))) - [_ {#Tuple parts}] - (tuple$ (list#composite parts (list acc))) +(def''' .private (function#composite f g) + (All (_ a b c) + (-> (-> b c) (-> a b) (-> a c))) + (function' [x] (f (g x)))) - [_ {#Form parts}] - (form$ (list#composite parts (list acc))) +(def''' .private (symbol_name x) + (-> Code ($' Maybe Symbol)) + ({[_ {#Symbol sname}] + {#Some sname} - _ - (` ((~ app) (~ acc)))} - app))) - init - apps))) + _ + {#None}} + x)) - _ - (failure "Wrong syntax for |>")} - tokens))) +(def''' .private (symbol_short x) + (-> Code ($' Maybe Text)) + ({[_ {#Symbol "" sname}] + {#Some sname} -(def:'' .public <| - Macro - (macro (_ tokens) - ({{#Item [init apps]} - (meta#in (list (list#mix ("lux type check" (-> Code Code Code) - (function' [app acc] - ({[_ {#Variant parts}] - (variant$ (list#composite parts (list acc))) + _ + {#None}} + x)) - [_ {#Tuple parts}] - (tuple$ (list#composite parts (list acc))) +(def''' .private (tuple_list tuple) + (-> Code ($' Maybe ($' List Code))) + ({[_ {#Tuple members}] + {#Some members} - [_ {#Form parts}] - (form$ (list#composite parts (list acc))) + _ + {#None}} + tuple)) - _ - (` ((~ app) (~ acc)))} - app))) - init - apps))) +(def''' .private (realized_template env template) + (-> Replacement_Environment Code Code) + ({[_ {#Symbol "" sname}] + ({{#Some subst} + subst _ - (failure "Wrong syntax for <|")} - (list#reversed tokens)))) - -(def:''' .private (function#composite f g) - (All (_ a b c) - (-> (-> b c) (-> a b) (-> a c))) - (function' [x] (f (g x)))) + template} + (..replacement sname env)) -(def:''' .private (symbol_name x) - (-> Code ($' Maybe Symbol)) - ({[_ {#Symbol sname}] - {#Some sname} + [meta {#Form elems}] + [meta {#Form (list#each (realized_template env) elems)}] - _ - {#None}} - x)) - -(def:''' .private (symbol_short x) - (-> Code ($' Maybe Text)) - ({[_ {#Symbol "" sname}] - {#Some sname} + [meta {#Tuple elems}] + [meta {#Tuple (list#each (realized_template env) elems)}] - _ - {#None}} - x)) + [meta {#Variant elems}] + [meta {#Variant (list#each (realized_template env) elems)}] -(def:''' .private (tuple_list tuple) - (-> Code ($' Maybe ($' List Code))) - ({[_ {#Tuple members}] - {#Some members} - - _ - {#None}} - tuple)) - -(def:''' .private (realized_template env template) - (-> Replacement_Environment Code Code) - ({[_ {#Symbol "" sname}] - ({{#Some subst} - subst + _ + template} + template)) + +(def''' .private (every? p xs) + (All (_ a) + (-> (-> a Bit) ($' List a) Bit)) + (list#mix (function' [_2 _1] (if _1 (p _2) #0)) #1 xs)) + +(def''' .private (high_bits value) + (-> ($' I64 Any) I64) + ("lux i64 right-shift" 32 value)) + +(def''' .private low_mask + I64 + (|> 1 ("lux i64 left-shift" 32) ("lux i64 -" 1))) + +(def''' .private (low_bits value) + (-> ($' I64 Any) I64) + ("lux i64 and" low_mask value)) + +(def''' .private (n/< reference sample) + (-> Nat Nat Bit) + (let' [referenceH (high_bits reference) + sampleH (high_bits sample)] + (if ("lux i64 <" referenceH sampleH) + #1 + (if ("lux i64 =" referenceH sampleH) + ("lux i64 <" + (low_bits reference) + (low_bits sample)) + #0)))) + +(def''' .private (list#conjoint xs) + (All (_ a) + (-> ($' List ($' List a)) ($' List a))) + (list#mix list#composite {#End} (list#reversed xs))) + +(def'' .public with_template + Macro + (macro (_ tokens) + ({{#Item [[_ {#Tuple bindings}] {#Item [[_ {#Tuple templates}] data]}]} + ({[{#Some bindings'} {#Some data'}] + (let' [apply ("lux type check" (-> Replacement_Environment ($' List Code)) + (function' [env] (list#each (realized_template env) templates))) + num_bindings (list#size bindings')] + (if (every? (function' [size] ("lux i64 =" num_bindings size)) + (list#each list#size data')) + (|> data' + (list#each (function#composite apply (replacement_environment bindings'))) + list#conjoint + meta#in) + (failure (..wrong_syntax_error [..prelude "with_template"])))) _ - template} - (..replacement sname env)) + (failure (..wrong_syntax_error [..prelude "with_template"]))} + [(monad#each maybe#monad symbol_short bindings) + (monad#each maybe#monad tuple_list data)]) - [meta {#Form elems}] - [meta {#Form (list#each (realized_template env) elems)}] + _ + (failure (..wrong_syntax_error [..prelude "with_template"]))} + tokens))) + +(def''' .private (n// param subject) + (-> Nat Nat Nat) + (if ("lux i64 <" +0 ("lux type as" Int param)) + (if (n/< param subject) + 0 + 1) + (let' [quotient (|> subject + ("lux i64 right-shift" 1) + ("lux i64 /" ("lux type as" Int param)) + ("lux i64 left-shift" 1)) + flat ("lux i64 *" + ("lux type as" Int param) + ("lux type as" Int quotient)) + remainder ("lux i64 -" flat subject)] + (if (n/< param remainder) + quotient + ("lux i64 +" 1 quotient))))) + +(def''' .private (n/% param subject) + (-> Nat Nat Nat) + (let' [flat ("lux i64 *" + ("lux type as" Int param) + ("lux type as" Int (n// param subject)))] + ("lux i64 -" flat subject))) + +(def''' .private (n/min left right) + (-> Nat Nat Nat) + (if (n/< right left) + left + right)) + +(def''' .private (bit#encoded x) + (-> Bit Text) + (if x "#1" "#0")) + +(def''' .private (digit::format digit) + (-> Nat Text) + ({[0] "0" + [1] "1" [2] "2" [3] "3" + [4] "4" [5] "5" [6] "6" + [7] "7" [8] "8" [9] "9" + _ ("lux io error" "@digit::format Undefined behavior.")} + digit)) + +(def''' .private (nat#encoded value) + (-> Nat Text) + ({[0] "0" + _ (let' [loop ("lux type check" (-> Nat Text Text) + (function' again [input output] + (if ("lux i64 =" 0 input) + output + (again (n// 10 input) + (text#composite (|> input (n/% 10) digit::format) + output)))))] + (loop value ""))} + value)) + +(def''' .private (int#abs value) + (-> Int Int) + (if ("lux i64 <" +0 value) + ("lux i64 *" -1 value) + value)) - [meta {#Tuple elems}] - [meta {#Tuple (list#each (realized_template env) elems)}] +(def''' .private (int#encoded value) + (-> Int Text) + (if ("lux i64 =" +0 value) + "+0" + (let' [sign (if ("lux i64 <" value +0) + "+" + "-")] + (("lux type check" (-> Int Text Text) + (function' again [input output] + (if ("lux i64 =" +0 input) + (text#composite sign output) + (again ("lux i64 /" +10 input) + (text#composite (|> input ("lux i64 %" +10) ("lux type as" Nat) digit::format) + output))))) + (|> value ("lux i64 /" +10) int#abs) + (|> value ("lux i64 %" +10) int#abs ("lux type as" Nat) digit::format))))) + +(def''' .private (frac#encoded x) + (-> Frac Text) + ("lux f64 encode" x)) + +(def''' .public (not x) + (-> Bit Bit) + (if x #0 #1)) + +(def''' .private (macro_type? type) + (-> Type Bit) + ({{#Named ["library/lux" "Macro"] {#Primitive "#Macro" {#End}}} + #1 - [meta {#Variant elems}] - [meta {#Variant (list#each (realized_template env) elems)}] + _ + #0} + type)) + +(def''' .private (named_macro' modules current_module module name) + (-> ($' List (Tuple Text Module)) + Text Text Text + ($' Maybe Macro)) + (do maybe#monad + [$module (plist#value module modules) + gdef (let' [[..#module_hash _ ..#module_aliases _ ..#definitions bindings ..#imports _ ..#module_state _] ("lux type check" Module $module)] + (plist#value name bindings))] + ({{#Alias [r_module r_name]} + (named_macro' modules current_module r_module r_name) + + {#Definition [exported? def_type def_value]} + (if (macro_type? def_type) + (if exported? + {#Some ("lux type as" Macro def_value)} + (if (text#= module current_module) + {#Some ("lux type as" Macro def_value)} + {#None})) + {#None}) + + {#Type [exported? type labels]} + {#None} - _ - template} - template)) - -(def:''' .private (every? p xs) - (All (_ a) - (-> (-> a Bit) ($' List a) Bit)) - (list#mix (function' [_2 _1] (if _1 (p _2) #0)) #1 xs)) - -(def:''' .private (high_bits value) - (-> ($' I64 Any) I64) - ("lux i64 right-shift" 32 value)) - -(def:''' .private low_mask - I64 - (|> 1 ("lux i64 left-shift" 32) ("lux i64 -" 1))) - -(def:''' .private (low_bits value) - (-> ($' I64 Any) I64) - ("lux i64 and" low_mask value)) - -(def:''' .private (n/< reference sample) - (-> Nat Nat Bit) - (let' [referenceH (high_bits reference) - sampleH (high_bits sample)] - (if ("lux i64 <" referenceH sampleH) - #1 - (if ("lux i64 =" referenceH sampleH) - ("lux i64 <" - (low_bits reference) - (low_bits sample)) - #0)))) - -(def:''' .private (list#conjoint xs) - (All (_ a) - (-> ($' List ($' List a)) ($' List a))) - (list#mix list#composite {#End} (list#reversed xs))) - -(def:'' .public with_template - Macro - (macro (_ tokens) - ({{#Item [[_ {#Tuple bindings}] {#Item [[_ {#Tuple templates}] data]}]} - ({[{#Some bindings'} {#Some data'}] - (let' [apply ("lux type check" (-> Replacement_Environment ($' List Code)) - (function' [env] (list#each (realized_template env) templates))) - num_bindings (list#size bindings')] - (if (every? (function' [size] ("lux i64 =" num_bindings size)) - (list#each list#size data')) - (|> data' - (list#each (function#composite apply (replacement_environment bindings'))) - list#conjoint - meta#in) - (failure (..wrong_syntax_error [..prelude "with_template"])))) + {#Tag _} + {#None} - _ - (failure (..wrong_syntax_error [..prelude "with_template"]))} - [(monad#each maybe#monad symbol_short bindings) - (monad#each maybe#monad tuple_list data)]) + {#Slot _} + {#None}} + ("lux type check" Global gdef)))) - _ - (failure (..wrong_syntax_error [..prelude "with_template"]))} - tokens))) - -(def:''' .private (n// param subject) - (-> Nat Nat Nat) - (if ("lux i64 <" +0 ("lux type as" Int param)) - (if (n/< param subject) - 0 - 1) - (let' [quotient (|> subject - ("lux i64 right-shift" 1) - ("lux i64 /" ("lux type as" Int param)) - ("lux i64 left-shift" 1)) - flat ("lux i64 *" - ("lux type as" Int param) - ("lux type as" Int quotient)) - remainder ("lux i64 -" flat subject)] - (if (n/< param remainder) - quotient - ("lux i64 +" 1 quotient))))) - -(def:''' .private (n/% param subject) - (-> Nat Nat Nat) - (let' [flat ("lux i64 *" - ("lux type as" Int param) - ("lux type as" Int (n// param subject)))] - ("lux i64 -" flat subject))) - -(def:''' .private (n/min left right) - (-> Nat Nat Nat) - (if (n/< right left) - left - right)) - -(def:''' .private (bit#encoded x) - (-> Bit Text) - (if x "#1" "#0")) - -(def:''' .private (digit::format digit) - (-> Nat Text) - ({[0] "0" - [1] "1" [2] "2" [3] "3" - [4] "4" [5] "5" [6] "6" - [7] "7" [8] "8" [9] "9" - _ ("lux io error" "@digit::format Undefined behavior.")} - digit)) - -(def:''' .private (nat#encoded value) - (-> Nat Text) - ({[0] "0" - _ (let' [loop ("lux type check" (-> Nat Text Text) - (function' again [input output] - (if ("lux i64 =" 0 input) - output - (again (n// 10 input) - (text#composite (|> input (n/% 10) digit::format) - output)))))] - (loop value ""))} - value)) +(def''' .private (normal name) + (-> Symbol ($' Meta Symbol)) + ({["" name] + (do meta#monad + [module_name ..current_module_name] + (in [module_name name])) -(def:''' .private (int#abs value) - (-> Int Int) - (if ("lux i64 <" +0 value) - ("lux i64 *" -1 value) - value)) - -(def:''' .private (int#encoded value) - (-> Int Text) - (if ("lux i64 =" +0 value) - "+0" - (let' [sign (if ("lux i64 <" value +0) - "+" - "-")] - (("lux type check" (-> Int Text Text) - (function' again [input output] - (if ("lux i64 =" +0 input) - (text#composite sign output) - (again ("lux i64 /" +10 input) - (text#composite (|> input ("lux i64 %" +10) ("lux type as" Nat) digit::format) - output))))) - (|> value ("lux i64 /" +10) int#abs) - (|> value ("lux i64 %" +10) int#abs ("lux type as" Nat) digit::format))))) - -(def:''' .private (frac#encoded x) - (-> Frac Text) - ("lux f64 encode" x)) - -(def:''' .public (not x) - (-> Bit Bit) - (if x #0 #1)) - -(def:''' .private (macro_type? type) - (-> Type Bit) - ({{#Named ["library/lux" "Macro"] {#Primitive "#Macro" {#End}}} - #1 + _ + (meta#in name)} + name)) - _ - #0} - type)) +(def''' .private (named_macro full_name) + (-> Symbol ($' Meta ($' Maybe Macro))) + (do meta#monad + [current_module current_module_name] + (let' [[module name] full_name] + (function' [state] + ({[..#info info ..#source source ..#current_module _ ..#modules modules + ..#scopes scopes ..#type_context types ..#host host + ..#seed seed ..#expected expected + ..#location location ..#extensions extensions + ..#scope_type_vars scope_type_vars ..#eval _eval] + {#Right state (named_macro' modules current_module module name)}} + state))))) + +(def''' .private (macro? name) + (-> Symbol ($' Meta Bit)) + (do meta#monad + [name (normal name) + output (named_macro name)] + (in ({{#Some _} #1 + {#None} #0} + output)))) + +(def''' .private (list#interposed sep xs) + (All (_ a) + (-> a ($' List a) ($' List a))) + ({{#End} + xs -(def:''' .private (named_macro' modules current_module module name) - (-> ($' List (Tuple Text Module)) - Text Text Text - ($' Maybe Macro)) - (do maybe#monad - [$module (plist#value module modules) - gdef (let' [[..#module_hash _ ..#module_aliases _ ..#definitions bindings ..#imports _ ..#module_state _] ("lux type check" Module $module)] - (plist#value name bindings))] - ({{#Alias [r_module r_name]} - (named_macro' modules current_module r_module r_name) - - {#Definition [exported? def_type def_value]} - (if (macro_type? def_type) - (if exported? - {#Some ("lux type as" Macro def_value)} - (if (text#= module current_module) - {#Some ("lux type as" Macro def_value)} - {#None})) - {#None}) - - {#Type [exported? type labels]} - {#None} + {#Item [x {#End}]} + xs - {#Tag _} - {#None} + {#Item [x xs']} + (partial_list x sep (list#interposed sep xs'))} + xs)) - {#Slot _} - {#None}} - ("lux type check" Global gdef)))) +(def''' .private (single_expansion token) + (-> Code ($' Meta ($' List Code))) + ({[_ {#Form {#Item [_ {#Symbol name}] args}}] + (do meta#monad + [name' (normal name) + ?macro (named_macro name')] + ({{#Some macro} + (("lux type as" Macro' macro) args) + + {#None} + (in (list token))} + ?macro)) -(def:''' .private (normal name) - (-> Symbol ($' Meta Symbol)) - ({["" name] - (do meta#monad - [module_name ..current_module_name] - (in [module_name name])) + _ + (meta#in (list token))} + token)) - _ - (meta#in name)} - name)) - -(def:''' .private (named_macro full_name) - (-> Symbol ($' Meta ($' Maybe Macro))) - (do meta#monad - [current_module current_module_name] - (let' [[module name] full_name] - (function' [state] - ({[..#info info ..#source source ..#current_module _ ..#modules modules - ..#scopes scopes ..#type_context types ..#host host - ..#seed seed ..#expected expected - ..#location location ..#extensions extensions - ..#scope_type_vars scope_type_vars ..#eval _eval] - {#Right state (named_macro' modules current_module module name)}} - state))))) - -(def:''' .private (macro? name) - (-> Symbol ($' Meta Bit)) - (do meta#monad - [name (normal name) - output (named_macro name)] - (in ({{#Some _} #1 - {#None} #0} - output)))) - -(def:''' .private (list#interposed sep xs) - (All (_ a) - (-> a ($' List a) ($' List a))) - ({{#End} - xs +(def''' .private (expansion token) + (-> Code ($' Meta ($' List Code))) + ({[_ {#Form {#Item [_ {#Symbol name}] args}}] + (do meta#monad + [name' (normal name) + ?macro (named_macro name')] + ({{#Some macro} + (do meta#monad + [top_level_expansion (("lux type as" Macro' macro) args) + recursive_expansion (monad#each meta#monad expansion top_level_expansion)] + (in (list#conjoint recursive_expansion))) + + {#None} + (in (list token))} + ?macro)) - {#Item [x {#End}]} - xs + _ + (meta#in (list token))} + token)) - {#Item [x xs']} - (partial_list x sep (list#interposed sep xs'))} - xs)) +(def''' .private (full_expansion' full_expansion name args) + (-> (-> Code ($' Meta ($' List Code))) Symbol ($' List Code) ($' Meta ($' List Code))) + (do meta#monad + [name' (normal name) + ?macro (named_macro name')] + ({{#Some macro} + (do meta#monad + [expansion (("lux type as" Macro' macro) args) + expansion' (monad#each meta#monad full_expansion expansion)] + (in (list#conjoint expansion'))) + + {#None} + (do meta#monad + [args' (monad#each meta#monad full_expansion args)] + (in (list (form$ {#Item (symbol$ name) (list#conjoint args')}))))} + ?macro))) + +(def''' .private (in_module module meta) + (All (_ a) + (-> Text ($' Meta a) ($' Meta a))) + (function' [lux] + ({[..#info info ..#source source + ..#current_module current_module ..#modules modules + ..#scopes scopes ..#type_context type_context + ..#host host ..#seed seed + ..#expected expected ..#location location + ..#extensions extensions ..#scope_type_vars scope_type_vars + ..#eval eval] + ({{#Left error} + {#Left error} + + {#Right [[..#info info' ..#source source' + ..#current_module _ ..#modules modules' + ..#scopes scopes' ..#type_context type_context' + ..#host host' ..#seed seed' + ..#expected expected' ..#location location' + ..#extensions extensions' ..#scope_type_vars scope_type_vars' + ..#eval eval'] + output]} + {#Right [[..#info info' ..#source source' + ..#current_module current_module ..#modules modules' + ..#scopes scopes' ..#type_context type_context' + ..#host host' ..#seed seed' + ..#expected expected' ..#location location' + ..#extensions extensions' ..#scope_type_vars scope_type_vars' + ..#eval eval'] + output]}} + (meta [..#info info ..#source source + ..#current_module {.#Some module} ..#modules modules + ..#scopes scopes ..#type_context type_context + ..#host host ..#seed seed + ..#expected expected ..#location location + ..#extensions extensions ..#scope_type_vars scope_type_vars + ..#eval eval]))} + lux))) + +(def''' .private (full_expansion expand_in_module?) + (-> Bit Code ($' Meta ($' List Code))) + (function' again [syntax] + ({[_ {#Form {#Item head tail}}] + ({[_ {#Form {#Item [_ {#Text "lux in-module"}] + {#Item [_ {#Text module}] + {#Item [_ {#Symbol name}] + {#End}}}}}] + (if expand_in_module? + (..in_module module (..full_expansion' again name tail)) + (do meta#monad + [members' (monad#each meta#monad again {#Item head tail})] + (in (list (form$ (list#conjoint members')))))) + + [_ {#Symbol name}] + (..full_expansion' again name tail) + + _ + (do meta#monad + [members' (monad#each meta#monad again {#Item head tail})] + (in (list (form$ (list#conjoint members')))))} + head) + + [_ {#Variant members}] + (do meta#monad + [members' (monad#each meta#monad again members)] + (in (list (variant$ (list#conjoint members'))))) + + [_ {#Tuple members}] + (do meta#monad + [members' (monad#each meta#monad again members)] + (in (list (tuple$ (list#conjoint members'))))) + + _ + (meta#in (list syntax))} + syntax))) + +(def''' .private (text#encoded original) + (-> Text Text) + (all text#composite ..double_quote original ..double_quote)) + +(def''' .private (code#encoded code) + (-> Code Text) + ({[_ {#Bit value}] + (bit#encoded value) + + [_ {#Nat value}] + (nat#encoded value) + + [_ {#Int value}] + (int#encoded value) + + [_ {#Rev value}] + ("lux io error" "@code#encoded Undefined behavior.") + + [_ {#Frac value}] + (frac#encoded value) -(def:''' .private (single_expansion token) - (-> Code ($' Meta ($' List Code))) - ({[_ {#Form {#Item [_ {#Symbol name}] args}}] - (do meta#monad - [name' (normal name) - ?macro (named_macro name')] - ({{#Some macro} - (("lux type as" Macro' macro) args) - - {#None} - (in (list token))} - ?macro)) + [_ {#Text value}] + (text#encoded value) + + [_ {#Symbol [module name]}] + (symbol#encoded [module name]) + + [_ {#Form xs}] + (all text#composite "(" (|> xs + (list#each code#encoded) + (list#interposed " ") + list#reversed + (list#mix text#composite "")) ")") + + [_ {#Tuple xs}] + (all text#composite "[" (|> xs + (list#each code#encoded) + (list#interposed " ") + list#reversed + (list#mix text#composite "")) "]") + + [_ {#Variant xs}] + (all text#composite "{" (|> xs + (list#each code#encoded) + (list#interposed " ") + list#reversed + (list#mix text#composite "")) "}")} + code)) + +(def''' .private (normal_type type) + (-> Code Code) + ({[_ {#Variant {#Item [_ {#Symbol symbol}] parts}}] + (` {(~ (symbol$ symbol)) (~+ (list#each normal_type parts))}) + + [_ {#Tuple members}] + (` (Tuple (~+ (list#each normal_type members)))) + + [_ {#Form {#Item [_ {#Text "lux in-module"}] + {#Item [_ {#Text module}] + {#Item type' + {#End}}}}}] + (` ("lux in-module" (~ (text$ module)) (~ (normal_type type')))) + + [_ {#Form {#Item [_ {#Symbol ["" "~"]}] {#Item expression {#End}}}}] + expression + + [_0 {#Form {#Item [_1 {#Variant {#Item binding {#Item body {#End}}}}] + {#Item value + {#End}}}}] + [_0 {#Form {#Item [_1 {#Variant {#Item binding {#Item (normal_type body) {#End}}}}] + {#Item value + {#End}}}}] + + [_0 {#Form {#Item [_1 {#Symbol ["library/lux" "__adjusted_quantified_type__"]}] + {#Item _permission + {#Item _level + {#Item body + {#End}}}}}}] + [_0 {#Form {#Item [_1 {#Symbol [..prelude "__adjusted_quantified_type__"]}] + {#Item _permission + {#Item _level + {#Item (normal_type body) + {#End}}}}}}] + + [_ {#Form {#Item type_fn args}}] + (list#mix ("lux type check" (-> Code Code Code) + (function' [arg type_fn] (` {.#Apply (~ arg) (~ type_fn)}))) + (normal_type type_fn) + (list#each normal_type args)) - _ - (meta#in (list token))} - token)) + _ + type} + type)) -(def:''' .private (expansion token) - (-> Code ($' Meta ($' List Code))) - ({[_ {#Form {#Item [_ {#Symbol name}] args}}] +(def'' .public type + Macro + (macro (_ tokens) + ({{#Item type {#End}} (do meta#monad - [name' (normal name) - ?macro (named_macro name')] - ({{#Some macro} + [initialized_quantification? (function' [lux] {#Right [lux (initialized_quantification? lux)]})] + (if initialized_quantification? (do meta#monad - [top_level_expansion (("lux type as" Macro' macro) args) - recursive_expansion (monad#each meta#monad expansion top_level_expansion)] - (in (list#conjoint recursive_expansion))) - - {#None} - (in (list token))} - ?macro)) - - _ - (meta#in (list token))} - token)) - -(def:''' .private (full_expansion' full_expansion name args) - (-> (-> Code ($' Meta ($' List Code))) Symbol ($' List Code) ($' Meta ($' List Code))) - (do meta#monad - [name' (normal name) - ?macro (named_macro name')] - ({{#Some macro} - (do meta#monad - [expansion (("lux type as" Macro' macro) args) - expansion' (monad#each meta#monad full_expansion expansion)] - (in (list#conjoint expansion'))) - - {#None} - (do meta#monad - [args' (monad#each meta#monad full_expansion args)] - (in (list (form$ {#Item (symbol$ name) (list#conjoint args')}))))} - ?macro))) - -(def:''' .private (in_module module meta) - (All (_ a) - (-> Text ($' Meta a) ($' Meta a))) - (function' [lux] - ({[..#info info ..#source source - ..#current_module current_module ..#modules modules - ..#scopes scopes ..#type_context type_context - ..#host host ..#seed seed - ..#expected expected ..#location location - ..#extensions extensions ..#scope_type_vars scope_type_vars - ..#eval eval] - ({{#Left error} - {#Left error} - - {#Right [[..#info info' ..#source source' - ..#current_module _ ..#modules modules' - ..#scopes scopes' ..#type_context type_context' - ..#host host' ..#seed seed' - ..#expected expected' ..#location location' - ..#extensions extensions' ..#scope_type_vars scope_type_vars' - ..#eval eval'] - output]} - {#Right [[..#info info' ..#source source' - ..#current_module current_module ..#modules modules' - ..#scopes scopes' ..#type_context type_context' - ..#host host' ..#seed seed' - ..#expected expected' ..#location location' - ..#extensions extensions' ..#scope_type_vars scope_type_vars' - ..#eval eval'] - output]}} - (meta [..#info info ..#source source - ..#current_module {.#Some module} ..#modules modules - ..#scopes scopes ..#type_context type_context - ..#host host ..#seed seed - ..#expected expected ..#location location - ..#extensions extensions ..#scope_type_vars scope_type_vars - ..#eval eval]))} - lux))) - -(def:''' .private (full_expansion expand_in_module?) - (-> Bit Code ($' Meta ($' List Code))) - (function' again [syntax] - ({[_ {#Form {#Item head tail}}] - ({[_ {#Form {#Item [_ {#Text "lux in-module"}] - {#Item [_ {#Text module}] - {#Item [_ {#Symbol name}] - {#End}}}}}] - (if expand_in_module? - (..in_module module (..full_expansion' again name tail)) - (do meta#monad - [members' (monad#each meta#monad again {#Item head tail})] - (in (list (form$ (list#conjoint members')))))) + [type+ (full_expansion #0 type)] + ({{#Item type' {#End}} + (in (list (normal_type type'))) - [_ {#Symbol name}] - (..full_expansion' again name tail) - - _ - (do meta#monad - [members' (monad#each meta#monad again {#Item head tail})] - (in (list (form$ (list#conjoint members')))))} - head) - - [_ {#Variant members}] - (do meta#monad - [members' (monad#each meta#monad again members)] - (in (list (variant$ (list#conjoint members'))))) - - [_ {#Tuple members}] - (do meta#monad - [members' (monad#each meta#monad again members)] - (in (list (tuple$ (list#conjoint members'))))) - - _ - (meta#in (list syntax))} - syntax))) - -(def:''' .private (text#encoded original) - (-> Text Text) - (all text#composite ..double_quote original ..double_quote)) - -(def:''' .private (code#encoded code) - (-> Code Text) - ({[_ {#Bit value}] - (bit#encoded value) - - [_ {#Nat value}] - (nat#encoded value) - - [_ {#Int value}] - (int#encoded value) - - [_ {#Rev value}] - ("lux io error" "@code#encoded Undefined behavior.") - - [_ {#Frac value}] - (frac#encoded value) - - [_ {#Text value}] - (text#encoded value) - - [_ {#Symbol [module name]}] - (symbol#encoded [module name]) - - [_ {#Form xs}] - (all text#composite "(" (|> xs - (list#each code#encoded) - (list#interposed " ") - list#reversed - (list#mix text#composite "")) ")") - - [_ {#Tuple xs}] - (all text#composite "[" (|> xs - (list#each code#encoded) - (list#interposed " ") - list#reversed - (list#mix text#composite "")) "]") - - [_ {#Variant xs}] - (all text#composite "{" (|> xs - (list#each code#encoded) - (list#interposed " ") - list#reversed - (list#mix text#composite "")) "}")} - code)) - -(def:''' .private (normal_type type) - (-> Code Code) - ({[_ {#Variant {#Item [_ {#Symbol symbol}] parts}}] - (` {(~ (symbol$ symbol)) (~+ (list#each normal_type parts))}) - - [_ {#Tuple members}] - (` (Tuple (~+ (list#each normal_type members)))) - - [_ {#Form {#Item [_ {#Text "lux in-module"}] - {#Item [_ {#Text module}] - {#Item type' - {#End}}}}}] - (` ("lux in-module" (~ (text$ module)) (~ (normal_type type')))) - - [_ {#Form {#Item [_ {#Symbol ["" "~"]}] {#Item expression {#End}}}}] - expression - - [_0 {#Form {#Item [_1 {#Variant {#Item binding {#Item body {#End}}}}] - {#Item value - {#End}}}}] - [_0 {#Form {#Item [_1 {#Variant {#Item binding {#Item (normal_type body) {#End}}}}] - {#Item value - {#End}}}}] - - [_0 {#Form {#Item [_1 {#Symbol ["library/lux" "__adjusted_quantified_type__"]}] - {#Item _permission - {#Item _level - {#Item body - {#End}}}}}}] - [_0 {#Form {#Item [_1 {#Symbol [..prelude "__adjusted_quantified_type__"]}] - {#Item _permission - {#Item _level - {#Item (normal_type body) - {#End}}}}}}] - - [_ {#Form {#Item type_fn args}}] - (list#mix ("lux type check" (-> Code Code Code) - (function' [arg type_fn] (` {.#Apply (~ arg) (~ type_fn)}))) - (normal_type type_fn) - (list#each normal_type args)) + _ + (failure "The expansion of the type-syntax had to yield a single element.")} + type+)) + (in (list (..quantified (` (..type (~ type)))))))) _ - type} - type)) - -(def:'' .public type - Macro - (macro (_ tokens) - ({{#Item type {#End}} - (do meta#monad - [initialized_quantification? (function' [lux] {#Right [lux (initialized_quantification? lux)]})] - (if initialized_quantification? - (do meta#monad - [type+ (full_expansion #0 type)] - ({{#Item type' {#End}} - (in (list (normal_type type'))) - - _ - (failure "The expansion of the type-syntax had to yield a single element.")} - type+)) - (in (list (..quantified (` (..type (~ type)))))))) - - _ - (failure "Wrong syntax for type")} - tokens))) - -(def:'' .public is - Macro - (macro (_ tokens) - ({{#Item type {#Item value {#End}}} - (meta#in (list (` ("lux type check" - (..type (~ type)) - (~ value))))) + (failure "Wrong syntax for type")} + tokens))) - _ - (failure "Wrong syntax for :")} - tokens))) +(def'' .public is + Macro + (macro (_ tokens) + ({{#Item type {#Item value {#End}}} + (meta#in (list (` ("lux type check" + (..type (~ type)) + (~ value))))) -(def:'' .public as - Macro - (macro (_ tokens) - ({{#Item type {#Item value {#End}}} - (meta#in (list (` ("lux type as" - (..type (~ type)) - (~ value))))) + _ + (failure "Wrong syntax for :")} + tokens))) - _ - (failure "Wrong syntax for as")} - tokens))) +(def'' .public as + Macro + (macro (_ tokens) + ({{#Item type {#Item value {#End}}} + (meta#in (list (` ("lux type as" + (..type (~ type)) + (~ value))))) -(def:''' .private (empty? xs) - (All (_ a) - (-> ($' List a) Bit)) - ({{#End} #1 - _ #0} - xs)) + _ + (failure "Wrong syntax for as")} + tokens))) + +(def''' .private (empty? xs) + (All (_ a) + (-> ($' List a) Bit)) + ({{#End} #1 + _ #0} + xs)) (with_template [ ] - [(def:''' .private ( xy) - (All (_ a b) - (-> (Tuple a b) )) - (let' [[x y] xy] - ))] + [(def''' .private ( xy) + (All (_ a b) + (-> (Tuple a b) )) + (let' [[x y] xy] + ))] [product#left a x] [product#right b y]) -(def:''' .private (generated_symbol prefix state) - (-> Text ($' Meta Code)) - ({[..#info info ..#source source ..#current_module _ ..#modules modules - ..#scopes scopes ..#type_context types ..#host host - ..#seed seed ..#expected expected - ..#location location ..#extensions extensions - ..#scope_type_vars scope_type_vars ..#eval _eval] - {#Right [..#info info ..#source source ..#current_module _ ..#modules modules - ..#scopes scopes ..#type_context types ..#host host - ..#seed ("lux i64 +" 1 seed) ..#expected expected - ..#location location ..#extensions extensions - ..#scope_type_vars scope_type_vars ..#eval _eval] - (local$ (all text#composite "__gensym__" prefix (nat#encoded seed)))}} - state)) - -(def:'' .public exec - Macro - (macro (_ tokens) - ({{#Item value actions} - (let' [dummy (local$ "")] - (meta#in (list (list#mix ("lux type check" (-> Code Code Code) - (function' [pre post] (` ({(~ dummy) (~ post)} - (~ pre))))) - value - actions)))) - - _ - (failure "Wrong syntax for exec")} - (list#reversed tokens)))) - -(def:'' .private def:' - Macro - (macro (_ tokens) - (let' [parts (is (Maybe [Code Code (List Code) (Maybe Code) Code]) - ({{#Item export_policy {#Item [_ {#Form {#Item name args}}] {#Item type {#Item body {#End}}}}} - {#Some [export_policy name args {#Some type} body]} - - {#Item export_policy {#Item name {#Item type {#Item body {#End}}}}} - {#Some [export_policy name {#End} {#Some type} body]} - - {#Item export_policy {#Item [_ {#Form {#Item name args}}] {#Item body {#End}}}} - {#Some [export_policy name args {#None} body]} - - {#Item export_policy {#Item name {#Item body {#End}}}} - {#Some [export_policy name {#End} {#None} body]} +(def''' .private (generated_symbol prefix state) + (-> Text ($' Meta Code)) + ({[..#info info ..#source source ..#current_module _ ..#modules modules + ..#scopes scopes ..#type_context types ..#host host + ..#seed seed ..#expected expected + ..#location location ..#extensions extensions + ..#scope_type_vars scope_type_vars ..#eval _eval] + {#Right [..#info info ..#source source ..#current_module _ ..#modules modules + ..#scopes scopes ..#type_context types ..#host host + ..#seed ("lux i64 +" 1 seed) ..#expected expected + ..#location location ..#extensions extensions + ..#scope_type_vars scope_type_vars ..#eval _eval] + (local$ (all text#composite "__gensym__" prefix (nat#encoded seed)))}} + state)) - _ - {#None}} - tokens))] - ({{#Some [export_policy name args ?type body]} - (let' [body' ({{#End} - body +(def'' .public exec + Macro + (macro (_ tokens) + ({{#Item value actions} + (let' [dummy (local$ "")] + (meta#in (list (list#mix ("lux type check" (-> Code Code Code) + (function' [pre post] (` ({(~ dummy) (~ post)} + (~ pre))))) + value + actions)))) - _ - (` (function' (~ name) [(~+ args)] (~ body)))} - args) - body'' ({{#Some type} - (` (is (~ type) (~ body'))) - - {#None} - body'} - ?type)] - (meta#in (list (` ("lux def" (~ name) - (~ body'') - (~ export_policy)))))) - - {#None} - (failure "Wrong syntax for def'")} - parts)))) - -(def:' .private (case_expansion branches) - (-> (List Code) (Meta (List Code))) - ({{#Item [_ {#Form {#Item [_ {#Symbol name}] args}}] - {#Item body - branches'}} - (do meta#monad - [??? (macro? name)] - (if ??? - (do meta#monad - [init_expansion (single_expansion (form$ (partial_list (symbol$ name) (form$ args) body branches')))] - (case_expansion init_expansion)) - (do meta#monad - [sub_expansion (case_expansion branches')] - (in (partial_list (form$ (partial_list (symbol$ name) args)) - body - sub_expansion))))) - - {#Item pattern {#Item body branches'}} - (do meta#monad - [sub_expansion (case_expansion branches')] - (in (partial_list pattern body sub_expansion))) - - {#End} - (do meta#monad [] (in (list))) + _ + (failure "Wrong syntax for exec")} + (list#reversed tokens)))) + +(def'' .private def' + Macro + (macro (_ tokens) + (let' [parts (is (Maybe [Code Code (List Code) (Maybe Code) Code]) + ({{#Item export_policy {#Item [_ {#Form {#Item name args}}] {#Item type {#Item body {#End}}}}} + {#Some [export_policy name args {#Some type} body]} + + {#Item export_policy {#Item name {#Item type {#Item body {#End}}}}} + {#Some [export_policy name {#End} {#Some type} body]} + + {#Item export_policy {#Item [_ {#Form {#Item name args}}] {#Item body {#End}}}} + {#Some [export_policy name args {#None} body]} + + {#Item export_policy {#Item name {#Item body {#End}}}} + {#Some [export_policy name {#End} {#None} body]} - _ - (failure (all text#composite "'lux.case' expects an even number of tokens: " (|> branches - (list#each code#encoded) - (list#interposed " ") - list#reversed - (list#mix text#composite ""))))} - branches)) - -(def:'' .public case - Macro - (macro (_ tokens) - ({{#Item value branches} + _ + {#None}} + tokens))] + ({{#Some [export_policy name args ?type body]} + (let' [body' ({{#End} + body + + _ + (` (function' (~ name) [(~+ args)] (~ body)))} + args) + body'' ({{#Some type} + (` (is (~ type) (~ body'))) + + {#None} + body'} + ?type)] + (meta#in (list (` ("lux def" (~ name) + (~ body'') + (~ export_policy)))))) + + {#None} + (failure "Wrong syntax for def'")} + parts)))) + +(def' .private (case_expansion branches) + (-> (List Code) (Meta (List Code))) + ({{#Item [_ {#Form {#Item [_ {#Symbol name}] args}}] + {#Item body + branches'}} + (do meta#monad + [??? (macro? name)] + (if ??? (do meta#monad - [expansion (case_expansion branches)] - (in (list (` ((~ (variant$ expansion)) (~ value)))))) - - _ - (failure "Wrong syntax for case")} - tokens))) - -(def:'' .public pattern - Macro - (macro (_ tokens) - (case tokens - {#Item [_ {#Form {#Item pattern {#End}}}] {#Item body branches}} + [init_expansion (single_expansion (form$ (partial_list (symbol$ name) (form$ args) body branches')))] + (case_expansion init_expansion)) (do meta#monad - [pattern+ (full_expansion #1 pattern)] - (case pattern+ - {#Item pattern' {#End}} - (in (partial_list pattern' body branches)) - - _ - (failure "`pattern` can only expand to 1 pattern."))) - - _ - (failure "Wrong syntax for `pattern` macro")))) + [sub_expansion (case_expansion branches')] + (in (partial_list (form$ (partial_list (symbol$ name) args)) + body + sub_expansion))))) -(def:'' .private pattern#or - Macro - (macro (_ tokens) - (case tokens - (pattern (partial_list [_ {#Form patterns}] body branches)) - (case patterns - {#End} - (failure "pattern#or cannot have 0 patterns") + {#Item pattern {#Item body branches'}} + (do meta#monad + [sub_expansion (case_expansion branches')] + (in (partial_list pattern body sub_expansion))) - _ - (let' [pairs (|> patterns - (list#each (function' [pattern] (list pattern body))) - (list#conjoint))] - (meta#in (list#composite pairs branches)))) - _ - (failure "Wrong syntax for pattern#or")))) + {#End} + (do meta#monad [] (in (list))) -(def:'' .public symbol - Macro - (macro (_ tokens) - (case tokens - (pattern (list [_ {#Symbol [module name]}])) - (meta#in (list (` [(~ (text$ module)) (~ (text$ name))]))) - - _ - (failure (..wrong_syntax_error [..prelude "symbol"]))))) + _ + (failure (all text#composite "'lux.case' expects an even number of tokens: " (|> branches + (list#each code#encoded) + (list#interposed " ") + list#reversed + (list#mix text#composite ""))))} + branches)) + +(def'' .public case + Macro + (macro (_ tokens) + ({{#Item value branches} + (do meta#monad + [expansion (case_expansion branches)] + (in (list (` ((~ (variant$ expansion)) (~ value)))))) -(def:' .private (symbol? code) - (-> Code Bit) - (case code - [_ {#Symbol _}] - #1 + _ + (failure "Wrong syntax for case")} + tokens))) + +(def'' .public pattern + Macro + (macro (_ tokens) + (case tokens + {#Item [_ {#Form {#Item pattern {#End}}}] {#Item body branches}} + (do meta#monad + [pattern+ (full_expansion #1 pattern)] + (case pattern+ + {#Item pattern' {#End}} + (in (partial_list pattern' body branches)) + + _ + (failure "`pattern` can only expand to 1 pattern."))) + + _ + (failure "Wrong syntax for `pattern` macro")))) - _ - #0)) +(def'' .private pattern#or + Macro + (macro (_ tokens) + (case tokens + (pattern (partial_list [_ {#Form patterns}] body branches)) + (case patterns + {#End} + (failure "pattern#or cannot have 0 patterns") -(def:'' .public let - Macro - (macro (_ tokens) - (case tokens - (pattern (list [_ {#Tuple bindings}] body)) - (case (..pairs bindings) - {#Some bindings} - (|> bindings - list#reversed - (list#mix (is (-> [Code Code] Code Code) - (function' [lr body'] - (let' [[l r] lr] - (if (symbol? l) - (` ({(~ l) (~ body')} (~ r))) - (` (case (~ r) (~ l) (~ body'))))))) - body) - list - meta#in) + _ + (let' [pairs (|> patterns + (list#each (function' [pattern] (list pattern body))) + (list#conjoint))] + (meta#in (list#composite pairs branches)))) + _ + (failure "Wrong syntax for pattern#or")))) + +(def'' .public symbol + Macro + (macro (_ tokens) + (case tokens + (pattern (list [_ {#Symbol [module name]}])) + (meta#in (list (` [(~ (text$ module)) (~ (text$ name))]))) + + _ + (failure (..wrong_syntax_error [..prelude "symbol"]))))) - {#None} - (failure "let requires an even number of parts")) +(def' .private (symbol? code) + (-> Code Bit) + (case code + [_ {#Symbol _}] + #1 - _ - (failure (..wrong_syntax_error (symbol ..let)))))) + _ + #0)) + +(def'' .public let + Macro + (macro (_ tokens) + (case tokens + (pattern (list [_ {#Tuple bindings}] body)) + (case (..pairs bindings) + {#Some bindings} + (|> bindings + list#reversed + (list#mix (is (-> [Code Code] Code Code) + (function' [lr body'] + (let' [[l r] lr] + (if (symbol? l) + (` ({(~ l) (~ body')} (~ r))) + (` (case (~ r) (~ l) (~ body'))))))) + body) + list + meta#in) -(def:'' .public function - Macro - (macro (_ tokens) - (case (is (Maybe [Text Code (List Code) Code]) - (case tokens - (pattern (list [_ {#Form (partial_list [_ {#Symbol ["" name]}] head tail)}] body)) - {#Some name head tail body} - - _ - {#None})) - {#Some g!name head tail body} - (let [g!blank (local$ "") - nest (is (-> Code (-> Code Code Code)) - (function' [g!name] - (function' [arg body'] - (if (symbol? arg) - (` ([(~ g!name) (~ arg)] (~ body'))) - (` ([(~ g!name) (~ g!blank)] - (.case (~ g!blank) (~ arg) (~ body'))))))))] - (meta#in (list (nest (..local$ g!name) head - (list#mix (nest g!blank) body (list#reversed tail)))))) + {#None} + (failure "let requires an even number of parts")) - {#None} - (failure (..wrong_syntax_error (symbol ..function)))))) + _ + (failure (..wrong_syntax_error (symbol ..let)))))) + +(def'' .public function + Macro + (macro (_ tokens) + (case (is (Maybe [Text Code (List Code) Code]) + (case tokens + (pattern (list [_ {#Form (partial_list [_ {#Symbol ["" name]}] head tail)}] body)) + {#Some name head tail body} + + _ + {#None})) + {#Some g!name head tail body} + (let [g!blank (local$ "") + nest (is (-> Code (-> Code Code Code)) + (function' [g!name] + (function' [arg body'] + (if (symbol? arg) + (` ([(~ g!name) (~ arg)] (~ body'))) + (` ([(~ g!name) (~ g!blank)] + (.case (~ g!blank) (~ arg) (~ body'))))))))] + (meta#in (list (nest (..local$ g!name) head + (list#mix (nest g!blank) body (list#reversed tail)))))) -(def:' .private Parser - Type - {#Named [..prelude "Parser"] - (..type (All (_ a) - (-> (List Code) (Maybe [(List Code) a]))))}) + {#None} + (failure (..wrong_syntax_error (symbol ..function)))))) -(def:' .private (parsed parser tokens) - (All (_ a) (-> (Parser a) (List Code) (Maybe a))) - (case (parser tokens) - (pattern {#Some [(list) it]}) - {#Some it} +(def' .private Parser + Type + {#Named [..prelude "Parser"] + (..type (All (_ a) + (-> (List Code) (Maybe [(List Code) a]))))}) - _ - {#None})) - -(def:' .private (inP it tokens) - (All (_ a) - (-> a (Parser a))) - {#Some [tokens it]}) - -(def:' .private (orP leftP rightP tokens) - (All (_ l r) - (-> (Parser l) - (Parser r) - (Parser (Or l r)))) - (case (leftP tokens) - {#Some [tokens left]} - {#Some [tokens {#Left left}]} +(def' .private (parsed parser tokens) + (All (_ a) (-> (Parser a) (List Code) (Maybe a))) + (case (parser tokens) + (pattern {#Some [(list) it]}) + {#Some it} - _ - (case (rightP tokens) - {#Some [tokens right]} - {#Some [tokens {#Right right}]} + _ + {#None})) + +(def' .private (inP it tokens) + (All (_ a) + (-> a (Parser a))) + {#Some [tokens it]}) + +(def' .private (orP leftP rightP tokens) + (All (_ l r) + (-> (Parser l) + (Parser r) + (Parser (Or l r)))) + (case (leftP tokens) + {#Some [tokens left]} + {#Some [tokens {#Left left}]} - _ - {#None}))) - -(def:' .private (eitherP leftP rightP tokens) - (All (_ a) - (-> (Parser a) - (Parser a) - (Parser a))) - (case (leftP tokens) - {#None} - (rightP tokens) - - it - it)) - -(def:' .private (andP leftP rightP tokens) - (All (_ l r) - (-> (Parser l) - (Parser r) - (Parser [l r]))) - (do maybe#monad - [left (leftP tokens) - .let [[tokens left] left] - right (rightP tokens) - .let [[tokens right] right]] - (in [tokens [left right]]))) - -(def:' .private (afterP leftP rightP tokens) - (All (_ l r) - (-> (Parser l) - (Parser r) - (Parser r))) - (do maybe#monad - [left (leftP tokens) - .let [[tokens left] left]] - (rightP tokens))) - -(def:' .private (someP itP tokens) - (All (_ a) - (-> (Parser a) - (Parser (List a)))) - (case (itP tokens) - {#Some [tokens head]} - (do maybe#monad - [it (someP itP tokens) - .let [[tokens tail] it]] - (in [tokens (partial_list head tail)])) + _ + (case (rightP tokens) + {#Some [tokens right]} + {#Some [tokens {#Right right}]} - {#None} - {#Some [tokens (list)]})) - -(def:' .private (manyP itP tokens) - (All (_ a) - (-> (Parser a) - (Parser (List a)))) - (do maybe#monad - [it (itP tokens) - .let [[tokens head] it] - it (someP itP tokens) - .let [[tokens tail] it]] - (in [tokens (partial_list head tail)]))) - -(def:' .private (maybeP itP tokens) - (All (_ a) - (-> (Parser a) - (Parser (Maybe a)))) - (case (itP tokens) - {#Some [tokens it]} - {#Some [tokens {#Some it}]} + _ + {#None}))) + +(def' .private (eitherP leftP rightP tokens) + (All (_ a) + (-> (Parser a) + (Parser a) + (Parser a))) + (case (leftP tokens) + {#None} + (rightP tokens) + + it + it)) + +(def' .private (andP leftP rightP tokens) + (All (_ l r) + (-> (Parser l) + (Parser r) + (Parser [l r]))) + (do maybe#monad + [left (leftP tokens) + .let [[tokens left] left] + right (rightP tokens) + .let [[tokens right] right]] + (in [tokens [left right]]))) + +(def' .private (afterP leftP rightP tokens) + (All (_ l r) + (-> (Parser l) + (Parser r) + (Parser r))) + (do maybe#monad + [left (leftP tokens) + .let [[tokens left] left]] + (rightP tokens))) + +(def' .private (someP itP tokens) + (All (_ a) + (-> (Parser a) + (Parser (List a)))) + (case (itP tokens) + {#Some [tokens head]} + (do maybe#monad + [it (someP itP tokens) + .let [[tokens tail] it]] + (in [tokens (partial_list head tail)])) - {#None} - {#Some [tokens {#None}]})) + {#None} + {#Some [tokens (list)]})) + +(def' .private (manyP itP tokens) + (All (_ a) + (-> (Parser a) + (Parser (List a)))) + (do maybe#monad + [it (itP tokens) + .let [[tokens head] it] + it (someP itP tokens) + .let [[tokens tail] it]] + (in [tokens (partial_list head tail)]))) + +(def' .private (maybeP itP tokens) + (All (_ a) + (-> (Parser a) + (Parser (Maybe a)))) + (case (itP tokens) + {#Some [tokens it]} + {#Some [tokens {#Some it}]} -(def:' .private (tupleP itP tokens) - (All (_ a) - (-> (Parser a) (Parser a))) - (case tokens - (pattern (partial_list [_ {#Tuple input}] tokens')) - (do maybe#monad - [it (parsed itP input)] - (in [tokens' it])) + {#None} + {#Some [tokens {#None}]})) - _ - {#None})) +(def' .private (tupleP itP tokens) + (All (_ a) + (-> (Parser a) (Parser a))) + (case tokens + (pattern (partial_list [_ {#Tuple input}] tokens')) + (do maybe#monad + [it (parsed itP input)] + (in [tokens' it])) -(def:' .private (formP itP tokens) - (All (_ a) - (-> (Parser a) (Parser a))) - (case tokens - (pattern (partial_list [_ {#Form input}] tokens')) - (do maybe#monad - [it (parsed itP input)] - (in [tokens' it])) + _ + {#None})) - _ - {#None})) +(def' .private (formP itP tokens) + (All (_ a) + (-> (Parser a) (Parser a))) + (case tokens + (pattern (partial_list [_ {#Form input}] tokens')) + (do maybe#monad + [it (parsed itP input)] + (in [tokens' it])) -(def:' .private (bindingP tokens) - (Parser [Text Code]) - (case tokens - (pattern (partial_list [_ {#Symbol ["" name]}] value &rest)) - {#Some [&rest [name value]]} + _ + {#None})) - _ - {#None})) +(def' .private (bindingP tokens) + (Parser [Text Code]) + (case tokens + (pattern (partial_list [_ {#Symbol ["" name]}] value &rest)) + {#Some [&rest [name value]]} -(def:' .private (endP tokens) - (Parser Any) - (case tokens - (pattern (list)) - {#Some [tokens []]} + _ + {#None})) - _ - {#None})) +(def' .private (endP tokens) + (Parser Any) + (case tokens + (pattern (list)) + {#Some [tokens []]} -(def:' .private (anyP tokens) - (Parser Code) - (case tokens - (pattern (partial_list code tokens')) - {#Some [tokens' code]} + _ + {#None})) - _ - {#None})) +(def' .private (anyP tokens) + (Parser Code) + (case tokens + (pattern (partial_list code tokens')) + {#Some [tokens' code]} -(def:' .private (localP tokens) - (-> (List Code) (Maybe [(List Code) Text])) - (case tokens - (pattern (partial_list [_ {#Symbol ["" local]}] tokens')) - {#Some [tokens' local]} + _ + {#None})) - _ - {#None})) +(def' .private (localP tokens) + (-> (List Code) (Maybe [(List Code) Text])) + (case tokens + (pattern (partial_list [_ {#Symbol ["" local]}] tokens')) + {#Some [tokens' local]} + + _ + {#None})) -(def:' .private (symbolP tokens) - (-> (List Code) (Maybe [(List Code) Symbol])) - (case tokens - (pattern (partial_list [_ {#Symbol it}] tokens')) - {#Some [tokens' it]} +(def' .private (symbolP tokens) + (-> (List Code) (Maybe [(List Code) Symbol])) + (case tokens + (pattern (partial_list [_ {#Symbol it}] tokens')) + {#Some [tokens' it]} - _ - {#None})) + _ + {#None})) (with_template [ ] - [(def:' .private ( tokens) - (-> (List Code) (Maybe (List ))) - (case tokens - {#End} - {#Some {#End}} + [(def' .private ( tokens) + (-> (List Code) (Maybe (List ))) + (case tokens + {#End} + {#Some {#End}} - _ - (do maybe#monad - [% ( tokens) - .let' [[tokens head] %] - tail ( tokens)] - (in {#Item head tail}))))] + _ + (do maybe#monad + [% ( tokens) + .let' [[tokens head] %] + tail ( tokens)] + (in {#Item head tail}))))] [parametersP Text localP] [enhanced_parametersP Code anyP] ) (with_template [ ] - [(def:' .private ( tokens) - (Parser [Text (List )]) - (case tokens - (pattern (partial_list [_ {#Form local_declaration}] tokens')) - (do maybe#monad - [% (localP local_declaration) - .let' [[local_declaration name] %] - parameters ( local_declaration)] - (in [tokens' [name parameters]])) - - _ - (do maybe#monad - [% (localP tokens) - .let' [[tokens' name] %]] - (in [tokens' [name {#End}]]))))] + [(def' .private ( tokens) + (Parser [Text (List )]) + (case tokens + (pattern (partial_list [_ {#Form local_declaration}] tokens')) + (do maybe#monad + [% (localP local_declaration) + .let' [[local_declaration name] %] + parameters ( local_declaration)] + (in [tokens' [name parameters]])) + + _ + (do maybe#monad + [% (localP tokens) + .let' [[tokens' name] %]] + (in [tokens' [name {#End}]]))))] [local_declarationP Text parametersP] [enhanced_local_declarationP Code enhanced_parametersP] ) -(def:' .private (export_policyP tokens) - (-> (List Code) [(List Code) Code]) - (case tokens - (pattern (partial_list candidate tokens')) - (case candidate - [_ {#Bit it}] - [tokens' candidate] - - [_ {#Symbol ["" _]}] - [tokens (` .private)] - - [_ {#Symbol it}] - [tokens' candidate] +(def' .private (export_policyP tokens) + (-> (List Code) [(List Code) Code]) + (case tokens + (pattern (partial_list candidate tokens')) + (case candidate + [_ {#Bit it}] + [tokens' candidate] + + [_ {#Symbol ["" _]}] + [tokens (` .private)] + + [_ {#Symbol it}] + [tokens' candidate] - _ - [tokens (` .private)]) + _ + [tokens (` .private)]) - _ - [tokens (` .private)])) + _ + [tokens (` .private)])) (with_template [ ] - [(def:' .private ( tokens) - (-> (List Code) (Maybe [(List Code) [Code Text (List )]])) - (do maybe#monad - [.let' [[tokens export_policy] (export_policyP tokens)] - % ( tokens) - .let' [[tokens [name parameters]] %]] - (in [tokens [export_policy name parameters]])))] + [(def' .private ( tokens) + (-> (List Code) (Maybe [(List Code) [Code Text (List )]])) + (do maybe#monad + [.let' [[tokens export_policy] (export_policyP tokens)] + % ( tokens) + .let' [[tokens [name parameters]] %]] + (in [tokens [export_policy name parameters]])))] [declarationP Text local_declarationP] [enhanced_declarationP Code enhanced_local_declarationP] ) -(def:' .private (bodyP tokens) - (-> (List Code) (Maybe [(List Code) [(Maybe Code) Code]])) - (case tokens - ... TB - (pattern (partial_list type body tokens')) - {#Some [tokens' [{#Some type} body]]} +(def' .private (bodyP tokens) + (-> (List Code) (Maybe [(List Code) [(Maybe Code) Code]])) + (case tokens + ... TB + (pattern (partial_list type body tokens')) + {#Some [tokens' [{#Some type} body]]} - ... B - (pattern (partial_list body tokens')) - {#Some [tokens' [{#None} body]]} + ... B + (pattern (partial_list body tokens')) + {#Some [tokens' [{#None} body]]} - _ - {#None})) - -(def:' .private (definitionP tokens) - (-> (List Code) (Maybe [Code Text (List Code) (Maybe Code) Code])) - (do maybe#monad - [% (enhanced_declarationP tokens) - .let' [[tokens [export_policy name parameters]] %] - % (bodyP tokens) - .let' [[tokens [?type body]] %] - _ (endP tokens)] - (in [export_policy name parameters ?type body]))) - -(def:'' .public def: - Macro - (macro (_ tokens) - (case (definitionP tokens) - {#Some [export_policy name parameters ?type body]} - (let [body (case parameters - {#End} - body + _ + {#None})) + +(def' .private (definitionP tokens) + (-> (List Code) (Maybe [Code Text (List Code) (Maybe Code) Code])) + (do maybe#monad + [% (enhanced_declarationP tokens) + .let' [[tokens [export_policy name parameters]] %] + % (bodyP tokens) + .let' [[tokens [?type body]] %] + _ (endP tokens)] + (in [export_policy name parameters ?type body]))) + +(def'' .public def + Macro + (macro (_ tokens) + (case (definitionP tokens) + {#Some [export_policy name parameters ?type body]} + (let [body (case parameters + {#End} + body - _ - (` (function ((~ (..local$ name)) (~+ parameters)) - (~ body)))) - body (case ?type - {#Some type} - (` (is (~ type) - (~ body))) - - {#None} - body)] - (meta#in (list (` ("lux def" (~ (..local$ name)) - (~ body) - (~ export_policy)))))) - - {#None} - (failure (..wrong_syntax_error (symbol ..def:)))))) + _ + (` (function ((~ (..local$ name)) (~+ parameters)) + (~ body)))) + body (case ?type + {#Some type} + (` (is (~ type) + (~ body))) + + {#None} + body)] + (meta#in (list (` ("lux def" (~ (..local$ name)) + (~ body) + (~ export_policy)))))) + + {#None} + (failure (..wrong_syntax_error (symbol ..def)))))) -(def: (list#one f xs) +(def (list#one f xs) (All (_ a b) (-> (-> a (Maybe b)) (List a) (Maybe b))) (case xs @@ -2957,7 +2957,7 @@ {#Some y}))) (with_template [
] - [(def: .public + [(def .public (macro (_ tokens) (case (list#reversed tokens) (pattern (partial_list last init)) @@ -2972,15 +2972,15 @@ [and (if (~ pre) (~ post) #0) "'and' requires >=1 clauses."] [or (if (~ pre) #1 (~ post)) "'or' requires >=1 clauses."]) -(def: (index part text) +(def (index part text) (-> Text Text (Maybe Nat)) ("lux text index" 0 part text)) -(def: .public (panic! message) +(def .public (panic! message) (-> Text Nothing) ("lux io error" message)) -(def: maybe#else +(def maybe#else (macro (_ tokens state) (case tokens (pattern (list else maybe)) @@ -2996,7 +2996,7 @@ _ {#Left (..wrong_syntax_error (symbol ..maybe#else))}))) -(def: (text#all_split_by splitter input) +(def (text#all_split_by splitter input) (-> Text Text (List Text)) (case (..index splitter input) {#None} @@ -3011,7 +3011,7 @@ ("lux text size" input))] ("lux text clip" after_offset after_length input)))))) -(def: (item idx xs) +(def (item idx xs) (All (_ a) (-> Nat (List a) (Maybe a))) (case xs @@ -3024,7 +3024,7 @@ (item ("lux i64 -" 1 idx) xs')))) ... https://en.wikipedia.org/wiki/Lambda_calculus#%CE%B2-reduction -(def: (reduced env type) +(def (reduced env type) (-> (List Type) Type Type) (case type {#Sum left right} @@ -3070,7 +3070,7 @@ type )) -(def: (applied_type param type_fn) +(def (applied_type param type_fn) (-> Type Type (Maybe Type)) (case type_fn {#UnivQ env body} @@ -3091,7 +3091,7 @@ {#None})) (with_template [ ] - [(def: ( type) + [(def ( type) (-> Type (List Type)) (case type { left right} @@ -3105,7 +3105,7 @@ [flat_lambda #Function] ) -(def: (flat_application type) +(def (flat_application type) (-> Type [Type (List Type)]) (case type {#Apply head func'} @@ -3115,7 +3115,7 @@ _ [type (list)])) -(def: (interface_methods type) +(def (interface_methods type) (-> Type (Maybe (List Type))) (case type {#Product _} @@ -3141,7 +3141,7 @@ _ {#Some (list type)})) -(def: (module name) +(def (module name) (-> Text (Meta Module)) (function (_ state) (let [[..#info info ..#source source ..#current_module _ ..#modules modules @@ -3155,7 +3155,7 @@ _ {#Left (all text#composite "Unknown module: " name)})))) -(def: (type_slot [module name]) +(def (type_slot [module name]) (-> Symbol (Meta [Nat (List Symbol) Bit Type])) (do meta#monad [=module (..module module) @@ -3176,7 +3176,7 @@ _ (failure (text#composite "Unknown slot: " (symbol#encoded [module name])))))) -(def: (record_slots type) +(def (record_slots type) (-> Type (Meta (Maybe [(List Symbol) (List Type)]))) (case type {#Apply arg func} @@ -3213,7 +3213,7 @@ _ (meta#in {#None}))) -(def: expected_type +(def expected_type (Meta Type) (function (_ state) (let [[..#info info ..#source source ..#current_module _ ..#modules modules @@ -3227,7 +3227,7 @@ {#None} {#Left "Not expecting any type."})))) -(def: (type#encoded type) +(def (type#encoded type) (-> Type Text) (case type {#Primitive name params} @@ -3273,7 +3273,7 @@ (symbol#encoded name) )) -(def: .public implementation +(def .public implementation (macro (_ tokens) (do meta#monad [tokens' (monad#each meta#monad expansion tokens) @@ -3310,7 +3310,7 @@ (list#conjoint tokens'))] (in (list (tuple$ (list#conjoint members))))))) -(def: (text#interposed separator parts) +(def (text#interposed separator parts) (-> Text (List Text) Text) (case parts {#End} @@ -3322,12 +3322,12 @@ head tail))) -(def: (function#identity value) +(def (function#identity value) (All (_ a) (-> a a)) value) -(def: (everyP itP tokens) +(def (everyP itP tokens) (All (_ a) (-> (-> (List Code) (Maybe [(List Code) a])) (-> (List Code) (Maybe (List a))))) @@ -3347,7 +3347,7 @@ {#End} {#Some (list)})) -(def: (caseP tokens) +(def (caseP tokens) (-> (List Code) (Maybe [(List Code) [Text Code]])) (case tokens (pattern (partial_list [_ {#Variant (list [_ {#Symbol ["" niladic]}])}] tokens')) @@ -3359,7 +3359,7 @@ _ {#None})) -(def: .public Variant +(def .public Variant (macro (_ tokens) (case (everyP caseP tokens) {#Some cases} @@ -3371,7 +3371,7 @@ {#None} (failure (..wrong_syntax_error (symbol ..Variant)))))) -(def: (slotP tokens) +(def (slotP tokens) (-> (List Code) (Maybe [(List Code) [Text Code]])) (case tokens (pattern (partial_list [_ {#Symbol ["" slot]}] type tokens')) @@ -3380,7 +3380,7 @@ _ {#None})) -(def: .public Record +(def .public Record (macro (_ tokens) (case tokens (pattern (list [_ {#Tuple record}])) @@ -3397,7 +3397,7 @@ _ (failure (..wrong_syntax_error (symbol ..Record)))))) -(def: (typeP tokens) +(def (typeP tokens) (-> (List Code) (Maybe [Code Text (List Text) Code])) (do maybe#monad [% (declarationP tokens) @@ -3407,7 +3407,7 @@ _ (endP tokens)] (in [export_policy name parameters definition]))) -(def: (textP tokens) +(def (textP tokens) (-> (List Code) (Maybe [(List Code) Text])) (case tokens (pattern (partial_list [_ {#Text it}] tokens')) @@ -3416,7 +3416,7 @@ _ {#None})) -(def: (type_declaration it) +(def (type_declaration it) (-> Code (Meta (Tuple Code (Maybe (Either (List Text) (List Text)))))) ({[_ {#Form {#Item [_ {#Symbol declarer}] parameters}}] (do meta#monad @@ -3448,7 +3448,7 @@ (meta#in [type {#None}])} it)) -(def: .public type: +(def .public type: (macro (_ tokens) (case (typeP tokens) {#Some [export_policy name args type_codes]} @@ -3503,11 +3503,11 @@ #import_alias (Maybe Text) #import_referrals (List Referral)])) -(def: referral_parser +(def referral_parser (Parser Referral) (formP (andP symbolP (someP anyP)))) -(def: (referrals_parser aliased?) +(def (referrals_parser aliased?) (-> Bit (Parser (List Referral))) (all eitherP (manyP referral_parser) @@ -3517,12 +3517,12 @@ (list)))) (inP (list)))) -(def: (text#split_at' at x) +(def (text#split_at' at x) (-> Nat Text [Text Text]) [("lux text clip" 0 at x) ("lux text clip" at (|> x "lux text size" ("lux i64 -" at)) x)]) -(def: (text#split_by token sample) +(def (text#split_by token sample) (-> Text Text (Maybe [Text Text])) (do ..maybe#monad [index (..index token sample) @@ -3530,7 +3530,7 @@ [_ post] (text#split_at' ("lux text size" token) post')]] (in [pre post]))) -(def: (replaced pattern replacement template) +(def (replaced pattern replacement template) (-> Text Text Text Text) ((is (-> Text Text Text) (function (again left right) @@ -3542,11 +3542,11 @@ ("lux text concat" left right)))) "" template)) -(def: (alias_stand_in index) +(def (alias_stand_in index) (-> Nat Text) (all "lux text concat" "[" (nat#encoded index) "]")) -(def: (module_alias context aliased) +(def (module_alias context aliased) (-> (List Text) Text Text) (product#right (list#mix (function (_ replacement [index aliased]) @@ -3555,13 +3555,13 @@ [0 aliased] context))) -(def: .public module_separator +(def .public module_separator "/") -(def: parallel_hierarchy_sigil +(def parallel_hierarchy_sigil "\") -(def: (normal_parallel_path' hierarchy root) +(def (normal_parallel_path' hierarchy root) (-> Text Text Text) (case [(text#split_by ..module_separator hierarchy) (text#split_by ..parallel_hierarchy_sigil root)] @@ -3574,7 +3574,7 @@ "" hierarchy _ (all text#composite root ..module_separator hierarchy)))) -(def: (normal_parallel_path hierarchy root) +(def (normal_parallel_path hierarchy root) (-> Text Text (Maybe Text)) (case (text#split_by ..parallel_hierarchy_sigil root) {#Some ["" root']} @@ -3583,7 +3583,7 @@ _ {#None})) -(def: (relative_ups relatives input) +(def (relative_ups relatives input) (-> Nat Text Nat) (case ("lux text index" relatives ..module_separator input) {#None} @@ -3594,7 +3594,7 @@ (relative_ups ("lux i64 +" 1 relatives) input) relatives))) -(def: (list#after amount list) +(def (list#after amount list) (All (_ a) (-> Nat (List a) (List a))) (case [amount list] (pattern#or [0 _] [_ {#End}]) @@ -3603,7 +3603,7 @@ [_ {#Item _ tail}] (list#after ("lux i64 -" 1 amount) tail))) -(def: (absolute_module_name nested? relative_root module) +(def (absolute_module_name nested? relative_root module) (-> Bit Text Text (Meta Text)) (case (relative_ups 0 module) 0 @@ -3630,7 +3630,7 @@ "Importing module: " module \n " Relative Root: " relative_root \n)))))) -(def: (imports_parser nested? relative_root context imports) +(def (imports_parser nested? relative_root context imports) (-> Bit Text (List Text) (List Code) (Meta (List Importation))) (do meta#monad [imports' (monad#each meta#monad @@ -3701,7 +3701,7 @@ imports)] (in (list#conjoint imports')))) -(def: (exported_definitions module state) +(def (exported_definitions module state) (-> Text (Meta (List Text))) (let [[current_module modules] (case state [..#info info ..#source source ..#current_module current_module ..#modules modules @@ -3753,7 +3753,7 @@ code#encoded))}) )) -(def: (list#only p xs) +(def (list#only p xs) (All (_ a) (-> (-> a Bit) (List a) (List a))) (case xs @@ -3765,7 +3765,7 @@ {#Item x (list#only p xs')} (list#only p xs')))) -(def: (is_member? cases name) +(def (is_member? cases name) (-> (List Text) Text Bit) (let [output (list#mix (function (_ case prev) (or prev @@ -3774,7 +3774,7 @@ cases)] output)) -(def: (test_referrals current_module imported_module all_defs referred_defs) +(def (test_referrals current_module imported_module all_defs referred_defs) (-> Text Text (List Text) (List Text) (Meta (List Any))) (monad#each meta#monad (is (-> Text (Meta Any)) @@ -3784,11 +3784,11 @@ (failure (all text#composite _def " is not defined in module " imported_module " @ " current_module))))) referred_defs)) -(def: (alias_definition imported_module def) +(def (alias_definition imported_module def) (-> Text Text Code) (` ("lux def alias" (~ (local$ def)) (~ (symbol$ [imported_module def]))))) -(def: .public only +(def .public only (macro (_ tokens) (case (..parsed (all ..andP ..textP @@ -3805,21 +3805,21 @@ {.#None} (failure (..wrong_syntax_error (symbol ..only)))))) -(def: .public |>> +(def .public |>> (macro (_ tokens) (do meta#monad [g!_ (..generated_symbol "_") g!arg (..generated_symbol "arg")] (meta#in (list (` (function ((~ g!_) (~ g!arg)) (|> (~ g!arg) (~+ tokens))))))))) -(def: .public <<| +(def .public <<| (macro (_ tokens) (do meta#monad [g!_ (..generated_symbol "_") g!arg (..generated_symbol "arg")] (meta#in (list (` (function ((~ g!_) (~ g!arg)) (<| (~+ tokens) (~ g!arg))))))))) -(def: .public except +(def .public except (macro (_ tokens) (case (..parsed (all ..andP ..textP @@ -3838,7 +3838,7 @@ {.#None} (failure (..wrong_syntax_error (symbol ..except)))))) -(def: (in_env name state) +(def (in_env name state) (-> Text Lux (Maybe Type)) (case state [..#info info ..#source source ..#current_module _ ..#modules modules @@ -3860,7 +3860,7 @@ locals)))) scopes))) -(def: (definition_type name state) +(def (definition_type name state) (-> Symbol Lux (Maybe Type)) (let [[v_module v_name] name [..#info info ..#source source ..#current_module _ ..#modules modules @@ -3897,7 +3897,7 @@ {#Slot _} {#None}))))) -(def: (definition_value name state) +(def (definition_value name state) (-> Symbol (Meta [Type Any])) (let [[v_module v_name] name [..#info info ..#source source ..#current_module _ ..#modules modules @@ -3934,7 +3934,7 @@ {#Slot _} {#Left (text#composite "Unknown definition: " (symbol#encoded name))}))))) -(def: (type_variable idx bindings) +(def (type_variable idx bindings) (-> Nat (List [Nat (Maybe Type)]) (Maybe Type)) (case bindings {#End} @@ -3945,7 +3945,7 @@ bound (type_variable idx bindings')))) -(def: (type_definition full_name) +(def (type_definition full_name) (-> Symbol (Meta Type)) (do meta#monad [.let [[module name] full_name] @@ -3988,7 +3988,7 @@ temp)) ))) -(def: (zipped_2 xs ys) +(def (zipped_2 xs ys) (All (_ a b) (-> (List a) (List b) (List [a b]))) (case xs @@ -4003,7 +4003,7 @@ _ (list))) -(def: .public open +(def .public open (macro (_ tokens) (case tokens (pattern (partial_list [_ {#Form (list [_ {#Text alias}])}] body branches)) @@ -4060,7 +4060,7 @@ _ (failure (..wrong_syntax_error (symbol ..open)))))) -(def: .public cond +(def .public cond (macro (_ tokens) (case (list#reversed tokens) (pattern (partial_list else branches')) @@ -4079,7 +4079,7 @@ _ (failure (..wrong_syntax_error (symbol ..cond)))))) -(def: (enumeration' idx xs) +(def (enumeration' idx xs) (All (_ a) (-> Nat (List a) (List [Nat a]))) (case xs @@ -4089,12 +4089,12 @@ {#End} {#End})) -(def: (enumeration xs) +(def (enumeration xs) (All (_ a) (-> (List a) (List [Nat a]))) (enumeration' 0 xs)) -(def: .public the +(def .public the (macro (_ tokens) (case tokens (pattern (list [_ {#Symbol slot'}] record)) @@ -4136,7 +4136,7 @@ _ (failure (..wrong_syntax_error (symbol ..the)))))) -(def: (open_declaration imported_module alias tags my_tag_index [module short] source type) +(def (open_declaration imported_module alias tags my_tag_index [module short] source type) (-> Text Text (List Symbol) Nat Symbol Code Type (Meta (List Code))) (do meta#monad [output (record_slots type) @@ -4165,7 +4165,7 @@ (~ source+) #0))))))) -(def: (implementation_declarations imported_module alias implementation) +(def (implementation_declarations imported_module alias implementation) (-> Text Text Symbol (Meta (List Code))) (do meta#monad [interface (type_definition implementation) @@ -4185,7 +4185,7 @@ "Can only 'open:' structs: " (symbol#encoded implementation) " : " (type#encoded interface)))))) -(def: (localized module global) +(def (localized module global) (-> Text Symbol Symbol) (case global ["" local] @@ -4194,7 +4194,7 @@ _ global)) -(def: .public open: +(def .public open: (macro (_ tokens) (case (..parsed (all ..andP (..maybeP (all ..andP @@ -4252,14 +4252,14 @@ {.#None} (failure (..wrong_syntax_error (symbol ..open:)))))) -(def: (imported_by? import_name module_name) +(def (imported_by? import_name module_name) (-> Text Text (Meta Bit)) (do meta#monad [module (module module_name) .let [[..#module_hash _ ..#module_aliases _ ..#definitions _ ..#imports imports ..#module_state _] module]] (in (is_member? imports import_name)))) -(def: (referrals module_name extra) +(def (referrals module_name extra) (-> Text (List Code) (Meta (List Referral))) (do meta#monad [extra,referral (case (referrals_parser #0 extra) @@ -4281,7 +4281,7 @@ (list#interposed " ") (list#mix text#composite ""))))))) -(def: refer +(def refer (macro (_ tokens) (case tokens (pattern (partial_list [_ {#Text imported_module}] [_ {#Text alias}] options)) @@ -4299,7 +4299,7 @@ _ (failure (..wrong_syntax_error (symbol ..refer)))))) -(def: .public with +(def .public with (macro (_ tokens) (case (..parsed (..andP ..anyP ..anyP) tokens) @@ -4310,7 +4310,7 @@ {.#None} (failure (..wrong_syntax_error (symbol ..with)))))) -(def: .public at +(def .public at (macro (_ tokens) (case tokens (pattern (list implementation [_ {#Symbol member}])) @@ -4322,7 +4322,7 @@ _ (failure (..wrong_syntax_error (symbol ..at)))))) -(def: .public has +(def .public has (macro (_ tokens) (case tokens (pattern (list [_ {#Symbol slot'}] value record)) @@ -4406,7 +4406,7 @@ _ (failure (..wrong_syntax_error (symbol ..has)))))) -(def: .public revised +(def .public revised (macro (_ tokens) (case tokens (pattern (list [_ {#Symbol slot'}] fun record)) @@ -4476,7 +4476,7 @@ _ (failure (..wrong_syntax_error (symbol ..revised)))))) -(def: .private with_template#pattern +(def .private with_template#pattern (macro (_ tokens) (case tokens (pattern (partial_list [_ {#Form (list [_ {#Tuple bindings}] @@ -4507,7 +4507,7 @@ (failure (..wrong_syntax_error (symbol ..with_template#pattern)))))) (with_template [ ] - [(def: .public + [(def .public (All (_ s) (-> (I64 s) (I64 s))) (|>> ( 1)))] @@ -4516,7 +4516,7 @@ [-- "lux i64 -"] ) -(def: (interleaved xs ys) +(def (interleaved xs ys) (All (_ a) (-> (List a) (List a) (List a))) (case xs @@ -4531,7 +4531,7 @@ {#Item y ys'} (partial_list x y (interleaved xs' ys'))))) -(def: (type_code type) +(def (type_code type) (-> Type Code) (case type {#Primitive name params} @@ -4562,7 +4562,7 @@ ... (~ (type_code anonymous))}) (symbol$ [module name]))) -(def: .public loop +(def .public loop (macro (_ tokens) (let [?params (case tokens (pattern (list [_ {#Form (list name [_ {#Tuple bindings}])}] body)) @@ -4605,7 +4605,7 @@ {#None} (failure (..wrong_syntax_error (symbol ..loop))))))) -(def: (with_expansions' label tokens target) +(def (with_expansions' label tokens target) (-> Text (List Code) Code (List Code)) (case target (pattern#or [_ {#Bit _}] [_ {#Nat _}] [_ {#Int _}] [_ {#Rev _}] [_ {#Frac _}] [_ {#Text _}]) @@ -4624,7 +4624,7 @@ [#Variant] [#Tuple]))) -(def: .public with_expansions +(def .public with_expansions (macro (_ tokens) (case (parsed (andP (tupleP (someP bindingP)) (someP anyP)) tokens) {#Some [bindings bodies]} @@ -4657,7 +4657,7 @@ {#None} (failure (..wrong_syntax_error (symbol ..with_expansions)))))) -(def: (flat_alias type) +(def (flat_alias type) (-> Type Type) (case type (with_template#pattern [] @@ -4676,7 +4676,7 @@ _ type)) -(def: (static_simple_literal name) +(def (static_simple_literal name) (-> Symbol (Meta Code)) (do meta#monad [type+value (definition_value name) @@ -4695,7 +4695,7 @@ _ (failure (text#composite "Cannot anti-quote type: " (symbol#encoded name)))))) -(def: (static_literal token) +(def (static_literal token) (-> Code (Meta Code)) (case token [_ {#Symbol [def_module def_name]}] @@ -4720,7 +4720,7 @@ ... (at meta#monad in token) )) -(def: .public static +(def .public static (macro (_ tokens) (case tokens (pattern (list pattern)) @@ -4734,7 +4734,7 @@ (type: Multi_Level_Case [Code (List [Code Code])]) -(def: (case_level^ level) +(def (case_level^ level) (-> Code (Meta [Code Code])) (case level (pattern [_ {#Tuple (list expr binding)}]) @@ -4744,7 +4744,7 @@ (meta#in [level (` #1)]) )) -(def: (multi_level_case^ levels) +(def (multi_level_case^ levels) (-> (List Code) (Meta Multi_Level_Case)) (case levels {#End} @@ -4755,7 +4755,7 @@ [extras' (monad#each meta#monad case_level^ extras)] (in [init extras'])))) -(def: (multi_level_case$ g!_ [[init_pattern levels] body]) +(def (multi_level_case$ g!_ [[init_pattern levels] body]) (-> Code [Multi_Level_Case Code] (List Code)) (let [inner_pattern_body (list#mix (function (_ [calculation pattern] success) (let [bind? (case pattern @@ -4775,7 +4775,7 @@ (is (List [Code Code]) (list#reversed levels)))] (list init_pattern inner_pattern_body))) -(def: pattern#multi +(def pattern#multi (macro (_ tokens) (case tokens (pattern (partial_list [_meta {#Form levels}] body next_branches)) @@ -4807,12 +4807,12 @@ _ (failure (..wrong_syntax_error (symbol ..pattern#multi)))))) -(def: .public (same? reference sample) +(def .public (same? reference sample) (All (_ a) (-> a a Bit)) ("lux is" reference sample)) -(def: .public as_expected +(def .public as_expected (macro (_ tokens) (case tokens (pattern (list expr)) @@ -4823,12 +4823,12 @@ _ (failure (..wrong_syntax_error (symbol ..as_expected)))))) -(def: location +(def location (Meta Location) (function (_ compiler) {#Right [compiler (the #location compiler)]})) -(def: .public undefined +(def .public undefined (macro (_ tokens) (case tokens {#End} @@ -4842,7 +4842,7 @@ _ (failure (..wrong_syntax_error (symbol ..undefined)))))) -(def: .public type_of +(def .public type_of (macro (_ tokens) (case tokens (pattern (list [_ {#Symbol var_name}])) @@ -4859,7 +4859,7 @@ _ (failure (..wrong_syntax_error (symbol ..type_of)))))) -(def: (templateP tokens) +(def (templateP tokens) (-> (List Code) (Maybe [Text (List Text) (List Code)])) (do maybe#monad [% (local_declarationP tokens) @@ -4869,7 +4869,7 @@ _ (endP tokens)] (in [name parameters templates]))) -(def: .public template +(def .public template (macro (_ tokens) (case (templateP tokens) {#Some [name args input_templates]} @@ -4897,7 +4897,7 @@ (failure (..wrong_syntax_error (symbol ..template)))))) (with_template [ ] - [(def: .public + [(def .public (template ( it) [(..|> it (..is (..I64 ..Any)) (..as ))]))] @@ -4907,11 +4907,11 @@ [rev ..Rev] ) -(def: .public these +(def .public these (macro (_ tokens compiler) {#Right [compiler tokens]})) -(def: .public char +(def .public char (macro (_ tokens compiler) (case tokens (pattern#multi (pattern (list [_ {#Text input}])) @@ -4923,12 +4923,12 @@ _ {#Left (..wrong_syntax_error (symbol ..char))}))) -(def: target +(def target (Meta Text) (function (_ compiler) {#Right [compiler (the [#info #target] compiler)]})) -(def: (platform_name choice) +(def (platform_name choice) (-> Code (Meta Text)) (case choice [_ {#Text platform}] @@ -4954,7 +4954,7 @@ "Invalid target platform syntax: " (..code#encoded choice) \n "Must be either a text literal or a symbol.")))) -(def: (target_pick target options default) +(def (target_pick target options default) (-> Text (List [Code Code]) (Maybe Code) (Meta (List Code))) (case options {#End} @@ -4972,7 +4972,7 @@ (meta#in (list pick)) (target_pick target options' default))))) -(def: .public for +(def .public for (macro (_ tokens) (case (..parsed (..andP (..someP (..andP ..anyP ..anyP)) (..maybeP ..anyP)) @@ -4986,7 +4986,7 @@ (failure (..wrong_syntax_error (symbol ..for)))))) ... TODO: Delete "scope_type_vars" (including the #scope_type_vars Lux state) and "parameter" ASAP. -(for "{old}" (these (def: (scope_type_vars state) +(for "{old}" (these (def (scope_type_vars state) (Meta (List Nat)) (case state [..#info info ..#source source ..#current_module _ ..#modules modules @@ -4995,7 +4995,7 @@ ..#scope_type_vars scope_type_vars ..#eval _eval] {#Right [state scope_type_vars]})) - (def: .public parameter + (def .public parameter (macro (_ tokens) (case tokens (pattern (list [_ {#Nat idx}])) @@ -5010,9 +5010,9 @@ _ (failure (..wrong_syntax_error (symbol ..$))))))) - (these (def: .public parameter ""))) + (these (def .public parameter ""))) -(def: (refer_code imported_module alias referrals) +(def (refer_code imported_module alias referrals) (-> Text Text (List Referral) Code) (` ((~! ..refer) (~ (text$ imported_module)) @@ -5021,7 +5021,7 @@ (` ((~ (symbol$ macro)) (~+ parameters)))) referrals))))) -(def: .public using +(def .public using (macro (_ _imports) (do meta#monad [current_module ..current_module_name @@ -5048,12 +5048,12 @@ =refers) =refers)})))) -(def: (symbol#= [moduleL shortL] [moduleR shortR]) +(def (symbol#= [moduleL shortL] [moduleR shortR]) (-> Symbol Symbol Bit) (and (text#= moduleL moduleR) (text#= shortL shortR))) -(def: (type#= left right) +(def (type#= left right) (-> Type Type Bit) (case [left right] [{#Primitive nameL parametersL} {#Primitive nameR parametersR}] @@ -5099,15 +5099,15 @@ (type: .public Immediate_UnQuote (Primitive "#Macro/Immediate_UnQuote")) -(def: .public immediate_unquote +(def .public immediate_unquote (-> Macro Immediate_UnQuote) (|>> (as Immediate_UnQuote))) -(def: immediate_unquote_macro +(def immediate_unquote_macro (-> Immediate_UnQuote Macro') (|>> (as Macro'))) -(def: .public ~~ +(def .public ~~ (..immediate_unquote (macro (_ it) (case it @@ -5117,7 +5117,7 @@ _ (failure (wrong_syntax_error (symbol ..~~))))))) -(def: aggregate_embedded_expansions +(def aggregate_embedded_expansions (template (_ embedded_expansions <@> <*>) [(do meta#monad [<*>' (monad#each meta#monad embedded_expansions <*>)] @@ -5127,7 +5127,7 @@ (list#mix list#composite (list))) [<@> { (list#each product#right <*>')}]]))])) -(def: (meta#try it) +(def (meta#try it) (All (_ a) (-> (Meta a) (Meta (Either Text a)))) (function (_ state) (case (it state) @@ -5137,7 +5137,7 @@ {#Right [state output]} {#Right [state {#Right output}]}))) -(def: (embedded_expansions code) +(def (embedded_expansions code) (-> Code (Meta [(List Code) Code])) (case code (pattern [@ {#Form (partial_list [@symbol {#Symbol original_symbol}] parameters)}]) @@ -5175,7 +5175,7 @@ _ (meta#in [(list) code]))) -(def: .public `` +(def .public `` (macro (_ tokens) (case tokens (pattern (list raw)) @@ -5188,15 +5188,15 @@ _ (failure (..wrong_syntax_error (symbol ..``)))))) -(def: .public false +(def .public false Bit #0) -(def: .public true +(def .public true Bit #1) -(def: .public try +(def .public try (macro (_ tokens) (case tokens (pattern (list expression)) @@ -5209,7 +5209,7 @@ _ (..failure (..wrong_syntax_error (symbol ..try)))))) -(def: (methodP tokens) +(def (methodP tokens) (-> (List Code) (Maybe [(List Code) [Text Code]])) (case tokens (pattern (partial_list [_ {#Form (list [_ {#Text "lux type check"}] @@ -5221,7 +5221,7 @@ _ {#None})) -(def: .public Interface +(def .public Interface (macro (_ tokens) (do meta#monad [methods' (monad#each meta#monad expansion tokens)] @@ -5233,14 +5233,14 @@ {#None} (failure (..wrong_syntax_error (symbol ..Interface))))))) -(def: (recursive_type g!self g!dummy name body) +(def (recursive_type g!self g!dummy name body) (-> Code Code Text Code Code) (` {.#Apply (..Primitive "") (.All ((~ g!self) (~ g!dummy)) (~ (let$ (local$ name) (` {.#Apply (..Primitive "") (~ g!self)}) body)))})) -(def: .public Rec +(def .public Rec (macro (_ tokens) (case tokens (pattern (list [_ {#Symbol "" name}] body)) diff --git a/stdlib/source/library/lux/abstract/apply.lux b/stdlib/source/library/lux/abstract/apply.lux index 0685484d5..35320cbd4 100644 --- a/stdlib/source/library/lux/abstract/apply.lux +++ b/stdlib/source/library/lux/abstract/apply.lux @@ -14,16 +14,16 @@ (-> (f a) (f (-> a b)) (f b))) on))) -(def: .public (composite f_monad f_apply g_apply) +(def .public (composite f_monad f_apply g_apply) (All (_ F G) (-> (Monad F) (Apply F) (Apply G) ... TODO: Replace (All (_ a) (F (G a))) with (functor.Then F G) (Apply (All (_ a) (F (G a)))))) (implementation - (def: functor + (def functor (functor.composite (the functor f_apply) (the functor g_apply))) - (def: (on fgx fgf) + (def (on fgx fgf) ... TODO: Switch from this version to the one below (in comments) ASAP. (for @.old (let [fgf' (at f_apply on fgf diff --git a/stdlib/source/library/lux/abstract/codec.lux b/stdlib/source/library/lux/abstract/codec.lux index ce6bab822..1af71150f 100644 --- a/stdlib/source/library/lux/abstract/codec.lux +++ b/stdlib/source/library/lux/abstract/codec.lux @@ -14,16 +14,16 @@ (is (-> m (Try a)) decoded))) -(def: .public (composite cb_codec ba_codec) +(def .public (composite cb_codec ba_codec) (All (_ a b c) (-> (Codec c b) (Codec b a) (Codec c a))) (implementation - (def: encoded + (def encoded (|>> (at ba_codec encoded) (at cb_codec encoded))) - (def: (decoded cy) + (def (decoded cy) (do try.monad [by (at cb_codec decoded cy)] (at ba_codec decoded by))))) diff --git a/stdlib/source/library/lux/abstract/comonad.lux b/stdlib/source/library/lux/abstract/comonad.lux index 54f8707a3..405acfbf1 100644 --- a/stdlib/source/library/lux/abstract/comonad.lux +++ b/stdlib/source/library/lux/abstract/comonad.lux @@ -23,7 +23,7 @@ (-> (w a) (w (w a)))) disjoint))) -(def: .public be +(def .public be (macro (_ tokens state) (case (is (Maybe [(Maybe Text) Code (List Code) Code]) (case tokens diff --git a/stdlib/source/library/lux/abstract/comonad/free.lux b/stdlib/source/library/lux/abstract/comonad/free.lux index 60cbb883b..2e7e7cf1c 100644 --- a/stdlib/source/library/lux/abstract/comonad/free.lux +++ b/stdlib/source/library/lux/abstract/comonad/free.lux @@ -8,20 +8,20 @@ (type: .public (Free F a) [a (F (Free F a))]) -(def: .public (functor dsl) +(def .public (functor dsl) (All (_ F) (-> (Functor F) (Functor (Free F)))) (implementation - (def: (each f [head tail]) + (def (each f [head tail]) [(f head) (at dsl each (each f) tail)]))) -(def: .public (comonad dsl) +(def .public (comonad dsl) (All (_ F) (-> (Functor F) (CoMonad (Free F)))) (implementation - (def: functor (..functor dsl)) + (def functor (..functor dsl)) - (def: (out [head tail]) + (def (out [head tail]) head) - (def: (disjoint [head tail]) + (def (disjoint [head tail]) [[head tail] (at dsl each disjoint tail)]))) diff --git a/stdlib/source/library/lux/abstract/enum.lux b/stdlib/source/library/lux/abstract/enum.lux index fbc9249ba..58e127f7d 100644 --- a/stdlib/source/library/lux/abstract/enum.lux +++ b/stdlib/source/library/lux/abstract/enum.lux @@ -10,7 +10,7 @@ (is (-> e e) succ) (is (-> e e) pred))) -(def: .public (range enum from to) +(def .public (range enum from to) (All (_ a) (-> (Enum a) a a (List a))) (let [(open "/#[0]") enum] (loop (again [end to diff --git a/stdlib/source/library/lux/abstract/equivalence.lux b/stdlib/source/library/lux/abstract/equivalence.lux index 064492b0f..fcd0f41cd 100644 --- a/stdlib/source/library/lux/abstract/equivalence.lux +++ b/stdlib/source/library/lux/abstract/equivalence.lux @@ -10,17 +10,17 @@ (is (-> a a Bit) =))) -(def: .public (rec sub) +(def .public (rec sub) (All (_ a) (-> (-> (Equivalence a) (Equivalence a)) (Equivalence a))) (implementation - (def: (= left right) + (def (= left right) (sub = left right)))) -(def: .public functor +(def .public functor (contravariant.Functor Equivalence) (implementation - (def: (each f equivalence) + (def (each f equivalence) (implementation - (def: (= reference sample) + (def (= reference sample) (at equivalence = (f reference) (f sample))))))) diff --git a/stdlib/source/library/lux/abstract/functor.lux b/stdlib/source/library/lux/abstract/functor.lux index fb80f0f1f..43bfa28d9 100644 --- a/stdlib/source/library/lux/abstract/functor.lux +++ b/stdlib/source/library/lux/abstract/functor.lux @@ -12,10 +12,10 @@ (type: .public (Or f g) (All (_ a) (.Or (f a) (g a)))) -(def: .public (sum (open "f#[0]") (open "g#[0]")) +(def .public (sum (open "f#[0]") (open "g#[0]")) (All (_ F G) (-> (Functor F) (Functor G) (Functor (..Or F G)))) (implementation - (def: (each f fa|ga) + (def (each f fa|ga) (case fa|ga {.#Left fa} {.#Left (f#each f fa)} @@ -26,18 +26,18 @@ (type: .public (And f g) (All (_ a) (.And (f a) (g a)))) -(def: .public (product (open "f#[0]") (open "g#[0]")) +(def .public (product (open "f#[0]") (open "g#[0]")) (All (_ F G) (-> (Functor F) (Functor G) (Functor (..And F G)))) (implementation - (def: (each f [fa ga]) + (def (each f [fa ga]) [(f#each f fa) (g#each f ga)]))) (type: .public (Then f g) (All (_ a) (f (g a)))) -(def: .public (composite (open "f#[0]") (open "g#[0]")) +(def .public (composite (open "f#[0]") (open "g#[0]")) (All (_ F G) (-> (Functor F) (Functor G) (Functor (..Then F G)))) (implementation - (def: (each f fga) + (def (each f fga) (f#each (g#each f) fga)))) diff --git a/stdlib/source/library/lux/abstract/hash.lux b/stdlib/source/library/lux/abstract/hash.lux index 31a8d24b7..ef5df6022 100644 --- a/stdlib/source/library/lux/abstract/hash.lux +++ b/stdlib/source/library/lux/abstract/hash.lux @@ -13,14 +13,14 @@ (is (-> a Nat) hash))) -(def: .public functor +(def .public functor (contravariant.Functor Hash) (implementation - (def: (each f super) + (def (each f super) (implementation - (def: equivalence + (def equivalence (at equivalence.functor each f (at super equivalence))) - (def: hash + (def hash (|>> f (at super hash))))))) diff --git a/stdlib/source/library/lux/abstract/interval.lux b/stdlib/source/library/lux/abstract/interval.lux index 9f4a4a6ec..0a538e925 100644 --- a/stdlib/source/library/lux/abstract/interval.lux +++ b/stdlib/source/library/lux/abstract/interval.lux @@ -18,22 +18,22 @@ (is a top))) -(def: .public (between enum bottom top) +(def .public (between enum bottom top) (All (_ a) (-> (Enum a) a a (Interval a))) (implementation - (def: enum enum) - (def: bottom bottom) - (def: top top))) + (def enum enum) + (def bottom bottom) + (def top top))) -(def: .public (singleton enum elem) +(def .public (singleton enum elem) (All (_ a) (-> (Enum a) a (Interval a))) (implementation - (def: enum enum) - (def: bottom elem) - (def: top elem))) + (def enum enum) + (def bottom elem) + (def top elem))) (with_template [ ] - [(def: .public ( interval) + [(def .public ( interval) (All (_ a) (-> (Interval a) Bit)) (let [(open ",#[0]") interval] ( ,#bottom ,#top)))] @@ -43,7 +43,7 @@ [singleton? ,#=] ) -(def: .public (within? interval elem) +(def .public (within? interval elem) (All (_ a) (-> (Interval a) a Bit)) (let [(open ",#[0]") interval] (cond (inner? interval) @@ -59,7 +59,7 @@ (,#= ,#top elem))))) (with_template [ ] - [(def: .public ( elem interval) + [(def .public ( elem interval) (All (_ a) (-> a (Interval a) Bit)) (let [(open "[0]") interval] (= elem)))] @@ -68,45 +68,45 @@ [ends_with? top] ) -(def: .public (borders? interval elem) +(def .public (borders? interval elem) (All (_ a) (-> (Interval a) a Bit)) (or (starts_with? elem interval) (ends_with? elem interval))) -(def: .public (union left right) +(def .public (union left right) (All (_ a) (-> (Interval a) (Interval a) (Interval a))) (implementation - (def: enum (the enum right)) - (def: bottom (order.min (at right order) (at left bottom) (at right bottom))) - (def: top (order.max (at right order) (at left top) (at right top))))) + (def enum (the enum right)) + (def bottom (order.min (at right order) (at left bottom) (at right bottom))) + (def top (order.max (at right order) (at left top) (at right top))))) -(def: .public (intersection left right) +(def .public (intersection left right) (All (_ a) (-> (Interval a) (Interval a) (Interval a))) (implementation - (def: enum (the enum right)) - (def: bottom (order.max (at right order) (at left bottom) (at right bottom))) - (def: top (order.min (at right order) (at left top) (at right top))))) + (def enum (the enum right)) + (def bottom (order.max (at right order) (at left bottom) (at right bottom))) + (def top (order.min (at right order) (at left top) (at right top))))) -(def: .public (complement interval) +(def .public (complement interval) (All (_ a) (-> (Interval a) (Interval a))) (implementation - (def: enum (the enum interval)) - (def: bottom (at interval succ (at interval top))) - (def: top (at interval pred (at interval bottom))))) + (def enum (the enum interval)) + (def bottom (at interval succ (at interval top))) + (def top (at interval pred (at interval bottom))))) -(def: .public (precedes? reference sample) +(def .public (precedes? reference sample) (All (_ a) (-> (Interval a) (Interval a) Bit)) (let [(open "[0]") reference limit (at reference bottom)] (and (< limit (at sample bottom)) (< limit (at sample top))))) -(def: .public (succeeds? reference sample) +(def .public (succeeds? reference sample) (All (_ a) (-> (Interval a) (Interval a) Bit)) (precedes? sample reference)) (with_template [ ] - [(def: .public ( reference sample) + [(def .public ( reference sample) (All (_ a) (-> a (Interval a) Bit)) (let [(open ",#[0]") sample] (and ( reference ,#bottom) @@ -116,20 +116,20 @@ [after? (order.> ,#order)] ) -(def: .public (meets? reference sample) +(def .public (meets? reference sample) (All (_ a) (-> (Interval a) (Interval a) Bit)) (let [(open ",#[0]") reference limit (at reference bottom)] (and (,#= limit (at sample top)) (order.<= ,#order limit (at sample bottom))))) -(def: .public (touches? reference sample) +(def .public (touches? reference sample) (All (_ a) (-> (Interval a) (Interval a) Bit)) (or (meets? reference sample) (meets? sample reference))) (with_template [ ] - [(def: .public ( reference sample) + [(def .public ( reference sample) (All (_ a) (-> (Interval a) (Interval a) Bit)) (let [(open ",#[0]") reference] (and (,#= (at reference ) @@ -142,15 +142,15 @@ [finishes? ,#top order.>= ,#bottom] ) -(def: .public equivalence +(def .public equivalence (All (_ a) (Equivalence (Interval a))) (implementation - (def: (= reference sample) + (def (= reference sample) (let [(open ",#[0]") reference] (and (,#= ,#bottom (at sample bottom)) (,#= ,#top (at sample top))))))) -(def: .public (nested? reference sample) +(def .public (nested? reference sample) (All (_ a) (-> (Interval a) (Interval a) Bit)) (cond (or (singleton? sample) (and (inner? reference) (inner? sample)) @@ -171,7 +171,7 @@ (order.<= ,#order (at reference top) (at sample top))))) )) -(def: .public (overlaps? reference sample) +(def .public (overlaps? reference sample) (All (_ a) (-> (Interval a) (Interval a) Bit)) (let [(open ",#[0]") reference] (and (not (at ..equivalence = reference sample)) diff --git a/stdlib/source/library/lux/abstract/mix.lux b/stdlib/source/library/lux/abstract/mix.lux index 3dc3ecc71..ea317146b 100644 --- a/stdlib/source/library/lux/abstract/mix.lux +++ b/stdlib/source/library/lux/abstract/mix.lux @@ -10,7 +10,7 @@ (-> (-> b a a) a (F b) a)) mix))) -(def: .public (with_monoid monoid mix value) +(def .public (with_monoid monoid mix value) (All (_ F a) (-> (Monoid a) (Mix F) (F a) a)) (let [(open "/#[0]") monoid] diff --git a/stdlib/source/library/lux/abstract/monad.lux b/stdlib/source/library/lux/abstract/monad.lux index 18c22027d..ecd4e1ac4 100644 --- a/stdlib/source/library/lux/abstract/monad.lux +++ b/stdlib/source/library/lux/abstract/monad.lux @@ -6,7 +6,7 @@ [// [functor (.only Functor)]]) -(def: (list#mix f init xs) +(def (list#mix f init xs) (All (_ a b) (-> (-> b a a) a (List b) a)) (case xs @@ -16,7 +16,7 @@ {.#Item x xs'} (list#mix f (f x init) xs'))) -(def: (list#size xs) +(def (list#size xs) (All (_ a) (-> (List a) Nat)) (loop (again [counter 0 xs xs]) @@ -27,14 +27,14 @@ {.#Item _ xs'} (again (++ counter) xs')))) -(def: (reversed xs) +(def (reversed xs) (All (_ a) (-> (List a) (List a))) (list#mix (function (_ head tail) {.#Item head tail}) {.#End} xs)) -(def: (pairs xs) +(def (pairs xs) (All (_ a) (-> (List a) (List [a a]))) (case xs {.#Item x1 {.#Item x2 xs'}} @@ -54,7 +54,7 @@ (-> (m (m a)) (m a))) conjoint))) -(def: .public do +(def .public do (macro (_ tokens state) (case (is (Maybe [(Maybe Text) Code (List Code) Code]) (case tokens @@ -107,14 +107,14 @@ {.#None} {.#Left "Wrong syntax for 'do'"}))) -(def: .public (then monad f) +(def .public (then monad f) (All (_ ! a b) (-> (Monad !) (-> a (! b)) (-> (! a) (! b)))) (|>> (at monad each f) (at monad conjoint))) -(def: .public (all monad) +(def .public (all monad) (All (_ ! a) (-> (Monad !) (List (! a)) (! (List a)))) @@ -130,7 +130,7 @@ (!#each (|>> {.#Item _x}) (again xs')))) !#conjoint))))) -(def: .public (each monad f) +(def .public (each monad f) (All (_ M a b) (-> (Monad M) (-> a (M b)) (List a) (M (List b)))) @@ -146,7 +146,7 @@ (!#each (|>> {.#Item _x}) (again xs')))) !#conjoint))))) -(def: .public (only monad f) +(def .public (only monad f) (All (_ ! a b) (-> (Monad !) (-> a (! Bit)) (List a) (! (List a)))) @@ -166,7 +166,7 @@ (again xs')))) !#conjoint))))) -(def: .public (mix monad f init xs) +(def .public (mix monad f init xs) (All (_ M a b) (-> (Monad M) (-> b a (M a)) a (List b) (M a))) diff --git a/stdlib/source/library/lux/abstract/monad/free.lux b/stdlib/source/library/lux/abstract/monad/free.lux index af3436ab4..f4e440054 100644 --- a/stdlib/source/library/lux/abstract/monad/free.lux +++ b/stdlib/source/library/lux/abstract/monad/free.lux @@ -11,10 +11,10 @@ {#Pure a} {#Effect (F (Free F a))})) -(def: .public (functor dsl) +(def .public (functor dsl) (All (_ F) (-> (Functor F) (Functor (Free F)))) (implementation - (def: (each f ea) + (def (each f ea) (case ea {#Pure a} {#Pure (f a)} @@ -22,13 +22,13 @@ {#Effect value} {#Effect (at dsl each (each f) value)})))) -(def: .public (apply dsl) +(def .public (apply dsl) (All (_ F) (-> (Functor F) (Apply (Free F)))) (implementation - (def: functor + (def functor (..functor dsl)) - (def: (on ea ef) + (def (on ea ef) (case [ef ea] [{#Pure f} {#Pure a}] {#Pure (f a)} @@ -42,15 +42,15 @@ {#Effect (at dsl each (on ea) ff)} )))) -(def: .public (monad dsl) +(def .public (monad dsl) (All (_ F) (-> (Functor F) (Monad (Free F)))) (implementation - (def: functor (..functor dsl)) + (def functor (..functor dsl)) - (def: (in a) + (def (in a) {#Pure a}) - (def: (conjoint efefa) + (def (conjoint efefa) (case efefa {#Pure efa} (case efa diff --git a/stdlib/source/library/lux/abstract/monad/indexed.lux b/stdlib/source/library/lux/abstract/monad/indexed.lux index f1d774637..30d3b403f 100644 --- a/stdlib/source/library/lux/abstract/monad/indexed.lux +++ b/stdlib/source/library/lux/abstract/monad/indexed.lux @@ -27,7 +27,7 @@ (type: Binding [Code Code]) -(def: binding +(def binding (Parser Binding) (<>.and .any .any)) @@ -36,24 +36,24 @@ {#Macro Symbol Code} {#Binding Binding})) -(def: global +(def global (Parser Symbol) (//.do <>.monad [[module short] .symbol _ (<>.assertion "" (case module "" false _ true))] (in [module short]))) -(def: context +(def context (Parser Context) (<>.or (<>.and ..global .any) binding)) -(def: (pair_list [binding value]) +(def (pair_list [binding value]) (All (_ a) (-> [a a] (List a))) (list binding value)) -(def: named_monad +(def named_monad (Parser [(Maybe Text) Code]) (<>.either (.tuple (<>.and (at <>.monad each (|>> {.#Some}) .local) @@ -61,7 +61,7 @@ (at <>.monad each (|>> [{.#None}]) .any))) -(def: .public do +(def .public do (syntax (_ [[?name monad] ..named_monad context (.tuple (<>.some context)) expression .any]) diff --git a/stdlib/source/library/lux/abstract/monoid.lux b/stdlib/source/library/lux/abstract/monoid.lux index a93d844a8..f5afe510a 100644 --- a/stdlib/source/library/lux/abstract/monoid.lux +++ b/stdlib/source/library/lux/abstract/monoid.lux @@ -9,13 +9,13 @@ (is (-> a a a) composite))) -(def: .public (and left right) +(def .public (and left right) (All (_ l r) (-> (Monoid l) (Monoid r) (Monoid [l r]))) (implementation - (def: identity + (def identity [(at left identity) (at right identity)]) - (def: (composite [lL rL] [lR rR]) + (def (composite [lL rL] [lR rR]) [(at left composite lL lR) (at right composite rL rR)]))) diff --git a/stdlib/source/library/lux/abstract/order.lux b/stdlib/source/library/lux/abstract/order.lux index e8dfbc834..71e546ed4 100644 --- a/stdlib/source/library/lux/abstract/order.lux +++ b/stdlib/source/library/lux/abstract/order.lux @@ -19,16 +19,16 @@ (type: .public (Comparison a) (-> (Order a) a a Bit)) -(def: .public (<= order parameter subject) +(def .public (<= order parameter subject) Comparison (or (at order < parameter subject) (at order = parameter subject))) -(def: .public (> order parameter subject) +(def .public (> order parameter subject) Comparison (at order < subject parameter)) -(def: .public (>= order parameter subject) +(def .public (>= order parameter subject) Comparison (or (at order < subject parameter) (at order = subject parameter))) @@ -36,21 +36,21 @@ (type: .public (Choice a) (-> (Order a) a a a)) -(def: .public (min order x y) +(def .public (min order x y) Choice (if (at order < y x) x y)) -(def: .public (max order x y) +(def .public (max order x y) Choice (if (at order < y x) y x)) -(def: .public functor +(def .public functor (contravariant.Functor Order) (implementation - (def: (each f order) + (def (each f order) (implementation - (def: equivalence + (def equivalence (at equivalence.functor each f (at order equivalence))) - (def: (< reference sample) + (def (< reference sample) (at order < (f reference) (f sample))))))) diff --git a/stdlib/source/library/lux/abstract/predicate.lux b/stdlib/source/library/lux/abstract/predicate.lux index 61a2bb41c..8becf51cd 100644 --- a/stdlib/source/library/lux/abstract/predicate.lux +++ b/stdlib/source/library/lux/abstract/predicate.lux @@ -12,11 +12,11 @@ (-> a Bit)) (with_template [ ] - [(def: .public + [(def .public Predicate (function.constant )) - (def: .public ( left right) + (def .public ( left right) (All (_ a) (-> (Predicate a) (Predicate a) (Predicate a))) (function (_ value) ( (left value) @@ -27,35 +27,35 @@ ) (with_template [ ] - [(def: .public + [(def .public (All (_ a) (Monoid (Predicate a))) (implementation - (def: identity ) - (def: composite )))] + (def identity ) + (def composite )))] [union ..none ..or] [intersection ..all ..and] ) -(def: .public (complement predicate) +(def .public (complement predicate) (All (_ a) (-> (Predicate a) (Predicate a))) (|>> predicate not)) -(def: .public (difference sub base) +(def .public (difference sub base) (All (_ a) (-> (Predicate a) (Predicate a) (Predicate a))) (function (_ value) (.and (base value) (not (sub value))))) -(def: .public (rec predicate) +(def .public (rec predicate) (All (_ a) (-> (-> (Predicate a) (Predicate a)) (Predicate a))) (function (again input) (predicate again input))) -(def: .public functor +(def .public functor (contravariant.Functor Predicate) (implementation - (def: (each f fb) + (def (each f fb) (|>> f fb)))) diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux index 4661a546e..2fe9f788f 100644 --- a/stdlib/source/library/lux/control/concatenative.lux +++ b/stdlib/source/library/lux/control/concatenative.lux @@ -32,29 +32,29 @@ [#bottom (Maybe Code) #top (List Code)])) -(def: top +(def top (Parser (List Code)) (.tuple (<>.some .any))) -(def: bottom +(def bottom (Parser Code) (.not ..top)) -(def: stack +(def stack (Parser Stack) (<>.either (<>.and (<>.maybe bottom) ..top) (<>.and (<>#each (|>> {.#Some}) bottom) (<>#in (list))))) -(def: (stack_type tops bottom) +(def (stack_type tops bottom) (-> (List Code) Code Code) (list#mix (function (_ top bottom) (` [(~ bottom) (~ top)])) bottom tops)) -(def: .public => +(def .public => (syntax (_ [inputs stack outputs stack]) (with_symbols [g!_ common_bottom] @@ -70,14 +70,14 @@ (` (-> (~ input_stack) (~ output_stack)))))))))) -(def: .public (value it) +(def .public (value it) (All (_ ,,, a) (-> (=> [] ,,, [a]) a)) (|> [] it product.right)) -(def: .public apply +(def .public apply (syntax (_ [arity (<>.only (n.> 0) .nat)]) (with_symbols [g!_ g!func g!stack g!output] (monad.do [! meta.monad] @@ -90,65 +90,65 @@ [(~ g!stack) ((~ g!func) (~+ g!inputs))])))))))))) (with_template [] - [(`` (def: .public (~~ (template.symbol ["apply_" ])) + [(`` (def .public (~~ (template.symbol ["apply_" ])) (..apply )))] [1] [2] [3] [4] [5] [6] [7] [8] ) -(def: .public (push x) +(def .public (push x) (All (_ a) (-> a (=> [] [a]))) (function (_ stack) [stack x])) -(def: .public drop +(def .public drop (All (_ t) (=> [t] [])) (function (_ [stack top]) stack)) -(def: .public nip +(def .public nip (All (_ _ a) (=> [_ a] [a])) (function (_ [[stack _] top]) [stack top])) -(def: .public dup +(def .public dup (All (_ a) (=> [a] [a a])) (function (_ [stack top]) [[stack top] top])) -(def: .public swap +(def .public swap (All (_ a b) (=> [a b] [b a])) (function (_ [[stack l] r]) [[stack r] l])) -(def: .public left_rotation +(def .public left_rotation (All (_ a b c) (=> [a b c] [b c a])) (function (_ [[[stack a] b] c]) [[[stack b] c] a])) -(def: .public right_rotation +(def .public right_rotation (All (_ a b c) (=> [a b c] [c a b])) (function (_ [[[stack a] b] c]) [[[stack c] a] b])) -(def: .public && +(def .public && (All (_ a b) (=> [a b] [(Tuple a b)])) (function (_ [[stack l] r]) [stack [l r]])) -(def: .public left +(def .public left (All (_ a b) (=> [a] [(Or a b)])) (function (_ [stack l]) [stack {0 #0 l}])) -(def: .public right +(def .public right (All (_ a b) (=> [b] [(Or a b)])) (function (_ [stack r]) [stack {0 #1 r}])) (with_template [ ] - [(`` (def: .public + [(`` (def .public (=> [ ] []) (function (_ [[stack subject] param]) [stack ( param subject)])))] @@ -198,7 +198,7 @@ [Frac Bit f/>= f.>=] ) -(def: .public if +(def .public if (All (_ ,,,0 ,,,1) (type.let [then (=> ,,,0 ,,,1) else (=> ,,,0 ,,,1)] @@ -209,7 +209,7 @@ (then stack) (else stack)))) -(def: .public call +(def .public call (All (_ ,,,0 ,,,1) (type.let [quote (=> ,,,0 ,,,1)] (=> ,,,0 [quote] @@ -217,7 +217,7 @@ (function (_ [stack quote]) (quote stack))) -(def: .public loop +(def .public loop (All (_ ,,,) (type.let [test (=> ,,, ,,, [Bit])] @@ -229,21 +229,21 @@ (loop [stack' pred]) stack')))) -(def: .public dip +(def .public dip (All (_ ,,, a) (=> ,,, [a (=> ,,, ,,,)] ,,, [a])) (function (_ [[stack a] quote]) [(quote stack) a])) -(def: .public dip_2 +(def .public dip_2 (All (_ ,,, a b) (=> ,,, [a b (=> ,,, ,,,)] ,,, [a b])) (function (_ [[[stack a] b] quote]) [[(quote stack) a] b])) -(def: .public do +(def .public do (All (_ ,,,0 ,,,1) (type.let [body (=> ,,,0 ,,,1) pred (=> ,,,1 ,,,0 [Bit])] @@ -252,7 +252,7 @@ (function (_ [[stack pred] body]) [[(body stack) pred] body])) -(def: .public while +(def .public while (All (_ ,,,0 ,,,1) (type.let [body (=> ,,,1 ,,,0) pred (=> ,,,0 ,,,1 [Bit])] @@ -264,21 +264,21 @@ (while [[(body stack') pred] body]) stack')))) -(def: .public compose +(def .public compose (All (_ ,,,0 ,,, ,,,1) (=> [(=> ,,,0 ,,,) (=> ,,, ,,,1)] [(=> ,,,0 ,,,1)])) (function (_ [[stack f] g]) [stack (|>> f g)])) -(def: .public partial +(def .public partial (All (_ ,,,0 ,,,1 a) (=> ,,,0 [a (=> ,,,0 [a] ,,,1)] ,,,0 [(=> ,,,0 ,,,1)])) (function (_ [[stack arg] quote]) [stack (|>> (push arg) quote)])) -(def: .public when +(def .public when (All (_ ,,,) (type.let [body (=> ,,, ,,,)] (=> ,,, [Bit body] @@ -288,7 +288,7 @@ (push ..drop) if)) -(def: .public ? +(def .public ? (All (_ a) (=> [Bit a a] [a])) (|>> left_rotation diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux index 40bc65ec2..e67bb3f2b 100644 --- a/stdlib/source/library/lux/control/concurrency/actor.lux +++ b/stdlib/source/library/lux/control/concurrency/actor.lux @@ -31,7 +31,7 @@ [(Rec Mailbox [(Async [( Actor s) Mailbox]) (Resolver [( Actor s) Mailbox])])])] - (these (def: (pending [read write]) + (these (def (pending [read write]) (All (_ a) (-> (Rec Mailbox [(Async [a Mailbox]) @@ -62,7 +62,7 @@ (type: .public (Behavior s) (-> (Mail s) s (Actor s) (Async (Try s)))) - (def: .public (spawn! behavior init) + (def .public (spawn! behavior init) (All (_ s) (-> (Behavior s) s (IO (Actor s)))) (io (let [self (sharing [s] (is (Behavior s) @@ -88,7 +88,7 @@ (again state' tail))))] self))) - (def: .public (alive? actor) + (def .public (alive? actor) (All (_ s) (-> (Actor s) (IO Bit))) (let [[obituary _] (the #obituary (representation actor))] (|> obituary @@ -101,18 +101,18 @@ _ bit.no)))))) - (def: .public (obituary' actor) + (def .public (obituary' actor) (All (_ s) (-> (Actor s) (IO (Maybe (Obituary s))))) (let [[obituary _] (the #obituary (representation actor))] (async.value obituary))) - (def: .public obituary + (def .public obituary (All (_ s) (-> (Actor s) (Async (Obituary s)))) (|>> representation (the #obituary) product.left)) - (def: .public (mail! mail actor) + (def .public (mail! mail actor) (All (_ s) (-> (Mail s) (Actor s) (IO (Try Any)))) (do [! io.monad] [alive? (..alive? actor)] @@ -140,7 +140,7 @@ (type: .public (Message s o) (-> s (Actor s) (Async (Try [s o])))) - (def: (mail message) + (def (mail message) (All (_ s o) (-> (Message s o) [(Async (Try o)) (Mail s)])) (let [[async resolve] (sharing [s o] (is (Message s o) @@ -163,7 +163,7 @@ (io.run! (resolve {try.#Failure error})) (async.resolved {try.#Failure error})))))])) - (def: .public (tell! message actor) + (def .public (tell! message actor) (All (_ s o) (-> (Message s o) (Actor s) (Async (Try o)))) (let [[async mail] (..mail message)] (do async.monad @@ -176,12 +176,12 @@ (in {try.#Failure error}))))) ))) -(def: .public default +(def .public default Behavior (function (_ mail state self) (mail state self))) -(def: .public (poison! actor) +(def .public (poison! actor) (All (_ s) (-> (Actor s) (IO (Try Any)))) (..mail! (function (_ state self) (async.resolved (exception.except ..poisoned []))) @@ -190,10 +190,10 @@ (type: .public Stop (IO Any)) -(def: continue! true) -(def: stop! false) +(def continue! true) +(def stop! false) -(def: .public (observe! action channel actor) +(def .public (observe! action channel actor) (All (_ r w s) (-> (-> r Stop (Mail s)) (Channel' r w) (Actor s) (IO Any))) (let [signal (is (Atom Bit) (atom.atom ..continue!)) diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux index 192c4e24c..11020adad 100644 --- a/stdlib/source/library/lux/control/concurrency/async.lux +++ b/stdlib/source/library/lux/control/concurrency/async.lux @@ -34,7 +34,7 @@ (-> w (IO Bit))) ... Sets an async's value if it has not been done yet. - (def: (resolver async) + (def (resolver async) (All (_ r w) (-> (Async' r w) (Resolver w))) (function (resolve value) (let [async (representation async)] @@ -54,23 +54,23 @@ (in #1)) (resolve value)))))))) - (def: .public (resolved value) + (def .public (resolved value) (All (_ a) (-> a (Async a))) (abstraction (atom [{.#Some (variance.write value)} (list)]))) - (def: .public (async _) + (def .public (async _) (All (_ r w) (-> Any [(Async' r w) (Resolver w)])) (let [async (abstraction (atom [{.#None} (list)]))] [async (..resolver async)])) - (def: .public value + (def .public value (All (_ r w) (-> (Async' r w) (IO (Maybe r)))) (|>> representation atom.read! (at io.functor each (|>> product.left (maybe#each (|>> variance.read)))))) - (def: .public (upon! f async) + (def .public (upon! f async) (All (_ r w) (-> (-> r (IO Any)) (Async' r w) (IO Any))) (do [! io.monad] [.let [async (representation async)] @@ -87,7 +87,7 @@ (upon! f (abstraction async))))))) ) -(def: .public resolved? +(def .public resolved? (All (_ r w) (-> (Async' r w) (IO Bit))) (|>> ..value (at io.functor each @@ -98,10 +98,10 @@ {.#Some _} #1))))) -(def: .public functor +(def .public functor (Functor Async) (implementation - (def: (each f fa) + (def (each f fa) (let [[fb resolve] (sharing [a b] (is (-> a b) f) @@ -111,12 +111,12 @@ (io.run! (..upon! (|>> f resolve) fa)) fb))))) -(def: .public apply +(def .public apply (Apply Async) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (on fa ff) + (def (on fa ff) (let [[fb resolve] (sharing [a b] (is (Async (-> a b)) ff) @@ -128,14 +128,14 @@ ff)) fb))))) -(def: .public monad +(def .public monad (Monad Async) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: in ..resolved) + (def in ..resolved) - (def: (conjoint mma) + (def (conjoint mma) (let [[ma resolve] (sharing [a] (is (Async (Async a)) mma) @@ -145,7 +145,7 @@ (io.run! (..upon! (..upon! resolve) mma)) ma))))) -(def: .public (and left right) +(def .public (and left right) (All (_ lr lw rr rw) (-> (Async' lr lw) (Async' rr rw) (Async [lr rr]))) (let [[read! write!] (sharing [lr lw rr rw] (is [(Async' lr lw) (Async' rr rw)] @@ -159,7 +159,7 @@ left))] read!)) -(def: .public (or left right) +(def .public (or left right) (All (_ lr lw rr rw) (-> (Async' lr lw) (Async' rr rw) (Async (Or lr rr)))) (let [[left|right resolve] (sharing [lr lw rr rw] (is [(Async' lr lw) (Async' rr rw)] @@ -177,7 +177,7 @@ left|right)))) -(def: .public (either left right) +(def .public (either left right) (All (_ a lw rw) (-> (Async' a lw) (Async' a rw) (Async a))) (let [[left||right resolve] (sharing [a lw rw] (is [(Async' a lw) (Async' a rw)] @@ -192,7 +192,7 @@ [right])) left||right)))) -(def: .public (schedule! milli_seconds computation) +(def .public (schedule! milli_seconds computation) (All (_ a) (-> Nat (IO a) (Async a))) (let [[!out resolve] (sharing [a] (is (IO a) @@ -207,19 +207,19 @@ io.run!) !out))) -(def: .public future +(def .public future (All (_ a) (-> (IO a) (Async a))) (..schedule! 0)) -(def: .public (after milli_seconds value) +(def .public (after milli_seconds value) (All (_ a) (-> Nat a (Async a))) (..schedule! milli_seconds (io value))) -(def: .public (delay milli_seconds) +(def .public (delay milli_seconds) (-> Nat (Async Any)) (..after milli_seconds [])) -(def: .public (within milli_seconds async) +(def .public (within milli_seconds async) (All (_ r w) (-> Nat (Async' r w) (Async (Maybe r)))) (..or (..delay milli_seconds) async)) diff --git a/stdlib/source/library/lux/control/concurrency/atom.lux b/stdlib/source/library/lux/control/concurrency/atom.lux index 86399e1a6..e98479e10 100644 --- a/stdlib/source/library/lux/control/concurrency/atom.lux +++ b/stdlib/source/library/lux/control/concurrency/atom.lux @@ -38,7 +38,7 @@ (type: .public (Atom a) (Atom'' (Mutable a a))) - (def: .public (atom value) + (def .public (atom value) (All (_ a) (-> a (Atom a))) (abstraction (with_expansions [ (as_expected (java/util/concurrent/atomic/AtomicReference::new value))] @@ -46,14 +46,14 @@ @.jvm (array.has! 0 (variance.write value) (array.empty 1)))))) - (def: .public (read! atom) + (def .public (read! atom) (All (_ r w) (-> (Atom' r w) (IO r))) (with_expansions [ (java/util/concurrent/atomic/AtomicReference::get (representation atom))] (io.io (for @.old (variance.read ) @.jvm (variance.read (array.item 0 (representation atom))))))) - (def: .public (compare_and_swap! current new atom) + (def .public (compare_and_swap! current new atom) (All (_ r w) (-> r w (Atom' r w) (IO Bit))) (io.io (for @.old (ffi.of_boolean (java/util/concurrent/atomic/AtomicReference::compareAndSet (variance.write @@ -73,7 +73,7 @@ false)))) ) -(def: .public (update! f atom) +(def .public (update! f atom) (All (_ r w) (-> (-> r w) (Atom' r w) (IO [r w]))) (loop (again [_ []]) (do io.monad @@ -84,7 +84,7 @@ (in [old new]) (again []))))) -(def: .public (write! value atom) +(def .public (write! value atom) (All (_ r w) (-> w (Atom' r w) (IO r))) (|> atom (..update! (function.constant value)) diff --git a/stdlib/source/library/lux/control/concurrency/frp.lux b/stdlib/source/library/lux/control/concurrency/frp.lux index 43aae713f..16ef2927c 100644 --- a/stdlib/source/library/lux/control/concurrency/frp.lux +++ b/stdlib/source/library/lux/control/concurrency/frp.lux @@ -35,13 +35,13 @@ (is (-> w (IO (Try Any))) feed))) -(def: (sink resolution) +(def (sink resolution) (All (_ a) (-> (async.Resolver (Maybe [(Mutable a a) (Channel a)])) (Sink a))) (let [sink (atom.atom resolution)] (implementation - (def: close + (def close (loop (again [_ []]) (do [! io.monad] [current (atom.read! sink) @@ -58,7 +58,7 @@ ... Someone else fed the sink while I was closing it. (again []))))))) - (def: (feed value) + (def (feed value) (loop (again [_ []]) (do [! io.monad] [current (atom.read! sink) @@ -83,27 +83,27 @@ ... Someone else fed the sink. (again [])))))))))) -(def: .public (channel _) +(def .public (channel _) (All (_ a) (-> Any [(Channel a) (Sink a)])) (let [[async resolve] (async.async [])] [async (..sink resolve)])) -(def: .public functor +(def .public functor (Functor Channel) (implementation - (def: (each f) + (def (each f) (async#each (maybe#each (function (_ [head tail]) [(variance.write (f (variance.read head))) (each f tail)])))))) -(def: .public apply +(def .public apply (Apply Channel) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (on fa ff) + (def (on fa ff) (do async.monad [item_f ff item_a fa] @@ -115,19 +115,19 @@ _ (in {.#None})))))) -(def: empty +(def empty Channel (async.resolved {.#None})) -(def: .public monad +(def .public monad (Monad Channel) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (in a) + (def (in a) (async.resolved {.#Some [(variance.write a) ..empty]})) - (def: (conjoint mma) + (def (conjoint mma) (let [[output sink] (sharing [a] (is (Channel (Channel a)) mma) @@ -161,7 +161,7 @@ (type: .public (Subscriber a) (-> a (IO (Maybe Any)))) -(def: .public (subscribe! subscriber channel) +(def .public (subscribe! subscriber channel) (All (_ r w) (-> (Subscriber r) (Channel' r w) (IO Any))) (io (exec (is (Async Any) @@ -181,7 +181,7 @@ (in []))))) []))) -(def: .public (only pass? channel) +(def .public (only pass? channel) (All (_ a) (-> (-> a Bit) (Channel a) (Channel a))) (do async.monad [item channel] @@ -195,13 +195,13 @@ {.#None} (in {.#None})))) -(def: .public (of_async async) +(def .public (of_async async) (All (_ a) (-> (Async a) (Channel a))) (async#each (function (_ value) {.#Some [(variance.write value) ..empty]}) async)) -(def: .public (mix f init channel) +(def .public (mix f init channel) (All (_ a b) (-> (-> b a (Async a)) a (Channel b) (Async a))) @@ -216,7 +216,7 @@ [init' (f (variance.read head) init)] (mix f init' tail))))) -(def: .public (mixes f init channel) +(def .public (mixes f init channel) (All (_ a b) (-> (-> b a (Async a)) a (Channel b) (Channel a))) @@ -234,7 +234,7 @@ [init' (f (variance.read head) init)] (mixes f init' tail)))))) -(def: .public (poll milli_seconds action) +(def .public (poll milli_seconds action) (All (_ a) (-> Nat (IO a) [(Channel a) (Sink a)])) (let [[output sink] (channel [])] @@ -246,11 +246,11 @@ (async.upon! again (async.delay milli_seconds))))) [output sink]))) -(def: .public (periodic milli_seconds) +(def .public (periodic milli_seconds) (-> Nat [(Channel Any) (Sink Any)]) (..poll milli_seconds (io []))) -(def: .public (iterations f init) +(def .public (iterations f init) (All (_ s o) (-> (-> s (Async (Maybe [s o]))) s (Channel o))) (do async.monad [?next (f init)] @@ -261,7 +261,7 @@ {.#None} {.#None})))) -(def: (distinct' equivalence previous channel) +(def (distinct' equivalence previous channel) (All (_ a) (-> (Equivalence a) a (Channel a) (Channel a))) (do async.monad [item channel] @@ -274,7 +274,7 @@ {.#None} (in {.#None})))) -(def: .public (distinct equivalence channel) +(def .public (distinct equivalence channel) (All (_ a) (-> (Equivalence a) (Channel a) (Channel a))) (do async.monad [item channel] @@ -285,7 +285,7 @@ {.#None} {.#None})))) -(def: .public (list channel) +(def .public (list channel) (All (_ a) (-> (Channel a) (Async (List a)))) (do [! async.monad] [item channel] @@ -297,7 +297,7 @@ {.#None} (in {.#End})))) -(def: .public (sequential milli_seconds values) +(def .public (sequential milli_seconds values) (All (_ a) (-> Nat (List a) (Channel a))) (case values {.#End} diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux index 5cf050d4b..fbfacf228 100644 --- a/stdlib/source/library/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux @@ -33,10 +33,10 @@ (primitive .public Semaphore (Atom State) - (def: most_positions_possible + (def most_positions_possible (.nat (at i.interval top))) - (def: .public (semaphore initial_open_positions) + (def .public (semaphore initial_open_positions) (-> Nat Semaphore) (let [max_positions (n.min initial_open_positions ..most_positions_possible)] @@ -44,7 +44,7 @@ #open_positions (.int max_positions) #waiting_list queue.empty])))) - (def: .public (wait! semaphore) + (def .public (wait! semaphore) (Ex (_ k) (-> Semaphore (Async Any))) (let [semaphore (representation semaphore) [signal sink] (is [(Async Any) (Resolver Any)] @@ -69,7 +69,7 @@ (exception.report "Max Positions" (%.nat max_positions))) - (def: .public (signal! semaphore) + (def .public (signal! semaphore) (Ex (_ k) (-> Semaphore (Async (Try Int)))) (let [semaphore (representation semaphore)] (async.future @@ -97,19 +97,19 @@ (primitive .public Mutex Semaphore - (def: .public (mutex _) + (def .public (mutex _) (-> Any Mutex) (abstraction (semaphore 1))) - (def: acquire! + (def acquire! (-> Mutex (Async Any)) (|>> representation ..wait!)) - (def: release! + (def release! (-> Mutex (Async (Try Int))) (|>> representation ..signal!)) - (def: .public (synchronize! mutex procedure) + (def .public (synchronize! mutex procedure) (All (_ a) (-> Mutex (IO (Async a)) (Async a))) (do async.monad [_ (..acquire! mutex) @@ -118,7 +118,7 @@ (in output))) ) -(def: .public limit +(def .public limit (refinement.refiner (n.> 0))) (type: .public Limit @@ -131,14 +131,14 @@ #start_turnstile Semaphore #end_turnstile Semaphore]) - (def: .public (barrier limit) + (def .public (barrier limit) (-> Limit Barrier) (abstraction [#limit limit #count (atom.atom 0) #start_turnstile (..semaphore 0) #end_turnstile (..semaphore 0)])) - (def: (un_block! times turnstile) + (def (un_block! times turnstile) (-> Nat Semaphore (Async Any)) (loop (again [step 0]) (if (n.< times step) @@ -148,7 +148,7 @@ (at async.monad in [])))) (with_template [ ] - [(def: ( barrier) + [(def ( barrier) (-> Barrier (Async Any)) (do async.monad [.let [barrier (representation barrier) @@ -164,7 +164,7 @@ [end! -- 0 #end_turnstile] ) - (def: .public (block! barrier) + (def .public (block! barrier) (-> Barrier (Async Any)) (do async.monad [_ (..start! barrier)] diff --git a/stdlib/source/library/lux/control/concurrency/stm.lux b/stdlib/source/library/lux/control/concurrency/stm.lux index 2a0ae3956..87dd101c9 100644 --- a/stdlib/source/library/lux/control/concurrency/stm.lux +++ b/stdlib/source/library/lux/control/concurrency/stm.lux @@ -35,15 +35,15 @@ (type: .public (Var a) (Var'' (Mutable a a))) - (def: .public (var value) + (def .public (var value) (All (_ a) (-> a (Var a))) (abstraction (atom.atom [(variance.write value) (list)]))) - (def: read! + (def read! (All (_ r w) (-> (Var' r w) r)) (|>> representation atom.read! io.run! product.left variance.read)) - (def: (write! new_value var) + (def (write! new_value var) (All (_ r w) (-> w (Var' r w) (IO Any))) (do [! io.monad] [.let [var' (representation var)] @@ -70,7 +70,7 @@ (in [])) (write! new_value var)))) - (def: .public (changes target) + (def .public (changes target) (All (_ a) (-> (Var a) (IO [(Channel a) (Sink a)]))) (do io.monad [.let [[channel sink] (sharing [a] @@ -80,8 +80,8 @@ (frp.channel [])))] _ (atom.update! (function (_ [value observers]) [value {.#Item (implementation - (def: close (at sink close)) - (def: feed (|>> variance.read (at sink feed)))) + (def close (at sink close)) + (def feed (|>> variance.read (at sink feed)))) observers}]) (representation target))] (in [channel sink]))) @@ -99,7 +99,7 @@ (type: .public (STM a) (-> Tx [Tx a])) -(def: (var_value var tx) +(def (var_value var tx) (All (_ r w) (-> (Var' r w) Tx (Maybe r))) (|> tx (list.example (function (_ [_var _original _current]) @@ -109,7 +109,7 @@ _current)) as_expected)) -(def: .public (read var) +(def .public (read var) (All (_ r w) (-> (Var' r w) (STM r))) (function (_ tx) (case (var_value var tx) @@ -124,7 +124,7 @@ tx} value])))) -(def: (with_updated_var var value tx) +(def (with_updated_var var value tx) (All (_ r w) (-> (Var' r w) w Tx Tx)) (case tx {.#End} @@ -142,7 +142,7 @@ #current _current] (with_updated_var var value tx')}))) -(def: .public (write value var) +(def .public (write value var) (All (_ r w) (-> w (Var' r w) (STM Any))) (function (_ tx) (case (var_value var tx) @@ -157,40 +157,40 @@ tx} []]))) -(def: .public functor +(def .public functor (Functor STM) (implementation - (def: (each f fa) + (def (each f fa) (function (_ tx) (let [[tx' a] (fa tx)] [tx' (f a)]))))) -(def: .public apply +(def .public apply (Apply STM) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (on fa ff) + (def (on fa ff) (function (_ tx) (let [[tx' f] (ff tx) [tx'' a] (fa tx')] [tx'' (f a)]))))) -(def: .public monad +(def .public monad (Monad STM) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (in a) + (def (in a) (function (_ tx) [tx a])) - (def: (conjoint mma) + (def (conjoint mma) (function (_ tx) (let [[tx' ma] (mma tx)] (ma tx')))))) -(def: .public (update f var) +(def .public (update f var) (All (_ r w) (-> (-> r w) (Var' r w) (STM [r w]))) (do ..monad [before (..read var) @@ -198,36 +198,36 @@ _ (..write after var)] (in [before after]))) -(def: (can_commit? tx) +(def (can_commit? tx) (-> Tx Bit) (list.every? (function (_ [_var _original _current]) (same? _original (..read! _var))) tx)) -(def: (commit_var! [_var _original _current]) +(def (commit_var! [_var _original _current]) (-> (Ex (_ r w) (Tx_Frame r w)) (IO Any)) (if (same? (as Any _original) (as Any _current)) (io []) (..write! _current _var))) -(def: fresh_tx Tx (list)) +(def fresh_tx Tx (list)) (type: (Commit a) [(STM a) (Async a) (Resolver a)]) -(def: pending_commits +(def pending_commits (Atom (Rec Commits [(Async [(Ex (_ a) (Commit a)) Commits]) (Resolver [(Ex (_ a) (Commit a)) Commits])])) (atom (async.async []))) -(def: commit_processor_flag +(def commit_processor_flag (Atom Bit) (atom #0)) -(def: (issue_commit! commit) +(def (issue_commit! commit) (All (_ a) (-> (Commit a) (IO Any))) (let [entry [commit (async.async [])]] (do [! io.monad] @@ -246,7 +246,7 @@ {.#Some [head tail]} (again tail))))))) -(def: (process_commit! commit) +(def (process_commit! commit) (All (_ a) (-> (Commit a) (IO Any))) (let [[stm_proc output resolve] commit [finished_tx value] (stm_proc fresh_tx)] @@ -256,7 +256,7 @@ (resolve value)) (..issue_commit! commit)))) -(def: start_commit_processor! +(def start_commit_processor! (IO Any) (do [! io.monad] [flag (atom.read! commit_processor_flag)] @@ -275,7 +275,7 @@ (in []))) ))) -(def: .public (commit! stm_proc) +(def .public (commit! stm_proc) (All (_ a) (-> (STM a) (Async a))) (let [[output resolver] (async.async [])] (exec diff --git a/stdlib/source/library/lux/control/concurrency/thread.lux b/stdlib/source/library/lux/control/concurrency/thread.lux index 4428f9daa..030e0c053 100644 --- a/stdlib/source/library/lux/control/concurrency/thread.lux +++ b/stdlib/source/library/lux/control/concurrency/thread.lux @@ -73,7 +73,7 @@ #action (IO Any)])) )) -(def: .public parallelism +(def .public parallelism Nat (with_expansions [ 1 (<| (configuration.for ["lua_compiler?" ""] @@ -88,7 +88,7 @@ ... Default ))) -(with_expansions [ (these (def: runner +(with_expansions [ (these (def runner java/util/concurrent/ScheduledThreadPoolExecutor (|> ..parallelism .int @@ -100,14 +100,14 @@ @.python (these) ... Default - (these (def: started? + (these (def started? (Atom Bit) (atom.atom false)) - (def: runner + (def runner (Atom (List Thread)) (atom.atom (list)))))) -(def: (execute! action) +(def (execute! action) (-> (IO Any) Any) (case (try (io.run! action)) {try.#Failure error} @@ -120,7 +120,7 @@ {try.#Success _} [])) -(def: .public (schedule! milli_seconds action) +(def .public (schedule! milli_seconds action) (-> Nat (IO Any) (IO Any)) (with_expansions [ (let [runnable (ffi.object [] [java/lang/Runnable] [] @@ -163,7 +163,7 @@ ... https://en.wikipedia.org/wiki/Event_loop ... Starts the event-loop. - (def: .public run! + (def .public run! (IO Any) (do [! io.monad] [started? (atom.read! ..started?)] diff --git a/stdlib/source/library/lux/control/continuation.lux b/stdlib/source/library/lux/control/continuation.lux index 3cbd80b92..5c3ac3e9c 100644 --- a/stdlib/source/library/lux/control/continuation.lux +++ b/stdlib/source/library/lux/control/continuation.lux @@ -16,15 +16,15 @@ (type: .public (Cont i o) (-> (-> i o) o)) -(def: .public (continued next cont) +(def .public (continued next cont) (All (_ i o) (-> (-> i o) (Cont i o) o)) (cont next)) -(def: .public result +(def .public result (All (_ a) (-> (Cont a a) a)) (..continued function.identity)) -(def: .public (with_current f) +(def .public (with_current f) (All (_ a b z) (-> (-> (-> a (Cont b z)) (Cont a z)) @@ -33,17 +33,17 @@ (f (function (_ a) (function (_ _) (k a))) k))) -(def: .public pending +(def .public pending (syntax (_ [expr .any]) (with_symbols [g!_ g!k] (in (list (` (.function ((~ g!_) (~ g!k)) ((~ g!k) (~ expr))))))))) -(def: .public (reset scope) +(def .public (reset scope) (All (_ i o) (-> (Cont i i) (Cont i o))) (function (_ k) (k (result scope)))) -(def: .public (shift f) +(def .public (shift f) (All (_ a) (-> (-> (-> a (Cont a a)) (Cont a a)) @@ -52,37 +52,37 @@ (f (function (_ a) (function (_ ic) (ic (oc a)))) function.identity))) -(def: .public functor +(def .public functor (All (_ o) (Functor (All (_ i) (Cont i o)))) (implementation - (def: (each f fv) + (def (each f fv) (function (_ k) (fv (function.composite k f)))))) -(def: .public apply +(def .public apply (All (_ o) (Apply (All (_ i) (Cont i o)))) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (on fv ff) + (def (on fv ff) (function (_ k) (|> (k (f v)) (function (_ v)) fv (function (_ f)) ff))))) -(def: .public monad +(def .public monad (All (_ o) (Monad (All (_ i) (Cont i o)))) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (in value) + (def (in value) (function (_ k) (k value))) - (def: (conjoint ffa) + (def (conjoint ffa) (function (_ k) (ffa (continued k)))))) -(def: .public (portal init) +(def .public (portal init) (All (_ i o z) (-> i (Cont [(-> i (Cont o z)) diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux index 81e46e66d..f80419c98 100644 --- a/stdlib/source/library/lux/control/exception.lux +++ b/stdlib/source/library/lux/control/exception.lux @@ -31,11 +31,11 @@ [#label Text #constructor (-> a Text)])) -(def: .public (match? exception error) +(def .public (match? exception error) (All (_ e) (-> (Exception e) Text Bit)) (text.starts_with? (the #label exception) error)) -(def: .public (when exception then try) +(def .public (when exception then try) (All (_ e a) (-> (Exception e) (-> Text a) (Try a) (Try a))) @@ -52,7 +52,7 @@ then)} {//.#Failure error})))) -(def: .public (otherwise else try) +(def .public (otherwise else try) (All (_ a) (-> (-> Text a) (Try a) a)) (case try @@ -62,21 +62,21 @@ {//.#Failure error} (else error))) -(def: .public (error exception message) +(def .public (error exception message) (All (_ e) (-> (Exception e) e Text)) ((the ..#constructor exception) message)) -(def: .public (except exception message) +(def .public (except exception message) (All (_ e a) (-> (Exception e) e (Try a))) {//.#Failure (..error exception message)}) -(def: .public (assertion exception message test) +(def .public (assertion exception message test) (All (_ e) (-> (Exception e) e Bit (Try Any))) (if test {//.#Success []} (..except exception message))) -(def: exception +(def exception (Parser [Code (List |type_variable|.Variable) [Text (List |input|.Input)] (Maybe Code)]) (let [private (is (Parser [(List |type_variable|.Variable) [Text (List |input|.Input)] (Maybe Code)]) (all <>.and @@ -90,14 +90,14 @@ (<>.and (<>#in (` .private)) private) ))) -(def: .public exception: +(def .public exception: (syntax (_ [[export_policy t_vars [name inputs] body] ..exception]) (macro.with_symbols [g!_ g!descriptor] (do meta.monad [current_module meta.current_module_name .let [descriptor (all text#composite "{" current_module "." name "}" text.new_line) g!self (code.local name)]] - (in (list (` (def: (~ export_policy) + (in (list (` (def (~ export_policy) (~ g!self) (All ((~ g!_) (~+ (list#each |type_variable|.format t_vars))) (..Exception [(~+ (list#each (the |input|.#type) inputs))])) @@ -107,7 +107,7 @@ ((~! text#composite) (~ g!descriptor) (~ (maybe.else (' "") body))))]))))))))) -(def: (report' entries) +(def (report' entries) (-> (List [Text Text]) Text) (let [header_separator ": " largest_header_size (list#mix (function (_ [header _] max) @@ -138,13 +138,13 @@ (on_entry head) tail)))) -(def: .public report +(def .public report (syntax (_ [entries (<>.many (<>.and .any .any))]) (in (list (` ((~! ..report') (list (~+ (|> entries (list#each (function (_ [header message]) (` [(~ header) (~ message)])))))))))))) -(def: .public (listing format entries) +(def .public (listing format entries) (All (_ a) (-> (-> a Text) (List a) Text)) (|> entries @@ -157,7 +157,7 @@ list.reversed ..report')) -(def: separator +(def separator (let [gap (all "lux text concat" text.new_line text.new_line) horizontal_line (|> "-" (list.repeated 64) text.together)] (all "lux text concat" @@ -165,14 +165,14 @@ horizontal_line gap))) -(def: (decorated prelude error) +(def (decorated prelude error) (-> Text Text Text) (all "lux text concat" prelude ..separator error)) -(def: .public (with exception message computation) +(def .public (with exception message computation) (All (_ e a) (-> (Exception e) e (Try a) (Try a))) (case computation {//.#Failure error} diff --git a/stdlib/source/library/lux/control/function.lux b/stdlib/source/library/lux/control/function.lux index 15cd56f93..bbf4969b3 100644 --- a/stdlib/source/library/lux/control/function.lux +++ b/stdlib/source/library/lux/control/function.lux @@ -4,31 +4,31 @@ [abstract [monoid (.only Monoid)]]]]) -(def: .public identity +(def .public identity (All (_ a) (-> a a)) (|>>)) -(def: .public (composite f g) +(def .public (composite f g) (All (_ a b c) (-> (-> b c) (-> a b) (-> a c))) (|>> g f)) -(def: .public (constant value) +(def .public (constant value) (All (_ o) (-> o (All (_ i) (-> i o)))) (function (_ _) value)) -(def: .public (flipped f) +(def .public (flipped f) (All (_ a b c) (-> (-> a b c) (-> b a c))) (function (_ x y) (f y x))) -(def: .public (on input function) +(def .public (on input function) (All (_ i o) (-> i (-> i o) o)) (function input)) -(def: .public monoid +(def .public monoid (All (_ a) (Monoid (-> a a))) (implementation - (def: identity ..identity) - (def: composite ..composite))) + (def identity ..identity) + (def composite ..composite))) diff --git a/stdlib/source/library/lux/control/function/contract.lux b/stdlib/source/library/lux/control/function/contract.lux index 753a90460..4bae3020d 100644 --- a/stdlib/source/library/lux/control/function/contract.lux +++ b/stdlib/source/library/lux/control/function/contract.lux @@ -24,13 +24,13 @@ [post_condition_failed] ) -(def: (assert! message test) +(def (assert! message test) (-> Text Bit []) (if test [] (panic! message))) -(def: .public pre +(def .public pre (syntax (_ [test .any expr .any]) (in (list (` (exec @@ -38,7 +38,7 @@ (~ test)) (~ expr))))))) -(def: .public post +(def .public post (syntax (_ [test .any expr .any]) (with_symbols [g!output] diff --git a/stdlib/source/library/lux/control/function/inline.lux b/stdlib/source/library/lux/control/function/inline.lux index e171f1f87..9481dd27c 100644 --- a/stdlib/source/library/lux/control/function/inline.lux +++ b/stdlib/source/library/lux/control/function/inline.lux @@ -15,11 +15,11 @@ [syntax (.only syntax) ["|[0]|" export]]]]]) -(def: declaration +(def declaration (Parser [Text (List Code)]) (.form (<>.and .local (<>.some .any)))) -(def: inline +(def inline (Parser [Code [Text (List Code)] Code Code]) (|export|.parser (all <>.and @@ -28,7 +28,7 @@ .any ))) -(def: .public inline: +(def .public inlined (syntax (_ [[privacy [name parameters] type term] ..inline]) (do [! meta.monad] [@ meta.current_module_name @@ -47,6 +47,6 @@ (list#each (function (_ parameter) (list parameter (` (~! .any))))) list#conjoint)]] - (in (list (` (def: (~ privacy) (~ (code.local name)) + (in (list (` (def (~ privacy) (~ (code.local name)) ((~! syntax) ((~ (code.local name)) [(~+ g!parameters)]) (.at (~! meta.monad) (~' in) (.list (.`' (~ inlined)))))))))))) diff --git a/stdlib/source/library/lux/control/function/memo.lux b/stdlib/source/library/lux/control/function/memo.lux index 47ed679d5..60c464887 100644 --- a/stdlib/source/library/lux/control/function/memo.lux +++ b/stdlib/source/library/lux/control/function/memo.lux @@ -17,7 +17,7 @@ ["[0]" // ["[1]" mixin (.only Mixin Recursive)]]) -(def: .public memoization +(def .public memoization (All (_ i o) (Mixin i (State (Dictionary i o) o))) (function (_ delegate recur) @@ -37,7 +37,7 @@ (type: .public (Memo i o) (Recursive i (State (Dictionary i o) o))) -(def: .public (open memo) +(def .public (open memo) (All (_ i o) (type.let [Memory (Dictionary i o)] (-> (Memo i o) (-> [Memory i] [Memory o])))) @@ -45,14 +45,14 @@ (function (_ [memory input]) (|> input memo (state.result memory))))) -(def: .public (closed hash memo) +(def .public (closed hash memo) (All (_ i o) (-> (Hash i) (Memo i o) (-> i o))) (let [memo (//.fixed (//.mixed ..memoization (//.of_recursive memo))) empty (dictionary.empty hash)] (|>> memo (state.result empty) product.right))) -(def: .public (none hash memo) +(def .public (none hash memo) (All (_ i o) (-> (Hash i) (Memo i o) (-> i o))) (let [memo (//.fixed (//.of_recursive memo)) diff --git a/stdlib/source/library/lux/control/function/mixin.lux b/stdlib/source/library/lux/control/function/mixin.lux index d23e86e04..44796c733 100644 --- a/stdlib/source/library/lux/control/function/mixin.lux +++ b/stdlib/source/library/lux/control/function/mixin.lux @@ -12,42 +12,42 @@ (type: .public (Mixin i o) (-> (-> i o) (-> i o) (-> i o))) -(def: .public (fixed f) +(def .public (fixed f) (All (_ i o) (-> (Mixin i o) (-> i o))) (function (mix input) ((f mix mix) input))) -(def: .public nothing +(def .public nothing Mixin (function (_ delegate recur) delegate)) -(def: .public (mixed parent child) +(def .public (mixed parent child) (All (_ i o) (-> (Mixin i o) (Mixin i o) (Mixin i o))) (function (_ delegate recur) (parent (child delegate recur) recur))) -(def: .public monoid +(def .public monoid (All (_ i o) (Monoid (Mixin i o))) (implementation - (def: identity ..nothing) - (def: composite ..mixed))) + (def identity ..nothing) + (def composite ..mixed))) -(def: .public (advice when then) +(def .public (advice when then) (All (_ i o) (-> (Predicate i) (Mixin i o) (Mixin i o))) (function (_ delegate recur input) (if (when input) ((then delegate recur) input) (delegate input)))) -(def: .public (before monad action) +(def .public (before monad action) (All (_ ! i o) (-> (Monad !) (-> i (! Any)) (Mixin i (! o)))) (function (_ delegate recur input) (do monad [_ (action input)] (delegate input)))) -(def: .public (after monad action) +(def .public (after monad action) (All (_ ! i o) (-> (Monad !) (-> i o (! Any)) (Mixin i (! o)))) (function (_ delegate recur input) (do monad @@ -58,7 +58,7 @@ (type: .public (Recursive i o) (-> (-> i o) (-> i o))) -(def: .public (of_recursive recursive) +(def .public (of_recursive recursive) (All (_ i o) (-> (Recursive i o) (Mixin i o))) (function (_ delegate recur) (recursive recur))) diff --git a/stdlib/source/library/lux/control/function/mutual.lux b/stdlib/source/library/lux/control/function/mutual.lux index bdf3fbde9..d0b03aa08 100644 --- a/stdlib/source/library/lux/control/function/mutual.lux +++ b/stdlib/source/library/lux/control/function/mutual.lux @@ -1,6 +1,6 @@ (.using [library - [lux (.except Definition let def: macro) + [lux (.except Definition let def macro) ["[0]" meta] [abstract ["[0]" monad (.only do)]] @@ -30,7 +30,7 @@ #type Code #body Code])) -(.def: mutual +(.def mutual (Parser [Declaration Code Code]) (all <>.and declaration.parser @@ -38,21 +38,21 @@ .any )) -(.def: (mutual_definition context g!context [g!name mutual]) +(.def (mutual_definition context g!context [g!name mutual]) (-> (List Code) Code [Code Mutual] Code) (` (function ((~ g!name) (~ g!context)) (.let [[(~+ context)] (~ g!context)] (function (~ (declaration.format (the #declaration mutual))) (~ (the #body mutual))))))) -(.def: (macro g!context g!self) +(.def (macro g!context g!self) (-> Code Code Macro) (<| (as Macro) (is Macro') (function (_ parameters) (at meta.monad in (list (` (((~ g!self) (~ g!context)) (~+ parameters)))))))) -(.def: .public let +(.def .public let (syntax (_ [functions (.tuple (<>.some ..mutual)) body .any]) (case functions @@ -101,12 +101,12 @@ [#export_policy Code #mutual Mutual])) -(.def: definition +(.def definition (Parser Definition) (.tuple (<>.either (<>.and .any ..mutual) (<>.and (<>#in (` .private)) ..mutual)))) -(.def: .public def: +(.def .public def (syntax (_ [functions (<>.many ..definition)]) (case functions {.#End} @@ -115,7 +115,7 @@ {.#Item definition {.#End}} (.let [(open "_[0]") definition (open "_[0]") _#mutual] - (in (list (` (.def: (~ _#export_policy) (~ (declaration.format _#declaration)) + (in (list (` (.def (~ _#export_policy) (~ (declaration.format _#declaration)) (~ _#type) (~ _#body)))))) @@ -138,7 +138,7 @@ (..macro g!context g!name)]) (list.zipped_2 hidden_names functions)))] - (in (list.partial (` (.def: (~ g!context) + (in (list.partial (` (.def (~ g!context) [(~+ (list#each (the [#mutual #type]) functions))] (.let [(~ g!context) (is (Rec (~ g!context) [(~+ context_types)]) @@ -150,7 +150,7 @@ g!pop (list#each (function (_ mutual) (.let [g!name (|> mutual (the [#mutual #declaration declaration.#name]) code.local)] - (` (.def: + (` (.def (~ (the #export_policy mutual)) (~ g!name) (~ (the [#mutual #type] mutual)) diff --git a/stdlib/source/library/lux/control/io.lux b/stdlib/source/library/lux/control/io.lux index 0b2372c6b..fecb0ee7b 100644 --- a/stdlib/source/library/lux/control/io.lux +++ b/stdlib/source/library/lux/control/io.lux @@ -17,54 +17,54 @@ (primitive .public (IO a) (-> Any a) - (def: label + (def label (All (_ a) (-> (-> Any a) (IO a))) (|>> abstraction)) - (def: !io + (def !io (template (!io computation) [(abstraction (template.with_locals [g!func g!arg] (function (g!func g!arg) computation)))])) - (def: run!' + (def run!' (template (run!' io) ... creatio ex nihilo [((representation io) [])])) - (def: .public io + (def .public io (syntax (_ [computation .any]) (with_symbols [g!func g!arg] (in (list (` ((~! ..label) (function ((~ g!func) (~ g!arg)) (~ computation))))))))) - (def: .public run! + (def .public run! (All (_ a) (-> (IO a) a)) (|>> ..run!')) - (def: .public functor + (def .public functor (Functor IO) (implementation - (def: (each f) + (def (each f) (|>> ..run!' f !io)))) - (def: .public apply + (def .public apply (Apply IO) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (on fa ff) + (def (on fa ff) (!io ((..run!' ff) (..run!' fa)))))) - (def: .public monad + (def .public monad (Monad IO) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: in + (def in (|>> !io)) - (def: conjoint + (def conjoint (|>> ..run!' ..run!' !io)))) ) diff --git a/stdlib/source/library/lux/control/lazy.lux b/stdlib/source/library/lux/control/lazy.lux index 343f866f7..50f18e0dd 100644 --- a/stdlib/source/library/lux/control/lazy.lux +++ b/stdlib/source/library/lux/control/lazy.lux @@ -20,7 +20,7 @@ (primitive .public (Lazy a) (-> [] a) - (def: (lazy' generator) + (def (lazy' generator) (All (_ a) (-> (-> [] a) (Lazy a))) (let [cache (atom.atom (sharing [a] (is (-> [] a) @@ -38,38 +38,38 @@ (io.run! (atom.compare_and_swap! _ {.#Some value} cache)) value))))))) - (def: .public (value lazy) + (def .public (value lazy) (All (_ a) (-> (Lazy a) a)) ((representation lazy) []))) -(def: .public lazy +(def .public lazy (syntax (_ [expression .any]) (with_symbols [g!_] (in (list (` ((~! ..lazy') (function ((~ g!_) (~ g!_)) (~ expression))))))))) -(def: .public (equivalence (open "_#[0]")) +(def .public (equivalence (open "_#[0]")) (All (_ a) (-> (Equivalence a) (Equivalence (Lazy a)))) (implementation - (def: (= left right) + (def (= left right) (_#= (..value left) (..value right))))) -(def: .public functor +(def .public functor (Functor Lazy) (implementation - (def: (each f fa) + (def (each f fa) (lazy (f (value fa)))))) -(def: .public apply +(def .public apply (Apply Lazy) (implementation - (def: functor ..functor) - (def: (on fa ff) + (def functor ..functor) + (def (on fa ff) (lazy ((value ff) (value fa)))))) -(def: .public monad +(def .public monad (Monad Lazy) (implementation - (def: functor ..functor) - (def: in (|>> lazy)) - (def: conjoint ..value))) + (def functor ..functor) + (def in (|>> lazy)) + (def conjoint ..value))) diff --git a/stdlib/source/library/lux/control/maybe.lux b/stdlib/source/library/lux/control/maybe.lux index 00cef670e..b138ab65c 100644 --- a/stdlib/source/library/lux/control/maybe.lux +++ b/stdlib/source/library/lux/control/maybe.lux @@ -15,13 +15,13 @@ ... {.#None} ... {.#Some a}) -(def: .public monoid +(def .public monoid (All (_ a) (Monoid (Maybe a))) (implementation - (def: identity + (def identity {.#None}) - (def: (composite mx my) + (def (composite mx my) (case mx {.#None} my @@ -29,10 +29,10 @@ _ mx)))) -(def: .public functor +(def .public functor (Functor Maybe) (implementation - (def: (each f ma) + (def (each f ma) (case ma {.#Some a} {.#Some (f a)} @@ -41,12 +41,12 @@ it (as_expected it))))) -(def: .public apply +(def .public apply (Apply Maybe) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (on fa ff) + (def (on fa ff) (case [ff fa] [{.#Some f} {.#Some a}] {.#Some (f a)} @@ -54,15 +54,15 @@ _ {.#None})))) -(def: .public monad +(def .public monad (Monad Maybe) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (in x) + (def (in x) {.#Some x}) - (def: (conjoint mma) + (def (conjoint mma) (case mma {.#Some mx} mx @@ -71,10 +71,10 @@ it (as_expected it))))) -(def: .public (equivalence super) +(def .public (equivalence super) (All (_ a) (-> (Equivalence a) (Equivalence (Maybe a)))) (implementation - (def: (= mx my) + (def (= mx my) (case [mx my] [{.#None} {.#None}] #1 @@ -85,13 +85,13 @@ _ #0)))) -(def: .public (hash super) +(def .public (hash super) (All (_ a) (-> (Hash a) (Hash (Maybe a)))) (implementation - (def: equivalence + (def equivalence (..equivalence (at super equivalence))) - (def: (hash value) + (def (hash value) (case value {.#None} 1 @@ -99,18 +99,18 @@ {.#Some value} (at super hash value))))) -(def: .public (with monad) +(def .public (with monad) (All (_ M) (-> (Monad M) (Monad (All (_ a) (M (Maybe a)))))) (implementation - (def: functor + (def functor (functor.composite (the monad.functor monad) ..functor)) - (def: in + (def in (|>> (at ..monad in) (at monad in))) - (def: (conjoint MmMma) + (def (conjoint MmMma) (do monad [mMma MmMma] (case mMma @@ -121,11 +121,11 @@ it (in (as_expected it))))))) -(def: .public (lifted monad) +(def .public (lifted monad) (All (_ M a) (-> (Monad M) (-> (M a) (M (Maybe a))))) (at monad each (at ..monad in))) -(def: .public else +(def .public else (macro (_ tokens state) (case tokens (pattern (.list else maybe)) @@ -141,11 +141,11 @@ _ {.#Left "Wrong syntax for 'else'"}))) -(def: .public trusted +(def .public trusted (All (_ a) (-> (Maybe a) a)) (|>> (..else (undefined)))) -(def: .public (list value) +(def .public (list value) (All (_ a) (-> (Maybe a) (List a))) (case value {.#Some value} @@ -155,7 +155,7 @@ _ (.list))) -(def: .public when +(def .public when (macro (_ tokens state) (case tokens (pattern (.list test then)) diff --git a/stdlib/source/library/lux/control/parser.lux b/stdlib/source/library/lux/control/parser.lux index fef41832d..1c402df83 100644 --- a/stdlib/source/library/lux/control/parser.lux +++ b/stdlib/source/library/lux/control/parser.lux @@ -19,10 +19,10 @@ (type: .public (Parser s a) (-> s (Try [s a]))) -(def: .public functor +(def .public functor (All (_ s) (Functor (Parser s))) (implementation - (def: (each f ma) + (def (each f ma) (function (_ input) (case (ma input) {try.#Success [input' a]} @@ -31,12 +31,12 @@ {try.#Failure msg} {try.#Failure msg}))))) -(def: .public apply +(def .public apply (All (_ s) (Apply (Parser s))) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (on fa ff) + (def (on fa ff) (function (_ input) (case (ff input) {try.#Success [input' f]} @@ -50,16 +50,16 @@ {try.#Failure msg} {try.#Failure msg}))))) -(def: .public monad +(def .public monad (All (_ s) (Monad (Parser s))) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (in x) + (def (in x) (function (_ input) {try.#Success [input x]})) - (def: (conjoint mma) + (def (conjoint mma) (function (_ input) (case (mma input) {try.#Success [input' ma]} @@ -68,14 +68,14 @@ {try.#Failure msg} {try.#Failure msg}))))) -(def: .public (assertion message test) +(def .public (assertion message test) (All (_ s) (-> Text Bit (Parser s Any))) (function (_ input) (if test {try.#Success [input []]} {try.#Failure message}))) -(def: .public (maybe parser) +(def .public (maybe parser) (All (_ s a) (-> (Parser s a) (Parser s (Maybe a)))) (function (_ input) @@ -86,19 +86,19 @@ {try.#Failure _} {try.#Success [input {.#None}]}))) -(def: .public (result parser input) +(def .public (result parser input) (All (_ s a) (-> (Parser s a) s (Try [s a]))) (parser input)) -(def: .public (and first second) +(def .public (and first second) (All (_ s a b) (-> (Parser s a) (Parser s b) (Parser s [a b]))) (do [! ..monad] [head first] (at ! each (|>> [head]) second))) -(def: .public (or left right) +(def .public (or left right) (All (_ s a b) (-> (Parser s a) (Parser s b) (Parser s (Or a b)))) (function (_ tokens) @@ -114,7 +114,7 @@ {try.#Failure error} {try.#Failure error})))) -(def: .public (either this that) +(def .public (either this that) (All (_ s a) (-> (Parser s a) (Parser s a) (Parser s a))) (function (_ tokens) @@ -125,7 +125,7 @@ output output))) -(def: .public (some parser) +(def .public (some parser) (All (_ s a) (-> (Parser s a) (Parser s (List a)))) (function (_ input) @@ -138,14 +138,14 @@ {try.#Failure _} {try.#Success [input (list)]}))) -(def: .public (many parser) +(def .public (many parser) (All (_ s a) (-> (Parser s a) (Parser s (List a)))) (|> (..some parser) (..and parser) (at ..monad each (|>> {.#Item})))) -(def: .public (exactly amount parser) +(def .public (exactly amount parser) (All (_ s a) (-> Nat (Parser s a) (Parser s (List a)))) (case amount 0 (at ..monad in (list)) @@ -155,13 +155,13 @@ (exactly (-- amount)) (at ! each (|>> {.#Item x})))))) -(def: .public (at_least amount parser) +(def .public (at_least amount parser) (All (_ s a) (-> Nat (Parser s a) (Parser s (List a)))) (do [! ..monad] [minimum (..exactly amount parser)] (at ! each (list#composite minimum) (..some parser)))) -(def: .public (at_most amount parser) +(def .public (at_most amount parser) (All (_ s a) (-> Nat (Parser s a) (Parser s (List a)))) (case amount 0 (at ..monad in (list)) @@ -175,7 +175,7 @@ {try.#Failure msg} {try.#Success [input (list)]})))) -(def: .public (between minimum additional parser) +(def .public (between minimum additional parser) (All (_ s a) (-> Nat Nat (Parser s a) (Parser s (List a)))) (do [! ..monad] [minimum (..exactly minimum parser)] @@ -184,7 +184,7 @@ _ (at ! each (list#composite minimum) (..at_most additional parser))))) -(def: .public (separated_by separator parser) +(def .public (separated_by separator parser) (All (_ s a b) (-> (Parser s b) (Parser s a) (Parser s (List a)))) (do [! ..monad] [?x (..maybe parser)] @@ -198,7 +198,7 @@ {.#None} (in {.#End})))) -(def: .public (not parser) +(def .public (not parser) (All (_ s a) (-> (Parser s a) (Parser s Any))) (function (_ input) (case (parser input) @@ -208,12 +208,12 @@ _ {try.#Failure "Expected to fail; yet succeeded."}))) -(def: .public (failure message) +(def .public (failure message) (All (_ s a) (-> Text (Parser s a))) (function (_ input) {try.#Failure message})) -(def: .public (lifted operation) +(def .public (lifted operation) (All (_ s a) (-> (Try a) (Parser s a))) (function (_ input) (case operation @@ -223,7 +223,7 @@ {try.#Failure error} {try.#Failure error}))) -(def: .public (else value parser) +(def .public (else value parser) (All (_ s a) (-> a (Parser s a) (Parser s a))) (function (_ input) (case (parser input) @@ -233,37 +233,37 @@ {try.#Failure error} {try.#Success [input value]}))) -(def: .public remaining +(def .public remaining (All (_ s) (Parser s s)) (function (_ inputs) {try.#Success [inputs inputs]})) -(def: .public (rec parser) +(def .public (rec parser) (All (_ s a) (-> (-> (Parser s a) (Parser s a)) (Parser s a))) (function (_ inputs) (..result (parser (rec parser)) inputs))) -(def: .public (after param subject) +(def .public (after param subject) (All (_ s _ a) (-> (Parser s _) (Parser s a) (Parser s a))) (do ..monad [_ param] subject)) -(def: .public (before param subject) +(def .public (before param subject) (All (_ s _ a) (-> (Parser s _) (Parser s a) (Parser s a))) (do ..monad [output subject _ param] (in output))) -(def: .public (only test parser) +(def .public (only test parser) (All (_ s a) (-> (-> a Bit) (Parser s a) (Parser s a))) (do ..monad [output parser _ (..assertion "Constraint failed." (test output))] (in output))) -(def: .public (parses? parser) +(def .public (parses? parser) (All (_ s a) (-> (Parser s a) (Parser s Bit))) (function (_ input) (case (parser input) @@ -273,7 +273,7 @@ {try.#Failure error} {try.#Success [input false]}))) -(def: .public (parses parser) +(def .public (parses parser) (All (_ s a) (-> (Parser s a) (Parser s Any))) (function (_ input) (case (parser input) @@ -283,7 +283,7 @@ {try.#Failure error} {try.#Failure error}))) -(def: .public (speculative parser) +(def .public (speculative parser) (All (_ s a) (-> (Parser s a) (Parser s a))) (function (_ input) (case (parser input) @@ -293,7 +293,7 @@ failure failure))) -(def: .public (codec codec parser) +(def .public (codec codec parser) (All (_ s a z) (-> (Codec a z) (Parser s a) (Parser s z))) (function (_ input) (case (parser input) diff --git a/stdlib/source/library/lux/control/parser/cli.lux b/stdlib/source/library/lux/control/parser/cli.lux index 89ea21893..b00698644 100644 --- a/stdlib/source/library/lux/control/parser/cli.lux +++ b/stdlib/source/library/lux/control/parser/cli.lux @@ -13,7 +13,7 @@ (type: .public (Parser a) (//.Parser (List Text) a)) -(def: .public (result parser inputs) +(def .public (result parser inputs) (All (_ a) (-> (Parser a) (List Text) (Try a))) (case (//.result parser inputs) {try.#Success [remaining output]} @@ -27,7 +27,7 @@ {try.#Failure try} {try.#Failure try})) -(def: .public any +(def .public any (Parser Text) (function (_ inputs) (case inputs @@ -37,7 +37,7 @@ _ {try.#Failure "Cannot parse empty arguments."}))) -(def: .public (parse parser) +(def .public (parse parser) (All (_ a) (-> (-> Text (Try a)) (Parser a))) (function (_ inputs) (do try.monad @@ -45,7 +45,7 @@ output (parser raw)] (in [remaining output])))) -(def: .public (this reference) +(def .public (this reference) (-> Text (Parser Any)) (function (_ inputs) (do try.monad @@ -54,7 +54,7 @@ (in [remaining []]) {try.#Failure (format "Missing token: '" reference "'")})))) -(def: .public (somewhere cli) +(def .public (somewhere cli) (All (_ a) (-> (Parser a) (Parser a))) (function (_ inputs) (loop (again [immediate inputs]) @@ -73,20 +73,20 @@ (in [{.#Item to_omit remaining} output]))))))) -(def: .public end +(def .public end (Parser Any) (function (_ inputs) (case inputs {.#End} {try.#Success [inputs []]} _ {try.#Failure (format "Unknown parameters: " (text.interposed " " inputs))}))) -(def: .public (named name value) +(def .public (named name value) (All (_ a) (-> Text (Parser a) (Parser a))) (|> value (//.after (..this name)) ..somewhere)) -(def: .public (parameter [short long] value) +(def .public (parameter [short long] value) (All (_ a) (-> [Text Text] (Parser a) (Parser a))) (|> value (//.after (//.either (..this short) (..this long))) diff --git a/stdlib/source/library/lux/control/parser/code.lux b/stdlib/source/library/lux/control/parser/code.lux index abdcb7075..337201593 100644 --- a/stdlib/source/library/lux/control/parser/code.lux +++ b/stdlib/source/library/lux/control/parser/code.lux @@ -22,7 +22,7 @@ ["[0]" symbol]]]] ["[0]" //]) -(def: (un_paired pairs) +(def (un_paired pairs) (All (_ a) (-> (List [a a]) (List a))) (case pairs {.#End} @@ -34,13 +34,13 @@ (type: .public Parser (//.Parser (List Code))) -(def: remaining_inputs +(def remaining_inputs (-> (List Code) Text) (|>> (list#each code.format) (text.interposed " ") (all text#composite text.new_line "Remaining input: "))) -(def: .public any +(def .public any (Parser Code) (function (_ tokens) (case tokens @@ -50,7 +50,7 @@ {.#Item [t tokens']} {try.#Success [tokens' t]}))) -(def: .public next +(def .public next (Parser Code) (function (_ tokens) (case tokens @@ -62,7 +62,7 @@ (with_template [ ] [(with_expansions [ (these {try.#Failure (all text#composite "Cannot parse " (remaining_inputs tokens))})] - (def: .public + (def .public (Parser ) (function (_ tokens) (case tokens @@ -72,7 +72,7 @@ _ ))) - (def: .public ( expected) + (def .public ( expected) (-> (Parser Any)) (function (_ tokens) (case tokens @@ -93,7 +93,7 @@ [symbol this_symbol Symbol .#Symbol symbol.equivalence "symbol"] ) -(def: .public (this code) +(def .public (this code) (-> Code (Parser Any)) (function (_ tokens) (case tokens @@ -107,7 +107,7 @@ {try.#Failure "There are no tokens to parse!"}))) (with_expansions [ (these {try.#Failure (all text#composite "Cannot parse local symbol" (remaining_inputs tokens))})] - (def: .public local + (def .public local (Parser Text) (function (_ tokens) (case tokens @@ -117,7 +117,7 @@ _ ))) - (def: .public (this_local expected) + (def .public (this_local expected) (-> Text (Parser Any)) (function (_ tokens) (case tokens @@ -130,7 +130,7 @@ )))) (with_expansions [ (these {try.#Failure (all text#composite "Cannot parse local symbol" (remaining_inputs tokens))})] - (def: .public global + (def .public global (Parser Symbol) (function (_ tokens) (case tokens @@ -143,7 +143,7 @@ _ ))) - (def: .public (this_global expected) + (def .public (this_global expected) (-> Symbol (Parser Any)) (function (_ tokens) (case tokens @@ -159,7 +159,7 @@ )))) (with_template [ ] - [(def: .public ( p) + [(def .public ( p) (All (_ a) (-> (Parser a) (Parser a))) (function (_ tokens) @@ -177,21 +177,21 @@ [tuple .#Tuple "tuple"] ) -(def: .public end +(def .public end (Parser Any) (function (_ tokens) (case tokens {.#End} {try.#Success [tokens []]} _ {try.#Failure (all text#composite "Expected list of tokens to be empty!" (remaining_inputs tokens))}))) -(def: .public end? +(def .public end? (Parser Bit) (function (_ tokens) {try.#Success [tokens (case tokens {.#End} true _ false)]})) -(def: .public (result parser inputs) +(def .public (result parser inputs) (All (_ a) (-> (Parser a) (List Code) (Try a))) (case (parser inputs) {try.#Failure error} @@ -208,14 +208,14 @@ (text.interposed ", ") (text#composite "Unconsumed inputs: "))}))) -(def: .public (locally inputs parser) +(def .public (locally inputs parser) (All (_ a) (-> (List Code) (Parser a) (Parser a))) (function (_ real) (do try.monad [value (..result parser inputs)] (in [real value])))) -(def: .public (not parser) +(def .public (not parser) (All (_ a) (-> (Parser a) (Parser Code))) (do //.monad [sample ..next diff --git a/stdlib/source/library/lux/control/parser/environment.lux b/stdlib/source/library/lux/control/parser/environment.lux index b6a669a56..601cd9a5d 100644 --- a/stdlib/source/library/lux/control/parser/environment.lux +++ b/stdlib/source/library/lux/control/parser/environment.lux @@ -25,11 +25,11 @@ (type: .public (Parser a) (//.Parser Environment a)) -(def: .public empty +(def .public empty Environment (dictionary.empty text.hash)) -(def: .public (property name) +(def .public (property name) (-> Property (Parser Text)) (function (_ environment) (case (dictionary.value name environment) @@ -39,6 +39,6 @@ {.#None} (exception.except ..unknown_property [name])))) -(def: .public (result parser environment) +(def .public (result parser environment) (All (_ a) (-> (Parser a) Environment (Try a))) (at try.monad each product.right (parser environment))) diff --git a/stdlib/source/library/lux/control/parser/json.lux b/stdlib/source/library/lux/control/parser/json.lux index 8f7fe459f..308c8c918 100644 --- a/stdlib/source/library/lux/control/parser/json.lux +++ b/stdlib/source/library/lux/control/parser/json.lux @@ -31,7 +31,7 @@ (exception: .public empty_input) -(def: .public (result parser json) +(def .public (result parser json) (All (_ a) (-> (Parser a) JSON (Try a))) (case (//.result parser (list json)) {try.#Success [remainder output]} @@ -45,7 +45,7 @@ {try.#Failure error} {try.#Failure error})) -(def: .public any +(def .public any (Parser JSON) (<| (function (_ inputs)) (case inputs @@ -60,7 +60,7 @@ "Value" (/.format value))) (with_template [ ] - [(def: .public + [(def .public (Parser ) (do //.monad [head ..any] @@ -84,7 +84,7 @@ "Sample" (/.format sample))) (with_template [ ] - [(def: .public ( test) + [(def .public ( test) (-> (Parser Bit)) (do //.monad [head ..any] @@ -95,7 +95,7 @@ _ (//.failure (exception.error ..unexpected_value [head]))))) - (def: .public ( test) + (def .public ( test) (-> (Parser Any)) (do //.monad [head ..any] @@ -113,12 +113,12 @@ [string? this_string /.String text.equivalence /.#String] ) -(def: .public (nullable parser) +(def .public (nullable parser) (All (_ a) (-> (Parser a) (Parser (Maybe a)))) (//.or ..null parser)) -(def: .public (array parser) +(def .public (array parser) (All (_ a) (-> (Parser a) (Parser a))) (do //.monad [head ..any] @@ -139,7 +139,7 @@ _ (//.failure (exception.error ..unexpected_value [head]))))) -(def: .public (object parser) +(def .public (object parser) (All (_ a) (-> (Parser a) (Parser a))) (do //.monad [head ..any] @@ -165,7 +165,7 @@ _ (//.failure (exception.error ..unexpected_value [head]))))) -(def: .public (field field_name parser) +(def .public (field field_name parser) (All (_ a) (-> Text (Parser a) (Parser a))) (function (again inputs) (case inputs @@ -191,7 +191,7 @@ _ (exception.except ..unconsumed_input inputs)))) -(def: .public dictionary +(def .public dictionary (All (_ a) (-> (Parser a) (Parser (Dictionary Text a)))) (|>> (//.and ..string) //.some diff --git a/stdlib/source/library/lux/control/parser/tree.lux b/stdlib/source/library/lux/control/parser/tree.lux index 751d370db..b7a37f0ef 100644 --- a/stdlib/source/library/lux/control/parser/tree.lux +++ b/stdlib/source/library/lux/control/parser/tree.lux @@ -15,17 +15,17 @@ (type: .public (Parser t a) (//.Parser (Zipper t) a)) -(def: .public (result' parser zipper) +(def .public (result' parser zipper) (All (_ t a) (-> (Parser t a) (Zipper t) (Try a))) (do try.monad [[zipper output] (//.result parser zipper)] (in output))) -(def: .public (result parser tree) +(def .public (result parser tree) (All (_ t a) (-> (Parser t a) (Tree t) (Try a))) (result' parser (zipper.zipper tree))) -(def: .public value +(def .public value (All (_ t) (Parser t t)) (function (_ zipper) {try.#Success [zipper (zipper.value zipper)]})) @@ -33,7 +33,7 @@ (exception: .public cannot_move_further) (with_template [ ] - [(def: .public + [(def .public (All (_ t) (Parser t [])) (function (_ zipper) (case ( zipper) diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux index 1b8a9de5a..cff760d80 100644 --- a/stdlib/source/library/lux/control/parser/type.lux +++ b/stdlib/source/library/lux/control/parser/type.lux @@ -23,7 +23,7 @@ ["[0]" check]]]] ["[0]" //]) -(def: |recursion_dummy| +(def |recursion_dummy| (template (|recursion_dummy|) [{.#Primitive "" {.#End}}])) @@ -69,11 +69,11 @@ (type: .public (Parser a) (//.Parser [Env (List Type)] a)) -(def: .public fresh +(def .public fresh Env (dictionary.empty n.hash)) -(def: (result' env poly types) +(def (result' env poly types) (All (_ a) (-> Env (Parser a) (List Type) (Try a))) (case (//.result poly [env types]) {try.#Failure error} @@ -87,16 +87,16 @@ _ (exception.except ..unconsumed_input remaining)))) -(def: .public (result poly type) +(def .public (result poly type) (All (_ a) (-> (Parser a) Type (Try a))) (result' ..fresh poly (list type))) -(def: .public env +(def .public env (Parser Env) (.function (_ [env inputs]) {try.#Success [[env inputs] env]})) -(def: (with_env temp poly) +(def (with_env temp poly) (All (_ a) (-> Env (Parser a) (Parser a))) (.function (_ [env inputs]) (case (//.result poly [temp inputs]) @@ -106,7 +106,7 @@ {try.#Success [[_ remaining] output]} {try.#Success [[env remaining] output]}))) -(def: .public next +(def .public next (Parser Type) (.function (_ [env inputs]) (case inputs @@ -116,7 +116,7 @@ {.#Item headT tail} {try.#Success [[env inputs] headT]}))) -(def: .public any +(def .public any (Parser Type) (.function (_ [env inputs]) (case inputs @@ -126,7 +126,7 @@ {.#Item headT tail} {try.#Success [[env tail] headT]}))) -(def: .public (local types poly) +(def .public (local types poly) (All (_ a) (-> (List Type) (Parser a) (Parser a))) (.function (_ [env pass_through]) (case (result' env poly types) @@ -136,11 +136,11 @@ {try.#Success output} {try.#Success [[env pass_through] output]}))) -(def: (label idx) +(def (label idx) (-> Nat Code) (code.local (all text#composite "label" text.tab (n#encoded idx)))) -(def: .public (with_extension type poly) +(def .public (with_extension type poly) (All (_ a) (-> Type (Parser a) (Parser [Code a]))) (.function (_ [env inputs]) (let [current_id (dictionary.size env) @@ -155,7 +155,7 @@ {try.#Success [[env inputs'] [g!var output]]})))) (with_template [ ] - [(`` (def: .public ( poly) + [(`` (def .public ( poly) (All (_ a) (-> (Parser a) (Parser a))) (do //.monad [headT ..any] @@ -168,7 +168,7 @@ [tuple type.flat_tuple ..not_tuple] ) -(def: polymorphic' +(def polymorphic' (Parser [Nat Type]) (do //.monad [headT any @@ -177,7 +177,7 @@ (//.failure (exception.error ..not_polymorphic headT)) (in [num_arg bodyT])))) -(def: .public (polymorphic poly) +(def .public (polymorphic poly) (All (_ a) (-> (Parser a) (Parser [Code (List Code) a]))) (do [! //.monad] [headT any @@ -214,7 +214,7 @@ [output poly] (in [funcL all_varsL output]))))) -(def: .public (function in_poly out_poly) +(def .public (function in_poly out_poly) (All (_ i o) (-> (Parser i) (Parser o) (Parser [i o]))) (do //.monad [headT any @@ -224,7 +224,7 @@ (local (list outputT) out_poly)) (//.failure (exception.error ..not_function headT))))) -(def: .public (applied poly) +(def .public (applied poly) (All (_ a) (-> (Parser a) (Parser a))) (do //.monad [headT any @@ -234,7 +234,7 @@ (..local {.#Item funcT paramsT} poly)))) (with_template [ ] - [(def: .public ( expected) + [(def .public ( expected) (-> Type (Parser Any)) (do //.monad [actual any] @@ -247,14 +247,14 @@ [super (function.flipped check.subsumes?)] ) -(def: .public (argument env idx) +(def .public (argument env idx) (-> Env Nat Nat) (let [env_level (n./ 2 (dictionary.size env)) parameter_level (n./ 2 idx) parameter_idx (n.% 2 idx)] (|> env_level -- (n.- parameter_level) (n.* 2) (n.+ parameter_idx)))) -(def: .public parameter +(def .public parameter (Parser Code) (do //.monad [env ..env @@ -271,7 +271,7 @@ _ (//.failure (exception.error ..not_parameter headT))))) -(def: .public (this_parameter id) +(def .public (this_parameter id) (-> Nat (Parser Any)) (do //.monad [env ..env @@ -285,7 +285,7 @@ _ (//.failure (exception.error ..not_parameter headT))))) -(def: .public existential +(def .public existential (Parser Nat) (do //.monad [headT any] @@ -296,7 +296,7 @@ _ (//.failure (exception.error ..not_existential headT))))) -(def: .public named +(def .public named (Parser [Symbol Type]) (do //.monad [inputT any] @@ -307,7 +307,7 @@ _ (//.failure (exception.error ..not_named inputT))))) -(def: .public (recursive poly) +(def .public (recursive poly) (All (_ a) (-> (Parser a) (Parser [Code a]))) (do [! //.monad] [headT any] @@ -323,7 +323,7 @@ _ (//.failure (exception.error ..not_recursive headT))))) -(def: .public recursive_self +(def .public recursive_self (Parser Code) (do //.monad [env ..env @@ -337,7 +337,7 @@ _ (//.failure (exception.error ..not_recursive headT))))) -(def: .public recursive_call +(def .public recursive_call (Parser Code) (do [! //.monad] [env ..env diff --git a/stdlib/source/library/lux/control/parser/xml.lux b/stdlib/source/library/lux/control/parser/xml.lux index 05680953a..16802de51 100644 --- a/stdlib/source/library/lux/control/parser/xml.lux +++ b/stdlib/source/library/lux/control/parser/xml.lux @@ -40,7 +40,7 @@ (exception.report "Inputs" (exception.listing (at /.codec encoded) inputs))) -(def: (result' parser attrs documents) +(def (result' parser attrs documents) (All (_ a) (-> (Parser a) Attrs (List XML) (Try a))) (case (//.result parser [attrs documents]) {try.#Success [[attrs' remaining] output]} @@ -51,11 +51,11 @@ {try.#Failure error} {try.#Failure error})) -(def: .public (result parser documents) +(def .public (result parser documents) (All (_ a) (-> (Parser a) (List XML) (Try a))) (..result' parser /.attributes documents)) -(def: .public text +(def .public text (Parser Text) (function (_ [attrs documents]) (case documents @@ -70,7 +70,7 @@ {/.#Node _} (exception.except ..unexpected_input []))))) -(def: .public tag +(def .public tag (Parser Tag) (function (_ [attrs documents]) (case documents @@ -85,7 +85,7 @@ {/.#Node tag _ _} {try.#Success [[attrs documents] tag]})))) -(def: .public (attribute name) +(def .public (attribute name) (-> Attribute (Parser Text)) (function (_ [attrs documents]) (case (dictionary.value name attrs) @@ -95,7 +95,7 @@ {.#Some value} {try.#Success [[attrs documents] value]}))) -(def: .public (node expected parser) +(def .public (node expected parser) (All (_ a) (-> Tag (Parser a) (Parser a))) (function (_ [attrs documents]) (case documents @@ -114,7 +114,7 @@ (try#each (|>> [[attrs tail]]))) (exception.except ..wrong_tag [expected actual])))))) -(def: .public any +(def .public any (Parser XML) (function (_ [attrs documents]) (case documents @@ -126,7 +126,7 @@ (exception: .public nowhere) -(def: .public (somewhere parser) +(def .public (somewhere parser) (All (_ a) (-> (Parser a) (Parser a))) (function (again [attrs input]) (case (//.result parser [attrs input]) diff --git a/stdlib/source/library/lux/control/pipe.lux b/stdlib/source/library/lux/control/pipe.lux index 611aaf179..7f7762924 100644 --- a/stdlib/source/library/lux/control/pipe.lux +++ b/stdlib/source/library/lux/control/pipe.lux @@ -19,29 +19,29 @@ ["n" nat] ["i" int]]]]]) -(def: body +(def body (Parser (List Code)) (.tuple (<>.some .any))) -(def: .public new +(def .public new (syntax (_ [start .any body ..body prev .any]) (in (list (` (|> (~ start) (~+ body))))))) -(def: .public let +(def .public let (syntax (_ [binding .any body .any prev .any]) (in (list (` (.let [(~ binding) (~ prev)] (~ body))))))) -(def: _reversed_ +(def _reversed_ (Parser Any) (function (_ tokens) {try.#Success [(list.reversed tokens) []]})) -(def: .public cond +(def .public cond (syntax (_ [_ _reversed_ prev .any else ..body @@ -55,7 +55,7 @@ (` (|> (~ g!temp) (~+ then)))))) (|> (~ g!temp) (~+ else)))))))))) -(def: .public if +(def .public if (syntax (_ [test ..body then ..body else ..body @@ -64,7 +64,7 @@ [(~+ else)] (~ prev))))))) -(def: .public when +(def .public when (syntax (_ [test ..body then ..body prev .any]) @@ -72,7 +72,7 @@ [] (~ prev))))))) -(def: .public while +(def .public while (syntax (_ [test ..body then ..body prev .any]) @@ -82,7 +82,7 @@ ((~ g!again) (|> (~ g!temp) (~+ then))) (~ g!temp))))))))) -(def: .public do +(def .public do (syntax (_ [monad .any steps (<>.some ..body) prev .any]) @@ -100,7 +100,7 @@ _ (in (list prev)))))) -(def: .public exec +(def .public exec (syntax (_ [body ..body prev .any]) (with_symbols [g!temp] @@ -108,7 +108,7 @@ (.exec (|> (~ g!temp) (~+ body)) (~ g!temp))))))))) -(def: .public tuple +(def .public tuple (syntax (_ [paths (<>.many ..body) prev .any]) (with_symbols [g!temp] @@ -116,7 +116,7 @@ [(~+ (list#each (function (_ body) (` (|> (~ g!temp) (~+ body)))) paths))]))))))) -(def: .public case +(def .public case (syntax (_ [branches (<>.many (<>.and .any .any)) prev .any]) (in (list (` (.case (~ prev) diff --git a/stdlib/source/library/lux/control/reader.lux b/stdlib/source/library/lux/control/reader.lux index dc9c65f57..923b10562 100644 --- a/stdlib/source/library/lux/control/reader.lux +++ b/stdlib/source/library/lux/control/reader.lux @@ -10,62 +10,62 @@ (type: .public (Reader r a) (-> r a)) -(def: .public read +(def .public read (All (_ r) (Reader r r)) (function (_ env) env)) -(def: .public (local change proc) +(def .public (local change proc) (All (_ r a) (-> (-> r r) (Reader r a) (Reader r a))) (|>> change proc)) -(def: .public (result env proc) +(def .public (result env proc) (All (_ r a) (-> r (Reader r a) a)) (proc env)) -(def: .public functor +(def .public functor (All (_ r) (Functor (Reader r))) (implementation - (def: (each f fa) + (def (each f fa) (function (_ env) (f (fa env)))))) -(def: .public apply +(def .public apply (All (_ r) (Apply (Reader r))) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (on fa ff) + (def (on fa ff) (function (_ env) ((ff env) (fa env)))))) -(def: .public monad +(def .public monad (All (_ r) (Monad (Reader r))) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (in x) + (def (in x) (function (_ env) x)) - (def: (conjoint mma) + (def (conjoint mma) (function (_ env) (mma env env))))) -(def: .public (with monad) +(def .public (with monad) (All (_ !) (-> (Monad !) (All (_ e) (Monad (All (_ a) (Reader e (! a))))))) (implementation - (def: functor + (def functor (functor.composite ..functor (the monad.functor monad))) - (def: in + (def in (|>> (at monad in) (at ..monad in))) - (def: (conjoint eMeMa) + (def (conjoint eMeMa) (function (_ env) (do monad [eMa (result env eMeMa)] (result env eMa)))))) -(def: .public lifted +(def .public lifted (All (_ ! e a) (-> (! a) (Reader e (! a)))) (at ..monad in)) diff --git a/stdlib/source/library/lux/control/region.lux b/stdlib/source/library/lux/control/region.lux index ea1abcec3..2c91dbbb8 100644 --- a/stdlib/source/library/lux/control/region.lux +++ b/stdlib/source/library/lux/control/region.lux @@ -23,7 +23,7 @@ (! [(List (Cleaner r !)) (Try a)]))) -(def: separator +(def separator Text (format text.new_line "-----------------------------------------" text.new_line @@ -42,7 +42,7 @@ (format separator error|output)))) -(def: (clean clean_up output) +(def (clean clean_up output) (All (_ a) (-> (Try Any) (Try a) (Try a))) (case clean_up {try.#Success _} @@ -51,7 +51,7 @@ {try.#Failure error} (exception.except ..clean_up_error [error output]))) -(def: .public (run! monad computation) +(def .public (run! monad computation) (All (_ ! a) (-> (Monad !) (All (_ r) (Region r ! a)) (! (Try a)))) @@ -61,7 +61,7 @@ (monad.each ! (function (_ cleaner) (cleaner []))) (at ! each (list#mix clean output))))) -(def: .public (acquire! monad cleaner value) +(def .public (acquire! monad cleaner value) (All (_ ! a) (-> (Monad !) (-> a (! (Try Any))) a (All (_ r) (Region r ! a)))) (function (_ [region cleaners]) @@ -69,12 +69,12 @@ cleaners} {try.#Success value}]))) -(def: .public (functor super) +(def .public (functor super) (All (_ !) (-> (Functor !) (All (_ r) (Functor (Region r !))))) (implementation - (def: (each f) + (def (each f) (function (_ fa) (function (_ region+cleaners) (at super each @@ -87,15 +87,15 @@ {try.#Failure error})]) (fa region+cleaners))))))) -(def: .public (apply super) +(def .public (apply super) (All (_ !) (-> (Monad !) (All (_ r) (Apply (Region r !))))) (implementation - (def: functor + (def functor (..functor (the monad.functor super))) - (def: (on fa ff) + (def (on fa ff) (function (_ [region cleaners]) (do super [[cleaners ef] (ff [region cleaners]) @@ -112,19 +112,19 @@ {try.#Failure error} (in [cleaners {try.#Failure error}]))))))) -(def: .public (monad super) +(def .public (monad super) (All (_ !) (-> (Monad !) (All (_ r) (Monad (Region r !))))) (implementation - (def: functor + (def functor (..functor (the monad.functor super))) - (def: (in value) + (def (in value) (function (_ [region cleaners]) (at super in [cleaners {try.#Success value}]))) - (def: (conjoint ffa) + (def (conjoint ffa) (function (_ [region cleaners]) (do super [[cleaners efa] (ffa [region cleaners])] @@ -135,20 +135,20 @@ {try.#Failure error} (in [cleaners {try.#Failure error}]))))))) -(def: .public (failure monad error) +(def .public (failure monad error) (All (_ ! a) (-> (Monad !) Text (All (_ r) (Region r ! a)))) (function (_ [region cleaners]) (at monad in [cleaners {try.#Failure error}]))) -(def: .public (except monad exception message) +(def .public (except monad exception message) (All (_ ! e a) (-> (Monad !) (Exception e) e (All (_ r) (Region r ! a)))) (failure monad (exception.error exception message))) -(def: .public (lifted monad operation) +(def .public (lifted monad operation) (All (_ ! a) (-> (Monad !) (! a) (All (_ r) (Region r ! a)))) diff --git a/stdlib/source/library/lux/control/remember.lux b/stdlib/source/library/lux/control/remember.lux index 8cd386ca6..1110c57bf 100644 --- a/stdlib/source/library/lux/control/remember.lux +++ b/stdlib/source/library/lux/control/remember.lux @@ -36,7 +36,7 @@ {.#None} ""))) -(def: deadline +(def deadline (Parser Date) (all <>.either (<>#each (|>> instant.of_millis instant.date) @@ -50,7 +50,7 @@ {try.#Failure message} (<>.failure message))))) -(def: .public remember +(def .public remember (syntax (_ [deadline ..deadline message .text focus (<>.maybe .any)]) @@ -66,7 +66,7 @@ (meta.failure (exception.error ..must_remember [deadline today message focus])))))) (with_template [ ] - [(`` (def: .public + [(`` (def .public (syntax (_ [deadline ..deadline message .text focus (<>.maybe .any)]) diff --git a/stdlib/source/library/lux/control/security/capability.lux b/stdlib/source/library/lux/control/security/capability.lux index 482f61161..6df5eaf19 100644 --- a/stdlib/source/library/lux/control/security/capability.lux +++ b/stdlib/source/library/lux/control/security/capability.lux @@ -26,20 +26,20 @@ (primitive .public (Capability brand input output) (-> input output) - (def: capability + (def capability (All (_ brand input output) (-> (-> input output) (Capability brand input output))) (|>> abstraction)) - (def: .public (use capability input) + (def .public (use capability input) (All (_ brand input output) (-> (Capability brand input output) input output)) ((representation capability) input)) - (def: .public capability: + (def .public capability: (syntax (_ [[export_policy declaration [forger input output]] (|export|.parser (all <>.and @@ -55,14 +55,14 @@ (in (list (` (type: (~ export_policy) (~ (|declaration|.format declaration)) (~ capability))) - (` (def: (~ (code.local forger)) + (` (def (~ (code.local forger)) (All ((~ g!_) (~+ (list#each code.local vars))) (-> (-> (~ input) (~ output)) (~ capability))) (~! ..capability))) )))))) - (def: .public (async capability) + (def .public (async capability) (All (_ brand input output) (-> (Capability brand input (IO output)) (Capability brand input (Async output)))) diff --git a/stdlib/source/library/lux/control/security/policy.lux b/stdlib/source/library/lux/control/security/policy.lux index f8856c593..fe683cf05 100644 --- a/stdlib/source/library/lux/control/security/policy.lux +++ b/stdlib/source/library/lux/control/security/policy.lux @@ -27,7 +27,7 @@ (-> (Policy brand value from) (Policy brand value to)))) - (def: .public (delegation downgrade upgrade) + (def .public (delegation downgrade upgrade) (All (_ brand from to) (-> (Can_Downgrade brand from) (Can_Upgrade brand to) (Delegation brand from to))) @@ -37,43 +37,43 @@ (-> (Privilege brand label) (scope label))) - (def: privilege + (def privilege Privilege [#can_upgrade (|>> abstraction) #can_downgrade (|>> representation)]) - (def: .public (with_policy context) + (def .public (with_policy context) (All (_ brand scope) (Ex (_ label) (-> (Context brand scope label) (scope label)))) (context ..privilege)) - (def: (of_policy constructor) + (def (of_policy constructor) (-> Type Type) (type (All (_ brand label) (constructor (All (_ value) (Policy brand value label)))))) - (def: .public functor + (def .public functor (~ (..of_policy Functor)) (implementation - (def: (each f fa) + (def (each f fa) (|> fa representation f abstraction)))) - (def: .public apply + (def .public apply (~ (..of_policy Apply)) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (on fa ff) + (def (on fa ff) (abstraction ((representation ff) (representation fa)))))) - (def: .public monad + (def .public monad (~ (..of_policy Monad)) (implementation - (def: functor ..functor) - (def: in (|>> abstraction)) - (def: conjoint (|>> representation)))) + (def functor ..functor) + (def in (|>> abstraction)) + (def conjoint (|>> representation)))) ) (with_template [ ] diff --git a/stdlib/source/library/lux/control/state.lux b/stdlib/source/library/lux/control/state.lux index dc007f65a..484592e71 100644 --- a/stdlib/source/library/lux/control/state.lux +++ b/stdlib/source/library/lux/control/state.lux @@ -9,70 +9,70 @@ (type: .public (State s a) (-> s [s a])) -(def: .public get +(def .public get (All (_ s) (State s s)) (function (_ state) [state state])) -(def: .public (put new_state) +(def .public (put new_state) (All (_ s) (-> s (State s Any))) (function (_ state) [new_state []])) -(def: .public (update change) +(def .public (update change) (All (_ s) (-> (-> s s) (State s Any))) (function (_ state) [(change state) []])) -(def: .public (use user) +(def .public (use user) (All (_ s a) (-> (-> s a) (State s a))) (function (_ state) [state (user state)])) -(def: .public (local change action) +(def .public (local change action) (All (_ s a) (-> (-> s s) (State s a) (State s a))) (function (_ state) (let [[state' output] (action (change state))] [state output]))) -(def: .public (result state action) +(def .public (result state action) (All (_ s a) (-> s (State s a) [s a])) (action state)) -(def: .public functor +(def .public functor (All (_ s) (Functor (State s))) (implementation - (def: (each f ma) + (def (each f ma) (function (_ state) (let [[state' a] (ma state)] [state' (f a)]))))) -(def: .public apply +(def .public apply (All (_ s) (Apply (State s))) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (on fa ff) + (def (on fa ff) (function (_ state) (let [[state' f] (ff state) [state'' a] (fa state')] [state'' (f a)]))))) -(def: .public monad +(def .public monad (All (_ s) (Monad (State s))) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (in a) + (def (in a) (function (_ state) [state a])) - (def: (conjoint mma) + (def (conjoint mma) (function (_ state) (let [[state' ma] (mma state)] (ma state')))))) -(def: .public (while condition body) +(def .public (while condition body) (All (_ s) (-> (State s Bit) (State s Any) (State s Any))) (do [! ..monad] [execute? condition] @@ -82,26 +82,26 @@ (while condition body)) (in [])))) -(def: .public (do_while condition body) +(def .public (do_while condition body) (All (_ s) (-> (State s Bit) (State s Any) (State s Any))) (do ..monad [_ body] (while condition body))) -(def: (with//functor functor) +(def (with//functor functor) (All (_ M s) (-> (Functor M) (Functor (All (_ a) (-> s (M [s a])))))) (implementation - (def: (each f sfa) + (def (each f sfa) (function (_ state) (at functor each (function (_ [s a]) [s (f a)]) (sfa state)))))) -(def: (with//apply monad) +(def (with//apply monad) (All (_ M s) (-> (Monad M) (Apply (All (_ a) (-> s (M [s a])))))) (implementation - (def: functor (with//functor (at monad functor))) + (def functor (with//functor (at monad functor))) - (def: (on sFa sFf) + (def (on sFa sFf) (function (_ state) (do monad [[state f] (sFf state) @@ -111,26 +111,26 @@ (type: .public (+State M s a) (-> s (M [s a]))) -(def: .public (result' state action) +(def .public (result' state action) (All (_ M s a) (-> s (+State M s a) (M [s a]))) (action state)) -(def: .public (with monad) +(def .public (with monad) (All (_ M s) (-> (Monad M) (Monad (+State M s)))) (implementation - (def: functor (with//functor (at monad functor))) + (def functor (with//functor (at monad functor))) - (def: (in a) + (def (in a) (function (_ state) (at monad in [state a]))) - (def: (conjoint sMsMa) + (def (conjoint sMsMa) (function (_ state) (do monad [[state' sMa] (sMsMa state)] (sMa state')))))) -(def: .public (lifted monad ma) +(def .public (lifted monad ma) (All (_ M s a) (-> (Monad M) (M a) (+State M s a))) (function (_ state) (do monad diff --git a/stdlib/source/library/lux/control/thread.lux b/stdlib/source/library/lux/control/thread.lux index bb48b31b0..4dbe81f34 100644 --- a/stdlib/source/library/lux/control/thread.lux +++ b/stdlib/source/library/lux/control/thread.lux @@ -28,14 +28,14 @@ (type: .public (Box t a) (Box'' t (Mutable a a))) - (def: .public (box init) + (def .public (box init) (All (_ a) (-> a (All (_ !) (Thread ! (Box ! a))))) (function (_ !) (|> (array.empty 1) (array.has! 0 (variance.write init)) abstraction))) - (def: .public (read! box) + (def .public (read! box) (All (_ ! r w) (-> (Box' ! r w) (Thread ! r))) (function (_ !) (|> box @@ -43,7 +43,7 @@ (array.item 0) variance.read))) - (def: .public (write! value box) + (def .public (write! value box) (All (_ r w) (-> w (All (_ !) (-> (Box' ! r w) (Thread ! Any))))) (function (_ !) (|> box @@ -52,49 +52,49 @@ abstraction))) ) -(def: .public (result thread) +(def .public (result thread) (All (_ a) (-> (All (_ !) (Thread ! a)) a)) (thread [])) -(def: .public io +(def .public io (All (_ a) (-> (All (_ !) (Thread ! a)) (IO a))) (|>> ..result io.io)) -(def: .public functor +(def .public functor (All (_ !) (Functor (Thread !))) (implementation - (def: (each f) + (def (each f) (function (_ fa) (function (_ !) (f (fa !))))))) -(def: .public apply +(def .public apply (All (_ !) (Apply (Thread !))) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (on fa ff) + (def (on fa ff) (function (_ !) ((ff !) (fa !)))))) -(def: .public monad +(def .public monad (All (_ !) (Monad (Thread !))) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (in value) + (def (in value) (function (_ !) value)) - (def: (conjoint ffa) + (def (conjoint ffa) (function (_ !) ((ffa !) !))))) -(def: .public (update! f box) +(def .public (update! f box) (All (_ ! r w) (-> (-> r w) (Box' ! r w) (Thread ! [r w]))) (do ..monad [old (read! box) diff --git a/stdlib/source/library/lux/control/try.lux b/stdlib/source/library/lux/control/try.lux index 6d0467043..23d3cf178 100644 --- a/stdlib/source/library/lux/control/try.lux +++ b/stdlib/source/library/lux/control/try.lux @@ -15,10 +15,10 @@ {#Failure Text} {#Success a})) -(def: .public functor +(def .public functor (Functor Try) (implementation - (def: (each f ma) + (def (each f ma) (case ma {#Success datum} {#Success (f datum)} @@ -27,12 +27,12 @@ it (as_expected it))))) -(def: .public apply +(def .public apply (Apply Try) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (on fa ff) + (def (on fa ff) (case ff {#Success f} (case fa @@ -47,15 +47,15 @@ it (as_expected it))))) -(def: .public monad +(def .public monad (Monad Try) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (in a) + (def (in a) {#Success a}) - (def: (conjoint mma) + (def (conjoint mma) (case mma {#Success ma} ma @@ -64,19 +64,19 @@ it (as_expected it))))) -(def: .public (with monad) +(def .public (with monad) ... TODO: Replace (All (_ a) (! (Try a))) with (functor.Then ! Try) (All (_ !) (-> (Monad !) (Monad (All (_ a) (! (Try a)))))) (implementation - (def: functor + (def functor (functor.composite (the monad.functor monad) ..functor)) - (def: in + (def in (|>> (at ..monad in) (at monad in))) - (def: (conjoint MeMea) + (def (conjoint MeMea) (do monad [eMea MeMea] (case eMea @@ -87,14 +87,14 @@ it (in (as_expected it))))))) -(def: .public (lifted monad) +(def .public (lifted monad) (All (_ ! a) (-> (Monad !) (-> (! a) (! (Try a))))) (at monad each (at ..monad in))) -(def: .public (equivalence (open "_#[0]")) +(def .public (equivalence (open "_#[0]")) (All (_ a) (-> (Equivalence a) (Equivalence (Try a)))) (implementation - (def: (= reference sample) + (def (= reference sample) (case [reference sample] [{#Success reference} {#Success sample}] (_#= reference sample) @@ -106,7 +106,7 @@ false )))) -(def: .public (trusted try) +(def .public (trusted try) (All (_ a) (-> (Try a) a)) (case try @@ -116,7 +116,7 @@ {#Failure message} (panic! message))) -(def: .public (maybe try) +(def .public (maybe try) (All (_ a) (-> (Try a) (Maybe a))) (case try @@ -127,7 +127,7 @@ _ {.#None})) -(def: .public (of_maybe maybe) +(def .public (of_maybe maybe) (All (_ a) (-> (Maybe a) (Try a))) (case maybe @@ -138,7 +138,7 @@ {#Failure (`` (("lux in-module" (~~ (static .prelude)) .symbol#encoded) (symbol ..of_maybe)))})) -(def: .public else +(def .public else (macro (_ tokens compiler) (case tokens (pattern (list else try)) @@ -153,7 +153,7 @@ _ {#Failure "Wrong syntax for 'else'"}))) -(def: .public when +(def .public when (macro (_ tokens state) (case tokens (pattern (.list test then)) diff --git a/stdlib/source/library/lux/control/writer.lux b/stdlib/source/library/lux/control/writer.lux index 88b536e30..6df2cf695 100644 --- a/stdlib/source/library/lux/control/writer.lux +++ b/stdlib/source/library/lux/control/writer.lux @@ -13,54 +13,54 @@ [#log log #value value])) -(def: .public (write message) +(def .public (write message) (All (_ log) (-> log (Writer log Any))) [message []]) -(def: .public functor +(def .public functor (All (_ l) (Functor (Writer l))) (implementation - (def: (each f fa) + (def (each f fa) (let [[log datum] fa] [log (f datum)])))) -(def: .public (apply monoid) +(def .public (apply monoid) (All (_ l) (-> (Monoid l) (Apply (Writer l)))) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (on fa ff) + (def (on fa ff) (let [[log1 f] ff [log2 a] fa] [(at monoid composite log1 log2) (f a)])))) -(def: .public (monad monoid) +(def .public (monad monoid) (All (_ l) (-> (Monoid l) (Monad (Writer l)))) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: in + (def in (|>> [(at monoid identity)])) - (def: (conjoint mma) + (def (conjoint mma) (let [[log1 [log2 a]] mma] [(at monoid composite log1 log2) a])))) -(def: .public (with monoid monad) +(def .public (with monoid monad) (All (_ l M) (-> (Monoid l) (Monad M) (Monad (All (_ a) (M (Writer l a)))))) (implementation - (def: functor + (def functor (functor.composite (the monad.functor monad) ..functor)) - (def: in + (def in (let [writer (..monad monoid)] (|>> (at writer in) (at monad in)))) - (def: (conjoint MlMla) + (def (conjoint MlMla) (do monad [[l1 Mla] (for @.old (is {.#Apply (Writer (parameter 0) @@ -74,7 +74,7 @@ [l2 a] Mla] (in [(at monoid composite l1 l2) a]))))) -(def: .public (lifted monoid monad) +(def .public (lifted monoid monad) (All (_ l M a) (-> (Monoid l) (Monad M) (-> (M a) (M (Writer l a))))) diff --git a/stdlib/source/library/lux/data/binary.lux b/stdlib/source/library/lux/data/binary.lux index b80d38724..102440856 100644 --- a/stdlib/source/library/lux/data/binary.lux +++ b/stdlib/source/library/lux/data/binary.lux @@ -23,15 +23,15 @@ (type: .public Binary /.Binary) -(def: .public size +(def .public size (-> Binary Nat) (|>> /.size)) -(def: .public empty +(def .public empty (-> Nat Binary) (|>> /.empty)) -(def: .public (mix $ init it) +(def .public (mix $ init it) (All (_ a) (-> (-> I64 a a) a Binary a)) (let [size (/.size it)] (loop (again [index 0 @@ -47,7 +47,7 @@ "Index" (%.nat index))) (with_template [ ] - [(def: .public ( index it) + [(def .public ( index it) (-> Nat Binary (Try I64)) (if (n.< (/.size it) (|> index )) {try.#Success ( index it)} @@ -60,7 +60,7 @@ ) (with_template [ ] - [(def: .public ( index value it) + [(def .public ( index value it) (-> Nat (I64 Any) Binary (Try Binary)) (if (n.< (/.size it) (|> index )) {try.#Success ( index value it)} @@ -72,10 +72,10 @@ [has_64! /.has_64! (n.+ 7)] ) -(def: .public equivalence +(def .public equivalence (Equivalence Binary) (implementation - (def: (= reference sample) + (def (= reference sample) (/.= reference sample)))) (exception: .public (cannot_copy [bytes Nat @@ -86,7 +86,7 @@ "Source input space" (%.nat source_input) "Target output space" (%.nat target_output))) -(def: .public (copy! bytes source_offset source target_offset target) +(def .public (copy! bytes source_offset source target_offset target) (-> Nat Nat Binary Nat Binary (Try Binary)) (let [source_input (n.- source_offset (/.size source)) target_output (n.- target_offset (/.size target))] @@ -103,7 +103,7 @@ "Offset" (%.nat offset) "Length" (%.nat length))) -(def: .public (slice offset length binary) +(def .public (slice offset length binary) (-> Nat Nat Binary (Try Binary)) (let [size (/.size binary) limit (n.+ length offset)] @@ -111,7 +111,7 @@ (exception.except ..slice_out_of_bounds [size offset length]) {try.#Success (/.slice offset length binary)}))) -(def: .public (after bytes binary) +(def .public (after bytes binary) (-> Nat Binary Binary) (cond (n.= 0 bytes) binary @@ -122,13 +122,13 @@ ... else (/.empty 0))) -(def: .public monoid +(def .public monoid (Monoid Binary) (implementation - (def: identity + (def identity (/.empty 0)) - (def: (composite left right) + (def (composite left right) (let [sizeL (/.size left) sizeR (/.size right) output (/.empty (n.+ sizeL sizeR))] diff --git a/stdlib/source/library/lux/data/bit.lux b/stdlib/source/library/lux/data/bit.lux index 6d9988573..369c9002c 100644 --- a/stdlib/source/library/lux/data/bit.lux +++ b/stdlib/source/library/lux/data/bit.lux @@ -10,56 +10,56 @@ ["[0]" function]]]]) (with_template [ ] - [(def: .public Bit #0) - (def: .public Bit #1)] + [(def .public Bit #0) + (def .public Bit #1)] [no yes] [off on] ) -(def: .public equivalence +(def .public equivalence (Equivalence Bit) (implementation - (def: (= x y) + (def (= x y) (if x y (not y))))) -(def: .public hash +(def .public hash (Hash Bit) (implementation - (def: equivalence ..equivalence) + (def equivalence ..equivalence) - (def: (hash value) + (def (hash value) (case value #0 2 #1 3)))) (with_template [ ] - [(def: .public + [(def .public (Monoid Bit) (implementation - (def: identity ) - (def: (composite x y) ( x y))))] + (def identity ) + (def (composite x y) ( x y))))] [disjunction #0 or] [conjunction #1 and] ) -(def: .public codec +(def .public codec (Codec Text Bit) (implementation - (def: (encoded x) + (def (encoded x) (if x "#1" "#0")) - (def: (decoded input) + (def (decoded input) (case input "#1" {.#Right #1} "#0" {.#Right #0} _ {.#Left "Wrong syntax for Bit."})))) -(def: .public complement +(def .public complement (All (_ a) (-> (-> a Bit) (-> a Bit))) (function.composite not)) diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux index f4e987ca9..0d02cef25 100644 --- a/stdlib/source/library/lux/data/collection/array.lux +++ b/stdlib/source/library/lux/data/collection/array.lux @@ -14,7 +14,7 @@ [variance (.only)]]]] ["!" \\unsafe]) -(def: .public type_name +(def .public type_name Text !.type) @@ -24,123 +24,123 @@ (type: .public Array !.Array) -(def: .public empty +(def .public empty (All (_ a) (-> Nat (Array a))) (|>> !.empty)) -(def: .public size +(def .public size (All (_ r w) (-> (Array' r w) Nat)) (|>> !.size)) -(def: .public (item index array) +(def .public (item index array) (All (_ r w) (-> Nat (Array' r w) (Maybe r))) (if (!.lacks? index array) {.#None} {.#Some (!.item index array)})) -(def: .public (has! index value array) +(def .public (has! index value array) (All (_ r w) (-> Nat w (Array' r w) (Array' r w))) (!.has! index value array)) -(def: .public (lacks! index array) +(def .public (lacks! index array) (All (_ r w) (-> Nat (Array' r w) (Array' r w))) (!.lacks! index array)) -(def: .public (lacks? index array) +(def .public (lacks? index array) (All (_ r w) (-> Nat (Array' r w) Bit)) (!.lacks? index array)) -(def: .public (has? index array) +(def .public (has? index array) (All (_ r w) (-> Nat (Array' r w) Bit)) (!.has? index array)) -(def: .public (revised! index $ array) +(def .public (revised! index $ array) (All (_ r w) (-> Nat (-> r w) (Array' r w) (Array' r w))) (!.revised! index $ array)) -(def: .public (upsert! index default transform array) +(def .public (upsert! index default transform array) (All (_ r w) (-> Nat r (-> r w) (Array' r w) (Array' r w))) (!.upsert! index default transform array)) -(def: .public (copy! length src_start src_array dest_start dest_array) +(def .public (copy! length src_start src_array dest_start dest_array) (All (_ r w) (-> Nat Nat (Array' w Nothing) Nat (Array' r w) (Array' r w))) (!.copy! length src_start src_array dest_start dest_array)) -(def: .public occupancy +(def .public occupancy (All (_ r w) (-> (Array' r w) Nat)) (|>> !.occupancy)) -(def: .public vacancy +(def .public vacancy (All (_ r w) (-> (Array' r w) Nat)) (|>> !.vacancy)) -(def: .public (only! ? it) +(def .public (only! ? it) (All (_ r w) (-> (Predicate r) (Array' r w) (Array' r w))) (!.only! ? it)) -(def: .public (example ? it) +(def .public (example ? it) (All (_ r w) (-> (Predicate r) (Array' r w) (Maybe r))) (!.example ? it)) -(def: .public (example' ? it) +(def .public (example' ? it) (All (_ r w) (-> (-> Nat r Bit) (Array' r w) (Maybe [Nat r]))) (!.example' ? it)) -(def: .public clone +(def .public clone (All (_ a) (-> (Array a) (Array a))) (|>> !.clone)) -(def: .public of_list +(def .public of_list (All (_ a) (-> (List a) (Array a))) (|>> !.of_list)) -(def: .public (list default array) +(def .public (list default array) (All (_ r w) (-> (Maybe r) (Array' r w) (List r))) (!.list default array)) -(def: .public (equivalence //) +(def .public (equivalence //) (All (_ r) (-> (Equivalence r) (Equivalence (Ex (_ w) (Array' r w))))) (implementation - (def: (= left/* right/*) + (def (= left/* right/*) (!.= // left/* right/*)))) -(def: .public monoid +(def .public monoid (All (_ a) (Monoid (Array a))) (implementation - (def: identity (!.empty 0)) + (def identity (!.empty 0)) - (def: (composite left/* right/*) + (def (composite left/* right/*) (!.composite left/* right/*)))) -(def: .public mix +(def .public mix (Mix (All (_ r) (Array' r Nothing))) (implementation - (def: (mix $ init it) + (def (mix $ init it) (!.mix (function (_ index partial total) ($ partial total)) init it)))) -(def: .public functor +(def .public functor (Functor Array) (implementation - (def: (each $ input) + (def (each $ input) (!.each $ input)))) (with_template [ ] - [(def: .public ( ? it) + [(def .public ( ? it) (All (_ r w) (-> (Predicate r) (Predicate (Array' r w)))) ( ? it))] @@ -149,7 +149,7 @@ [any? !.any?] ) -(def: .public (one ? it) +(def .public (one ? it) (All (_ r r' w) (-> (-> r (Maybe r')) (Array' r w) (Maybe r'))) (!.one ? it)) diff --git a/stdlib/source/library/lux/data/collection/bits.lux b/stdlib/source/library/lux/data/collection/bits.lux index c33ecd77f..8c524156e 100644 --- a/stdlib/source/library/lux/data/collection/bits.lux +++ b/stdlib/source/library/lux/data/collection/bits.lux @@ -17,36 +17,36 @@ (type: .public Chunk I64) -(def: .public chunk_size +(def .public chunk_size i64.width) (type: .public Bits (Array Chunk)) -(def: empty_chunk +(def empty_chunk Chunk (.i64 0)) -(def: .public empty +(def .public empty Bits (array.empty 0)) -(def: .public (size bits) +(def .public (size bits) (-> Bits Nat) (array#mix (function (_ chunk total) (|> chunk i64.ones (n.+ total))) 0 bits)) -(def: .public (capacity bits) +(def .public (capacity bits) (-> Bits Nat) (|> bits array.size (n.* chunk_size))) -(def: .public empty? +(def .public empty? (-> Bits Bit) (|>> ..size (n.= 0))) -(def: .public (bit index bits) +(def .public (bit index bits) (-> Nat Bits Bit) (let [[chunk_index bit_index] (n./% chunk_size index)] (.and (n.< (array.size bits) chunk_index) @@ -54,14 +54,14 @@ (maybe.else empty_chunk) (i64.one? bit_index))))) -(def: (chunk idx bits) +(def (chunk idx bits) (-> Nat Bits Chunk) (if (n.< (array.size bits) idx) (|> bits (array.item idx) (maybe.else empty_chunk)) empty_chunk)) (with_template [ ] - [(def: .public ( index input) + [(def .public ( index input) (-> Nat Bits Bits) (let [[chunk_index bit_index] (n./% chunk_size index)] (loop (again [size|output (n.max (++ chunk_index) @@ -94,7 +94,7 @@ [flipped i64.flipped] ) -(def: .public (intersects? reference sample) +(def .public (intersects? reference sample) (-> Bits Bits Bit) (let [chunks (n.min (array.size reference) (array.size sample))] @@ -107,7 +107,7 @@ (again (++ idx))) #0)))) -(def: .public (not input) +(def .public (not input) (-> Bits Bits) (case (array.size input) 0 @@ -131,7 +131,7 @@ output)))))) (with_template [ ] - [(def: .public ( param subject) + [(def .public ( param subject) (-> Bits Bits Bits) (case (n.max (array.size param) (array.size subject)) @@ -162,10 +162,10 @@ [xor i64.xor] ) -(def: .public equivalence +(def .public equivalence (Equivalence Bits) (implementation - (def: (= reference sample) + (def (= reference sample) (let [size (n.max (array.size reference) (array.size sample))] (loop (again [idx 0]) diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux index 124adeceb..a9f167556 100644 --- a/stdlib/source/library/lux/data/collection/dictionary.lux +++ b/stdlib/source/library/lux/data/collection/dictionary.lux @@ -88,7 +88,7 @@ ... Which is the same as 0000 0000 0000 0000 0000 0000 0000 0000. ... Or 0x00000000. ... Which is 32 zeroes, since the branching factor is 32. -(def: clean_bitmap +(def clean_bitmap Bit_Map 0) @@ -101,41 +101,41 @@ ... factor). ... The initial shifting level, though, is 0 (which corresponds to the ... shift in the shallowest node on the tree, which is the root node). -(def: root_level +(def root_level Level 0) ... The exponent to which 2 must be elevated, to reach the branching ... factor of the data-structure. -(def: branching_exponent +(def branching_exponent Nat 5) ... The threshold on which #Hierarchy nodes are demoted to #Base nodes, ... which is 1/4 of the branching factor (or a left-shift 2). -(def: demotion_threshold +(def demotion_threshold Nat (i64.left_shifted (n.- 2 branching_exponent) 1)) ... The threshold on which #Base nodes are promoted to #Hierarchy nodes, ... which is 1/2 of the branching factor (or a left-shift 1). -(def: promotion_threshold +(def promotion_threshold Nat (i64.left_shifted (n.- 1 branching_exponent) 1)) ... The size of hierarchy-nodes, which is 2^(branching-exponent). -(def: hierarchy_nodes_size +(def hierarchy_nodes_size Nat (i64.left_shifted branching_exponent 1)) ... The cannonical empty node, which is just an empty #Base node. -(def: empty_node +(def empty_node Node {#Base clean_bitmap (array.empty 0)}) ... Expands a copy of the array, to have 1 extra slot, which is used ... for storing the value. -(def: (array#has idx value old_array) +(def (array#has idx value old_array) (All (_ a) (-> Index a (Array a) (Array a))) (let [old_size (array.size old_array)] (|> (array.empty (++ old_size)) @@ -144,19 +144,19 @@ (array.copy! (n.- idx old_size) idx old_array (++ idx))))) ... Creates a copy of an array with an index set to a particular value. -(def: (array#revised idx value array) +(def (array#revised idx value array) (All (_ a) (-> Index a (Array a) (Array a))) (|> array array.clone (array.has! idx value))) ... Creates a clone of the array, with an empty position at index. -(def: (array#clear idx array) +(def (array#clear idx array) (All (_ a) (-> Index (Array a) (Array a))) (|> array array.clone (array.lacks! idx))) ... Shrinks a copy of the array by removing the space at index. -(def: (array#lacks idx array) +(def (array#lacks idx array) (All (_ a) (-> Index (Array a) (Array a))) (let [new_size (-- (array.size array))] (|> (array.empty new_size) @@ -165,32 +165,32 @@ ... Increases the level-shift by the branching-exponent, to explore ... levels further down the tree. -(def: level_up +(def level_up (-> Level Level) (n.+ branching_exponent)) -(def: hierarchy_mask +(def hierarchy_mask Bit_Map (-- hierarchy_nodes_size)) ... Gets the branching-factor sized section of the hash corresponding ... to a particular level, and uses that as an index into the array. -(def: (level_index level hash) +(def (level_index level hash) (-> Level Hash_Code Index) (i64.and ..hierarchy_mask (i64.right_shifted level hash))) ... A mechanism to go from indices to bit-positions. -(def: (to_bit_position index) +(def (to_bit_position index) (-> Index Bit_Position) (i64.left_shifted index 1)) ... The bit-position within a base that a given hash-code would have. -(def: (level_bit_position level hash) +(def (level_bit_position level hash) (-> Level Hash_Code Bit_Position) (to_bit_position (level_index level hash))) -(def: (with_bit_position? bit bitmap) +(def (with_bit_position? bit bitmap) (-> Bit_Position Bit_Map Bit) (|> bitmap (i64.and bit) @@ -198,39 +198,39 @@ not)) ... Figures out whether a bitmap only contains a single bit-position. -(def: only_bit_position? +(def only_bit_position? (-> Bit_Position Bit_Map Bit) n.=) -(def: (with_bit_position bit bitmap) +(def (with_bit_position bit bitmap) (-> Bit_Position Bit_Map Bit_Map) (i64.or bit bitmap)) -(def: without_bit_position +(def without_bit_position (-> Bit_Position Bit_Map Bit_Map) i64.xor) ... Figures out the size of a bitmap-indexed array by counting all the ... 1s within the bitmap. -(def: bitmap_size +(def bitmap_size (-> Bit_Map Nat) i64.ones) ... A mask that, for a given bit position, only allows all the 1s prior ... to it, which would indicate the bitmap-size (and, thus, index) ... associated with it. -(def: bit_position_mask +(def bit_position_mask (-> Bit_Position Bit_Map) --) ... The index on the base array, based on its bit-position. -(def: (base_index bit_position bitmap) +(def (base_index bit_position bitmap) (-> Bit_Position Bit_Map Index) (bitmap_size (i64.and (bit_position_mask bit_position) bitmap))) ... Produces the index of a KV-pair within a #Collisions node. -(def: (collision_index key_hash key colls) +(def (collision_index key_hash key colls) (All (_ k v) (-> (Hash k) k (Collisions k v) (Maybe Index))) (at maybe.monad each product.left (array.example' (function (_ idx [key' val']) @@ -239,7 +239,7 @@ ... When #Hierarchy nodes grow too small, they're demoted to #Base ... nodes to save space. -(def: (demotion except_idx [h_size h_array]) +(def (demotion except_idx [h_size h_array]) (All (_ k v) (-> Index (Hierarchy k v) [Bit_Map (Base k v)])) (product.right (list#mix (function (_ idx [insertion_idx node]) (let [[bitmap base] node] @@ -256,11 +256,11 @@ ... When #Base nodes grow too large, they're promoted to #Hierarchy to ... add some depth to the tree and help keep its balance. -(def: hierarchy_indices +(def hierarchy_indices (List Index) (list.indices hierarchy_nodes_size)) -(def: (promotion node#has key_hash level bitmap base) +(def (promotion node#has key_hash level bitmap base) (All (_ k v) (-> (-> Level Hash_Code k v (Hash k) (Node k v) (Node k v)) (Hash k) Level @@ -286,7 +286,7 @@ ... All empty nodes look the same (a #Base node with clean bitmap is ... used). ... So, this test is introduced to detect them. -(def: (node#empty? node) +(def (node#empty? node) (All (_ k v) (-> (Node k v) Bit)) (`` (case node {#Base (~~ (static ..clean_bitmap)) _} @@ -295,7 +295,7 @@ _ #0))) -(def: (node#has level hash key val key_hash node) +(def (node#has level hash key val key_hash node) (All (_ k v) (-> Level Hash_Code k v (Hash k) (Node k v) (Node k v))) (case node ... For #Hierarchy nodes, check whether one can add the element to @@ -387,7 +387,7 @@ (node#has level hash key val key_hash))) )) -(def: (node#lacks level hash key key_hash node) +(def (node#lacks level hash key key_hash node) (All (_ k v) (-> Level Hash_Code k (Hash k) (Node k v) (Node k v))) (case node ... For #Hierarchy nodes, find out if there's a valid sub-node for @@ -474,7 +474,7 @@ {#Collisions _hash (array#lacks idx _colls)})) )) -(def: (node#value level hash key key_hash node) +(def (node#value level hash key key_hash node) (All (_ k v) (-> Level Hash_Code k (Hash k) (Node k v) (Maybe v))) (case node ... For #Hierarchy nodes, just look-up the key on its children. @@ -505,7 +505,7 @@ _colls)) )) -(def: (node#size node) +(def (node#size node) (All (_ k v) (-> (Node k v) Nat)) (case node {#Hierarchy _size hierarchy} @@ -528,7 +528,7 @@ (array.size colls) )) -(def: (node#mix f init node) +(def (node#mix f init node) (All (_ k v a) (-> (-> [k v] a a) a (Node k v) a)) (case node {#Hierarchy _size hierarchy} @@ -554,7 +554,7 @@ init colls))) -(def: node#entries +(def node#entries (All (_ k v) (-> (Node k v) (List [k v]))) (node#mix (function (_ head tail) {.#Item head tail}) @@ -565,31 +565,31 @@ [#hash (Hash k) #root (Node k v)])) -(def: .public key_hash +(def .public key_hash (All (_ k v) (-> (Dictionary k v) (Hash k))) (the ..#hash)) -(def: .public (empty key_hash) +(def .public (empty key_hash) (All (_ k v) (-> (Hash k) (Dictionary k v))) [#hash key_hash #root ..empty_node]) -(def: .public (has key val dict) +(def .public (has key val dict) (All (_ k v) (-> k v (Dictionary k v) (Dictionary k v))) (let [[key_hash node] dict] [key_hash (node#has root_level (at key_hash hash key) key val key_hash node)])) -(def: .public (lacks key dict) +(def .public (lacks key dict) (All (_ k v) (-> k (Dictionary k v) (Dictionary k v))) (let [[key_hash node] dict] [key_hash (node#lacks root_level (at key_hash hash key) key key_hash node)])) -(def: .public (value key dict) +(def .public (value key dict) (All (_ k v) (-> k (Dictionary k v) (Maybe v))) (let [[key_hash node] dict] (node#value root_level (at key_hash hash key) key key_hash node))) -(def: .public (key? dict key) +(def .public (key? dict key) (All (_ k v) (-> (Dictionary k v) k Bit)) (case (value key dict) {.#None} #0 @@ -597,13 +597,13 @@ (exception: .public key_already_exists) -(def: .public (has' key val dict) +(def .public (has' key val dict) (All (_ k v) (-> k v (Dictionary k v) (Try (Dictionary k v)))) (case (value key dict) {.#None} {try.#Success (has key val dict)} {.#Some _} (exception.except ..key_already_exists []))) -(def: .public (revised key f dict) +(def .public (revised key f dict) (All (_ k v) (-> k (-> v v) (Dictionary k v) (Dictionary k v))) (case (value key dict) {.#None} @@ -612,26 +612,26 @@ {.#Some val} (has key (f val) dict))) -(def: .public (revised' key default f dict) +(def .public (revised' key default f dict) (All (_ k v) (-> k v (-> v v) (Dictionary k v) (Dictionary k v))) (..has key (f (maybe.else default (..value key dict))) dict)) -(def: .public size +(def .public size (All (_ k v) (-> (Dictionary k v) Nat)) (|>> (the #root) ..node#size)) -(def: .public empty? +(def .public empty? (All (_ k v) (-> (Dictionary k v) Bit)) (|>> size (n.= 0))) -(def: .public entries +(def .public entries (All (_ k v) (-> (Dictionary k v) (List [k v]))) (|>> (the #root) ..node#entries)) -(def: .public (of_list key_hash kvs) +(def .public (of_list key_hash kvs) (All (_ k v) (-> (Hash k) (List [k v]) (Dictionary k v))) (list#mix (function (_ [k v] dict) (..has k v dict)) @@ -639,7 +639,7 @@ kvs)) (with_template [ ] - [(def: .public + [(def .public (All (_ k v) (-> (Dictionary k v) (List ))) (|>> (the #root) (node#mix (function (_ [k v] bundle) @@ -650,14 +650,14 @@ [v values] ) -(def: .public (composite dict2 dict1) +(def .public (composite dict2 dict1) (All (_ k v) (-> (Dictionary k v) (Dictionary k v) (Dictionary k v))) (node#mix (function (_ [key val] dict) (has key val dict)) dict1 (the #root dict2))) -(def: .public (composite_with f dict2 dict1) +(def .public (composite_with f dict2 dict1) (All (_ k v) (-> (-> v v v) (Dictionary k v) (Dictionary k v) (Dictionary k v))) (node#mix (function (_ [key val2] dict) (case (value key dict) @@ -669,7 +669,7 @@ dict1 (the #root dict2))) -(def: .public (re_bound from_key to_key dict) +(def .public (re_bound from_key to_key dict) (All (_ k v) (-> k k (Dictionary k v) (Dictionary k v))) (case (value from_key dict) {.#None} @@ -680,7 +680,7 @@ (lacks from_key) (has to_key val)))) -(def: .public (sub keys dict) +(def .public (sub keys dict) (All (_ k v) (-> (List k) (Dictionary k v) (Dictionary k v))) (let [[key_hash _] dict] (list#mix (function (_ key new_dict) @@ -690,10 +690,10 @@ (empty key_hash) keys))) -(def: .public (equivalence (open ",#[0]")) +(def .public (equivalence (open ",#[0]")) (All (_ k v) (-> (Equivalence v) (Equivalence (Dictionary k v)))) (implementation - (def: (= reference subject) + (def (= reference subject) (and (n.= (..size reference) (..size subject)) (list.every? (function (_ [k rv]) @@ -705,10 +705,10 @@ #0)) (..entries reference)))))) -(def: node_functor +(def node_functor (All (_ k) (Functor (Node k))) (implementation - (def: (each f fa) + (def (each f fa) (case fa {#Hierarchy size hierarchy} {#Hierarchy size (array.each (each f) hierarchy)} @@ -728,14 +728,14 @@ [k (f v)]) collisions)})))) -(def: .public functor +(def .public functor (All (_ k) (Functor (Dictionary k))) (implementation - (def: (each f fa) + (def (each f fa) (.revised #root (at ..node_functor each f) fa)))) -(def: .public (monoid hash) +(def .public (monoid hash) (All (_ k v) (-> (Hash k) (Monoid (Dictionary k v)))) (implementation - (def: identity (..empty hash)) - (def: composite ..composite))) + (def identity (..empty hash)) + (def composite ..composite))) diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux index 38521368c..8592aaeec 100644 --- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux @@ -17,7 +17,7 @@ [number ["n" nat]]]]]) -(def: error_message +(def error_message "Invariant violation") (type: Color @@ -34,7 +34,7 @@ #right (Maybe (Node k v))])) (with_template [ ] - [(def: ( key value left right) + [(def ( key value left right) (All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) [#color {} #key key @@ -51,14 +51,14 @@ [#order (Order k) #root (Maybe (Node k v))])) -(def: .public (empty order) +(def .public (empty order) (All (_ k v) (-> (Order k) (Dictionary k v))) [#order order #root {.#None}]) ... TODO: Doing inneficient access of Order functions due to compiler bug. ... TODO: Must improve it as soon as bug is fixed. -(def: .public (value key dict) +(def .public (value key dict) (All (_ k v) (-> k (Dictionary k v) (Maybe v))) (let [... (open "_#[0]") (the #order dict) ] @@ -83,7 +83,7 @@ ... TODO: Doing inneficient access of Order functions due to compiler bug. ... TODO: Must improve it as soon as bug is fixed. -(def: .public (key? dict key) +(def .public (key? dict key) (All (_ k v) (-> (Dictionary k v) k Bit)) (let [... (open "_#[0]") (the #order dict) ] @@ -102,7 +102,7 @@ (again (the #right node))))))))) (with_template [ ] - [(def: .public ( dict) + [(def .public ( dict) (All (_ k v) (-> (Dictionary k v) (Maybe v))) (case (the #root dict) {.#None} @@ -121,7 +121,7 @@ [max #right] ) -(def: .public (size dict) +(def .public (size dict) (All (_ k v) (-> (Dictionary k v) Nat)) (loop (again [node (the #root dict)]) (case node @@ -132,12 +132,12 @@ (++ (n.+ (again (the #left node)) (again (the #right node))))))) -(def: .public empty? +(def .public empty? (All (_ k v) (-> (Dictionary k v) Bit)) (|>> ..size (n.= 0))) (with_template [ ] - [(def: ( self) + [(def ( self) (All (_ k v) (-> (Node k v) (Node k v))) (case (the #color self) {} @@ -151,7 +151,7 @@ [reddened #Black #Red (panic! error_message)] ) -(def: (with_left addition center) +(def (with_left addition center) (All (_ k v) (-> (Node k v) (Node k v) (Node k v))) (case (the #color center) {#Red} @@ -200,7 +200,7 @@ {#Black} )))) -(def: (with_right addition center) +(def (with_right addition center) (All (_ k v) (-> (Node k v) (Node k v) (Node k v))) (case (the #color center) {#Red} @@ -249,7 +249,7 @@ {#Black} )))) -(def: .public (has key value dict) +(def .public (has key value dict) (All (_ k v) (-> k v (Dictionary k v) (Dictionary k v))) (let [(open "_#[0]") (the #order dict) root' (loop (again [?root (the #root dict)]) @@ -278,7 +278,7 @@ ))] (.has #root root' dict))) -(def: (left_balanced key value ?left ?right) +(def (left_balanced key value ?left ?right) (All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) (case ?left (^.multi {.#Some left} @@ -307,7 +307,7 @@ _ (black key value ?left ?right))) -(def: (right_balanced key value ?left ?right) +(def (right_balanced key value ?left ?right) (All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) (case ?right (^.multi {.#Some right} @@ -334,7 +334,7 @@ _ (black key value ?left ?right))) -(def: (without_left key value ?left ?right) +(def (without_left key value ?left ?right) (All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) (case ?left (^.multi {.#Some left} @@ -363,7 +363,7 @@ (panic! error_message)) )) -(def: (without_right key value ?left ?right) +(def (without_right key value ?left ?right) (All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) (case ?right (^.multi {.#Some right} @@ -392,7 +392,7 @@ (panic! error_message) ))) -(def: (prepended ?left ?right) +(def (prepended ?left ?right) (All (_ k v) (-> (Maybe (Node k v)) (Maybe (Node k v)) (Maybe (Node k v)))) (case [?left ?right] [{.#None} _] @@ -472,7 +472,7 @@ _ (undefined))) -(def: .public (lacks key dict) +(def .public (lacks key dict) (All (_ k v) (-> k (Dictionary k v) (Dictionary k v))) (let [(open "_#[0]") (the #order dict) [?root found?] (loop (again [?root (the #root dict)]) @@ -527,7 +527,7 @@ (.has #root {.#Some (blackened root)} dict) ))) -(def: .public (revised key transform dict) +(def .public (revised key transform dict) (All (_ k v) (-> k (-> v v) (Dictionary k v) (Dictionary k v))) (case (..value key dict) {.#Some old} @@ -536,7 +536,7 @@ {.#None} dict)) -(def: .public (of_list order list) +(def .public (of_list order list) (All (_ k v) (-> (Order k) (List [k v]) (Dictionary k v))) (list#mix (function (_ [key value] dict) (..has key value dict)) @@ -544,7 +544,7 @@ list)) (with_template [ ] - [(def: .public ( dict) + [(def .public ( dict) (All (_ k v) (-> (Dictionary k v) (List ))) (loop (again [node (the #root dict)]) (case node @@ -562,10 +562,10 @@ [values v (the #value node')] ) -(def: .public (equivalence (open ",#[0]")) +(def .public (equivalence (open ",#[0]")) (All (_ k v) (-> (Equivalence v) (Equivalence (Dictionary k v)))) (implementation - (def: (= reference sample) + (def (= reference sample) (let [(open "/#[0]") (the #order reference)] (loop (again [entriesR (entries reference) entriesS (entries sample)]) diff --git a/stdlib/source/library/lux/data/collection/dictionary/plist.lux b/stdlib/source/library/lux/data/collection/dictionary/plist.lux index d594f7b5e..3dd3521c4 100644 --- a/stdlib/source/library/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/library/lux/data/collection/dictionary/plist.lux @@ -19,19 +19,19 @@ (type: .public (PList a) (List [Text a])) -(def: .public empty +(def .public empty PList {.#End}) -(def: .public size +(def .public size (All (_ a) (-> (PList a) Nat)) list.size) -(def: .public empty? +(def .public empty? (All (_ a) (-> (PList a) Bit)) (|>> ..size (n.= 0))) -(def: .public (value key properties) +(def .public (value key properties) (All (_ a) (-> Text (PList a) (Maybe a))) (case properties {.#End} @@ -43,7 +43,7 @@ (value key properties')))) (with_template [ ] - [(def: .public + [(def .public (All (_ a) (-> (PList a) (List ))) (list#each ))] @@ -51,7 +51,7 @@ [values a product.right] ) -(def: .public (contains? key properties) +(def .public (contains? key properties) (All (_ a) (-> Text (PList a) Bit)) (case (..value key properties) {.#Some _} @@ -60,7 +60,7 @@ {.#None} false)) -(def: .public (has key val properties) +(def .public (has key val properties) (All (_ a) (-> Text a (PList a) (PList a))) (case properties {.#End} @@ -73,7 +73,7 @@ {.#Item [k' v'] (has key val properties')}))) -(def: .public (revised key f properties) +(def .public (revised key f properties) (All (_ a) (-> Text (-> a a) (PList a) (PList a))) (case properties {.#End} @@ -84,7 +84,7 @@ {.#Item [k' (f v')] properties'} {.#Item [k' v'] (revised key f properties')}))) -(def: .public (lacks key properties) +(def .public (lacks key properties) (All (_ a) (-> Text (PList a) (PList a))) (case properties {.#End} @@ -96,10 +96,10 @@ {.#Item [k' v'] (lacks key properties')}))) -(def: .public (equivalence (open "/#[0]")) +(def .public (equivalence (open "/#[0]")) (All (_ a) (-> (Equivalence a) (Equivalence (PList a)))) (implementation - (def: (= reference subject) + (def (= reference subject) (and (n.= (list.size reference) (list.size subject)) (list.every? (function (_ [key val]) @@ -109,13 +109,13 @@ (maybe.else false))) subject))))) -(def: .public monoid +(def .public monoid (All (_ a) (Monoid (PList a))) (implementation - (def: identity + (def identity ..empty) - (def: (composite left right) + (def (composite left right) (list#mix (function (_ [key val] it) (..has key val it)) right diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux index dec3d00c1..6be267e78 100644 --- a/stdlib/source/library/lux/data/collection/list.lux +++ b/stdlib/source/library/lux/data/collection/list.lux @@ -23,10 +23,10 @@ ... #End ... {#Item a (List a)}) -(def: .public mix +(def .public mix (Mix List) (implementation - (def: (mix f init xs) + (def (mix f init xs) (case xs {.#End} init @@ -34,7 +34,7 @@ {.#Item x xs'} (mix f (f x init) xs'))))) -(def: .public (mixes f init inputs) +(def .public (mixes f init inputs) (All (_ a b) (-> (-> a b b) b (List a) (List b))) (case inputs {.#End} @@ -43,7 +43,7 @@ {.#Item [head tail]} {.#Item [init (mixes f (f head init) tail)]})) -(def: .public (reversed xs) +(def .public (reversed xs) (All (_ a) (-> (List a) (List a))) (mix (function (_ head tail) @@ -51,7 +51,7 @@ {.#End} xs)) -(def: .public (only keep? xs) +(def .public (only keep? xs) (All (_ a) (-> (Predicate a) (List a) (List a))) (case xs @@ -63,7 +63,7 @@ {.#Item x (only keep? xs')} (only keep? xs')))) -(def: .public (partition satisfies? list) +(def .public (partition satisfies? list) (All (_ a) (-> (Predicate a) (List a) [(List a) (List a)])) (case list {.#End} @@ -75,12 +75,12 @@ [{.#Item head in} out] [in {.#Item head out}])))) -(def: wrong_syntax_error +(def wrong_syntax_error (template (_ ) [((`` ("lux in-module" (~~ (static .prelude)) .wrong_syntax_error)) (symbol ))])) -(def: .public partial +(def .public partial (macro (_ tokens state) (case (reversed tokens) {.#Item tail heads} @@ -92,7 +92,7 @@ _ {.#Left (wrong_syntax_error ..partial)}))) -(def: .public (pairs xs) +(def .public (pairs xs) (All (_ a) (-> (List a) (Maybe (List [a a])))) (case xs (pattern (partial x1 x2 xs')) @@ -110,7 +110,7 @@ {.#None})) (with_template [ ] - [(def: .public ( n xs) + [(def .public ( n xs) (All (_ a) (-> Nat (List a) (List a))) (if (n.> 0 n) @@ -127,7 +127,7 @@ ) (with_template [ ] - [(def: .public ( predicate xs) + [(def .public ( predicate xs) (All (_ a) (-> (Predicate a) (List a) (List a))) (case xs @@ -143,7 +143,7 @@ [until (until predicate xs') xs] ) -(def: .public (split_at n xs) +(def .public (split_at n xs) (All (_ a) (-> Nat (List a) [(List a) (List a)])) (case n @@ -156,7 +156,7 @@ (let [[tail rest] (split_at (-- n) xs')] [{.#Item x tail} rest])))) -(def: (split_when' predicate ys xs) +(def (split_when' predicate ys xs) (All (_ a) (-> (Predicate a) (List a) (List a) [(List a) (List a)])) (case xs @@ -168,13 +168,13 @@ [ys xs] (split_when' predicate {.#Item x ys} xs')))) -(def: .public (split_when predicate xs) +(def .public (split_when predicate xs) (All (_ a) (-> (Predicate a) (List a) [(List a) (List a)])) (let [[ys' xs'] (split_when' predicate {.#End} xs)] [(reversed ys') xs'])) -(def: .public (sub size list) +(def .public (sub size list) (All (_ a) (-> Nat (List a) (List (List a)))) (case list {.#End} @@ -184,14 +184,14 @@ (let [[pre post] (split_at size list)] {.#Item pre (sub size post)}))) -(def: .public (repeated n x) +(def .public (repeated n x) (All (_ a) (-> Nat a (List a))) (case n 0 {.#End} _ {.#Item x (repeated (-- n) x)})) -(def: (iterations' f x) +(def (iterations' f x) (All (_ a) (-> (-> a (Maybe a)) a (List a))) (case (f x) @@ -201,7 +201,7 @@ {.#None} (list))) -(def: .public (iterations f x) +(def .public (iterations f x) (All (_ a) (-> (-> a (Maybe a)) a (List a))) (case (f x) @@ -211,7 +211,7 @@ {.#None} (list x))) -(def: .public (one check xs) +(def .public (one check xs) (All (_ a b) (-> (-> a (Maybe b)) (List a) (Maybe b))) (case xs @@ -226,7 +226,7 @@ {.#None} (one check xs')))) -(def: .public (all check xs) +(def .public (all check xs) (All (_ a b) (-> (-> a (Maybe b)) (List a) (List b))) (for @.js @@ -252,7 +252,7 @@ {.#None} (all check xs'))))) -(def: .public (example predicate xs) +(def .public (example predicate xs) (All (_ a) (-> (Predicate a) (List a) (Maybe a))) (..one (function (_ value) @@ -261,7 +261,7 @@ {.#None})) xs)) -(def: .public (interposed sep xs) +(def .public (interposed sep xs) (All (_ a) (-> a (List a) (List a))) (case xs @@ -274,12 +274,12 @@ {.#Item x xs'} (partial x sep (interposed sep xs')))) -(def: .public (size list) +(def .public (size list) (All (_ a) (-> (List a) Nat)) (mix (function (_ _ acc) (n.+ 1 acc)) 0 list)) (with_template [ ] - [(def: .public ( predicate items) + [(def .public ( predicate items) (All (_ a) (-> (Predicate a) (List a) Bit)) (case items @@ -294,7 +294,7 @@ [any? #0 or] ) -(def: .public (item i xs) +(def .public (item i xs) (All (_ a) (-> Nat (List a) (Maybe a))) (case xs @@ -306,10 +306,10 @@ 0 {.#Some x} _ (item (-- i) xs')))) -(def: .public (equivalence Equivalence) +(def .public (equivalence Equivalence) (All (_ a) (-> (Equivalence a) (Equivalence (List a)))) (implementation - (def: (= xs ys) + (def (= xs ys) (case [xs ys] [{.#End} {.#End}] #1 @@ -322,24 +322,24 @@ #0 )))) -(def: .public (hash super) +(def .public (hash super) (All (_ a) (-> (Hash a) (Hash (List a)))) (implementation - (def: equivalence + (def equivalence (..equivalence (at super equivalence))) - (def: hash + (def hash (at ..mix mix (function (_ member hash) (n.+ (at super hash member) hash)) 0)))) -(def: .public monoid +(def .public monoid (All (_ a) (Monoid (List a))) (implementation - (def: identity + (def identity {.#End}) - (def: (composite xs ys) + (def (composite xs ys) (case xs {.#End} ys @@ -349,10 +349,10 @@ (open: "[0]" ..monoid) -(def: .public functor +(def .public functor (Functor List) (implementation - (def: (each f ma) + (def (each f ma) (case ma {.#End} {.#End} @@ -362,12 +362,12 @@ (open: "[0]" ..functor) -(def: .public apply +(def .public apply (Apply List) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (on fa ff) + (def (on fa ff) (case ff {.#End} {.#End} @@ -377,18 +377,18 @@ (on fa) (composite (each f fa))))))) -(def: .public monad +(def .public monad (Monad List) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (in a) + (def (in a) {.#Item a {.#End}}) - (def: conjoint + (def conjoint (|>> reversed (mix composite identity))))) -(def: .public (sorted < xs) +(def .public (sorted < xs) (All (_ a) (-> (-> a a Bit) (List a) (List a))) (case xs {.#End} @@ -406,7 +406,7 @@ xs')] (.all composite (sorted < pre) (list x) (sorted < post))))) -(def: .public (empty? xs) +(def .public (empty? xs) (All (_ a) (Predicate (List a))) (case xs {.#End} @@ -415,7 +415,7 @@ _ false)) -(def: .public (member? eq xs x) +(def .public (member? eq xs x) (All (_ a) (-> (Equivalence a) (List a) a Bit)) (case xs {.#End} @@ -426,7 +426,7 @@ (member? eq xs' x)))) (with_template [ ] - [(def: .public ( xs) + [(def .public ( xs) (All (_ a) (-> (List a) (Maybe ))) (case xs {.#End} @@ -439,17 +439,17 @@ [tail (List a) xs'] ) -(def: .public (indices size) +(def .public (indices size) (All (_ a) (-> Nat (List Nat))) (case size 0 (list) _ (|> size -- (enum.range n.enum 0)))) -(def: (symbol$ name) +(def (symbol$ name) (-> Text Code) [["" 0 0] {.#Symbol "" name}]) -(def: (nat#encoded value) +(def (nat#encoded value) (-> Nat Text) (loop (again [input value output ""]) @@ -471,7 +471,7 @@ 0 output' _ (again input' output'))))) -(def: .public zipped +(def .public zipped (macro (_ tokens state) (case tokens (pattern (list [_ {.#Nat num_lists}])) @@ -509,10 +509,10 @@ _ {.#Left (wrong_syntax_error ..zipped)}))) -(def: .public zipped_2 (zipped 2)) -(def: .public zipped_3 (zipped 3)) +(def .public zipped_2 (zipped 2)) +(def .public zipped_3 (zipped 3)) -(def: .public zipped_with +(def .public zipped_with (macro (_ tokens state) (case tokens (pattern (list [_ {.#Nat num_lists}])) @@ -553,10 +553,10 @@ _ {.#Left (wrong_syntax_error ..zipped_with)}))) -(def: .public zipped_with_2 (zipped_with 2)) -(def: .public zipped_with_3 (zipped_with 3)) +(def .public zipped_with_2 (zipped_with 2)) +(def .public zipped_with_3 (zipped_with 3)) -(def: .public (last xs) +(def .public (last xs) (All (_ a) (-> (List a) (Maybe a))) (case xs {.#End} @@ -568,7 +568,7 @@ {.#Item x xs'} (last xs'))) -(def: .public (inits xs) +(def .public (inits xs) (All (_ a) (-> (List a) (Maybe (List a)))) (case xs {.#End} @@ -586,21 +586,21 @@ {.#Some {.#Item x tail}}) )) -(def: .public together +(def .public together (All (_ a) (-> (List (List a)) (List a))) (at ..monad conjoint)) -(def: .public (with monad) +(def .public (with monad) (All (_ M) (-> (Monad M) (Monad (All (_ a) (M (List a)))))) (implementation - (def: functor + (def functor (functor.composite (the monad.functor monad) ..functor)) - (def: in + (def in (|>> (at ..monad in) (at monad in))) - (def: (conjoint MlMla) + (def (conjoint MlMla) (do [! monad] [lMla MlMla ... TODO: Remove this version ASAP and use one below. @@ -610,11 +610,11 @@ (monad.all ! lMla))] (in (..together lla)))))) -(def: .public (lifted monad) +(def .public (lifted monad) (All (_ M a) (-> (Monad M) (-> (M a) (M (List a))))) (at monad each (at ..monad in))) -(def: .public (enumeration xs) +(def .public (enumeration xs) (All (_ a) (-> (List a) (List [Nat a]))) (loop (again [idx 0 xs xs]) @@ -625,7 +625,7 @@ {.#Item x xs'} {.#Item [idx x] (again (++ idx) xs')}))) -(def: .public when +(def .public when (macro (_ tokens state) (case tokens (pattern (.list test then)) @@ -636,7 +636,7 @@ _ {.#Left (wrong_syntax_error ..when)}))) -(def: .public (revised item revision it) +(def .public (revised item revision it) (All (_ a) (-> Nat (-> a a) (List a) (List a))) (case it {.#End} diff --git a/stdlib/source/library/lux/data/collection/queue.lux b/stdlib/source/library/lux/data/collection/queue.lux index d6d421304..54c1024b6 100644 --- a/stdlib/source/library/lux/data/collection/queue.lux +++ b/stdlib/source/library/lux/data/collection/queue.lux @@ -16,42 +16,42 @@ [#front (List a) #rear (List a)])) -(def: .public empty +(def .public empty Queue [#front (.list) #rear (.list)]) -(def: .public (of_list entries) +(def .public (of_list entries) (All (_ a) (-> (List a) (Queue a))) [#front entries #rear (.list)]) -(def: .public (list queue) +(def .public (list queue) (All (_ a) (-> (Queue a) (List a))) (let [(open "_[0]") queue] (list#composite _#front (list.reversed _#rear)))) -(def: .public front +(def .public front (All (_ a) (-> (Queue a) (Maybe a))) (|>> (the #front) list.head)) -(def: .public (size queue) +(def .public (size queue) (All (_ a) (-> (Queue a) Nat)) (let [(open "_[0]") queue] (n.+ (list.size _#front) (list.size _#rear)))) -(def: .public empty? +(def .public empty? (All (_ a) (-> (Queue a) Bit)) (|>> (the #front) list.empty?)) -(def: .public (member? equivalence queue member) +(def .public (member? equivalence queue member) (All (_ a) (-> (Equivalence a) (Queue a) a Bit)) (let [(open "_[0]") queue] (or (list.member? equivalence _#front member) (list.member? equivalence _#rear member)))) -(def: .public (next queue) +(def .public (next queue) (All (_ a) (-> (Queue a) (Queue a))) (case (the #front queue) ... Empty... @@ -69,7 +69,7 @@ (|> queue (has #front front')))) -(def: .public (end val queue) +(def .public (end val queue) (All (_ a) (-> a (Queue a) (Queue a))) (case (the #front queue) {.#End} @@ -78,17 +78,17 @@ _ (revised #rear (|>> {.#Item val}) queue))) -(def: .public (equivalence super) +(def .public (equivalence super) (All (_ a) (-> (Equivalence a) (Equivalence (Queue a)))) (implementation - (def: (= reference subject) + (def (= reference subject) (at (list.equivalence super) = (..list reference) (..list subject))))) -(def: .public functor +(def .public functor (Functor Queue) (implementation - (def: (each f fa) + (def (each f fa) [#front (|> fa (the #front) (list#each f)) #rear (|> fa (the #rear) (list#each f))]))) diff --git a/stdlib/source/library/lux/data/collection/queue/priority.lux b/stdlib/source/library/lux/data/collection/queue/priority.lux index e3016e239..30cc94613 100644 --- a/stdlib/source/library/lux/data/collection/queue/priority.lux +++ b/stdlib/source/library/lux/data/collection/queue/priority.lux @@ -19,18 +19,18 @@ (type: .public Priority Nat) -(def: .public max +(def .public max Priority n#top) -(def: .public min +(def .public min Priority n#bottom) -(def: builder +(def builder (tree.builder n.maximum)) -(def: :@: +(def :@: (by_example [@] (is (tree.Builder @ Priority) ..builder) @@ -39,18 +39,18 @@ (primitive .public (Queue a) (Maybe (Tree :@: Priority a)) - (def: .public empty + (def .public empty Queue (abstraction {.#None})) - (def: .public (front queue) + (def .public (front queue) (All (_ a) (-> (Queue a) (Maybe a))) (do maybe.monad [tree (representation queue)] (tree.one (n.= (tree.tag tree)) tree))) - (def: .public (size queue) + (def .public (size queue) (All (_ a) (-> (Queue a) Nat)) (case (representation queue) {.#None} @@ -65,7 +65,7 @@ {0 #1 [left right]} (n.+ (again left) (again right)))))) - (def: .public (member? equivalence queue member) + (def .public (member? equivalence queue member) (All (_ a) (-> (Equivalence a) (Queue a) a Bit)) (case (representation queue) {.#None} @@ -81,7 +81,7 @@ (or (again left) (again right)))))) - (def: .public (next queue) + (def .public (next queue) (All (_ a) (-> (Queue a) (Queue a))) (abstraction (do maybe.monad @@ -109,7 +109,7 @@ {.#Some =right} {.#Some (at ..builder branch left =right)}))))))) - (def: .public (end priority value queue) + (def .public (end priority value queue) (All (_ a) (-> Priority a (Queue a) (Queue a))) (let [addition (at ..builder leaf priority value)] (abstraction @@ -121,6 +121,6 @@ {.#Some (at ..builder branch tree addition)})))) ) -(def: .public empty? +(def .public empty? (All (_ a) (-> (Queue a) Bit)) (|>> ..size (n.= 0))) diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux index bae056369..da7ea73c1 100644 --- a/stdlib/source/library/lux/data/collection/sequence.lux +++ b/stdlib/source/library/lux/data/collection/sequence.lux @@ -51,16 +51,16 @@ (type: Index Nat) -(def: branching_exponent +(def branching_exponent Nat 5) -(def: root_level +(def root_level Level 0) (with_template [ ] - [(def: + [(def (-> Level Level) ( branching_exponent))] @@ -68,23 +68,23 @@ [level_down n.-] ) -(def: full_node_size +(def full_node_size Nat (i64.left_shifted branching_exponent 1)) -(def: branch_idx_mask +(def branch_idx_mask Nat (-- full_node_size)) -(def: branch_idx +(def branch_idx (-> Index Index) (i64.and branch_idx_mask)) -(def: (empty_hierarchy _) +(def (empty_hierarchy _) (All (_ a) (-> Any (Hierarchy a))) (array.empty ..full_node_size)) -(def: (tail_off sequence_size) +(def (tail_off sequence_size) (-> Nat Nat) (if (n.< full_node_size sequence_size) 0 @@ -92,7 +92,7 @@ (i64.right_shifted branching_exponent) (i64.left_shifted branching_exponent)))) -(def: (path level tail) +(def (path level tail) (All (_ a) (-> Level (Base a) (Node a))) (if (n.= 0 level) {#Base tail} @@ -100,12 +100,12 @@ (array.has! 0 (path (level_down level) tail)) {#Hierarchy}))) -(def: (tail singleton) +(def (tail singleton) (All (_ a) (-> a (Base a))) (|> (array.empty 1) (array.has! 0 singleton))) -(def: (with_tail size level tail parent) +(def (with_tail size level tail parent) (All (_ a) (-> Nat Level (Base a) (Hierarchy a) (Hierarchy a))) (let [sub_idx (branch_idx (i64.right_shifted level (-- size))) ... If we're currently on a bottom node @@ -126,14 +126,14 @@ (|> (array.clone parent) (array.has! sub_idx sub_node)))) -(def: (expanded_tail val tail) +(def (expanded_tail val tail) (All (_ a) (-> a (Base a) (Base a))) (let [tail_size (array.size tail)] (|> (array.empty (++ tail_size)) (array.copy! tail_size 0 tail 0) (array.has! tail_size val)))) -(def: (hierarchy#has level idx val hierarchy) +(def (hierarchy#has level idx val hierarchy) (All (_ a) (-> Level Index a (Hierarchy a) (Hierarchy a))) (let [sub_idx (branch_idx (i64.right_shifted level idx))] (case (array.item sub_idx hierarchy) @@ -151,7 +151,7 @@ _ (undefined)))) -(def: (without_tail size level hierarchy) +(def (without_tail size level hierarchy) (All (_ a) (-> Nat Level (Hierarchy a) (Maybe (Hierarchy a)))) (let [sub_idx (branch_idx (i64.right_shifted level (n.- 2 size)))] (cond (n.= 0 sub_idx) @@ -176,7 +176,7 @@ {.#Some}) ))) -(def: (node#list node) +(def (node#list node) (All (_ a) (-> (Node a) (List a))) (case node {#Base base} @@ -197,18 +197,18 @@ #root (Hierarchy a) #tail (Base a)])) -(def: .public empty +(def .public empty Sequence [#level (level_up root_level) #size 0 #root (empty_hierarchy []) #tail (array.empty 0)]) -(def: .public (size sequence) +(def .public (size sequence) (All (_ a) (-> (Sequence a) Nat)) (the #size sequence)) -(def: .public (suffix val sequence) +(def .public (suffix val sequence) (All (_ a) (-> a (Sequence a) (Sequence a))) ... Check if there is room in the tail. (let [sequence_size (the #size sequence)] @@ -249,11 +249,11 @@ (exception: base_was_not_found) -(def: .public (within_bounds? sequence idx) +(def .public (within_bounds? sequence idx) (All (_ a) (-> (Sequence a) Nat Bit)) (n.< (the #size sequence) idx)) -(def: (base_for idx sequence) +(def (base_for idx sequence) (All (_ a) (-> Index (Sequence a) (Try (Base a)))) (if (within_bounds? sequence idx) (if (n.< (tail_off (the #size sequence)) idx) @@ -275,7 +275,7 @@ {try.#Success (the #tail sequence)}) (exception.except ..index_out_of_bounds [sequence idx]))) -(def: .public (item idx sequence) +(def .public (item idx sequence) (All (_ a) (-> Nat (Sequence a) (Try a))) (do try.monad [base (base_for idx sequence) @@ -284,7 +284,7 @@ (exception.except ..incorrect_sequence_structure []) {try.#Success (array.item index base)}))) -(def: .public (has idx val sequence) +(def .public (has idx val sequence) (All (_ a) (-> Nat a (Sequence a) (Try (Sequence a)))) (let [sequence_size (the #size sequence)] (if (within_bounds? sequence idx) @@ -297,13 +297,13 @@ sequence))} (exception.except ..index_out_of_bounds [sequence idx])))) -(def: .public (revised idx revision it) +(def .public (revised idx revision it) (All (_ a) (-> Nat (-> a a) (Sequence a) (Try (Sequence a)))) (do try.monad [val (..item idx it)] (..has idx (revision val) it))) -(def: .public (prefix sequence) +(def .public (prefix sequence) (All (_ a) (-> (Sequence a) (Sequence a))) (case (the #size sequence) 0 @@ -348,31 +348,31 @@ (.has #tail new_tail)))))) )) -(def: .public (list sequence) +(def .public (list sequence) (All (_ a) (-> (Sequence a) (List a))) (list#composite (node#list {#Hierarchy (the #root sequence)}) (node#list {#Base (the #tail sequence)}))) -(def: .public of_list +(def .public of_list (All (_ a) (-> (List a) (Sequence a))) (list#mix ..suffix ..empty)) -(def: .public (member? equivalence sequence val) +(def .public (member? equivalence sequence val) (All (_ a) (-> (Equivalence a) (Sequence a) a Bit)) (list.member? equivalence (list sequence) val)) -(def: .public empty? +(def .public empty? (All (_ a) (-> (Sequence a) Bit)) (|>> (the #size) (n.= 0))) -(def: .public sequence +(def .public sequence (syntax (_ [elems (<>.some .any)]) (in (.list (` (..of_list (.list (~+ elems)))))))) -(def: (node_equivalence //#=) +(def (node_equivalence //#=) (All (_ a) (-> (Equivalence a) (Equivalence (Node a)))) (implementation - (def: (= v1 v2) + (def (= v1 v2) (case [v1 v2] [{#Base b1} {#Base b2}] (array.= //#= b1 b2) @@ -383,10 +383,10 @@ _ #0)))) -(def: .public (equivalence //#=) +(def .public (equivalence //#=) (All (_ a) (-> (Equivalence a) (Equivalence (Sequence a)))) (implementation - (def: (= v1 v2) + (def (= v1 v2) (and (n.= (the #size v1) (the #size v2)) (let [(open "node#[0]") (node_equivalence //#=)] (and (node#= {#Base (the #tail v1)} @@ -394,10 +394,10 @@ (node#= {#Hierarchy (the #root v1)} {#Hierarchy (the #root v2)}))))))) -(def: node_mix +(def node_mix (Mix Node) (implementation - (def: (mix $ init xs) + (def (mix $ init xs) (case xs {#Base base} (array.mix (function (_ _ item output) ($ item output)) @@ -409,10 +409,10 @@ init hierarchy))))) -(def: .public mix +(def .public mix (Mix Sequence) (implementation - (def: (mix $ init xs) + (def (mix $ init xs) (let [(open "[0]") node_mix] (mix $ (mix $ @@ -420,18 +420,18 @@ {#Hierarchy (the #root xs)}) {#Base (the #tail xs)}))))) -(def: .public monoid +(def .public monoid (All (_ a) (Monoid (Sequence a))) (implementation - (def: identity ..empty) + (def identity ..empty) - (def: (composite xs ys) + (def (composite xs ys) (list#mix suffix xs (..list ys))))) -(def: node_functor +(def node_functor (Functor Node) (implementation - (def: (each $ xs) + (def (each $ xs) (case xs {#Base base} {#Base (array.each $ base)} @@ -439,10 +439,10 @@ {#Hierarchy hierarchy} {#Hierarchy (array.each (each $) hierarchy)})))) -(def: .public functor +(def .public functor (Functor Sequence) (implementation - (def: (each $ xs) + (def (each $ xs) [#level (the #level xs) #size (the #size xs) #root (let [ ... TODO: This binding was established to get around a compilation error. Fix and inline! @@ -450,12 +450,12 @@ (|> xs (the #root) (array.each $))) #tail (|> xs (the #tail) (array.each $))]))) -(def: .public apply +(def .public apply (Apply Sequence) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (on fa ff) + (def (on fa ff) (let [(open "[0]") ..functor (open "[0]") ..mix (open "[0]") ..monoid @@ -463,27 +463,27 @@ ff)] (mix composite identity results))))) -(def: .public monad +(def .public monad (Monad Sequence) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: in + (def in (|>> sequence)) - (def: conjoint + (def conjoint (let [(open "[0]") ..mix (open "[0]") ..monoid] (mix (function (_ post pre) (composite pre post)) identity))))) -(def: .public reversed +(def .public reversed (All (_ a) (-> (Sequence a) (Sequence a))) (|>> ..list list.reversed (list#mix suffix ..empty))) (with_template [ ] - [(def: .public + [(def .public (All (_ a) (-> (Predicate a) (Sequence a) Bit)) (let [help (is (All (_ a) @@ -504,7 +504,7 @@ [any? array.any? #0 or] ) -(def: .public (only when items) +(def .public (only when items) (All (_ a) (-> (-> a Bit) (Sequence a) (Sequence a))) (..mix (function (_ item output) (if (when item) @@ -513,7 +513,7 @@ ..empty items)) -(def: (one|node check items) +(def (one|node check items) (All (_ a b) (-> (-> a (Maybe b)) (Node a) (Maybe b))) (case items @@ -523,7 +523,7 @@ {#Hierarchy items} (array.one (one|node check) items))) -(def: .public (one check items) +(def .public (one check items) (All (_ a b) (-> (-> a (Maybe b)) (Sequence a) (Maybe b))) (case (let [... TODO: This binding was established to get around a compilation error. Fix and inline! diff --git a/stdlib/source/library/lux/data/collection/set.lux b/stdlib/source/library/lux/data/collection/set.lux index 138d5c351..fd2e32815 100644 --- a/stdlib/source/library/lux/data/collection/set.lux +++ b/stdlib/source/library/lux/data/collection/set.lux @@ -20,88 +20,88 @@ (type: .public (Set a) (Dictionary a Any)) -(def: .public member_hash +(def .public member_hash (All (_ a) (-> (Set a) (Hash a))) //.key_hash) -(def: .public empty +(def .public empty (All (_ a) (-> (Hash a) (Set a))) //.empty) -(def: .public size +(def .public size (All (_ a) (-> (Set a) Nat)) //.size) -(def: .public (has elem set) +(def .public (has elem set) (All (_ a) (-> a (Set a) (Set a))) (|> set (//.has elem []))) -(def: .public lacks +(def .public lacks (All (_ a) (-> a (Set a) (Set a))) //.lacks) -(def: .public member? +(def .public member? (All (_ a) (-> (Set a) a Bit)) //.key?) -(def: .public list +(def .public list (All (_ a) (-> (Set a) (List a))) //.keys) -(def: .public union +(def .public union (All (_ a) (-> (Set a) (Set a) (Set a))) //.composite) -(def: .public (difference sub base) +(def .public (difference sub base) (All (_ a) (-> (Set a) (Set a) (Set a))) (list#mix ..lacks base (..list sub))) -(def: .public (intersection filter base) +(def .public (intersection filter base) (All (_ a) (-> (Set a) (Set a) (Set a))) (//.sub (//.keys filter) base)) -(def: .public equivalence +(def .public equivalence (All (_ a) (Equivalence (Set a))) (implementation - (def: (= (^.let reference [hash _]) sample) + (def (= (^.let reference [hash _]) sample) (and (n.= (..size reference) (..size sample)) (list.every? (..member? reference) (..list sample)))))) -(def: .public hash +(def .public hash (All (_ a) (Hash (Set a))) (implementation - (def: equivalence ..equivalence) + (def equivalence ..equivalence) - (def: (hash set) + (def (hash set) (|> set ..list (at (list.hash (..member_hash set)) hash))))) -(def: .public (monoid hash) +(def .public (monoid hash) (All (_ a) (-> (Hash a) (Monoid (Set a)))) (implementation - (def: identity (..empty hash)) - (def: composite ..union))) + (def identity (..empty hash)) + (def composite ..union))) -(def: .public empty? +(def .public empty? (All (_ a) (-> (Set a) Bit)) (|>> ..size (n.= 0))) -(def: .public (of_list hash elements) +(def .public (of_list hash elements) (All (_ a) (-> (Hash a) (List a) (Set a))) (list#mix ..has (..empty hash) elements)) -(def: .public (sub? super sub) +(def .public (sub? super sub) (All (_ a) (-> (Set a) (Set a) Bit)) (list.every? (..member? super) (..list sub))) -(def: .public (super? sub super) +(def .public (super? sub super) (All (_ a) (-> (Set a) (Set a) Bit)) (..sub? super sub)) -(def: .public predicate +(def .public predicate (All (_ a) (-> (Set a) (Predicate a))) ..member?) diff --git a/stdlib/source/library/lux/data/collection/set/multi.lux b/stdlib/source/library/lux/data/collection/set/multi.lux index 3e63b2926..72e1e1620 100644 --- a/stdlib/source/library/lux/data/collection/set/multi.lux +++ b/stdlib/source/library/lux/data/collection/set/multi.lux @@ -23,15 +23,15 @@ (primitive .public (Set a) (Dictionary a Nat) - (def: .public empty + (def .public empty (All (_ a) (-> (Hash a) (Set a))) (|>> dictionary.empty abstraction)) - (def: .public size + (def .public size (All (_ a) (-> (Set a) Nat)) (|>> representation dictionary.values (list#mix n.+ 0))) - (def: .public (has multiplicity elem set) + (def .public (has multiplicity elem set) (All (_ a) (-> Nat a (Set a) (Set a))) (case multiplicity 0 set @@ -40,7 +40,7 @@ (dictionary.revised' elem 0 (n.+ multiplicity)) abstraction))) - (def: .public (lacks multiplicity elem set) + (def .public (lacks multiplicity elem set) (All (_ a) (-> Nat a (Set a) (Set a))) (case multiplicity 0 set @@ -54,11 +54,11 @@ {.#None} set))) - (def: .public (multiplicity set elem) + (def .public (multiplicity set elem) (All (_ a) (-> (Set a) a Nat)) (|> set representation (dictionary.value elem) (maybe.else 0))) - (def: .public list + (def .public list (All (_ a) (-> (Set a) (List a))) (|>> representation dictionary.entries @@ -67,7 +67,7 @@ {.#End}))) (with_template [ ] - [(def: .public ( parameter subject) + [(def .public ( parameter subject) (All (_ a) (-> (Set a) (Set a) (Set a))) (abstraction (dictionary.composite_with (representation parameter) (representation subject))))] @@ -75,7 +75,7 @@ [sum n.+] ) - (def: .public (intersection parameter subject) + (def .public (intersection parameter subject) (All (_ a) (-> (Set a) (Set a) (Set a))) (let [subject (representation subject)] (list#mix (function (_ [elem multiplicity] output) @@ -86,7 +86,7 @@ (..empty (dictionary.key_hash subject)) (dictionary.entries subject)))) - (def: .public (difference parameter subject) + (def .public (difference parameter subject) (All (_ a) (-> (Set a) (Set a) (Set a))) (|> parameter representation @@ -95,7 +95,7 @@ (..lacks multiplicity elem output)) subject))) - (def: .public (sub? reference subject) + (def .public (sub? reference subject) (All (_ a) (-> (Set a) (Set a) Bit)) (|> subject representation @@ -105,17 +105,17 @@ (..multiplicity reference) (n.>= multiplicity)))))) - (def: .public (support set) + (def .public (support set) (All (_ a) (-> (Set a) (//.Set a))) (let [(^.let set [hash _]) (representation set)] (|> set dictionary.keys (//.of_list hash)))) - (def: .public equivalence + (def .public equivalence (All (_ a) (Equivalence (Set a))) (implementation - (def: (= reference sample) + (def (= reference sample) (let [reference (representation reference)] (and (n.= (dictionary.size reference) (dictionary.size (representation sample))) @@ -126,12 +126,12 @@ (..multiplicity sample) (n.= multiplicity)))))))))) - (def: .public hash + (def .public hash (All (_ a) (Hash (Set a))) (implementation - (def: equivalence ..equivalence) + (def equivalence ..equivalence) - (def: (hash set) + (def (hash set) (let [set (representation set) [hash _] set] (list#mix (function (_ [elem multiplicity] acc) @@ -140,23 +140,23 @@ (dictionary.entries set)))))) ) -(def: .public (member? set elem) +(def .public (member? set elem) (All (_ a) (-> (Set a) a Bit)) (|> elem (..multiplicity set) (n.> 0))) -(def: .public empty? +(def .public empty? (All (_ a) (-> (Set a) Bit)) (|>> ..size (n.= 0))) -(def: .public (of_list hash subject) +(def .public (of_list hash subject) (All (_ a) (-> (Hash a) (List a) (Set a))) (list#mix (..has 1) (..empty hash) subject)) -(def: .public (of_set subject) +(def .public (of_set subject) (All (_ a) (-> (//.Set a) (Set a))) (..of_list (//.member_hash subject) (//.list subject))) -(def: .public super? +(def .public super? (All (_ a) (-> (Set a) (Set a) Bit)) (function.flipped sub?)) diff --git a/stdlib/source/library/lux/data/collection/set/ordered.lux b/stdlib/source/library/lux/data/collection/set/ordered.lux index c876afca0..5cdd23dec 100644 --- a/stdlib/source/library/lux/data/collection/set/ordered.lux +++ b/stdlib/source/library/lux/data/collection/set/ordered.lux @@ -15,16 +15,16 @@ (primitive .public (Set a) (/.Dictionary a a) - (def: .public empty + (def .public empty (All (_ a) (-> (Order a) (Set a))) (|>> /.empty abstraction)) - (def: .public (member? set elem) + (def .public (member? set elem) (All (_ a) (-> (Set a) a Bit)) (/.key? (representation set) elem)) (with_template [ ] - [(def: .public + [(def .public (All (_ a) (-> (Set a) )) (|>> representation ))] @@ -34,52 +34,52 @@ [Bit empty? /.empty?] ) - (def: .public (has elem set) + (def .public (has elem set) (All (_ a) (-> a (Set a) (Set a))) (|> set representation (/.has elem elem) abstraction)) - (def: .public (lacks elem set) + (def .public (lacks elem set) (All (_ a) (-> a (Set a) (Set a))) (|> set representation (/.lacks elem) abstraction)) - (def: .public list + (def .public list (All (_ a) (-> (Set a) (List a))) (|>> representation /.keys)) - (def: .public (of_list order list) + (def .public (of_list order list) (All (_ a) (-> (Order a) (List a) (Set a))) (list#mix has (..empty order) list)) - (def: .public (union left right) + (def .public (union left right) (All (_ a) (-> (Set a) (Set a) (Set a))) (list#mix ..has right (..list left))) - (def: .public (intersection left right) + (def .public (intersection left right) (All (_ a) (-> (Set a) (Set a) (Set a))) (|> (..list right) (list.only (..member? left)) (..of_list (the /.#order (representation right))))) - (def: .public (difference param subject) + (def .public (difference param subject) (All (_ a) (-> (Set a) (Set a) (Set a))) (|> (..list subject) (list.only (|>> (..member? param) not)) (..of_list (the /.#order (representation subject))))) - (def: .public equivalence + (def .public equivalence (All (_ a) (Equivalence (Set a))) (implementation - (def: (= reference sample) + (def (= reference sample) (at (list.equivalence (at (representation reference) equivalence)) = (..list reference) (..list sample))))) ) -(def: .public (sub? super sub) +(def .public (sub? super sub) (All (_ a) (-> (Set a) (Set a) Bit)) (|> sub ..list (list.every? (..member? super)))) -(def: .public (super? sub super) +(def .public (super? sub super) (All (_ a) (-> (Set a) (Set a) Bit)) (sub? super sub)) diff --git a/stdlib/source/library/lux/data/collection/stack.lux b/stdlib/source/library/lux/data/collection/stack.lux index 086b727ca..5a7f19904 100644 --- a/stdlib/source/library/lux/data/collection/stack.lux +++ b/stdlib/source/library/lux/data/collection/stack.lux @@ -13,19 +13,19 @@ (primitive .public (Stack a) (List a) - (def: .public empty + (def .public empty Stack (abstraction (list))) - (def: .public size + (def .public size (All (_ a) (-> (Stack a) Nat)) (|>> representation //.size)) - (def: .public empty? + (def .public empty? (All (_ a) (-> (Stack a) Bit)) (|>> representation //.empty?)) - (def: .public (value stack) + (def .public (value stack) (All (_ a) (-> (Stack a) (Maybe a))) (case (representation stack) {.#End} @@ -34,7 +34,7 @@ {.#Item value _} {.#Some value})) - (def: .public (next stack) + (def .public (next stack) (All (_ a) (-> (Stack a) (Maybe [a (Stack a)]))) (case (representation stack) {.#End} @@ -43,22 +43,22 @@ {.#Item top stack'} {.#Some [top (abstraction stack')]})) - (def: .public (top value stack) + (def .public (top value stack) (All (_ a) (-> a (Stack a) (Stack a))) (abstraction {.#Item value (representation stack)})) - (def: .public (equivalence super) + (def .public (equivalence super) (All (_ a) (-> (Equivalence a) (Equivalence (Stack a)))) (implementation - (def: (= reference subject) + (def (= reference subject) (at (//.equivalence super) = (representation reference) (representation subject))))) - (def: .public functor + (def .public functor (Functor Stack) (implementation - (def: (each f value) + (def (each f value) (|> value representation (at //.functor each f) diff --git a/stdlib/source/library/lux/data/collection/stream.lux b/stdlib/source/library/lux/data/collection/stream.lux index f2f45add6..29b789e09 100644 --- a/stdlib/source/library/lux/data/collection/stream.lux +++ b/stdlib/source/library/lux/data/collection/stream.lux @@ -22,18 +22,18 @@ (type: .public (Stream a) (Cont [a (Stream a)])) -(def: .public (iterations step init) +(def .public (iterations step init) (All (_ a b) (-> (-> a [a b]) a (Stream b))) (let [[next x] (step init)] (//.pending [x (iterations step next)]))) -(def: .public (repeated x) +(def .public (repeated x) (All (_ a) (-> a (Stream a))) (//.pending [x (repeated x)])) -(def: .public (cycle [start next]) +(def .public (cycle [start next]) (All (_ a) (-> [a (List a)] (Stream a))) (loop (again [head start @@ -46,7 +46,7 @@ (again head' tail'))]))) (with_template [ ] - [(def: .public ( stream) + [(def .public ( stream) (All (_ a) (-> (Stream a) )) (let [[head tail] (//.result stream)] ))] @@ -55,7 +55,7 @@ [tail (Stream a)] ) -(def: .public (item idx stream) +(def .public (item idx stream) (All (_ a) (-> Nat (Stream a) a)) (let [[head tail] (//.result stream)] (case idx @@ -63,7 +63,7 @@ _ (item (-- idx) tail)))) (with_template [ ] - [(def: .public ( pred xs) + [(def .public ( pred xs) (All (_ a) (-> (Stream a) (List a))) (let [[x xs'] (//.result xs)] @@ -71,7 +71,7 @@ (list.partial x ( xs')) (list)))) - (def: .public ( pred xs) + (def .public ( pred xs) (All (_ a) (-> (Stream a) (Stream a))) (let [[x xs'] (//.result xs)] @@ -84,7 +84,7 @@ ) (with_template [ ] - [(def: .public ( pred xs) + [(def .public ( pred xs) (All (_ a) (-> (Stream a) [(List a) (Stream a)])) (let [[x xs'] (//.result xs)] @@ -97,37 +97,37 @@ [split_at Nat (n.= 0 pred) (-- pred)] ) -(def: .public (only predicate stream) +(def .public (only predicate stream) (All (_ a) (-> (-> a Bit) (Stream a) (Stream a))) (let [[head tail] (//.result stream)] (if (predicate head) (//.pending [head (only predicate tail)]) (only predicate tail)))) -(def: .public (partition left? xs) +(def .public (partition left? xs) (All (_ a) (-> (-> a Bit) (Stream a) [(Stream a) (Stream a)])) [(..only left? xs) (..only (bit.complement left?) xs)]) -(def: .public functor +(def .public functor (Functor Stream) (implementation - (def: (each f fa) + (def (each f fa) (let [[head tail] (//.result fa)] (//.pending [(f head) (each f tail)]))))) -(def: .public comonad +(def .public comonad (CoMonad Stream) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: out head) + (def out head) - (def: (disjoint wa) + (def (disjoint wa) (let [[head tail] (//.result wa)] (//.pending [wa (disjoint tail)]))))) -(def: .public pattern +(def .public pattern (syntax (_ [patterns (.form (<>.many .any)) body .any branches (<>.some .any)]) diff --git a/stdlib/source/library/lux/data/collection/tree.lux b/stdlib/source/library/lux/data/collection/tree.lux index 64b0d13f7..d1f9d46ba 100644 --- a/stdlib/source/library/lux/data/collection/tree.lux +++ b/stdlib/source/library/lux/data/collection/tree.lux @@ -21,7 +21,7 @@ [#value a #children (List (Tree a))])) -(def: .public (flat tree) +(def .public (flat tree) (All (_ a) (-> (Tree a) (List a))) (|> tree (the #children) @@ -29,12 +29,12 @@ list#conjoint {.#Item (the #value tree)})) -(def: .public (leaf value) +(def .public (leaf value) (All (_ a) (-> a (Tree a))) [#value value #children (list)]) -(def: .public (branch value children) +(def .public (branch value children) (All (_ a) (-> a (List (Tree a)) (Tree a))) [#value value #children children]) @@ -43,7 +43,7 @@ (Rec Tree_Code [Code (List Tree_Code)])) -(def: tree^ +(def tree^ (Parser Tree_Code) (|> (|>> <>.some .variant @@ -54,31 +54,31 @@ (<>.else (list)) (<>.and .any))) -(def: .public tree +(def .public tree (syntax (_ [root tree^]) (in (list (loop (again [[value children] root]) (` [#value (~ value) #children (list (~+ (list#each again children)))])))))) -(def: .public (equivalence super) +(def .public (equivalence super) (All (_ a) (-> (Equivalence a) (Equivalence (Tree a)))) (implementation - (def: (= tx ty) + (def (= tx ty) (and (at super = (the #value tx) (the #value ty)) (at (list.equivalence (equivalence super)) = (the #children tx) (the #children ty)))))) -(def: .public functor +(def .public functor (Functor Tree) (implementation - (def: (each f fa) + (def (each f fa) [#value (f (the #value fa)) #children (list#each (each f) (the #children fa))]))) -(def: .public mix +(def .public mix (Mix Tree) (implementation - (def: (mix f init tree) + (def (mix f init tree) (list#mix (function (_ tree' init') (mix f init' tree')) (f (the #value tree) init) diff --git a/stdlib/source/library/lux/data/collection/tree/finger.lux b/stdlib/source/library/lux/data/collection/tree/finger.lux index 0d8527308..3046509d3 100644 --- a/stdlib/source/library/lux/data/collection/tree/finger.lux +++ b/stdlib/source/library/lux/data/collection/tree/finger.lux @@ -30,7 +30,7 @@ branch))) (with_template [ ] - [(def: .public + [(def .public (All (_ @ t v) (-> (Tree @ t v) )) (|>> representation (the )))] @@ -38,22 +38,22 @@ [root #root (Either v [(Tree @ t v) (Tree @ t v)])] ) - (def: .public (builder monoid) + (def .public (builder monoid) (All (_ t) (Ex (_ @) (-> (Monoid t) (Builder @ t)))) (implementation - (def: (leaf tag value) + (def (leaf tag value) (abstraction [#monoid monoid #tag tag #root {.#Left value}])) - (def: (branch left right) + (def (branch left right) (abstraction [#monoid monoid #tag (at monoid composite (..tag left) (..tag right)) #root {.#Right [left right]}])))) - (def: .public (value tree) + (def .public (value tree) (All (_ @ t v) (-> (Tree @ t v) v)) (case (the #root (representation tree)) {0 #0 value} @@ -62,7 +62,7 @@ {0 #1 [left right]} (value left))) - (def: .public (tags tree) + (def .public (tags tree) (All (_ @ t v) (-> (Tree @ t v) (List t))) (case (the #root (representation tree)) {0 #0 value} @@ -72,7 +72,7 @@ (list#composite (tags left) (tags right)))) - (def: .public (values tree) + (def .public (values tree) (All (_ @ t v) (-> (Tree @ t v) (List v))) (case (the #root (representation tree)) {0 #0 value} @@ -82,7 +82,7 @@ (list#composite (values left) (values right)))) - (def: .public (one predicate tree) + (def .public (one predicate tree) (All (_ @ t v) (-> (Predicate t) (Tree @ t v) (Maybe v))) (let [[monoid tag root] (representation tree)] (if (predicate tag) @@ -101,7 +101,7 @@ {.#None}))) ) -(def: .public (exists? predicate tree) +(def .public (exists? predicate tree) (All (_ @ t v) (-> (Predicate t) (Tree @ t v) Bit)) (case (..one predicate tree) {.#Some _} diff --git a/stdlib/source/library/lux/data/collection/tree/zipper.lux b/stdlib/source/library/lux/data/collection/tree/zipper.lux index d02c354bb..e6bb39ba6 100644 --- a/stdlib/source/library/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/library/lux/data/collection/tree/zipper.lux @@ -29,12 +29,12 @@ [#family (Maybe (Family Zipper a)) #node (Tree a)])) -(def: .public (equivalence super) +(def .public (equivalence super) (All (_ a) (-> (Equivalence a) (Equivalence (Zipper a)))) (implementation - (def: (= reference sample) + (def (= reference sample) (let [== (all product.equivalence (maybe.equivalence (all product.equivalence @@ -44,40 +44,40 @@ (//.equivalence super))] (== reference sample))))) -(def: .public (zipper tree) +(def .public (zipper tree) (All (_ a) (-> (Tree a) (Zipper a))) [#family {.#None} #node tree]) -(def: .public tree +(def .public tree (All (_ a) (-> (Zipper a) (Tree a))) (the #node)) -(def: .public value +(def .public value (All (_ a) (-> (Zipper a) a)) (the [#node //.#value])) -(def: .public (set value zipper) +(def .public (set value zipper) (All (_ a) (-> a (Zipper a) (Zipper a))) (has [#node //.#value] value zipper)) -(def: .public (update transform zipper) +(def .public (update transform zipper) (All (_ a) (-> (-> a a) (Zipper a) (Zipper a))) (revised [#node //.#value] transform zipper)) -(def: children +(def children (All (_ a) (-> (Zipper a) (List (Tree a)))) (the [#node //.#children])) -(def: .public leaf? +(def .public leaf? (All (_ a) (-> (Zipper a) Bit)) (|>> ..children list.empty?)) -(def: .public branch? +(def .public branch? (All (_ a) (-> (Zipper a) Bit)) (|>> ..leaf? not)) -(def: .public (start? zipper) +(def .public (start? zipper) (All (_ a) (-> (Zipper a) Bit)) (case (the #family zipper) {.#None} @@ -86,7 +86,7 @@ _ false)) -(def: .public (down zipper) +(def .public (down zipper) (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case (..children zipper) {.#End} @@ -98,7 +98,7 @@ #rights tail]} #node head]})) -(def: .public (up zipper) +(def .public (up zipper) (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (do maybe.monad [family (the #family zipper)] @@ -117,7 +117,7 @@ _#parent)))))) (with_template [ ] - [(def: .public ( zipper) + [(def .public ( zipper) (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case (the #family zipper) {.#Some family} @@ -141,7 +141,7 @@ {.#None} {.#None})) - (def: .public ( zipper) + (def .public ( zipper) (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case (the #family zipper) {.#None} @@ -170,7 +170,7 @@ [left leftmost #lefts #rights] ) -(def: .public (next zipper) +(def .public (next zipper) (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case (..down zipper) {.#Some forward} @@ -187,7 +187,7 @@ [@ (..up @)] (again @)))))) -(def: (bottom zipper) +(def (bottom zipper) (All (_ a) (-> (Zipper a) (Zipper a))) (case (..right zipper) {.#Some forward} @@ -201,7 +201,7 @@ {.#None} zipper))) -(def: .public (previous zipper) +(def .public (previous zipper) (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case (..left zipper) {.#None} @@ -216,7 +216,7 @@ backward)})) (with_template [ ] - [(def: .public ( zipper) + [(def .public ( zipper) (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case ( zipper) {.#None} @@ -235,7 +235,7 @@ [start ..previous] ) -(def: .public (end? zipper) +(def .public (end? zipper) (All (_ a) (-> (Zipper a) Bit)) (case (..end zipper) {.#None} @@ -244,19 +244,19 @@ {.#Some _} false)) -(def: .public (interpose value zipper) +(def .public (interpose value zipper) (All (_ a) (-> a (Zipper a) (Zipper a))) (revised [#node //.#children] (|>> (//.branch value) list) zipper)) -(def: .public (adopt value zipper) +(def .public (adopt value zipper) (All (_ a) (-> a (Zipper a) (Zipper a))) (revised [#node //.#children] (|>> {.#Item (//.leaf value)}) zipper)) -(def: .public (remove zipper) +(def .public (remove zipper) (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (do maybe.monad [family (the #family zipper)] @@ -274,7 +274,7 @@ (has #node next)))))) (with_template [ ] - [(def: .public ( value zipper) + [(def .public ( value zipper) (All (_ a) (-> a (Zipper a) (Maybe (Zipper a)))) (case (the #family zipper) {.#None} @@ -289,10 +289,10 @@ [insert_right #rights] ) -(def: .public functor +(def .public functor (Functor Zipper) (implementation - (def: (each f (open "_[0]")) + (def (each f (open "_[0]")) [#family (maybe#each (function (_ (open "_[0]")) [#parent (each f _#parent) #lefts (list#each (//#each f) _#lefts) @@ -300,16 +300,16 @@ _#family) #node (//#each f _#node)]))) -(def: .public comonad +(def .public comonad (CoMonad Zipper) (implementation - (def: functor + (def functor ..functor) - (def: out + (def out (the [#node //.#value])) - (def: (disjoint (open "_[0]")) + (def (disjoint (open "_[0]")) (let [tree_splitter (is (All (_ a) (-> (Tree a) (Tree (Zipper a)))) (function (tree_splitter tree) [//.#value (..zipper tree) diff --git a/stdlib/source/library/lux/data/color.lux b/stdlib/source/library/lux/data/color.lux index 2a89c02fe..519b0f020 100644 --- a/stdlib/source/library/lux/data/color.lux +++ b/stdlib/source/library/lux/data/color.lux @@ -18,17 +18,17 @@ [type [primitive (.except)]]]]) -(def: rgb_limit 256) -(def: top (-- rgb_limit)) +(def rgb_limit 256) +(def top (-- rgb_limit)) -(def: rgb_factor +(def rgb_factor (|> top .int int.frac)) -(def: down +(def down (-> Nat Frac) (|>> .int int.frac (f./ rgb_factor))) -(def: up +(def up (-> Frac Nat) (|>> (f.* rgb_factor) f.int .nat)) @@ -54,79 +54,79 @@ (primitive .public Color RGB - (def: .public (of_rgb [red green blue]) + (def .public (of_rgb [red green blue]) (-> RGB Color) (abstraction [#red (n.% ..rgb_limit red) #green (n.% ..rgb_limit green) #blue (n.% ..rgb_limit blue)])) - (def: .public rgb + (def .public rgb (-> Color RGB) (|>> representation)) - (def: .public equivalence + (def .public equivalence (Equivalence Color) (implementation - (def: (= reference sample) + (def (= reference sample) (let [[rR gR bR] (representation reference) [rS gS bS] (representation sample)] (and (n.= rR rS) (n.= gR gS) (n.= bR bS)))))) - (def: .public hash + (def .public hash (Hash Color) (implementation - (def: equivalence ..equivalence) + (def equivalence ..equivalence) - (def: (hash value) + (def (hash value) (let [[r g b] (representation value)] (all i64.or (i64.left_shifted 16 r) (i64.left_shifted 8 g) b))))) - (def: .public black + (def .public black Color (..of_rgb [#red 0 #green 0 #blue 0])) - (def: .public white + (def .public white Color (..of_rgb [#red ..top #green ..top #blue ..top])) - (def: .public addition + (def .public addition (Monoid Color) (implementation - (def: identity ..black) + (def identity ..black) - (def: (composite left right) + (def (composite left right) (let [[lR lG lB] (representation left) [rR rG rB] (representation right)] (abstraction [#red (n.max lR rR) #green (n.max lG rG) #blue (n.max lB rB)]))))) - (def: (opposite_intensity value) + (def (opposite_intensity value) (-> Nat Nat) (|> ..top (n.- value))) - (def: .public (complement color) + (def .public (complement color) (-> Color Color) (let [[red green blue] (representation color)] (abstraction [#red (opposite_intensity red) #green (opposite_intensity green) #blue (opposite_intensity blue)]))) - (def: .public subtraction + (def .public subtraction (Monoid Color) (implementation - (def: identity ..white) + (def identity ..white) - (def: (composite left right) + (def (composite left right) (let [[lR lG lB] (representation (..complement left)) [rR rG rB] (representation right)] (abstraction [#red (n.min lR rR) @@ -134,7 +134,7 @@ #blue (n.min lB rB)]))))) ) -(def: .public (hsl color) +(def .public (hsl color) (-> Color HSL) (let [[red green blue] (rgb color) red (..down red) @@ -169,7 +169,7 @@ saturation luminance])))) -(def: (hue_rgb p q t) +(def (hue_rgb p q t) (-> Frac Frac Frac Nat) (let [t (cond (f.< +0.0 t) (f.+ +1.0 t) (f.> +1.0 t) (f.- +1.0 t) @@ -188,7 +188,7 @@ ... else p)))) -(def: .public (of_hsl [hue saturation luminance]) +(def .public (of_hsl [hue saturation luminance]) (-> HSL Color) (if (f.= +0.0 saturation) ... Achromatic @@ -206,7 +206,7 @@ #green (|> hue (hue_rgb p q)) #blue (|> hue (f.- third) (hue_rgb p q))])))) -(def: .public (hsb color) +(def .public (hsb color) (-> Color HSB) (let [[red green blue] (rgb color) red (..down red) @@ -238,7 +238,7 @@ saturation brightness])))) -(def: .public (of_hsb [hue saturation brightness]) +(def .public (of_hsb [hue saturation brightness]) (-> HSB Color) (let [hue (|> hue (f.* +6.0)) i (f.floor hue) @@ -255,7 +255,7 @@ #green (..up green) #blue (..up blue)]))) -(def: .public (cmyk color) +(def .public (cmyk color) (-> Color CMYK) (let [[red green blue] (rgb color) red (..down red) @@ -273,7 +273,7 @@ #yellow yellow #key key])) -(def: .public (of_cmyk [cyan magenta yellow key]) +(def .public (of_cmyk [cyan magenta yellow key]) (-> CMYK Color) (if (f.= +1.0 key) (of_rgb [#red 0 @@ -289,7 +289,7 @@ #green (..up green) #blue (..up blue)])))) -(def: (normal ratio) +(def (normal ratio) (-> Frac Frac) (cond (f.> +1.0 ratio) (f.% +1.0 ratio) @@ -300,7 +300,7 @@ ... else ratio)) -(def: .public (interpolated ratio end start) +(def .public (interpolated ratio end start) (-> Frac Color Color Color) (let [dS (..normal ratio) dE (|> +1.0 (f.- dS)) @@ -317,7 +317,7 @@ #blue (interpolated' blueE blueS)]))) (with_template [ ] - [(def: .public ( ratio color) + [(def .public ( ratio color) (-> Frac Color Color) (..interpolated ratio color))] @@ -326,7 +326,7 @@ ) (with_template [ ] - [(def: .public ( ratio color) + [(def .public ( ratio color) (-> Frac Color Color) (let [[hue saturation luminance] (hsl color)] (of_hsl [hue @@ -339,7 +339,7 @@ [f.- un_saturated] ) -(def: .public (gray_scale color) +(def .public (gray_scale color) (-> Color Color) (let [[_ _ luminance] (hsl color)] (of_hsl [+0.0 @@ -347,7 +347,7 @@ luminance]))) (with_template [ <1> <2>] - [(`` (def: .public ( color) + [(`` (def .public ( color) (-> Color [Color Color Color]) (let [[hue saturation luminance] (hsl color)] [color @@ -364,7 +364,7 @@ ) (with_template [ <1> <2> <3>] - [(`` (def: .public ( color) + [(`` (def .public ( color) (-> Color [Color Color Color Color]) (let [[hue saturation luminance] (hsb color)] [color @@ -388,7 +388,7 @@ (type: .public Palette (-> Spread Nat Color (List Color))) -(`` (def: .public (analogous spread variations color) +(`` (def .public (analogous spread variations color) Palette (let [[hue saturation brightness] (hsb color) spread (..normal spread)] @@ -398,7 +398,7 @@ brightness])) (list.indices variations))))) -(`` (def: .public (monochromatic spread variations color) +(`` (def .public (monochromatic spread variations color) Palette (let [[hue saturation brightness] (hsb color) spread (..normal spread)] @@ -413,15 +413,15 @@ (type: .public Alpha Rev) -(def: .public transparent +(def .public transparent Alpha rev#bottom) -(def: .public translucent +(def .public translucent Alpha .5) -(def: .public opaque +(def .public opaque Alpha rev#top) diff --git a/stdlib/source/library/lux/data/color/named.lux b/stdlib/source/library/lux/data/color/named.lux index 99fae8434..43633595d 100644 --- a/stdlib/source/library/lux/data/color/named.lux +++ b/stdlib/source/library/lux/data/color/named.lux @@ -7,7 +7,7 @@ ... https://developer.mozilla.org/en-US/docs/Web/CSS/color_value (with_template [ ] - [(`` (def: .public + [(`` (def .public Color (//.of_rgb [//.#red (hex ) //.#green (hex ) diff --git a/stdlib/source/library/lux/data/format/css.lux b/stdlib/source/library/lux/data/format/css.lux index df39b6b61..dca23f87c 100644 --- a/stdlib/source/library/lux/data/format/css.lux +++ b/stdlib/source/library/lux/data/format/css.lux @@ -30,29 +30,29 @@ (primitive .public (CSS brand) Text - (def: .public css + (def .public css (-> (CSS Any) Text) (|>> representation)) - (def: .public empty + (def .public empty (CSS Any) (abstraction "")) (type: .public Style (List (Ex (_ brand) [(Property brand) (Value brand)]))) - (def: .public (rule selector style) + (def .public (rule selector style) (-> (Selector Any) Style (CSS Common)) (abstraction (format (/selector.selector selector) "{" (/style.inline (/style.style style)) "}"))) - (def: .public char_set + (def .public char_set (-> Encoding (CSS Special)) (|>> encoding.name %.text (text.enclosed ["@charset " ";"]) abstraction)) - (def: .public (font font) + (def .public (font font) (-> Font (CSS Special)) (let [with_unicode (case (the /font.#unicode_range font) {.#Some unicode_range} @@ -75,7 +75,7 @@ (format "@font-face") abstraction))) - (def: .public (import url query) + (def .public (import url query) (-> URL (Maybe Query) (CSS Special)) (abstraction (format (format "@import url(" (%.text url) ")") (case query @@ -86,7 +86,7 @@ "") ";"))) - (def: separator + (def separator text.new_line) (type: .public Frame @@ -94,7 +94,7 @@ [#when (Value Percentage) #what Style])) - (def: .public (key_frames animation frames) + (def .public (key_frames animation frames) (-> (Value Animation) (List Frame) (CSS Special)) (abstraction (format "@keyframes " (/value.value animation) " {" (|> frames @@ -105,18 +105,18 @@ (text.interposed ..separator)) "}"))) - (def: !composite + (def !composite (template (!composite
 )
       [(abstraction
         (format (representation 
)
                 ..separator
                 (representation )))]))
   
-  (def: .public (and pre post)
+  (def .public (and pre post)
     (All (_ kind) (-> (CSS kind) (CSS kind) (CSS kind)))
     (!composite pre post))
 
-  (def: .public (in_context combinator selector css)
+  (def .public (in_context combinator selector css)
     (-> Combinator (Selector Any) (CSS Common) (CSS Common))
     (|> css
         representation
@@ -128,13 +128,13 @@
         (text.interposed ..separator)
         abstraction))
 
-  (def: .public (dependent combinator selector style inner)
+  (def .public (dependent combinator selector style inner)
     (-> Combinator (Selector Any) Style (CSS Common) (CSS Common))
     (!composite (..rule selector style)
                 (..in_context combinator selector inner)))
 
   (with_template [ ]
-    [(def: .public 
+    [(def .public 
        (-> (Selector Any) Style (CSS Common) (CSS Common))
        (..dependent ))]
 
@@ -142,7 +142,7 @@
     [with_children /selector.sub]
     )
 
-  (def: .public (in_case specializer selector css)
+  (def .public (in_case specializer selector css)
     (All (_ kind)
       (-> (Specializer kind) (Selector (Generic Any)) (CSS Common) (CSS Common)))
     (|> css
@@ -155,14 +155,14 @@
         (text.interposed ..separator)
         abstraction))
 
-  (def: .public (specialized combinator selector style inner)
+  (def .public (specialized combinator selector style inner)
     (All (_ kind)
       (-> (Specializer kind) (Selector (Generic Any)) Style (CSS Common) (CSS Common)))
     (!composite (..rule selector style)
                 (..in_case combinator selector inner)))
 
   (with_template [ ]
-    [(def: .public 
+    [(def .public 
        (-> (Selector (Generic Any)) Style (CSS Common) (CSS Common))
        (..specialized ))]
 
diff --git a/stdlib/source/library/lux/data/format/css/class.lux b/stdlib/source/library/lux/data/format/css/class.lux
index 1fb58b4d7..6a867e331 100644
--- a/stdlib/source/library/lux/data/format/css/class.lux
+++ b/stdlib/source/library/lux/data/format/css/class.lux
@@ -16,15 +16,15 @@
 (primitive .public Class
   Text
 
-  (def: .public class
+  (def .public class
     (-> Class Text)
     (|>> representation))
 
-  (def: .public custom
+  (def .public custom
     (-> Text Class)
     (|>> abstraction))
 
-  (def: .public generic
+  (def .public generic
     (syntax (_ [])
       (do meta.monad
         [module meta.current_module_name
diff --git a/stdlib/source/library/lux/data/format/css/id.lux b/stdlib/source/library/lux/data/format/css/id.lux
index 2ba540356..96a9ef1d2 100644
--- a/stdlib/source/library/lux/data/format/css/id.lux
+++ b/stdlib/source/library/lux/data/format/css/id.lux
@@ -16,15 +16,15 @@
 (primitive .public ID
   Text
 
-  (def: .public id
+  (def .public id
     (-> ID Text)
     (|>> representation))
 
-  (def: .public custom
+  (def .public custom
     (-> Text ID)
     (|>> abstraction))
 
-  (def: .public generic
+  (def .public generic
     (syntax (_ [])
       (do meta.monad
         [module meta.current_module_name
diff --git a/stdlib/source/library/lux/data/format/css/property.lux b/stdlib/source/library/lux/data/format/css/property.lux
index 21348e82d..5fa507633 100644
--- a/stdlib/source/library/lux/data/format/css/property.lux
+++ b/stdlib/source/library/lux/data/format/css/property.lux
@@ -54,20 +54,20 @@
                 White_Space Word_Break Word_Wrap Writing_Mode
                 Z_Index)]])
 
-(def: text_symbol
+(def text_symbol
   (syntax (_ [symbol s.text])
     (in (list (code.local (text.replaced "-" "_" symbol))))))
 
 (primitive .public (Property brand)
   Text
 
-  (def: .public name
+  (def .public name
     (-> (Property Any) Text)
     (|>> representation))
 
   (with_template [ + +]
     [(`` (with_template [ ]
-           [(def: .public 
+           [(def .public 
               (Property )
               (abstraction ))]
 
@@ -75,7 +75,7 @@
 
      (with_expansions [ (template.spliced +)]
        (with_template []
-         [(`` (def: .public (~~ (text_symbol ))
+         [(`` (def .public (~~ (text_symbol ))
                 (Property )
                 (abstraction )))]
          
diff --git a/stdlib/source/library/lux/data/format/css/query.lux b/stdlib/source/library/lux/data/format/css/query.lux
index f4d2fccd5..6af2f5539 100644
--- a/stdlib/source/library/lux/data/format/css/query.lux
+++ b/stdlib/source/library/lux/data/format/css/query.lux
@@ -21,19 +21,19 @@
                          Pointer Hover
                          Light Scripting Motion Color_Scheme)]])
 
-(def: text_symbol
+(def text_symbol
   (syntax (_ [symbol s.text])
     (in (list (code.local (text.replaced "-" "_" symbol))))))
 
 (primitive .public Media
   Text
 
-  (def: .public media
+  (def .public media
     (-> Media Text)
     (|>> representation))
 
   (with_template []
-    [(`` (def: .public (~~ (text_symbol ))
+    [(`` (def .public (~~ (text_symbol ))
            Media
            (abstraction )))]
 
@@ -46,12 +46,12 @@
 (primitive .public Feature
   Text
 
-  (def: .public feature
+  (def .public feature
     (-> Feature Text)
     (|>> representation))
 
   (with_template [ ]
-    [(`` (def: .public ((~~ (text_symbol )) input)
+    [(`` (def .public ((~~ (text_symbol )) input)
            (-> (Value ) Feature)
            (abstraction (format "("  ": " (//value.value input) ")"))))]
 
@@ -106,12 +106,12 @@
 (primitive .public Query
   Text
 
-  (def: .public query
+  (def .public query
     (-> Query Text)
     (|>> representation))
 
   (with_template [ ]
-    [(def: .public 
+    [(def .public 
        (-> Media Query)
        (|>> ..media (format ) abstraction))]
 
@@ -119,12 +119,12 @@
     [only "only "]
     )
 
-  (def: .public not
+  (def .public not
     (-> Feature Query)
     (|>> ..feature (format "not ") abstraction))
 
   (with_template [ ]
-    [(def: .public ( left right)
+    [(def .public ( 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 2fe5ae11e..ee3291e33 100644
--- a/stdlib/source/library/lux/data/format/css/selector.lux
+++ b/stdlib/source/library/lux/data/format/css/selector.lux
@@ -38,20 +38,20 @@
 (primitive .public (Selector kind)
   Text
 
-  (def: .public selector
+  (def .public selector
     (-> (Selector Any) Text)
     (|>> representation))
 
-  (def: .public any
+  (def .public any
     (Selector Cannot_Chain)
     (abstraction "*"))
 
-  (def: .public tag
+  (def .public tag
     (-> Tag (Selector Cannot_Chain))
     (|>> abstraction))
 
   (with_template [    ]
-    [(def: .public 
+    [(def .public 
        (->  (Selector ))
        (|>>  (format ) abstraction))]
 
@@ -61,7 +61,7 @@
 
   (with_template [  +]
     [(`` (with_template [ ]
-           [(def: .public ( right left)
+           [(def .public ( right left)
               (-> (Selector ) (Selector ) (Selector Composite))
               (abstraction (format (representation left)
                                    
@@ -89,12 +89,12 @@
   (type: .public Combinator
     (-> (Selector Any) (Selector Any) (Selector Composite)))
 
-  (def: .public (with? attribute)
+  (def .public (with? attribute)
     (-> Attribute (Selector Can_Chain))
     (abstraction (format "[" attribute "]")))
 
   (with_template [ ]
-    [(def: .public ( attribute value)
+    [(def .public ( attribute value)
        (-> Attribute Text (Selector Can_Chain))
        (abstraction (format "[" attribute  value "]")))]
 
@@ -108,7 +108,7 @@
 
   (with_template [ +]
     [(`` (with_template [ ]
-           [(def: .public 
+           [(def .public 
               (Selector )
               (abstraction ))]
 
@@ -152,7 +152,7 @@
       [selection "::selection"]]]
     )
 
-  (def: .public (language locale)
+  (def .public (language locale)
     (-> Locale (Selector Can_Chain))
     (|> locale
         locale.code
@@ -160,7 +160,7 @@
         (format ":lang")
         abstraction))
 
-  (def: .public not
+  (def .public not
     (-> (Selector Any) (Selector Can_Chain))
     (|>> representation
          (text.enclosed ["(" ")"])
@@ -170,12 +170,12 @@
   (primitive .public Index
     Text
 
-    (def: .public index
+    (def .public index
       (-> Nat Index)
       (|>> %.nat abstraction))
 
     (with_template [ ]
-      [(def: .public  Index (abstraction ))]
+      [(def .public  Index (abstraction ))]
       
       [odd "odd"]
       [even "even"]
@@ -186,7 +186,7 @@
        [#constant Int
         #variable Int]))
 
-    (def: .public (formula input)
+    (def .public (formula input)
       (-> Formula Index)
       (let [(open "_[0]") input]
         (abstraction (format (if (i.< +0 _#variable)
@@ -195,7 +195,7 @@
                              (%.int _#constant)))))
     
     (with_template [ ]
-      [(def: .public ( index)
+      [(def .public ( index)
          (-> Index (Selector Can_Chain))
          (|> (representation index)
              (text.enclosed ["(" ")"])
diff --git a/stdlib/source/library/lux/data/format/css/style.lux b/stdlib/source/library/lux/data/format/css/style.lux
index eba1e112d..50df42453 100644
--- a/stdlib/source/library/lux/data/format/css/style.lux
+++ b/stdlib/source/library/lux/data/format/css/style.lux
@@ -15,11 +15,11 @@
 (primitive .public Style
   Text
 
-  (def: .public empty
+  (def .public empty
     Style
     (abstraction ""))
 
-  (def: .public (with [property value])
+  (def .public (with [property value])
     (All (_ brand)
       (-> [(Property brand) (Value brand)]
           (-> Style Style)))
@@ -27,11 +27,11 @@
          (format (//property.name property) ": " (//value.value value) ";")
          abstraction))
 
-  (def: .public inline
+  (def .public inline
     (-> Style Text)
     (|>> representation))
 
-  (def: .public (style config)
+  (def .public (style config)
     (-> (List (Ex (_ brand) [(Property brand) (Value brand)]))
         Style)
     (list#mix ..with ..empty config))
diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux
index 66c82fe50..79afc29d6 100644
--- a/stdlib/source/library/lux/data/format/css/value.lux
+++ b/stdlib/source/library/lux/data/format/css/value.lux
@@ -29,28 +29,28 @@
  [//
   [selector (.only Label)]])
 
-(def: text_symbol
+(def text_symbol
   (syntax (_ [symbol .text])
     (in (list (code.local (text.replaced "-" "_" symbol))))))
 
-(def: enumeration
+(def enumeration
   (template (_    + +)
     [(primitive .public 
        
 
-       (def: .public 
+       (def .public 
          (->  )
          (|>> representation))
 
        (`` (with_template [ ]
-             [(def: .public   (abstraction ))]
+             [(def .public   (abstraction ))]
 
              (~~ (template.spliced +))
              ))
 
        (template.spliced +))]))
 
-(def: (%number value)
+(def (%number value)
   (Format Frac)
   (let [raw (%.frac value)]
     (if (f.< +0.0 value)
@@ -60,12 +60,12 @@
 (primitive .public (Value brand)
   Text
 
-  (def: .public value
+  (def .public value
     (-> (Value Any) Text)
     (|>> representation))
 
   (with_template [ ]
-    [(def: .public  Value (abstraction ))]
+    [(def .public  Value (abstraction ))]
 
     [initial "initial"]
     [inherit "inherit"]
@@ -90,7 +90,7 @@
     [(primitive .public  Any)
 
      (`` (with_template [ ]
-           [(def: .public 
+           [(def .public 
               (Value )
               (abstraction ))]
            
@@ -98,7 +98,7 @@
 
      (with_expansions [ (template.spliced +)]
        (with_template []
-         [(`` (def: .public (~~ (..text_symbol ))
+         [(`` (def .public (~~ (..text_symbol ))
                 (Value )
                 (abstraction )))]
          
@@ -775,9 +775,9 @@
      []]
     )
 
-  (def: value_separator ",")
+  (def value_separator ",")
 
-  (def: (apply name inputs)
+  (def (apply name inputs)
     (-> Text (List Text) Value)
     (|> inputs
         (text.interposed ..value_separator)
@@ -793,18 +793,18 @@
     [end "end"]]
    [])
 
-  (def: .public (steps intervals step)
+  (def .public (steps intervals step)
     (-> Nat Step (Value Timing))
     (..apply "steps" (list (%.nat intervals) (..step step))))
 
-  (def: .public (cubic_bezier p0 p1 p2 p3)
+  (def .public (cubic_bezier p0 p1 p2 p3)
     (-> Frac Frac Frac Frac (Value Timing))
     (|> (list p0 p1 p2 p3)
         (list#each %number)
         (..apply "cubic-bezier")))
 
   (with_template [ ]
-    [(def: .public 
+    [(def .public 
        (-> Nat (Value ))
        (|>> %.nat abstraction))]
 
@@ -814,18 +814,18 @@
     [span_line Grid_Span]
     )
 
-  (def: .public animation
+  (def .public animation
     (-> Label (Value Animation))
     (|>> abstraction))
 
-  (def: .public (rgb color)
+  (def .public (rgb color)
     (-> color.Color (Value Color))
     (let [[red green blue] (color.rgb color)]
       (..apply "rgb" (list (%.nat red)
                            (%.nat green)
                            (%.nat blue)))))
 
-  (def: .public (rgba pigment)
+  (def .public (rgba pigment)
     (-> color.Pigment (Value Color))
     (let [(open "_[0]") pigment
           [red green blue] (color.rgb _#color)]
@@ -837,7 +837,7 @@
                               (format "0" (%.rev _#alpha)))))))
 
   (with_template [ ]
-    [(def: .public ( value)
+    [(def .public ( value)
        (-> Frac (Value Length))
        (abstraction (format (%number value) )))]
 
@@ -859,14 +859,14 @@
     [fr "fr"]
     )
 
-  (def: (%int value)
+  (def (%int value)
     (Format Int)
     (if (i.< +0 value)
       (%.int value)
       (%.nat (.nat value))))
 
   (with_template [ ]
-    [(def: .public ( value)
+    [(def .public ( value)
        (-> Int (Value Time))
        (abstraction (format (if (i.< +0 value)
                               (%.int value)
@@ -878,13 +878,13 @@
     [milli_seconds "ms"]
     )
 
-  (def: .public thickness
+  (def .public thickness
     (-> (Value Length) (Value Thickness))
     (|>> transmutation))
 
-  (def: slice_separator " ")
+  (def slice_separator " ")
 
-  (def: .public (slice_number/2 horizontal vertical)
+  (def .public (slice_number/2 horizontal vertical)
     (-> Nat Nat (Value Slice))
     (abstraction (format (%.nat horizontal) ..slice_separator
                          (%.nat vertical))))
@@ -892,18 +892,18 @@
   (primitive .public Stop
     Text
 
-    (def: .public stop
+    (def .public stop
       (-> (Value Color) Stop)
       (|>> (representation Value) (abstraction Stop)))
 
-    (def: stop_separator " ")
+    (def stop_separator " ")
 
-    (def: .public (single_stop length color)
+    (def .public (single_stop length color)
       (-> (Value Length) (Value Color) Stop)
       (abstraction (format (representation Value color) ..stop_separator
                            (representation Value length))))
 
-    (def: .public (double_stop start end color)
+    (def .public (double_stop start end color)
       (-> (Value Length) (Value Length) (Value Color) Stop)
       (abstraction (format (representation Value color) ..stop_separator
                            (representation Value start) ..stop_separator
@@ -912,11 +912,11 @@
     (primitive .public Hint
       Text
 
-      (def: .public hint
+      (def .public hint
         (-> (Value Length) Hint)
         (|>> (representation Value) (abstraction Hint)))
 
-      (def: (with_hint [hint stop])
+      (def (with_hint [hint stop])
         (-> [(Maybe Hint) Stop] Text)
         (case hint
           {.#None}
@@ -931,22 +931,22 @@
   (primitive .public Angle
     Text
 
-    (def: .public angle
+    (def .public angle
       (-> Angle Text)
       (|>> representation))
 
-    (def: .public (turn value)
+    (def .public (turn value)
       (-> Rev Angle)
       (abstraction (format (%.rev value) "turn")))
 
-    (def: degree_limit Nat 360)
+    (def degree_limit Nat 360)
     
-    (def: .public (degree value)
+    (def .public (degree value)
       (-> Nat Angle)
       (abstraction (format (%.nat (n.% ..degree_limit value)) "deg")))
 
     (with_template [ ]
-      [(def: .public 
+      [(def .public 
          Angle
          (..degree ))]
       
@@ -957,7 +957,7 @@
       )
 
     (with_template [ ]
-      [(def: .public ( angle start next)
+      [(def .public ( angle start next)
          (-> Angle Stop (List/1 [(Maybe Hint) Stop]) (Value Image))
          (let [[now after] next]
            (..apply  (list.partial (representation Angle angle)
@@ -969,24 +969,24 @@
       )
     )
 
-  (def: percentage_limit Nat (.++ 100))
+  (def percentage_limit Nat (.++ 100))
 
-  (def: .public (%% value)
+  (def .public (%% value)
     (-> Nat (Value Percentage))
     (abstraction (format (%.nat (n.% percentage_limit value)) "%")))
 
-  (def: .public slice_percent/1
+  (def .public slice_percent/1
     (-> (Value Percentage) (Value Slice))
     (|>> transmutation))
 
-  (def: .public (slice_percent/2 horizontal vertical)
+  (def .public (slice_percent/2 horizontal vertical)
     (-> (Value Percentage) (Value Percentage) (Value Slice))
     (abstraction (format (representation horizontal) ..slice_separator
                          (representation vertical))))
 
   (with_template [ 
 +]
     [(`` (with_template [ ]
-           [(def: .public 
+           [(def .public 
               (->  (Value Filter))
               (|>> 
 (list) (..apply )))]
 
@@ -1006,13 +1006,13 @@
       [sepia "sepia"]]]
     )
 
-  (def: .public svg_filter
+  (def .public svg_filter
     (-> URL (Value Filter))
     (|>> (list) (..apply "url")))
 
-  (def: default_shadow_length (px +0.0))
+  (def default_shadow_length (px +0.0))
 
-  (def: .public (drop_shadow horizontal vertical blur spread color)
+  (def .public (drop_shadow horizontal vertical blur spread color)
     (-> (Value Length) (Value Length)
         (Maybe (Value Length)) (Maybe (Value Length))
         (Value Color)
@@ -1026,10 +1026,10 @@
         (list)
         (..apply "drop-shadow")))
 
-  (def: length_separator " ")
+  (def length_separator " ")
 
   (with_template [ ]
-    [(def: .public ( horizontal vertical)
+    [(def .public ( horizontal vertical)
        (-> (Value Length) (Value Length) (Value ))
        (abstraction (format (representation horizontal)
                             ..length_separator
@@ -1039,11 +1039,11 @@
     [fit Fit]
     )
 
-  (def: .public (fit/1 length)
+  (def .public (fit/1 length)
     (-> (Value Length) (Value Fit))
     (..fit length length))
 
-  (def: .public image
+  (def .public image
     (-> URL (Value Image))
     (|>> %.text
          (list)
@@ -1068,7 +1068,7 @@
    [])
 
   (with_template [ ]
-    [(def: .public ( shape extent location start next)
+    [(def .public ( shape extent location start next)
        (-> Shape (Maybe Extent) (Value Location)
            Stop (List/1 [(Maybe Hint) Stop])
            (Value Image))
@@ -1089,7 +1089,7 @@
     [repeating_radial_gradient "repeating-radial-gradient"]
     )
 
-  (def: .public (shadow horizontal vertical blur spread color inset?)
+  (def .public (shadow horizontal vertical blur spread color inset?)
     (-> (Value Length) (Value Length)
         (Maybe (Value Length)) (Maybe (Value Length))
         (Value Color) Bit
@@ -1113,30 +1113,30 @@
       #bottom (Value Length)
       #left (Value Length)]))
 
-  (def: .public (clip rectangle)
+  (def .public (clip rectangle)
     (-> Rectangle (Value Clip))
     (`` (..apply "rect" (list (~~ (with_template []
                                     [(representation (the  rectangle))]
 
                                     [#top] [#right] [#bottom] [#left]))))))
 
-  (def: .public counter
+  (def .public counter
     (-> Label (Value Counter))
     (|>> abstraction))
 
-  (def: .public current_count
+  (def .public current_count
     (-> (Value Counter) (Value Content))
     (|>> representation (list) (..apply "counter")))
 
-  (def: .public text
+  (def .public text
     (-> Text (Value Content))
     (|>> %.text abstraction))
 
-  (def: .public attribute
+  (def .public attribute
     (-> Label (Value Content))
     (|>> (list) (..apply "attr")))
 
-  (def: .public media
+  (def .public media
     (-> URL (Value Content))
     (|>> (list) (..apply "url")))
 
@@ -1149,11 +1149,11 @@
     [cursive "cursive"]
     [fantasy "fantasy"]
     [monospace "monospace"]]
-   [(def: .public font
+   [(def .public font
       (-> Text Font)
       (|>> %.text abstraction))
 
-    (def: .public (font_family options)
+    (def .public (font_family options)
       (-> (List Font) (Value Font))
       (case options
         {.#Item _}
@@ -1165,35 +1165,35 @@
         {.#End}
         ..initial))])
 
-  (def: .public font_size
+  (def .public font_size
     (-> (Value Length) (Value Font_Size))
     (|>> transmutation))
 
-  (def: .public number
+  (def .public number
     (-> Frac (Value Number))
     (|>> %number abstraction))
 
-  (def: .public grid
+  (def .public grid
     (-> Label (Value Grid))
     (|>> abstraction))
 
-  (def: .public fit_content
+  (def .public fit_content
     (-> (Value Length) (Value Grid_Content))
     (|>> representation (list) (..apply "fit-content")))
 
-  (def: .public (min_max min max)
+  (def .public (min_max min max)
     (-> (Value Grid_Content) (Value Grid_Content) (Value Grid_Content))
     (..apply "minmax" (list (representation min)
                             (representation max))))
 
-  (def: .public grid_span
+  (def .public grid_span
     (-> Nat (Value Grid_Span))
     (|>> %.nat (format "span ") abstraction))
 
-  (def: grid_column_separator " ")
-  (def: grid_row_separator " ")
+  (def grid_column_separator " ")
+  (def grid_row_separator " ")
 
-  (def: .public grid_template
+  (def .public grid_template
     (-> (List (List (Maybe (Value Grid)))) (Value Grid_Template))
     (let [empty (is (Value Grid)
                     (abstraction "."))]
@@ -1204,11 +1204,11 @@
            (text.interposed ..grid_row_separator)
            abstraction)))
 
-  (def: .public (resolution dpi)
+  (def .public (resolution dpi)
     (-> Nat (Value Resolution))
     (abstraction (format (%.nat dpi) "dpi")))
 
-  (def: .public (ratio numerator denominator)
+  (def .public (ratio numerator denominator)
     (-> Nat Nat (Value Ratio))
     (abstraction (format (%.nat numerator) "/" (%.nat denominator))))
 
@@ -1227,20 +1227,20 @@
     [double_left_quote "\201C"]
     [double_right_quote "\201D"]
     [low_double_quote "\201E"]]
-   [(def: .public quote
+   [(def .public quote
       (-> Text Quote)
       (|>> abstraction))])
 
-  (def: quote_separator " ")
+  (def quote_separator " ")
 
-  (def: .public (quotes [left0 right0] [left1 right1])
+  (def .public (quotes [left0 right0] [left1 right1])
     (-> [Quote Quote] [Quote Quote] (Value Quotes))
     (|> (list left0 right0 left1 right1)
         (list#each (|>> ..quote_text %.text))
         (text.interposed ..quote_separator)
         abstraction))
 
-  (def: .public (matrix_2d [a b] [c d] [tx ty])
+  (def .public (matrix_2d [a b] [c d] [tx ty])
     (-> [Frac Frac]
         [Frac Frac]
         [Frac Frac]
@@ -1249,7 +1249,7 @@
         (list#each %number)
         (..apply "matrix")))
 
-  (def: .public (matrix_3d [a0 b0 c0 d0] [a1 b1 c1 d1] [a2 b2 c2 d2] [a3 b3 c3 d3])
+  (def .public (matrix_3d [a0 b0 c0 d0] [a1 b1 c1 d1] [a2 b2 c2 d2] [a3 b3 c3 d3])
     (-> [Frac Frac Frac Frac]
         [Frac Frac Frac Frac]
         [Frac Frac Frac Frac]
@@ -1260,7 +1260,7 @@
         (..apply "matrix3d")))
 
   (with_template [   ]
-    [(`` (def: .public ( [(~~ (template.spliced ))])
+    [(`` (def .public ( [(~~ (template.spliced ))])
            (-> [(~~ (template.spliced ))] (Value Transform))
            (|> (list (~~ (template.spliced )))
                (list#each %number)
@@ -1282,7 +1282,7 @@
     )
 
   (with_template [   ]
-    [(`` (def: .public ( [(~~ (template.spliced ))])
+    [(`` (def .public ( [(~~ (template.spliced ))])
            (-> [(~~ (template.spliced ))] (Value Transform))
            (|> (list (~~ (template.spliced )))
                (list#each ..angle)
@@ -1298,36 +1298,36 @@
     [skew_y "skewY" [Angle] [angle]]
     )
 
-  (def: .public (rotate_3d [x y z angle])
+  (def .public (rotate_3d [x y z angle])
     (-> [Frac Frac Frac Angle] (Value Transform))
     (..apply "rotate3d"
              (list (%number x) (%number y) (%number z) (..angle angle))))
 
-  (def: origin_separator " ")
+  (def origin_separator " ")
 
-  (def: .public (origin_2d x y)
+  (def .public (origin_2d x y)
     (-> (Value Length) (Value Length) (Value Transform_Origin))
     (abstraction (format (representation x) ..origin_separator
                          (representation y))))
 
-  (def: .public (origin_3d x y z)
+  (def .public (origin_3d x y z)
     (-> (Value Length) (Value Length) (Value Length) (Value Transform_Origin))
     (abstraction (format (representation x) ..origin_separator
                          (representation y) ..origin_separator
                          (representation z))))
 
-  (def: .public vertical_align
+  (def .public vertical_align
     (-> (Value Length) (Value Vertical_Align))
     (|>> transmutation))
 
-  (def: .public (z_index index)
+  (def .public (z_index index)
     (-> Int (Value Z_Index))
     (abstraction (if (i.< +0 index)
                    (%.int index)
                    (%.nat (.nat index)))))
 
   (with_template [  ]
-    [(def: .public ( pre post)
+    [(def .public ( pre post)
        (-> (Value ) (Value ) (Value ))
        (abstraction (format (representation pre)
                             
@@ -1340,7 +1340,7 @@
 
   ... https://developer.mozilla.org/en-US/docs/Web/CSS/calc()
   (with_template [ ]
-    [(def: .public ( parameter subject)
+    [(def .public ( parameter subject)
        (.All (_ kind)
          (-> (Value ) (Value (Numeric kind))
              (Value (Numeric kind))))
diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux
index 3a8bcd5c6..7a9d61adc 100644
--- a/stdlib/source/library/lux/data/format/html.lux
+++ b/stdlib/source/library/lux/data/format/html.lux
@@ -43,7 +43,7 @@
    {#Top}
    {#Frame Text}))
 
-(def: (target value)
+(def (target value)
   (-> Target Text)
   (case value
     {#Blank} "_blank"
@@ -53,7 +53,7 @@
     {#Frame name} name))
 
 ... Properly formats text to ensure no injection can happen on the HTML.
-(def: safe
+(def safe
   (-> Text Text)
   (|>> (text.replaced "&" "&")
        (text.replaced "<" "<")
@@ -62,20 +62,20 @@
        (text.replaced "'" "'")
        (text.replaced "/" "/")))
 
-(def: attributes
+(def attributes
   (-> Attributes Text)
   (|>> (list#each (function (_ [key val])
                     (format " " key "=" text.double_quote (..safe val) text.double_quote)))
        text.together))
 
-(def: (open tag attributes)
+(def (open tag attributes)
   (-> Tag Attributes Text)
   (|> attributes
       ..attributes
       (format tag)
       (text.enclosed ["<" ">"])))
 
-(def: close
+(def close
   (-> Tag Text)
   (text.enclosed [""]))
 
@@ -119,40 +119,40 @@
       [Track Track']]]
     )
 
-  (def: .public html
+  (def .public html
     (-> Document Text)
     (|>> representation))
 
-  (def: .public (and pre post)
+  (def .public (and pre post)
     (All (_ brand) (-> (HTML brand) (HTML brand) (HTML brand)))
     (abstraction (format (representation pre) (representation post))))
 
-  (def: .public (comment content node)
+  (def .public (comment content node)
     (All (_ brand) (-> Text (HTML brand) (HTML brand)))
     (abstraction
      (format (text.enclosed [""] content)
              (representation node))))
 
-  (def: (empty name attributes)
+  (def (empty name attributes)
     (-> Tag Attributes HTML)
     (abstraction
      (format (..open name attributes)
              (..close name))))
 
-  (def: (simple tag attributes)
+  (def (simple tag attributes)
     (-> Tag Attributes HTML)
     (|> attributes
         (..open tag)
         abstraction))
 
-  (def: (tag name attributes content)
+  (def (tag name attributes content)
     (-> Tag Attributes (HTML Any) HTML)
     (abstraction
      (format (..open name attributes)
              (representation content)
              (..close name))))
 
-  (def: (raw tag attributes content)
+  (def (raw tag attributes content)
     (-> Text Attributes Text HTML)
     (abstraction
      (format (..open tag attributes)
@@ -160,7 +160,7 @@
              (..close tag))))
 
   (.with_template [  ]
-    [(def: .public 
+    [(def .public 
        (-> Attributes )
        (..simple ))]
 
@@ -172,7 +172,7 @@
     [parameter "param" Parameter]
     )
 
-  (def: .public (base href target)
+  (def .public (base href target)
     (-> URL (Maybe Target) Meta)
     (let [partial (list ["href" href])
           full (case target
@@ -183,40 +183,40 @@
                  partial)]
       (..simple "base" full)))
 
-  (def: .public style
+  (def .public style
     (-> Style Meta)
     (|>> style.inline (..raw "style" (list))))
 
-  (def: .public (script attributes inline)
+  (def .public (script attributes inline)
     (-> Attributes (Maybe Script) Meta)
     (|> inline
         (maybe#each js.code)
         (maybe.else "")
         (..raw "script" attributes)))
 
-  (def: .public text
+  (def .public text
     (-> Text Content)
     (|>> ..safe
          abstraction))
 
   (.with_template [  ]
-    [(def: .public 
+    [(def .public 
        Element
        (..simple  (list)))
 
-     (def: .public  )]
+     (def .public  )]
     ["br"  br  line_break]
     ["wbr" wbr word_break]
     ["hr"  hr  separator]
     )
 
-  (def: .public (image source attributes)
+  (def .public (image source attributes)
     (-> URL Attributes Image)
     (|> attributes
         {.#Item ["src" source]}
         (..simple "img")))
 
-  (def: .public (svg attributes content)
+  (def .public (svg attributes content)
     (-> Attributes XML Element)
     (|> content
         (at xml.codec encoded)
@@ -227,10 +227,10 @@
      [#horizontal Nat
       #vertical Nat]))
 
-  (def: metric_separator ",")
-  (def: coord_separator ",")
+  (def metric_separator ",")
+  (def coord_separator ",")
 
-  (def: (%coord [horizontal vertical])
+  (def (%coord [horizontal vertical])
     (Format Coord)
     (format (%.nat horizontal) ..metric_separator (%.nat vertical)))
   
@@ -251,15 +251,15 @@
       #third Coord
       #extra (List Coord)]))
 
-  (def: (%rectangle [start end])
+  (def (%rectangle [start end])
     (Format Rectangle)
     (format (%coord start) ..coord_separator (%coord end)))
 
-  (def: (%circle [center radius])
+  (def (%circle [center radius])
     (Format Circle)
     (format (%coord center) ..metric_separator (%.nat radius)))
 
-  (def: (%polygon [first second third extra])
+  (def (%polygon [first second third extra])
     (Format Polygon)
     (|> (list.partial first second third extra)
         (list#each %coord)
@@ -272,7 +272,7 @@
      {#Polygon Polygon}))
 
   (.with_template [   ]
-    [(def: ( attributes shape)
+    [(def ( attributes shape)
        (-> Attributes  (HTML Any))
        (..simple "area" (list.partial ["shape" ]
                                       ["coords" ( shape)]
@@ -283,7 +283,7 @@
     [polygon "poly" Polygon ..%polygon]
     )
   
-  (def: (area attributes shape)
+  (def (area attributes shape)
     (-> Attributes Shape (HTML Any))
     (case shape
       {#Rectangle rectangle}
@@ -295,7 +295,7 @@
       {#Polygon polygon}
       (..polygon attributes polygon)))
 
-  (def: .public (each attributes areas for)
+  (def .public (each attributes areas for)
     (-> Attributes (List [Attributes Shape]) Image Image)
     (all ..and
          for
@@ -308,7 +308,7 @@
                   (list#mix (function.flipped ..and) head tail)))))
 
   (.with_template [  ]
-    [(def: .public 
+    [(def .public 
        (-> Attributes )
        (..empty ))]
 
@@ -320,7 +320,7 @@
     )
 
   (.with_template [ ]
-    [(def: .public ( attributes media on_unsupported)
+    [(def .public ( attributes media on_unsupported)
        (-> Attributes Media (Maybe Content) Element)
        (..tag  attributes
               (|> on_unsupported
@@ -331,20 +331,20 @@
     [video "video"]
     )
 
-  (def: .public (picture attributes sources image)
+  (def .public (picture attributes sources image)
     (-> Attributes Source Image Element)
     (..tag "picture" attributes (..and sources image)))
 
-  (def: .public (anchor href attributes content)
+  (def .public (anchor href attributes content)
     (-> URL Attributes Element Element)
     (..tag "a" (list.partial ["href" href] attributes) content))
 
-  (def: .public label
+  (def .public label
     (-> ID Input)
     (|>> ["for"] list (..empty "label")))
 
   (.with_template [   ]
-    [(def: .public ( description attributes content)
+    [(def .public ( description attributes content)
        (-> (Maybe Content) Attributes  )
        (..tag  attributes
               (case description
@@ -362,7 +362,7 @@
     )
 
   (.with_template [  ]
-    [(def: .public ( attributes content)
+    [(def .public ( attributes content)
        (-> Attributes (Maybe Content) )
        (|> content
            (maybe.else (..text ""))
@@ -376,7 +376,7 @@
     (-> Attributes Content Element))
 
   (.with_template [ ]
-    [(def: .public 
+    [(def .public 
        Phrase
        (..tag ))]
 
@@ -412,9 +412,9 @@
     [variable "var"]
     )
 
-  (def: .public incorrect ..struck)
+  (def .public incorrect ..struck)
 
-  (def: (ruby_pronunciation pronunciation)
+  (def (ruby_pronunciation pronunciation)
     (-> Content (HTML Any))
     (..tag "rt" (list)
            (all ..and
@@ -422,7 +422,7 @@
                 pronunciation
                 (..tag "rp" (list) (..text ")")))))
 
-  (def: .public (ruby attributes content pronunciation)
+  (def .public (ruby attributes content pronunciation)
     (-> Attributes Content Content Element)
     (..tag "ruby" attributes
            (all ..and
@@ -433,7 +433,7 @@
     (-> Attributes Element Element))
 
   (.with_template [ ]
-    [(def: .public 
+    [(def .public 
        Composite
        (..tag ))]
 
@@ -451,7 +451,7 @@
     )
 
   (.with_template [  ]
-    [(def: 
+    [(def 
        (->  (HTML Any))
        (..tag  (list)))]
 
@@ -459,7 +459,7 @@
     ["dd" description Element]
     )
 
-  (def: .public (description_list attributes descriptions)
+  (def .public (description_list attributes descriptions)
     (-> Attributes (List [Content Element]) Element)
     (case (list#each (function (_ [term description])
                        (all ..and
@@ -473,10 +473,10 @@
       (..tag "dl" attributes
              (list#mix (function.flipped ..and) head tail))))
 
-  (def: .public p ..paragraph)
+  (def .public p ..paragraph)
 
   (.with_template [   ]
-    [(def: .public 
+    [(def .public 
        (-> Attributes  )
        (..tag ))]
 
@@ -495,7 +495,7 @@
     )
 
   (.with_template [   ]
-    [(def: .public 
+    [(def .public 
        (->  )
        (..tag  (list)))]
 
@@ -509,7 +509,7 @@
     )
 
   (.with_template [   ]
-    [(def: 
+    [(def 
        (->  )
        (..tag  (list)))]
 
@@ -520,7 +520,7 @@
     [columns_group "colgroup" Column HTML]
     )
 
-  (def: .public (table attributes caption columns headers rows footer)
+  (def .public (table attributes caption columns headers rows footer)
     (-> Attributes (Maybe Content) (Maybe Column) Header (List Cell) (Maybe Cell) Element)
     (let [head (..table_head (..table_row headers))
           content (case (list#each table_row rows)
@@ -556,7 +556,7 @@
              content)))
 
   (.with_template [ ]
-    [(def: .public 
+    [(def .public 
        (-> Head Body Document)
        (let [doc_type ]
          (function (_ head body)
diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux
index 19c3a9bba..af8a52bb4 100644
--- a/stdlib/source/library/lux/data/format/json.lux
+++ b/stdlib/source/library/lux/data/format/json.lux
@@ -59,12 +59,12 @@
   [Object (Dictionary String JSON)]
   )
 
-(def: .public null?
+(def .public null?
   (Predicate JSON)
   (|>> (pipe.case {#Null} true
          _ false)))
 
-(def: .public object
+(def .public object
   (-> (List [String JSON]) JSON)
   (|>> (dictionary.of_list text.hash) {..#Object}))
 
@@ -79,7 +79,7 @@
      {#Object'  (Dictionary String JSON')}
      {#Code'    Code})))
 
-(def: jsonP
+(def jsonP
   (.Parser JSON')
   (<>.rec
    (function (_ jsonP)
@@ -95,7 +95,7 @@
           .any
           ))))
 
-(def: (jsonF token)
+(def (jsonF token)
   (-> JSON' Code)
   (case token
     {#Null' _}
@@ -122,11 +122,11 @@
     {#Code' code}
     code))
 
-(def: .public json
+(def .public json
   (syntax (_ [token ..jsonP])
     (in (list (` (is JSON (~ (jsonF token))))))))
 
-(def: .public (fields json)
+(def .public (fields json)
   (-> JSON (Try (List String)))
   (case json
     {#Object obj}
@@ -135,7 +135,7 @@
     _
     {try.#Failure (all text#composite "Cannot get the fields of a non-object.")}))
 
-(def: .public (field key json)
+(def .public (field key json)
   (-> String JSON (Try JSON))
   (case json
     {#Object obj}
@@ -149,7 +149,7 @@
     _
     {try.#Failure (all text#composite "Cannot get field '" key "' on a non-object.")}))
 
-(def: .public (has key value json)
+(def .public (has key value json)
   (-> String JSON JSON (Try JSON))
   (case json
     {#Object obj}
@@ -159,7 +159,7 @@
     {try.#Failure (all text#composite "Cannot set field '" key "' on a non-object.")}))
 
 (with_template [  ]
-  [(def: .public ( key json)
+  [(def .public ( key json)
      (-> Text JSON (Try ))
      (case (field key json)
        {try.#Success { value}}
@@ -178,10 +178,10 @@
   [object_field  #Object  Object]
   )
 
-(def: .public equivalence
+(def .public equivalence
   (Equivalence JSON)
   (implementation
-   (def: (= x y)
+   (def (= x y)
      (case [x y]
        [{#Null} {#Null}]
        #1
@@ -222,17 +222,17 @@
 ............................................................
 ............................................................
 
-(def: (null_format _)
+(def (null_format _)
   (-> Null Text)
   "null")
 
-(def: boolean_format
+(def boolean_format
   (-> Boolean Text)
   (|>> (pipe.case
          #0 "false"
          #1 "true")))
 
-(def: number_format
+(def number_format
   (-> Number Text)
   (|>> (pipe.case
          +0.0 ... OR -0.0
@@ -244,16 +244,16 @@
              raw
              (|> raw (text.split_at 1) maybe.trusted product.right))))))
 
-(def: escape "\")
-(def: escaped_dq (text#composite ..escape text.double_quote))
+(def escape "\")
+(def escaped_dq (text#composite ..escape text.double_quote))
 
-(def: string_format
+(def string_format
   (-> String Text)
   (|>> (text.replaced text.double_quote ..escaped_dq)
        (text.enclosed [text.double_quote text.double_quote])))
 
 (with_template [ ]
-  [(def: 
+  [(def 
      Text
      )]
 
@@ -267,14 +267,14 @@
   ["}" object_end]
   )
 
-(def: (array_format format)
+(def (array_format format)
   (-> (-> JSON Text) (-> Array Text))
   (|>> (sequence#each format)
        sequence.list
        (text.interposed ..value_separator)
        (text.enclosed [..array_start ..array_end])))
 
-(def: (kv_format format [key value])
+(def (kv_format format [key value])
   (-> (-> JSON Text) (-> [String JSON] Text))
   (all text#composite
        (..string_format key)
@@ -282,14 +282,14 @@
        (format value)
        ))
 
-(def: (object_format format)
+(def (object_format format)
   (-> (-> JSON Text) (-> Object Text))
   (|>> dictionary.entries
        (list#each (..kv_format format))
        (text.interposed ..value_separator)
        (text.enclosed [..object_start ..object_end])))
 
-(def: .public (format json)
+(def .public (format json)
   (-> JSON Text)
   (case json
     (^.with_template [ ]
@@ -307,25 +307,25 @@
 ............................................................
 ............................................................
 
-(def: space_parser
+(def space_parser
   (Parser Text)
   (.some .space))
 
-(def: value_separator_parser
+(def value_separator_parser
   (Parser [Text Any Text])
   (all <>.and
        ..space_parser
        (.this ..value_separator)
        ..space_parser))
 
-(def: null_parser
+(def null_parser
   (Parser Null)
   (do <>.monad
     [_ (.this "null")]
     (in [])))
 
 (with_template [  ]
-  [(def: 
+  [(def 
      (Parser Boolean)
      (do <>.monad
        [_ (.this )]
@@ -335,13 +335,13 @@
   [false_parser "false" #0]
   )
 
-(def: boolean_parser
+(def boolean_parser
   (Parser Boolean)
   (all <>.either
        ..true_parser
        ..false_parser))
 
-(def: number_parser
+(def number_parser
   (Parser Number)
   (do [! <>.monad]
     [signed? (<>.parses? (.this "-"))
@@ -363,7 +363,7 @@
       {try.#Success value}
       (in value))))
 
-(def: escaped_parser
+(def escaped_parser
   (Parser Text)
   (all <>.either
        (<>.after (.this "\t")
@@ -381,7 +381,7 @@
        (<>.after (.this "\\")
                  (<>#in "\"))))
 
-(def: string_parser
+(def string_parser
   (Parser String)
   (<| (.enclosed [text.double_quote text.double_quote])
       (loop (again [_ []]))
@@ -395,7 +395,7 @@
           (in (all text#composite chars escaped next_chars)))
         (in chars))))
 
-(def: (kv_parser json_parser)
+(def (kv_parser json_parser)
   (-> (Parser JSON) (Parser [String JSON]))
   (do <>.monad
     [key ..string_parser
@@ -406,7 +406,7 @@
     (in [key value])))
 
 (with_template [     ]
-  [(def: ( json_parser)
+  [(def ( json_parser)
      (-> (Parser JSON) (Parser ))
      (do <>.monad
        [_ (.this )
@@ -420,7 +420,7 @@
   [object_parser Object ..object_start ..object_end (kv_parser json_parser) (dictionary.of_list text.hash)]
   )
 
-(def: json_parser
+(def json_parser
   (Parser JSON)
   (<>.rec
    (function (_ json_parser)
@@ -432,8 +432,8 @@
           (array_parser json_parser)
           (object_parser json_parser)))))
 
-(def: .public codec
+(def .public codec
   (Codec Text JSON)
   (implementation
-   (def: encoded ..format)
-   (def: decoded (.result json_parser))))
+   (def encoded ..format)
+   (def decoded (.result json_parser))))
diff --git a/stdlib/source/library/lux/data/format/markdown.lux b/stdlib/source/library/lux/data/format/markdown.lux
index d65c5e6f6..f328045dc 100644
--- a/stdlib/source/library/lux/data/format/markdown.lux
+++ b/stdlib/source/library/lux/data/format/markdown.lux
@@ -13,7 +13,7 @@
 
 ... https://www.markdownguide.org/basic-syntax/
 
-(def: safe
+(def safe
   (-> Text Text)
   (|>> (text.replaced "\" "\\")
        (text.replaced "`" "\`")
@@ -37,19 +37,19 @@
 (primitive .public (Markdown brand)
   Text
 
-  (def: .public empty
+  (def .public empty
     Markdown
     (abstraction ""))
 
-  (def: .public text
+  (def .public text
     (-> Text (Markdown Span))
     (|>> ..safe abstraction))
 
-  (def: blank_line
+  (def blank_line
     (format text.new_line text.new_line))
 
   (with_template [ ]
-    [(def: .public ( content)
+    [(def .public ( content)
        (-> Text (Markdown Block))
        (abstraction (format  " " (..safe content) ..blank_line)))]
 
@@ -61,20 +61,20 @@
     [heading/6 "######"]
     )
 
-  (def: (block content)
+  (def (block content)
     (-> Text (Markdown Block))
     (abstraction (format content ..blank_line)))
 
-  (def: .public paragraph
+  (def .public paragraph
     (-> (Markdown Span) (Markdown Block))
     (|>> representation ..block))
 
-  (def: .public break
+  (def .public break
     (Markdown Span)
     (abstraction (format "  " text.new_line)))
 
   (with_template [ ]
-    [(def: .public 
+    [(def .public 
        (-> (Markdown Span) (Markdown Span))
        (|>> representation
             (text.enclosed [ ])
@@ -84,7 +84,7 @@
     [italic "_"]
     )
 
-  (def: (prefix with)
+  (def (prefix with)
     (-> Text (-> Text Text))
     (|>> (text.all_split_by text.new_line)
          (list#each (function (_ line)
@@ -93,17 +93,17 @@
                         (format with line))))
          (text.interposed text.new_line)))
 
-  (def: indent
+  (def indent
     (-> Text Text)
     (..prefix text.tab))
 
-  (def: .public quote
+  (def .public quote
     (-> (Markdown Block) (Markdown Block))
     (|>> representation
          (..prefix "> ")
          abstraction))
 
-  (def: .public numbered_list
+  (def .public numbered_list
     (-> (List [(Markdown Span) (Maybe (Markdown Block))])
         (Markdown Block))
     (|>> list.enumeration
@@ -122,7 +122,7 @@
          (text.interposed text.new_line)
          ..block))
 
-  (def: .public bullet_list
+  (def .public bullet_list
     (-> (List [(Markdown Span) (Maybe (Markdown Block))])
         (Markdown Block))
     (|>> (list#each (function (_ [summary detail])
@@ -141,19 +141,19 @@
          ..block))
 
   ... A snippet of code.
-  (def: .public snippet
+  (def .public snippet
     (-> Text (Markdown Span))
     (|>> (text.enclosed ["`` " " ``"]) abstraction))
 
   ... A (generic) block of code.
-  (def: .public generic_code
+  (def .public generic_code
     (-> Text (Markdown Block))
     (let [open (format "```" text.new_line)
           close (format text.new_line "```")]
       (|>> (text.enclosed [open close]) ..block)))
 
   ... A block of code of a specific language.
-  (def: .public (code language block)
+  (def .public (code language block)
     (-> Text Text (Markdown Block))
     (let [open (format "```" language text.new_line)
           close (format text.new_line "```")]
@@ -161,15 +161,15 @@
           (text.enclosed [open close])
           ..block)))
 
-  (def: .public (image description url)
+  (def .public (image description url)
     (-> Text URL (Markdown Span))
     (abstraction (format "![" (..safe description) "](" url ")")))
 
-  (def: .public horizontal_rule
+  (def .public horizontal_rule
     (Markdown Block)
     (..block "___"))
 
-  (def: .public (link description url)
+  (def .public (link description url)
     (-> (Markdown Span) URL (Markdown Span))
     (abstraction (format "[" (representation description) "](" url ")")))
 
@@ -177,7 +177,7 @@
     Text)
 
   (with_template [ ]
-    [(def: .public 
+    [(def .public 
        (->  (Markdown Span))
        (|>> (text.enclosed ["<" ">"]) abstraction))]
 
@@ -186,7 +186,7 @@
     )
 
   (with_template [  ]
-    [(def: .public ( pre post)
+    [(def .public ( pre post)
        (-> (Markdown ) (Markdown ) (Markdown ))
        (abstraction (format (representation pre)  (representation post))))]
 
@@ -194,7 +194,7 @@
     [then Block ""]
     )
 
-  (def: .public markdown
+  (def .public markdown
     (All (_ a) (-> (Markdown a) Text))
     (|>> representation))
   )
diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux
index 272d666de..4fd668306 100644
--- a/stdlib/source/library/lux/data/format/tar.lux
+++ b/stdlib/source/library/lux/data/format/tar.lux
@@ -41,11 +41,11 @@
 (type: Size
   Nat)
 
-(def: octal_size
+(def octal_size
   Size
   8)
 
-(def: (octal_padding max_size number)
+(def (octal_padding max_size number)
   (-> Size Text Text)
   (let [padding_size (n.- (text.size number)
                           max_size)
@@ -54,16 +54,16 @@
                     text.together)]
     (format padding number)))
 
-(def: blank " ")
-(def: null text.null)
+(def blank " ")
+(def null text.null)
 
-(def: small_size Size 6)
-(def: big_size Size 11)
+(def small_size Size 6)
+(def big_size Size 11)
 
 (with_template [  
                     
                 ]
-  [(def: .public 
+  [(def .public 
      Nat
      (|> ..octal_size
          (list.repeated )
@@ -78,17 +78,17 @@
    (primitive .public 
      Nat
 
-     (def: .public ( value)
+     (def .public ( value)
        (-> Nat (Try ))
        (if (n.<  value)
          {try.#Success (abstraction value)}
          (exception.except  [value])))
 
-     (def: .public 
+     (def .public 
        (->  Nat)
        (|>> representation))
 
-     (def: 
+     (def 
        (Writer )
        (let [suffix 
              padded_size (n.+ (text.size suffix) )]
@@ -99,7 +99,7 @@
               (at utf8.codec encoded)
               (\\format.segment padded_size))))
 
-     (def: 
+     (def 
        (-> Nat )
        (|>> (n.% )
             abstraction))
@@ -121,7 +121,7 @@
    "Expected" (%.nat expected)
    "Actual" (%.nat actual)))
 
-(def: small_suffix
+(def small_suffix
   (Parser Any)
   (do <>.monad
     [pre_end .bits_8
@@ -135,7 +135,7 @@
                        (n.= expected end)))]
     (in [])))
 
-(def: small_parser
+(def small_parser
   (Parser Small)
   (do <>.monad
     [digits (.segment ..small_size)
@@ -146,7 +146,7 @@
        [value (at n.octal decoded digits)]
        (..small value)))))
 
-(def: big_parser
+(def big_parser
   (Parser Big)
   (do <>.monad
     [digits (.segment ..big_size)
@@ -163,28 +163,28 @@
 (primitive Checksum
   Text
 
-  (def: from_checksum
+  (def from_checksum
     (-> Checksum Text)
     (|>> representation))
 
-  (def: dummy_checksum
+  (def dummy_checksum
     Checksum
     (abstraction "        "))
 
-  (def: checksum_suffix
+  (def checksum_suffix
     (format ..blank ..null))
 
-  (def: checksum
+  (def checksum
     (-> Binary Nat)
     (binary.mix n.+ 0))
 
-  (def: checksum_checksum
+  (def checksum_checksum
     (|> ..dummy_checksum
         representation
         (at utf8.codec encoded)
         ..checksum))
 
-  (def: checksum_code
+  (def checksum_code
     (-> Binary Checksum)
     (|>> ..checksum
          ..as_small
@@ -194,7 +194,7 @@
          (text.suffix ..checksum_suffix)
          abstraction))
 
-  (def: checksum_writer
+  (def checksum_writer
     (Writer Checksum)
     (let [padded_size (n.+ (text.size ..checksum_suffix)
                            ..small_size)]
@@ -202,7 +202,7 @@
            (at utf8.codec encoded)
            (\\format.segment padded_size))))
 
-  (def: checksum_parser
+  (def checksum_parser
     (Parser [Nat Checksum])
     (do <>.monad
       [ascii (.segment ..small_size)
@@ -214,11 +214,11 @@
            (abstraction (format digits ..checksum_suffix))])))
   )
 
-(def: last_ascii
+(def last_ascii
   Char
   (number.hex "007F"))
 
-(def: ascii?
+(def ascii?
   (-> Text Bit)
   (|>> (at utf8.codec encoded)
        (binary.mix (function (_ char verdict)
@@ -230,10 +230,10 @@
   (exception.report
    "Text" (%.text text)))
 
-(def: .public name_size Size 31)
-(def: .public path_size Size 99)
+(def .public name_size Size 31)
+(def .public path_size Size 99)
 
-(def: (un_padded string)
+(def (un_padded string)
   (-> Binary Binary)
   (case (binary!.size string)
     0 string
@@ -258,7 +258,7 @@
         "Size" (%.nat (text.size value))
         "Maximum" (%.nat )))
 
-     (def: .public ( value)
+     (def .public ( value)
        (->  (Try ))
        (if (..ascii? value)
          (if (|> value
@@ -269,11 +269,11 @@
            {try.#Success (abstraction value)})
          (exception.except ..not_ascii [value])))
 
-     (def: .public 
+     (def .public 
        (->  )
        (|>> representation))
 
-     (def: 
+     (def 
        (Writer )
        (let [suffix ..null
              padded_size (n.+ (text.size suffix) )]
@@ -282,7 +282,7 @@
               (at utf8.codec encoded)
               (\\format.segment padded_size))))
 
-     (def: 
+     (def 
        (Parser )
        (do <>.monad
          [string (.segment )
@@ -295,7 +295,7 @@
             [text (at utf8.codec decoded (..un_padded string))]
             ( text)))))
 
-     (def: .public 
+     (def .public 
        
        (try.trusted ( "")))
      )]
@@ -304,19 +304,19 @@
   [Path file.Path ..path_size path_is_too_long path from_path path_writer path_parser no_path]
   )
 
-(def: magic_size Size 7)
+(def magic_size Size 7)
 
 (primitive Magic
   Text
 
-  (def: ustar
+  (def ustar
     (abstraction "ustar  "))
 
-  (def: from_magic
+  (def from_magic
     (-> Magic Text)
     (|>> representation))
 
-  (def: magic_writer
+  (def magic_writer
     (Writer Magic)
     (let [padded_size (n.+ (text.size ..null)
                            ..magic_size)]
@@ -324,7 +324,7 @@
            (at utf8.codec encoded)
            (\\format.segment padded_size))))
 
-  (def: magic_parser
+  (def magic_parser
     (Parser Magic)
     (do <>.monad
       [string (.segment ..magic_size)
@@ -337,32 +337,32 @@
            (at utf8.codec decoded string)))))
   )
 
-(def: block_size Size 512)
+(def block_size Size 512)
 
-(def: owner_id_size ..small_size)
+(def owner_id_size ..small_size)
 
-(def: blank_size Size (text.size ..blank))
-(def: null_size Size (text.size ..null))
-(def: mode_size Size ..small_size)
-(def: content_size Size ..big_size)
-(def: modification_time_size Size ..big_size)
-(def: checksum_size Size ..small_size)
-(def: link_flag_size Size 1)
-(def: device_size Size ..small_size)
+(def blank_size Size (text.size ..blank))
+(def null_size Size (text.size ..null))
+(def mode_size Size ..small_size)
+(def content_size Size ..big_size)
+(def modification_time_size Size ..big_size)
+(def checksum_size Size ..small_size)
+(def link_flag_size Size 1)
+(def device_size Size ..small_size)
 
-(def: small_number
+(def small_number
   (-> Size Size)
   (|>> (all n.+ ..blank_size ..null_size)))
 
-(def: big_number
+(def big_number
   (-> Size Size)
   (|>> (all n.+ ..blank_size)))
 
-(def: string
+(def string
   (-> Size Size)
   (|>> (all n.+ ..null_size)))
 
-(def: header_size
+(def header_size
   (all n.+
        ... name
        (..string ..path_size)
@@ -396,11 +396,11 @@
 (primitive Link_Flag
   Char
 
-  (def: link_flag
+  (def link_flag
     (-> Link_Flag Char)
     (|>> representation))
 
-  (def: link_flag_writer
+  (def link_flag_writer
     (Writer Link_Flag)
     (|>> representation
          \\format.bits_8))
@@ -415,7 +415,7 @@
                                      [(char "6") fifo]
                                      [(char "7") contiguous])]
     (with_template [ ]
-      [(def: 
+      [(def 
          Link_Flag
          (abstraction ))]
 
@@ -426,7 +426,7 @@
       (exception.report
        "Value" (%.nat value)))
 
-    (def: link_flag_parser
+    (def link_flag_parser
       (Parser Link_Flag)
       (do <>.monad
         [it .bits_8]
@@ -444,17 +444,17 @@
 (primitive .public Mode
   Nat
 
-  (def: .public mode
+  (def .public mode
     (-> Mode Nat)
     (|>> representation))
 
-  (def: .public (and left right)
+  (def .public (and left right)
     (-> Mode Mode Mode)
     (abstraction
      (i64.or (representation left)
              (representation right))))
 
-  (def: mode_writer
+  (def mode_writer
     (Writer Mode)
     (|>> representation
          ..small
@@ -483,14 +483,14 @@
                                      ["2000" set_group_id_on_execution]
                                      ["4000" set_user_id_on_execution])]
     (with_template [ ]
-      [(def: .public 
+      [(def .public 
          Mode
          (abstraction (number.oct )))]
 
       
       )
 
-    (def: maximum_mode
+    (def maximum_mode
       Mode
       (all and
            ..none
@@ -512,7 +512,7 @@
            ..set_user_id_on_execution
            ))
 
-    (def: mode_parser
+    (def mode_parser
       (Parser Mode)
       (do [! <>.monad]
         [value (at ! each ..from_small ..small_parser)]
@@ -523,7 +523,7 @@
           (in (abstraction value))))))
   )
 
-(def: maximum_content_size
+(def maximum_content_size
   Nat
   (|> ..octal_size
       (list.repeated ..content_size)
@@ -532,17 +532,17 @@
 (primitive .public Content
   [Big Binary]
 
-  (def: .public (content content)
+  (def .public (content content)
     (-> Binary (Try Content))
     (do try.monad
       [size (..big (binary!.size content))]
       (in (abstraction [size content]))))
 
-  (def: from_content
+  (def from_content
     (-> Content [Big Binary])
     (|>> representation))
 
-  (def: .public data
+  (def .public data
     (-> Content Binary)
     (|>> representation product.right))
   )
@@ -550,7 +550,7 @@
 (type: .public ID
   Small)
 
-(def: .public no_id
+(def .public no_id
   ID
   (..as_small 0))
 
@@ -582,14 +582,14 @@
 (type: Device
   Small)
 
-(def: no_device
+(def no_device
   Device
   (try.trusted (..small 0)))
 
 (type: .public Tar
   (Sequence Entry))
 
-(def: (blocks size)
+(def (blocks size)
   (-> Big Nat)
   (n.+ (n./ ..block_size
             (..from_big size))
@@ -597,7 +597,7 @@
          0 0
          _ 1)))
 
-(def: rounded_content_size
+(def rounded_content_size
   (-> Big Nat)
   (|>> ..blocks
        (n.* ..block_size)))
@@ -619,7 +619,7 @@
     #major_device Device
     #minor_device Device]))
 
-(def: header_writer'
+(def header_writer'
   (Writer Header)
   (all \\format.and
        ..path_writer
@@ -638,7 +638,7 @@
        ..small_writer
        ))
 
-(def: (header_writer header)
+(def (header_writer header)
   (Writer Header)
   (let [checksum (|> header
                      (has #checksum ..dummy_checksum)
@@ -649,14 +649,14 @@
         (\\format.result ..header_writer')
         (\\format.segment ..block_size))))
 
-(def: modification_time
+(def modification_time
   (-> Instant Big)
   (|>> instant.relative
        (duration.ticks duration.second)
        .nat
        ..as_big))
 
-(def: (file_writer link_flag)
+(def (file_writer link_flag)
   (-> Link_Flag (Writer File))
   (function (_ [path modification_time mode ownership content])
     (let [[size content] (..from_content content)
@@ -679,15 +679,15 @@
                 #minor_device ..no_device]
                content]))))
 
-(def: normal_file_writer
+(def normal_file_writer
   (Writer File)
   (..file_writer ..normal))
 
-(def: contiguous_file_writer
+(def contiguous_file_writer
   (Writer File)
   (..file_writer ..contiguous))
 
-(def: (symbolic_link_writer path)
+(def (symbolic_link_writer path)
   (Writer Path)
   (..header_writer
    [#path ..no_path
@@ -705,7 +705,7 @@
     #major_device ..no_device
     #minor_device ..no_device]))
 
-(def: (directory_writer path)
+(def (directory_writer path)
   (Writer Path)
   (..header_writer
    [#path path
@@ -723,7 +723,7 @@
     #major_device ..no_device
     #minor_device ..no_device]))
 
-(def: entry_writer
+(def entry_writer
   (Writer Entry)
   (|>> (pipe.case
          {#Normal value} (..normal_file_writer value)
@@ -731,11 +731,11 @@
          {#Directory value} (..directory_writer value)
          {#Contiguous value} (..contiguous_file_writer value))))
 
-(def: end_of_archive_size
+(def end_of_archive_size
   Size
   (n.* 2 ..block_size))
 
-(def: .public writer
+(def .public writer
   (Writer Tar)
   (let [end_of_archive (binary!.empty ..end_of_archive_size)]
     (function (_ tar)
@@ -751,7 +751,7 @@
    "Expected" (%.nat expected)
    "Actual" (%.nat actual)))
 
-(def: header_padding_size
+(def header_padding_size
   (n.- header_size block_size))
 
 ... When the checksum gets originally calculated, the assumption is that all the characters in the checksum field
@@ -760,7 +760,7 @@
 ... an incorrect result, as the contents of the checksum field would be an actual checksum, instead of just spaces.
 ... To correct for this, it is necessary to calculate the checksum of just the checksum field, subtract that, and then
 ... add-in the checksum of the spaces.
-(def: (expected_checksum checksum header)
+(def (expected_checksum checksum header)
   (-> Checksum Binary Nat)
   (let [|checksum| (|> checksum
                        ..from_checksum
@@ -770,7 +770,7 @@
         (n.- |checksum|)
         (n.+ ..checksum_checksum))))
 
-(def: header_parser
+(def header_parser
   (Parser Header)
   (do <>.monad
     [binary_header (<>.speculative (.segment block_size))
@@ -808,7 +808,7 @@
          #major_device major_device
          #minor_device minor_device])))
 
-(def: (file_parser header)
+(def (file_parser header)
   (-> Header (Parser File))
   (do <>.monad
     [.let [size (the #size header)
@@ -831,7 +831,7 @@
                   #id (the #group_id header)]]
          content])))
 
-(def: entry_parser
+(def entry_parser
   (Parser Entry)
   (do [! <>.monad]
     [header ..header_parser]
@@ -850,7 +850,7 @@
 
 ... It's safe to implement the parser this way because the range of values for Nat is 2^64
 ... Whereas the maximum possible value for the checksum of a 512 block is (256 × 512) = 131,072
-(def: end_of_archive_block_parser
+(def end_of_archive_block_parser
   (Parser Any)
   (do <>.monad
     [block (.segment ..block_size)]
@@ -861,7 +861,7 @@
 
 (exception: .public invalid_end_of_archive)
 
-(def: end_of_archive_parser
+(def end_of_archive_parser
   (Parser Any)
   (do <>.monad
     [_ (<>.at_most 2 end_of_archive_block_parser)
@@ -870,7 +870,7 @@
      (exception.assertion ..invalid_end_of_archive []
                           done?))))
 
-(def: .public parser
+(def .public parser
   (Parser Tar)
   (|> (<>.some ..entry_parser)
       (at <>.monad each sequence.of_list)
diff --git a/stdlib/source/library/lux/data/format/xml.lux b/stdlib/source/library/lux/data/format/xml.lux
index ff08ad834..41ec13be0 100644
--- a/stdlib/source/library/lux/data/format/xml.lux
+++ b/stdlib/source/library/lux/data/format/xml.lux
@@ -31,7 +31,7 @@
 (type: .public Attrs
   (Dictionary Attribute Text))
 
-(def: .public attributes
+(def .public attributes
   Attrs
   (dictionary.empty symbol.hash))
 
@@ -41,10 +41,10 @@
      {#Text Text}
      {#Node Tag Attrs (List XML)})))
 
-(def: namespace_separator
+(def namespace_separator
   ":")
 
-(def: xml_standard_escape_char^
+(def xml_standard_escape_char^
   (Parser Text)
   (all <>.either
        (<>.after (.this "<") (<>#in "<"))
@@ -54,7 +54,7 @@
        (<>.after (.this """) (<>#in text.double_quote))
        ))
 
-(def: xml_unicode_escape_char^
+(def xml_unicode_escape_char^
   (Parser Text)
   (|> (do [! <>.monad]
         [hex? (<>.maybe (.this "x"))]
@@ -71,17 +71,17 @@
       (<>.before (.this ";"))
       (<>.after (.this "&#"))))
 
-(def: xml_escape_char^
+(def xml_escape_char^
   (Parser Text)
   (<>.either xml_standard_escape_char^
              xml_unicode_escape_char^))
 
-(def: xml_char^
+(def xml_char^
   (Parser Text)
   (<>.either (.none_of (all text#composite "<>&" text.double_quote))
              xml_escape_char^))
 
-(def: xml_identifier
+(def xml_identifier
   (Parser Text)
   (.slice
    (all .and!
@@ -90,7 +90,7 @@
         (.some! (<>.either (.one_of! "_.-")
                                  .alpha_num!)))))
 
-(def: namespaced_symbol^
+(def namespaced_symbol^
   (Parser Symbol)
   (do <>.monad
     [first_part xml_identifier
@@ -102,22 +102,22 @@
       {.#Some second_part}
       (in [first_part second_part]))))
 
-(def: tag^ namespaced_symbol^)
-(def: attr_name^ namespaced_symbol^)
+(def tag^ namespaced_symbol^)
+(def attr_name^ namespaced_symbol^)
 
-(def: spaced^
+(def spaced^
   (All (_ a) (-> (Parser a) (Parser a)))
   (let [white_space^ (<>.some .space)]
     (|>> (<>.before white_space^)
          (<>.after white_space^))))
 
-(def: attr_value^
+(def attr_value^
   (Parser Text)
   (let [value^ (.some xml_char^)]
     (<>.either (.enclosed [text.double_quote text.double_quote] value^)
                (.enclosed ["'" "'"] value^))))
 
-(def: attrs^
+(def attrs^
   (Parser Attrs)
   (<| (at <>.monad each (dictionary.of_list symbol.hash))
       <>.some
@@ -125,7 +125,7 @@
       (<>.after (.this "="))
       (..spaced^ attr_value^)))
 
-(def: (close_tag^ expected)
+(def (close_tag^ expected)
   (-> Tag (Parser []))
   (do <>.monad
     [actual (|> tag^
@@ -137,21 +137,21 @@
                        "  Actual: " (symbol#encoded actual) \n)
                   (symbol#= expected actual))))
 
-(def: comment^
+(def comment^
   (Parser Slice)
   (|> (.not! (.this "--"))
       .some!
       (.enclosed [""])
       ..spaced^))
 
-(def: xml_header^
+(def xml_header^
   (Parser Attrs)
   (|> (..spaced^ attrs^)
       (<>.before (.this "?>"))
       (<>.after (.this ".this "]]>")]
     (|> (.some! (.not! end))
@@ -159,17 +159,17 @@
         (<>.after (.this " (..spaced^ (.many xml_char^))
       (<>.either (.slice cdata^))
       (<>#each (|>> {#Text}))))
 
-(def: null^
+(def null^
   (Parser Any)
   (.this (text.of_char 0)))
 
-(def: xml^
+(def xml^
   (Parser XML)
   (|> (<>.rec
        (function (_ node^)
@@ -202,7 +202,7 @@
       (<>.before (<>.some ..null^))
       (<>.after (<>.maybe ..xml_header^))))
 
-(def: (sanitize_value input)
+(def (sanitize_value input)
   (-> Text Text)
   (|> input
       (text.replaced "&" "&")
@@ -211,17 +211,17 @@
       (text.replaced "'" "'")
       (text.replaced text.double_quote """)))
 
-(def: .public (tag [namespace name])
+(def .public (tag [namespace name])
   (-> Tag Text)
   (case namespace
     "" name
     _ (all text#composite namespace ..namespace_separator name)))
 
-(def: .public attribute
+(def .public attribute
   (-> Attribute Text)
   ..tag)
 
-(def: xml_header
+(def xml_header
   Text
   (let [quote (is (-> Text Text)
                   (function (_ value)
@@ -232,10 +232,10 @@
          " encoding=" (quote "UTF-8")
          "?>")))
 
-(def: .public codec
+(def .public codec
   (Codec Text XML)
   (implementation
-   (def: encoded
+   (def encoded
      (let [attributes (is (-> Attrs Text)
                           (function (_ attrs)
                             (|> attrs
@@ -275,13 +275,13 @@
                                text.together)
                            text.new_line prefix "")))))
               ))))
-   (def: decoded
+   (def decoded
      (.result ..xml^))))
 
-(def: .public equivalence
+(def .public equivalence
   (Equivalence XML)
   (implementation
-   (def: (= reference sample)
+   (def (= reference sample)
      (case [reference sample]
        [{#Text reference/value} {#Text sample/value}]
        (text#= reference/value sample/value)
diff --git a/stdlib/source/library/lux/data/identity.lux b/stdlib/source/library/lux/data/identity.lux
index 55e942681..30d890dff 100644
--- a/stdlib/source/library/lux/data/identity.lux
+++ b/stdlib/source/library/lux/data/identity.lux
@@ -12,28 +12,28 @@
 (type: .public (Identity a)
   a)
 
-(def: .public functor
+(def .public functor
   (Functor Identity)
   (implementation
-   (def: each function.identity)))
+   (def each function.identity)))
 
-(def: .public apply
+(def .public apply
   (Apply Identity)
   (implementation
-   (def: functor ..functor)
-   (def: (on fa ff)
+   (def functor ..functor)
+   (def (on fa ff)
      (ff fa))))
 
-(def: .public monad
+(def .public monad
   (Monad Identity)
   (implementation
-   (def: functor ..functor)
-   (def: in function.identity)
-   (def: conjoint function.identity)))
+   (def functor ..functor)
+   (def in function.identity)
+   (def conjoint function.identity)))
 
-(def: .public comonad
+(def .public comonad
   (CoMonad Identity)
   (implementation
-   (def: functor ..functor)
-   (def: out function.identity)
-   (def: disjoint function.identity)))
+   (def functor ..functor)
+   (def out function.identity)
+   (def disjoint function.identity)))
diff --git a/stdlib/source/library/lux/data/product.lux b/stdlib/source/library/lux/data/product.lux
index 02caab668..6e8767e04 100644
--- a/stdlib/source/library/lux/data/product.lux
+++ b/stdlib/source/library/lux/data/product.lux
@@ -6,7 +6,7 @@
     [hash (.only Hash)]]]])
 
 (with_template []
-  [(def: .public ( [left right])
+  [(def .public ( [left right])
      (All (_ left right)
        (-> [left right] ))
      )]
@@ -16,14 +16,14 @@
   )
 
 ... https://en.wikipedia.org/wiki/Currying
-(def: .public (curried f)
+(def .public (curried f)
   (All (_ a b c)
     (-> (-> [a b] c)
         (-> a b c)))
   (function (_ x y)
     (f [x y])))
 
-(def: .public (uncurried f)
+(def .public (uncurried f)
   (All (_ a b c)
     (-> (-> a b c)
         (-> [a b] c)))
@@ -31,38 +31,38 @@
     (let [[x y] xy]
       (f x y))))
 
-(def: .public (swapped [left right])
+(def .public (swapped [left right])
   (All (_ left right) (-> [left right] [right left]))
   [right left])
 
-(def: .public (then f g)
+(def .public (then f g)
   (All (_ a b c d)
     (-> (-> a c) (-> b d)
         (-> [a b] [c d])))
   (function (_ [x y])
     [(f x) (g y)]))
 
-(def: .public (forked f g)
+(def .public (forked f g)
   (All (_ a l r)
     (-> (-> a l) (-> a r)
         (-> a [l r])))
   (function (_ x)
     [(f x) (g x)]))
 
-(def: .public (equivalence left right)
+(def .public (equivalence left right)
   (All (_ l r) (-> (Equivalence l) (Equivalence r) (Equivalence [l r])))
   (implementation
-   (def: (= [rl rr] [sl sr])
+   (def (= [rl rr] [sl sr])
      (and (at left = rl sl)
           (at right = rr sr)))))
 
-(def: .public (hash left right)
+(def .public (hash left right)
   (All (_ l r) (-> (Hash l) (Hash r) (Hash [l r])))
   (implementation
-   (def: equivalence
+   (def equivalence
      (..equivalence (at left equivalence)
                     (at right equivalence)))
-   (def: (hash [leftV rightV])
+   (def (hash [leftV rightV])
      ("lux i64 +"
       (at left hash leftV)
       (at right hash rightV)))))
diff --git a/stdlib/source/library/lux/data/store.lux b/stdlib/source/library/lux/data/store.lux
index c5b82a4c5..8e4c0746d 100644
--- a/stdlib/source/library/lux/data/store.lux
+++ b/stdlib/source/library/lux/data/store.lux
@@ -12,43 +12,43 @@
    [#cursor s
     #peek (-> s a)]))
 
-(def: (extend f wa)
+(def (extend f wa)
   (All (_ s a b) (-> (-> (Store s a) b) (Store s a) (Store s b)))
   [#cursor (the #cursor wa)
    #peek (function (_ s) (f (has #cursor s wa)))])
 
-(def: .public functor
+(def .public functor
   (All (_ s) (Functor (Store s)))
   (implementation
-   (def: (each f fa)
+   (def (each f fa)
      (extend (function (_ store)
                (f (at store peek (at store cursor))))
              fa))))
 
-(def: .public comonad
+(def .public comonad
   (All (_ s) (CoMonad (Store s)))
   (implementation
-   (def: functor
+   (def functor
      ..functor)
 
-   (def: (out wa)
+   (def (out wa)
      (a/an peek (a/an cursor)))
 
-   (def: disjoint
+   (def disjoint
      (extend id))))
 
-(def: .public (peeks trans store)
+(def .public (peeks trans store)
   (All (_ s a) (-> (-> s s) (Store s a) a))
   (|> (a/an cursor) trans (a/an peek)))
 
-(def: .public (seek cursor store)
+(def .public (seek cursor store)
   (All (_ s a) (-> s (Store s a) (Store s a)))
   (at (a/an disjoint store) peek cursor))
 
-(def: .public (seeks change store)
+(def .public (seeks change store)
   (All (_ s a) (-> (-> s s) (Store s a) (Store s a)))
   (|> store (a/an disjoint) (peeks change)))
 
-(def: .public (experiment Functor change store)
+(def .public (experiment Functor change store)
   (All (_ f s a) (-> (Functor f) (-> s (f s)) (Store s a) (f a)))
   (at Functor each (a/an peek) (change (a/an cursor))))
diff --git a/stdlib/source/library/lux/data/sum.lux b/stdlib/source/library/lux/data/sum.lux
index 00dddc0e6..ce03e75d6 100644
--- a/stdlib/source/library/lux/data/sum.lux
+++ b/stdlib/source/library/lux/data/sum.lux
@@ -6,7 +6,7 @@
     [hash (.only Hash)]]]])
 
 (with_template [ ]
-  [(def: .public ( value)
+  [(def .public ( value)
      (All (_ left right)
        (->  (Or left right)))
      {0  value})]
@@ -14,7 +14,7 @@
   [#0 left]
   [#1 right])
 
-(def: .public (either on_left on_right)
+(def .public (either on_left on_right)
   (All (_ a b c)
     (-> (-> a c) (-> b c)
         (-> (Or a b) c)))
@@ -23,7 +23,7 @@
       {0 #0 l} (on_left l)
       {0 #1 r} (on_right r))))
 
-(def: .public (then on_left on_right)
+(def .public (then on_left on_right)
   (All (_ l l' r r')
     (-> (-> l l') (-> r r')
         (-> (Or l r) (Or l' r'))))
@@ -33,7 +33,7 @@
       {0 #1 r} {0 #1 (on_right r)})))
 
 (with_template [  ]
-  [(def: .public ( items)
+  [(def .public ( items)
      (All (_ a b) (-> (List (Or a b)) (List )))
      (case items
        {.#End}
@@ -49,7 +49,7 @@
   [rights b #1]
   )
 
-(def: .public (partition xs)
+(def .public (partition xs)
   (All (_ a b) (-> (List (Or a b)) [(List a) (List b)]))
   (case xs
     {.#End}
@@ -61,10 +61,10 @@
         {0 #0 x'}  [{.#Item x' lefts} rights]
         {0 #1 x'} [lefts {.#Item x' rights}]))))
 
-(def: .public (equivalence left right)
+(def .public (equivalence left right)
   (All (_ l r) (-> (Equivalence l) (Equivalence r) (Equivalence (Or l r))))
   (implementation
-   (def: (= reference sample)
+   (def (= reference sample)
      (case [reference sample]
        [{.#Left reference} {.#Left sample}]
        (at left = reference sample)
@@ -75,13 +75,13 @@
        _
        false))))
 
-(def: .public (hash left right)
+(def .public (hash left right)
   (All (_ l r) (-> (Hash l) (Hash r) (Hash (Or l r))))
   (implementation
-   (def: equivalence
+   (def equivalence
      (..equivalence (at left equivalence)
                     (at right equivalence)))
-   (def: (hash value)
+   (def (hash value)
      (.nat (case value
              {.#Left value}
              ("lux i64 *" +2 (.int (at left hash value)))
diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux
index 918fde82a..9c2649f55 100644
--- a/stdlib/source/library/lux/data/text.lux
+++ b/stdlib/source/library/lux/data/text.lux
@@ -26,13 +26,13 @@
 
 ... TODO: Instead of ints, chars should be produced fron nats.
 ... (The JVM specifies chars as 16-bit unsigned integers)
-(def: .public of_char
+(def .public of_char
   (-> Char Text)
   (|>> .int "lux i64 char"))
 
 (with_template [  ]
-  [(def: .public  (..of_char ))
-   (def: .public  )]
+  [(def .public  (..of_char ))
+   (def .public  )]
 
   [00 \0  null]
   [07 \a  alarm]
@@ -45,28 +45,28 @@
   [34 \'' double_quote]
   )
 
-(def: .public line_feed
+(def .public line_feed
   ..new_line)
 
-(def: .public size
+(def .public size
   (-> Text Nat)
   (|>> "lux text size"))
 
-(def: .public (char index input)
+(def .public (char index input)
   (-> Nat Text (Maybe Char))
   (if (n.< ("lux text size" input) index)
     {.#Some ("lux text char" index input)}
     {.#None}))
 
-(def: .public (index_since offset pattern input)
+(def .public (index_since offset pattern input)
   (-> Nat Text Text (Maybe Nat))
   ("lux text index" offset pattern input))
 
-(def: .public (index pattern input)
+(def .public (index pattern input)
   (-> Text Text (Maybe Nat))
   (index_since 0 pattern input))
 
-(def: .public (last_index part text)
+(def .public (last_index part text)
   (-> Text Text (Maybe Nat))
   (loop (again [offset 0
                 output (is (Maybe Nat)
@@ -79,7 +79,7 @@
         {.#Some offset'}
         (again (++ offset') output')))))
 
-(def: .public (starts_with? prefix x)
+(def .public (starts_with? prefix x)
   (-> Text Text Bit)
   (case (index prefix x)
     {.#Some 0}
@@ -88,7 +88,7 @@
     _
     false))
 
-(def: .public (ends_with? postfix x)
+(def .public (ends_with? postfix x)
   (-> Text Text Bit)
   (case (last_index postfix x)
     {.#Some n}
@@ -98,12 +98,12 @@
     _
     false))
 
-(def: .public (enclosed_by? boundary value)
+(def .public (enclosed_by? boundary value)
   (-> Text Text Bit)
   (and (starts_with? boundary value)
        (ends_with? boundary value)))
 
-(def: .public (contains? sub text)
+(def .public (contains? sub text)
   (-> Text Text Bit)
   (case ("lux text index" 0 sub text)
     {.#Some _}
@@ -112,40 +112,40 @@
     _
     false))
 
-(def: .public (prefix param subject)
+(def .public (prefix param subject)
   (-> Text Text Text)
   ("lux text concat" param subject))
 
-(def: .public (suffix param subject)
+(def .public (suffix param subject)
   (-> Text Text Text)
   ("lux text concat" subject param))
 
-(def: .public (enclosed [left right] content)
+(def .public (enclosed [left right] content)
   (-> [Text Text] Text Text)
   (all "lux text concat" left content right))
 
-(def: .public (enclosed' boundary content)
+(def .public (enclosed' boundary content)
   (-> Text Text Text)
   (enclosed [boundary boundary] content))
 
-(def: .public format
+(def .public format
   (-> Text Text)
   (..enclosed' ..double_quote))
 
-(def: .public (clip offset size input)
+(def .public (clip offset size input)
   (-> Nat Nat Text (Maybe Text))
   (if (|> size (n.+ offset) (n.> ("lux text size" input)))
     {.#None}
     {.#Some ("lux text clip" offset size input)}))
 
-(def: .public (clip_since offset input)
+(def .public (clip_since offset input)
   (-> Nat Text (Maybe Text))
   (let [size ("lux text size" input)]
     (if (n.> size offset)
       {.#None}
       {.#Some ("lux text clip" offset (n.- offset size) input)})))
 
-(def: .public (split_at at x)
+(def .public (split_at at x)
   (-> Nat Text (Maybe [Text Text]))
   (case [(..clip 0 at x) (..clip_since at x)]
     [{.#Some pre} {.#Some post}]
@@ -154,7 +154,7 @@
     _
     {.#None}))
 
-(def: .public (split_by token sample)
+(def .public (split_by token sample)
   (-> Text Text (Maybe [Text Text]))
   (do maybe.monad
     [index (index token sample)
@@ -162,7 +162,7 @@
      [_ post] (split_at (size token) post')]
     (in [pre post])))
 
-(def: .public (all_split_by token sample)
+(def .public (all_split_by token sample)
   (-> Text Text (List Text))
   (loop (again [input sample
                 output (is (List Text) (list))])
@@ -177,14 +177,14 @@
           {.#Item input}
           list.reversed))))
 
-(def: .public (replaced_once pattern replacement template)
+(def .public (replaced_once pattern replacement template)
   (-> Text Text Text Text)
   (<| (maybe.else template)
       (do maybe.monad
         [[pre post] (..split_by pattern template)]
         (in (all "lux text concat" pre replacement post)))))
 
-(for @.js (these (def: defined?
+(for @.js (these (def defined?
                    (macro (_ tokens lux)
                      (case tokens
                        (pattern (list it))
@@ -197,7 +197,7 @@
 
                        _
                        {.#Left ""})))
-                 (def: if_nashorn
+                 (def if_nashorn
                    (macro (_ tokens lux)
                      (case tokens
                        (pattern (list then else))
@@ -211,7 +211,7 @@
                        {.#Left ""}))))
      (these))
 
-(def: .public (replaced pattern replacement template)
+(def .public (replaced pattern replacement template)
   (-> Text Text Text Text)
   (with_expansions [... Inefficient default
                      (loop (again [left ""
@@ -258,34 +258,34 @@
          ... Inefficient default
          )))
 
-(def: .public equivalence
+(def .public equivalence
   (Equivalence Text)
   (implementation
-   (def: (= reference sample)
+   (def (= reference sample)
      ("lux text =" reference sample))))
 
-(def: .public order
+(def .public order
   (Order Text)
   (implementation
-   (def: equivalence ..equivalence)
+   (def equivalence ..equivalence)
 
-   (def: (< reference sample)
+   (def (< reference sample)
      ("lux text <" reference sample))))
 
-(def: .public monoid
+(def .public monoid
   (Monoid Text)
   (implementation
-   (def: identity "")
+   (def identity "")
    
-   (def: (composite left right)
+   (def (composite left right)
      ("lux text concat" left right))))
 
-(def: .public hash
+(def .public hash
   (Hash Text)
   (implementation
-   (def: equivalence ..equivalence)
+   (def equivalence ..equivalence)
    
-   (def: (hash input)
+   (def (hash input)
      (for @.old
           (|> input
               (is (Primitive "java.lang.Object"))
@@ -313,29 +313,29 @@
                            (n.+ ("lux text char" index input))))
                 hash)))))))
 
-(def: .public together
+(def .public together
   (-> (List Text) Text)
   (let [(^.open "[0]") ..monoid]
     (|>> list.reversed
          (list#mix composite identity))))
 
-(def: .public (interposed separator texts)
+(def .public (interposed separator texts)
   (-> Text (List Text) Text)
   (case separator
     "" (..together texts)
     _ (|> texts (list.interposed separator) ..together)))
 
-(def: .public (empty? text)
+(def .public (empty? text)
   (-> Text Bit)
   (case text
     "" true
     _  false))
 
-(def: .public space
+(def .public space
   Text
   " ")
 
-(def: .public (space? char)
+(def .public (space? char)
   (-> Char Bit)
   (with_expansions [ (with_template []
                                 [(pattern (.char (~~ (static ))))]
@@ -354,7 +354,7 @@
           _
           false))))
 
-(def: .public (lower_cased value)
+(def .public (lower_cased value)
   (-> Text Text)
   (for @.old
        (as Text
@@ -377,7 +377,7 @@
        (as Text
            ("ruby object do" "downcase" value []))))
 
-(def: .public (upper_cased value)
+(def .public (upper_cased value)
   (-> Text Text)
   (for @.old
        (as Text
diff --git a/stdlib/source/library/lux/data/text/buffer.lux b/stdlib/source/library/lux/data/text/buffer.lux
index a099758f5..82404b2dd 100644
--- a/stdlib/source/library/lux/data/text/buffer.lux
+++ b/stdlib/source/library/lux/data/text/buffer.lux
@@ -56,7 +56,7 @@
            ... default
            (Sequence Text))
 
-      (def: .public empty
+      (def .public empty
         Buffer
         (abstraction (with_expansions [ [0 function.identity]]
                        (for @.old 
@@ -66,7 +66,7 @@
                             ... default
                             sequence.empty))))
 
-      (def: .public (then chunk buffer)
+      (def .public (then chunk buffer)
         (-> Text Buffer Buffer)
         (with_expansions [ (let [[capacity transform] (representation buffer)
                                       then! (is (-> Text java/lang/StringBuilder java/lang/StringBuilder)
@@ -98,7 +98,7 @@
                ... default
                (|> buffer representation (sequence.suffix chunk) abstraction))))
 
-      (def: .public size
+      (def .public size
         (-> Buffer Nat)
         (with_expansions [ (|>> representation product.left)]
           (for @.old 
@@ -111,7 +111,7 @@
                                     (n.+ (//.size chunk) total))
                                   0)))))
 
-      (def: .public (text buffer)
+      (def .public (text buffer)
         (-> Buffer Text)
         (with_expansions [ (let [[capacity transform] (representation buffer)]
                                   (|> (java/lang/StringBuilder::new (ffi.as_int (.int capacity)))
diff --git a/stdlib/source/library/lux/data/text/encoding.lux b/stdlib/source/library/lux/data/text/encoding.lux
index 2863d9623..16a0a2891 100644
--- a/stdlib/source/library/lux/data/text/encoding.lux
+++ b/stdlib/source/library/lux/data/text/encoding.lux
@@ -11,7 +11,7 @@
   Text
 
   (with_template [ ]
-    [(`` (def: .public 
+    [(`` (def .public 
            Encoding
            (abstraction )))]
 
@@ -160,7 +160,7 @@
     [koi8_u "KOI8-U"]
     )
 
-  (def: .public name
+  (def .public name
     (-> Encoding Text)
     (|>> representation))
   )
diff --git a/stdlib/source/library/lux/data/text/encoding/utf8.lux b/stdlib/source/library/lux/data/text/encoding/utf8.lux
index a95d4f163..8c7e5ef26 100644
--- a/stdlib/source/library/lux/data/text/encoding/utf8.lux
+++ b/stdlib/source/library/lux/data/text/encoding/utf8.lux
@@ -55,7 +55,7 @@
        (these (ffi.import Almost_Binary)
               (ffi.import (unpack [ffi.String ffi.String] Almost_Binary))
               (ffi.import (array_values [Almost_Binary] Binary))
-              (def: php_byte_array_format "C*"))
+              (def php_byte_array_format "C*"))
 
        @.scheme
        ... https://srfi.schemers.org/srfi-140/srfi-140.html
@@ -63,7 +63,7 @@
               (ffi.import (utf8->string [Binary] Text)))
        (these)))
 
-(def: (encoded value)
+(def (encoded value)
   (-> Text Binary)
   (for @.old
        (java/lang/String::getBytes (ffi.as_string (//.name //.utf_8))
@@ -109,7 +109,7 @@
        @.scheme
        (..string->utf8 value)))
 
-(def: (decoded value)
+(def (decoded value)
   (-> Binary (Try Text))
   (with_expansions [ {try.#Success (ffi.of_string (java/lang/String::new value (ffi.as_string (//.name //.utf_8))))}]
     (for @.old 
@@ -155,8 +155,8 @@
              ..utf8->string
              {try.#Success}))))
 
-(def: .public codec
+(def .public codec
   (Codec Binary Text)
   (implementation
-   (def: encoded ..encoded)
-   (def: decoded ..decoded)))
+   (def encoded ..encoded)
+   (def decoded ..decoded)))
diff --git a/stdlib/source/library/lux/data/text/escape.lux b/stdlib/source/library/lux/data/text/escape.lux
index 258c5c3a9..f2c21a26e 100644
--- a/stdlib/source/library/lux/data/text/escape.lux
+++ b/stdlib/source/library/lux/data/text/escape.lux
@@ -20,10 +20,10 @@
  ["[0]" // (.only Char)
   ["%" \\format (.only format)]])
 
-(def: sigil "\")
+(def sigil "\")
 
 (with_template [ ]
-  [(def: 
+  [(def 
      (|>  (//.char 0) maybe.trusted))]
 
   [sigil_char ..sigil]
@@ -31,10 +31,10 @@
   )
 
 (with_template [  ]
-  [(def: 
+  [(def 
      (|>  (//.char 0) maybe.trusted))
    
-   (def: 
+   (def 
      (format ..sigil ))]
 
   ["0" \0_sigil escaped_\0]
@@ -50,7 +50,7 @@
   )
 
 (with_template [ ]
-  [(def: 
+  [(def 
      (|>  (//.char 0) maybe.trusted))]
 
   [\0 //.\0]
@@ -65,10 +65,10 @@
   [\\ ..sigil]
   )
 
-(def: ascii_bottom (hex "20"))
-(def: ascii_top (hex "7E"))
+(def ascii_bottom (hex "20"))
+(def ascii_top (hex "7E"))
 
-(def: .public (escapable? char)
+(def .public (escapable? char)
   (-> Char Bit)
   (or (n.< ..ascii_bottom char)
       (n.> ..ascii_top char)
@@ -83,7 +83,7 @@
         _
         false)))
 
-(def: (ascii_escaped replacement pre_offset pre_limit previous current)
+(def (ascii_escaped replacement pre_offset pre_limit previous current)
   (-> Text Nat Nat Text Text [Text Text Nat])
   (let [post_offset (++ pre_offset)
         post_limit (n.- post_offset pre_limit)]
@@ -93,7 +93,7 @@
      ("lux text clip" post_offset post_limit current)
      post_limit]))
 
-(def: (unicode_escaped char pre_offset pre_limit previous current)
+(def (unicode_escaped char pre_offset pre_limit previous current)
   (-> Char Nat Nat Text Text [Text Text Nat])
   (let [code (at n.hex encoded char)
         replacement (format ..sigil "u"
@@ -110,7 +110,7 @@
      ("lux text clip" post_offset post_limit current)
      post_limit]))
 
-(def: .public (escaped text)
+(def .public (escaped text)
   (-> Text Text)
   (loop (again [offset 0
                 previous ""
@@ -160,16 +160,16 @@
    "In" (%.text text)
    "At" (%.nat offset)))
 
-(def: code_size
+(def code_size
   4)
 
-(def: ascii_escape_offset
+(def ascii_escape_offset
   2)
 
-(def: unicode_escape_offset
+(def unicode_escape_offset
   (n.+ ..ascii_escape_offset ..code_size))
 
-(def: (ascii_un_escaped replacement offset previous current limit)
+(def (ascii_un_escaped replacement offset previous current limit)
   (-> Text Nat Text Text Nat [Text Text Nat])
   (let [limit' (|> limit (n.- offset) (n.- ..ascii_escape_offset))]
     [(format previous
@@ -178,7 +178,7 @@
      ("lux text clip" (n.+ ..ascii_escape_offset offset) limit' current)
      limit']))
 
-(def: (unicode_un_escaped offset previous current limit)
+(def (unicode_un_escaped offset previous current limit)
   (-> Nat Text Text Nat (Try [Text Text Nat]))
   (case (|> current
             ("lux text clip" (n.+ ..ascii_escape_offset offset) ..code_size)
@@ -194,7 +194,7 @@
     {try.#Failure error}
     (exception.except ..invalid_unicode_escape [current offset])))
 
-(def: .public (un_escaped text)
+(def .public (un_escaped text)
   (-> Text (Try Text))
   (loop (again [offset 0
                 previous ""
@@ -239,7 +239,7 @@
                       "" current
                       _ (format previous current))})))
 
-(def: .public literal
+(def .public literal
   (syntax (_ [literal .text])
     (case (..un_escaped literal)
       {try.#Success un_escaped}
diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux
index 34ce70739..6648375ba 100644
--- a/stdlib/source/library/lux/data/text/regex.lux
+++ b/stdlib/source/library/lux/data/text/regex.lux
@@ -26,11 +26,11 @@
  ["[0]" // (.only)
   ["%" \\format (.only format)]])
 
-(def: regex_char^
+(def regex_char^
   (Parser Text)
   (.none_of "\.|&()[]{}"))
 
-(def: escaped_char^
+(def escaped_char^
   (Parser Text)
   (do <>.monad
     [? (<>.parses? (.this "\"))]
@@ -38,31 +38,31 @@
       .any
       regex_char^)))
 
-(def: (refine^ refinement^ base^)
+(def (refine^ refinement^ base^)
   (All (_ a) (-> (Parser a) (Parser Text) (Parser Text)))
   (do <>.monad
     [output base^
      _ (.local output refinement^)]
     (in output)))
 
-(def: word^
+(def word^
   (Parser Text)
   (<>.either .alpha_num
              (.one_of "_")))
 
-(def: (copy reference)
+(def (copy reference)
   (-> Text (Parser Text))
   (<>.after (.this reference) (<>#in reference)))
 
-(def: together^
+(def together^
   (-> (Parser (List Text)) (Parser Text))
   (at <>.monad each //.together))
 
-(def: symbol_char^
+(def symbol_char^
   (Parser Text)
   (.none_of (format "[]{}()s.<>" //.double_quote)))
 
-(def: symbol_part^
+(def symbol_part^
   (Parser Text)
   (do <>.monad
     [head (refine^ (.not .decimal)
@@ -70,7 +70,7 @@
      tail (.some symbol_char^)]
     (in (format head tail))))
 
-(def: (symbol^ current_module)
+(def (symbol^ current_module)
   (-> Text (Parser Symbol))
   (all <>.either
        (<>.and (<>#in current_module) (<>.after (.this "..") symbol_part^))
@@ -78,13 +78,13 @@
        (<>.and (<>#in .prelude) (<>.after (.this ".") symbol_part^))
        (<>.and (<>#in "") symbol_part^)))
 
-(def: (re_var^ current_module)
+(def (re_var^ current_module)
   (-> Text (Parser Code))
   (do <>.monad
     [symbol (.enclosed ["\@<" ">"] (symbol^ current_module))]
     (in (` (is ((~! .Parser) Text) (~ (code.symbol symbol)))))))
 
-(def: re_range^
+(def re_range^
   (Parser Code)
   (do [! <>.monad]
     [from (|> regex_char^ (at ! each (|>> (//.char 0) maybe.trusted)))
@@ -92,19 +92,19 @@
      to (|> regex_char^ (at ! each (|>> (//.char 0) maybe.trusted)))]
     (in (` ((~! .range) (~ (code.nat from)) (~ (code.nat to)))))))
 
-(def: re_char^
+(def re_char^
   (Parser Code)
   (do <>.monad
     [char escaped_char^]
     (in (` ((~! ..copy) (~ (code.text char)))))))
 
-(def: re_options^
+(def re_options^
   (Parser Code)
   (do <>.monad
     [options (.many escaped_char^)]
     (in (` ((~! .one_of) (~ (code.text options)))))))
 
-(def: re_user_class^'
+(def re_user_class^'
   (Parser Code)
   (do <>.monad
     [negate? (<>.maybe (.this "^"))
@@ -115,7 +115,7 @@
           {.#Some _} (` ((~! .not) (all ((~! <>.either)) (~+ parts))))
           {.#None}   (` (all ((~! <>.either)) (~+ parts)))))))
 
-(def: re_user_class^
+(def re_user_class^
   (Parser Code)
   (do <>.monad
     [init ..re_user_class^'
@@ -127,34 +127,34 @@
                   init
                   rest))))
 
-(def: blank^
+(def blank^
   (Parser Text)
   (.one_of (format " " //.tab)))
 
-(def: ascii^
+(def ascii^
   (Parser Text)
   (.range (hex "0") (hex "7F")))
 
-(def: control^
+(def control^
   (Parser Text)
   (<>.either (.range (hex "0") (hex "1F"))
              (.one_of (//.of_char (hex "7F")))))
 
-(def: punct^
+(def punct^
   (Parser Text)
   (.one_of (format "!#$%&'()*+,-./:;<=>?@[\]^_`{|}~"
                          //.double_quote)))
 
-(def: graph^
+(def graph^
   (Parser Text)
   (<>.either punct^ .alpha_num))
 
-(def: print^
+(def print^
   (Parser Text)
   (<>.either graph^
              (.one_of (//.of_char (hex "20")))))
 
-(def: re_system_class^
+(def re_system_class^
   (Parser Code)
   (do <>.monad
     []
@@ -183,17 +183,17 @@
          (<>.after (.this "\p{Print}") (in (` (~! print^))))
          )))
 
-(def: re_class^
+(def re_class^
   (Parser Code)
   (<>.either re_system_class^
              (.enclosed ["[" "]"] re_user_class^)))
 
-(def: number^
+(def number^
   (Parser Nat)
   (|> (.many .decimal)
       (<>.codec n.decimal)))
 
-(def: re_back_reference^
+(def re_back_reference^
   (Parser Code)
   (<>.either (do <>.monad
                [_ (.this "\")
@@ -205,7 +205,7 @@
                 _ (.this ">")]
                (in (` ((~! ..copy) (~ (code.symbol ["" captured_symbol]))))))))
 
-(def: (re_simple^ current_module)
+(def (re_simple^ current_module)
   (-> Text (Parser Code))
   (all <>.either
        re_class^
@@ -214,7 +214,7 @@
        re_char^
        ))
 
-(def: (re_simple_quantified^ current_module)
+(def (re_simple_quantified^ current_module)
   (-> Text (Parser Code))
   (do <>.monad
     [base (re_simple^ current_module)
@@ -237,7 +237,7 @@
    "Input" (format (%.nat from) "," (%.nat to))
    "Should be" (format (%.nat to) "," (%.nat from))))
 
-(def: (re_counted_quantified^ current_module)
+(def (re_counted_quantified^ current_module)
   (-> Text (Parser Code))
   (do [! <>.monad]
     [base (re_simple^ current_module)]
@@ -261,12 +261,12 @@
                [limit number^]
                (in (` ((~! together^) ((~! <>.exactly) (~ (code.nat limit)) (~ base))))))))))
 
-(def: (re_quantified^ current_module)
+(def (re_quantified^ current_module)
   (-> Text (Parser Code))
   (<>.either (re_simple_quantified^ current_module)
              (re_counted_quantified^ current_module)))
 
-(def: (re_complex^ current_module)
+(def (re_complex^ current_module)
   (-> Text (Parser Code))
   (all <>.either
        (re_quantified^ current_module)
@@ -277,7 +277,7 @@
    {#Non_Capturing}
    {#Capturing [(Maybe Text) Nat]}))
 
-(def: (re_sequential^ capturing? re_scoped^ current_module)
+(def (re_sequential^ capturing? re_scoped^ current_module)
   (-> Bit
       (-> Text (Parser [Re_Group Code]))
       Text
@@ -329,11 +329,11 @@
              ((~ (' in)) [(~ g!total) (~+ (list.reversed names))])))])
     ))
 
-(def: (unflatten^ lexer)
+(def (unflatten^ lexer)
   (-> (Parser Text) (Parser [Text Any]))
   (<>.and lexer (at <>.monad in [])))
 
-(def: (|||^ left right)
+(def (|||^ left right)
   (All (_ l r) (-> (Parser [Text l]) (Parser [Text r]) (Parser [Text (Or l r)])))
   (function (_ input)
     (case (left input)
@@ -348,7 +348,7 @@
         {try.#Failure error}
         {try.#Failure error}))))
 
-(def: (|||_^ left right)
+(def (|||_^ left right)
   (All (_ l r) (-> (Parser [Text l]) (Parser [Text r]) (Parser Text)))
   (function (_ input)
     (case (left input)
@@ -363,13 +363,13 @@
         {try.#Failure error}
         {try.#Failure error}))))
 
-(def: (prep_alternative [num_captures alt])
+(def (prep_alternative [num_captures alt])
   (-> [Nat Code] Code)
   (if (n.> 0 num_captures)
     alt
     (` ((~! unflatten^) (~ alt)))))
 
-(def: (re_alternative^ capturing? re_scoped^ current_module)
+(def (re_alternative^ capturing? re_scoped^ current_module)
   (-> Bit
       (-> Text (Parser [Re_Group Code]))
       Text
@@ -387,7 +387,7 @@
                    (~ (prep_alternative head))
                    (~+ (list#each prep_alternative tail))))]))))
 
-(def: (re_scoped^ current_module)
+(def (re_scoped^ current_module)
   (-> Text (Parser [Re_Group Code]))
   (all <>.either
        (do <>.monad
@@ -411,11 +411,11 @@
           _ (.this ")")]
          (in [{#Capturing [{.#None} num_captures]} pattern]))))
 
-(def: (regex^ current_module)
+(def (regex^ current_module)
   (-> Text (Parser Code))
   (at <>.monad each product.right (re_alternative^ #1 re_scoped^ current_module)))
 
-(def: .public regex
+(def .public regex
   (syntax (_ [pattern .text])
     (do meta.monad
       [current_module meta.current_module_name]
@@ -428,7 +428,7 @@
         {try.#Success regex}
         (in (list regex))))))
 
-(def: .public pattern
+(def .public pattern
   (syntax (_ [[pattern bindings] (.form (<>.and .text (<>.maybe .any)))
               body .any
               branches (<>.many .any)])
diff --git a/stdlib/source/library/lux/data/text/unicode/block.lux b/stdlib/source/library/lux/data/text/unicode/block.lux
index 7f3eeb32d..db55002a9 100644
--- a/stdlib/source/library/lux/data/text/unicode/block.lux
+++ b/stdlib/source/library/lux/data/text/unicode/block.lux
@@ -17,14 +17,14 @@
 (primitive .public Block
   (Interval Char)
   
-  (def: .public monoid
+  (def .public monoid
     (Monoid Block)
     (implementation
-     (def: identity
+     (def identity
        (abstraction
         (interval.between n.enum n#top n#bottom)))
      
-     (def: (composite left right)
+     (def (composite left right)
        (let [left (representation left)
              right (representation right)]
          (abstraction
@@ -34,12 +34,12 @@
                             (n.max (at left top)
                                    (at right top))))))))
 
-  (def: .public (block start additional)
+  (def .public (block start additional)
     (-> Char Nat Block)
     (abstraction (interval.between n.enum start (n.+ additional start))))
 
   (with_template [ ]
-    [(def: .public 
+    [(def .public 
        (-> Block Char)
        (|>> representation (the )))]
 
@@ -47,34 +47,34 @@
     [end   interval.top]
     )
 
-  (def: .public (size block)
+  (def .public (size block)
     (-> Block Nat)
     (let [start (the interval.bottom (representation block))
           end (the interval.top (representation block))]
       (|> end (n.- start) ++)))
 
-  (def: .public (within? block char)
+  (def .public (within? block char)
     (All (_ a) (-> Block Char Bit))
     (interval.within? (representation block) char))
   )
 
-(def: .public equivalence
+(def .public equivalence
   (Equivalence Block)
   (implementation
-   (def: (= reference subject)
+   (def (= reference subject)
      (and (n.= (..start reference) (..start subject))
           (n.= (..end reference) (..end subject))))))
 
-(def: .public hash
+(def .public hash
   (Hash Block)
   (implementation
-   (def: equivalence ..equivalence)
-   (def: (hash value)
+   (def equivalence ..equivalence)
+   (def (hash value)
      (i64.or (i64.left_shifted 32 (..start value))
              (..end value)))))
 
 (with_template [  ]
-  [(def: .public 
+  [(def .public 
      Block
      (let [start (hex )
            end (hex )]
diff --git a/stdlib/source/library/lux/data/text/unicode/set.lux b/stdlib/source/library/lux/data/text/unicode/set.lux
index 287c78ca0..1abe5427f 100644
--- a/stdlib/source/library/lux/data/text/unicode/set.lux
+++ b/stdlib/source/library/lux/data/text/unicode/set.lux
@@ -16,10 +16,10 @@
    [// (.only Char)]
    ["[1][0]" block (.only Block)]]])
 
-(def: builder
+(def builder
   (tree.builder //block.monoid))
 
-(def: :@:
+(def :@:
   (by_example [@]
     (is (tree.Builder @ Block)
         ..builder)
@@ -29,19 +29,19 @@
 (primitive .public Set
   (Tree :@: Block [])
 
-  (def: .public (composite left right)
+  (def .public (composite left right)
     (-> Set Set Set)
     (abstraction
      (at builder branch
          (representation left)
          (representation right))))
 
-  (def: (singleton block)
+  (def (singleton block)
     (-> Block Set)
     (abstraction
      (at builder leaf block [])))
 
-  (def: .public (set [head tail])
+  (def .public (set [head tail])
     (-> [Block (List Block)] Set)
     (list#mix (is (-> Block Set Set)
                   (function (_ block set)
@@ -49,7 +49,7 @@
               (..singleton head)
               tail))
 
-  (def: character/0
+  (def character/0
     Set
     (..set [//block.basic_latin
             (list //block.latin_1_supplement
@@ -82,7 +82,7 @@
                   //block.myanmar
                   //block.georgian)]))
 
-  (def: character/1
+  (def character/1
     Set
     (..set [//block.hangul_jamo
             (list //block.ethiopic
@@ -116,7 +116,7 @@
                   //block.enclosed_alphanumerics
                   //block.box_drawing)]))
 
-  (def: character/2
+  (def character/2
     Set
     (..set [//block.block_elements
             (list //block.geometric_shapes
@@ -150,7 +150,7 @@
                   //block.hangul_syllables
                   )]))
 
-  (def: .public character
+  (def .public character
     Set
     (all ..composite
          ..character/0
@@ -158,7 +158,7 @@
          ..character/2
          ))
 
-  (def: .public non_character
+  (def .public non_character
     Set
     (..set [//block.high_surrogates
             (list  //block.high_private_use_surrogates
@@ -193,26 +193,26 @@
                    ... //block.tags
                    )]))
 
-  (def: .public full
+  (def .public full
     Set
     (all ..composite
          ..character
          ..non_character
          ))
 
-  (def: .public start
+  (def .public start
     (-> Set Char)
     (|>> representation
          tree.tag
          //block.start))
 
-  (def: .public end
+  (def .public end
     (-> Set Char)
     (|>> representation
          tree.tag
          //block.end))
 
-  (def: .public (member? set character)
+  (def .public (member? set character)
     (-> Set Char Bit)
     (loop (again [tree (representation set)])
       (if (//block.within? (tree.tag tree) character)
@@ -225,16 +225,16 @@
               (again right)))
         false)))
 
-  (def: .public equivalence
+  (def .public equivalence
     (Equivalence Set)
     (implementation
-     (def: (= reference subject)
+     (def (= reference subject)
        (set#= (set.of_list //block.hash (tree.tags (representation reference)))
               (set.of_list //block.hash (tree.tags (representation subject)))))))
   )
 
 (with_template [ ]
-  [(def: .public 
+  [(def .public 
      Set
      (..set ))]
 
diff --git a/stdlib/source/library/lux/data/trace.lux b/stdlib/source/library/lux/data/trace.lux
index cc92f72ac..87032785f 100644
--- a/stdlib/source/library/lux/data/trace.lux
+++ b/stdlib/source/library/lux/data/trace.lux
@@ -12,22 +12,22 @@
    [#monoid (Monoid t)
     #trace (-> t a)]))
 
-(def: .public functor
+(def .public functor
   (All (_ t) (Functor (Trace t)))
   (implementation
-   (def: (each f fa)
+   (def (each f fa)
      (revised #trace (composite f) fa))))
 
-(def: .public comonad
+(def .public comonad
   (All (_ t) (CoMonad (Trace t)))
   (implementation
-   (def: functor ..functor)
+   (def functor ..functor)
 
-   (def: (out wa)
+   (def (out wa)
      ((the #trace wa)
       (the [#monoid monoid.#identity] wa)))
 
-   (def: (disjoint wa)
+   (def (disjoint wa)
      (let [monoid (the #monoid wa)]
        [#monoid monoid
         #trace (function (_ t1)
@@ -36,6 +36,6 @@
                            ((the #trace wa)
                             (at monoid composite t1 t2)))])]))))
 
-(def: .public (result context tracer)
+(def .public (result context tracer)
   (All (_ t a) (-> t (Trace t a) a))
   (at tracer trace context))
diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux
index 5aa890145..a4cbd9b25 100644
--- a/stdlib/source/library/lux/debug.lux
+++ b/stdlib/source/library/lux/debug.lux
@@ -119,10 +119,10 @@
               (import (format [Text .Any] Text)))
        ))
 
-(def: Inspector
+(def Inspector
   (.type (Format Any)))
 
-(for @.lua (def: (tuple_array tuple)
+(for @.lua (def (tuple_array tuple)
              (-> (array.Array Any) (array.Array Any))
              (array.of_list
               (loop (again [idx 0])
@@ -132,7 +132,7 @@
                     {.#Item member (again (++ idx))})))))
      (these))
 
-(def: (tuple_inspection inspection)
+(def (tuple_inspection inspection)
   (-> Inspector Inspector)
   (with_expansions [ (for @.lua (~~ (these ..tuple_array))
                                     (~~ (these)))]
@@ -143,7 +143,7 @@
              (text.interposed " ")
              (text.enclosed ["[" "]"])))))
 
-(def: .public (inspection value)
+(def .public (inspection value)
   Inspector
   (with_expansions [ (let [object (as java/lang/Object value)]
                             (`` (<| (~~ (with_template [ ]
@@ -387,7 +387,7 @@
 (type: Representation
   (-> Any Text))
 
-(def: primitive_representation
+(def primitive_representation
   (Parser Representation)
   (`` (all <>.either
            (do <>.monad
@@ -407,7 +407,7 @@
                  [Text %.text]))
            )))
 
-(def: (special_representation representation)
+(def (special_representation representation)
   (-> (Parser Representation) (Parser Representation))
   (`` (all <>.either
            (~~ (with_template [ ]
@@ -442,7 +442,7 @@
              (in (|>> (as (Maybe Any))
                       (%.maybe elemR)))))))
 
-(def: (variant_representation representation)
+(def (variant_representation representation)
   (-> (Parser Representation) (Parser Representation))
   (do <>.monad
     [membersR+ (.variant (<>.many representation))]
@@ -468,7 +468,7 @@
                                             (undefined)))]
             (%.format "{" (%.nat lefts) " " (%.bit right?) " " sub_repr "}"))))))
 
-(def: (tuple_representation representation)
+(def (tuple_representation representation)
   (-> (Parser Representation) (Parser Representation))
   (do <>.monad
     [membersR+ (.tuple (<>.many representation))]
@@ -487,7 +487,7 @@
                                  (%.format (headR leftV) " " (again tailR rightV)))))]
             (%.format "[" tuple_body "]"))))))
 
-(def: representation_parser
+(def representation_parser
   (Parser Representation)
   (<>.rec
    (function (_ representation)
@@ -513,7 +513,7 @@
           (<>.failure "")
           ))))
 
-(def: .public (representation type value)
+(def .public (representation type value)
   (-> Type Any (Try Text))
   (case (.result ..representation_parser type)
     {try.#Success representation}
@@ -522,14 +522,14 @@
     {try.#Failure _}
     (exception.except ..cannot_represent_value type)))
 
-(def: .public private
+(def .public private
   (syntax (_ [definition .symbol])
     (let [[module _] definition]
       (in (list (` ("lux in-module"
                     (~ (code.text module))
                     (~ (code.symbol definition)))))))))
 
-(def: .public (log! message)
+(def .public (log! message)
   (-> Text Any)
   ("lux io log" message))
 
@@ -539,7 +539,7 @@
    "Location" (%.location location)
    "Type" (%.type type)))
 
-(def: .public hole
+(def .public hole
   (syntax (_ [])
     (do meta.monad
       [location meta.location
@@ -549,7 +549,7 @@
 (type: Target
   [Text (Maybe Code)])
 
-(def: target
+(def target
   (.Parser Target)
   (<>.either (<>.and .local
                      (at <>.monad in {.#None}))
@@ -560,7 +560,7 @@
   (exception.report
    "Name" (%.text name)))
 
-(def: .public here
+(def .public here
   (syntax (_ [targets (is (.Parser (List Target))
                           (|> ..target
                               <>.some
diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux
index abe8d3ff3..3c5ad2e10 100644
--- a/stdlib/source/library/lux/documentation.lux
+++ b/stdlib/source/library/lux/documentation.lux
@@ -35,7 +35,7 @@
       [lux
        ["[0]" syntax]]]]]]])
 
-(def: |recursion_dummy|
+(def |recursion_dummy|
   (template (_)
     [{.#Primitive "" {.#End}}]))
 
@@ -44,12 +44,12 @@
    {#Comment Text}
    {#Code Code}))
 
-(def: fragment
+(def fragment
   (Parser Fragment)
   (<>.or .text
          .any))
 
-(def: (reference_column code)
+(def (reference_column code)
   (-> Code Nat)
   (case code
     (^.with_template []
@@ -73,7 +73,7 @@
      [.#Tuple])
     ))
 
-(def: (padding reference_column [_ old_line old_column] [_ new_line new_column])
+(def (padding reference_column [_ old_line old_column] [_ new_line new_column])
   (-> Nat Location Location Text)
   (if (n.= old_line new_line)
     (if (n.< old_column new_column)
@@ -86,7 +86,7 @@
               ""
               (text.together (list.repeated (n.- reference_column new_column) " "))))))
 
-(def: (code_documentation expected_module old_location reference_column example)
+(def (code_documentation expected_module old_location reference_column example)
   (-> Text Location Nat Code [Location Text])
   (case example
     [new_location {.#Symbol [module short]}]
@@ -130,15 +130,15 @@
      [syntax.open_tuple   syntax.close_tuple   .#Tuple])
     ))
 
-(def: blank_line
+(def blank_line
   Text
   (format \n \n))
 
-(def: single_line_comment
+(def single_line_comment
   (-> Text Text)
   (text.prefix "... "))
 
-(def: (fragment_documentation module fragment)
+(def (fragment_documentation module fragment)
   (-> Text Fragment Text)
   (case fragment
     {#Comment comment}
@@ -151,10 +151,10 @@
           (..code_documentation module (has .#column reference_column location) reference_column)
           product.right))))
 
-(def: parameter_name_options "abcdefghijklmnopqrstuvwxyz")
-(def: parameter_name_options_count (text.size parameter_name_options))
+(def parameter_name_options "abcdefghijklmnopqrstuvwxyz")
+(def parameter_name_options_count (text.size parameter_name_options))
 
-(def: (parameter_type_name id)
+(def (parameter_type_name id)
   (-> Nat Text)
   (format "_" (%.nat id))
   ... (case (text.char id ..parameter_name_options)
@@ -166,13 +166,13 @@
   ...           (parameter_type_name (n.% parameter_name_options_count id))))
   )
 
-(def: type_variable_names
+(def type_variable_names
   (Stream Text)
   (stream.iterations (product.forked ++ parameter_type_name)
                      0))
 
 (with_template [ ]
-  [(def: ( id)
+  [(def ( id)
      (-> Nat Bit)
      ( id))]
 
@@ -180,11 +180,11 @@
   [type_parameter? n.odd?]
   )
 
-(def: (parameter_id level id)
+(def (parameter_id level id)
   (-> Nat Nat Nat)
   (n.- (n./ 2 id) level))
 
-(def: (parameter_name [type_function_name type_function_arguments] level id)
+(def (parameter_name [type_function_name type_function_arguments] level id)
   (-> [Text (List Text)] Nat Nat Text)
   (if (type_parameter? id)
     (let [parameter_id (..parameter_id level id)]
@@ -200,7 +200,7 @@
               (stream.item parameter_id)))))      
     type_function_name))
 
-(def: (level_parameters offset level)
+(def (level_parameters offset level)
   (-> Nat Nat (List Text))
   (if (n.= 0 level)
     (list)
@@ -209,14 +209,14 @@
         (enum.range n.enum 0)
         (list#each (|>> (n.+ (++ offset)) parameter_type_name)))))
 
-(def: (nested line_prefix body)
+(def (nested line_prefix body)
   (-> Text Text Text)
   (|> body
       (text.all_split_by \n)
       (list#each (text.prefix line_prefix))
       (text.interposed \n)))
 
-(def: (%type' level type_function_name nestable? module type)
+(def (%type' level type_function_name nestable? module type)
   (-> Nat Text Bit Text Type Text)
   (case type
     {.#Primitive name params}
@@ -298,11 +298,11 @@
           (%.symbol [_module _name]))
     ))
 
-(def: type
+(def type
   (-> Text Type Text)
   (%type' (-- 0) "?" true))
 
-(def: (parameterized_type arity type)
+(def (parameterized_type arity type)
   (-> Nat Type (Maybe Type))
   (case arity
     0 {.#Some type}
@@ -313,7 +313,7 @@
         _
         {.#None})))
 
-(def: (type_definition' nestable? level arity type_function_info tags module type)
+(def (type_definition' nestable? level arity type_function_info tags module type)
   (-> Bit Nat Nat [Text (List Text)] (List Text) Text Type Text)
   (case tags
     (pattern (list single_tag))
@@ -436,7 +436,7 @@
             (%.symbol [_module _name]))
       )))
 
-(def: (type_definition module [name parameters] tags type)
+(def (type_definition module [name parameters] tags type)
   (-> Text [Text (List Text)] (List Text) Type Text)
   (let [arity (list.size parameters)]
     (case (parameterized_type arity type)
@@ -446,7 +446,7 @@
       {.#None}
       (..type module type))))
 
-(def: description
+(def description
   (Parser (Maybe Code))
   (<>.or (.this_text "")
          .any))
@@ -455,7 +455,7 @@
   (exception.report
    "Name" (%.symbol name)))
 
-(def: qualified_symbol
+(def qualified_symbol
   (Parser Symbol)
   (do <>.monad
     [name .symbol]
@@ -466,7 +466,7 @@
       _
       (in name))))
 
-(def: example_separator
+(def example_separator
   Code
   (let [c/01 "...."
         c/04 (format c/01 c/01 c/01 c/01)
@@ -478,11 +478,11 @@
 (type: Example
   (List Fragment))
 
-(def: example
+(def example
   (Parser Example)
   (.tuple (<>.many ..fragment)))
 
-(def: (example_documentation module example)
+(def (example_documentation module example)
   (-> Text Example Code)
   (|> example
       (list#each (..fragment_documentation module))
@@ -493,13 +493,13 @@
 (type: Declaration
   [Symbol (List Text)])
 
-(def: declaration
+(def declaration
   (Parser Declaration)
   (<>.either (<>.and ..qualified_symbol (<>#in (list)))
              (.form (<>.and ..qualified_symbol
                                   (<>.some (.local))))))
 
-(def: minimal_definition_documentation
+(def minimal_definition_documentation
   (syntax (_ [[name parameters] ..declaration])
     (do meta.monad
       [.let [g!module (code.text (product.left name))]
@@ -538,7 +538,7 @@
                                     (` ((~! ..type) (~ g!module) (~ g!type))))))))
                        ))))))))
 
-(def: definition_documentation
+(def definition_documentation
   (syntax (_ [[name parameters] ..declaration
               description ..description
               examples (<>.some ..example)])
@@ -581,7 +581,7 @@
     #expected (Set Text)
     #definitions (List Definition)]))
 
-(def: .public default
+(def .public default
   (syntax (_ [[name parameters] ..declaration])
     (macro.with_symbols [g!_]
       (let [[_ short] name]
@@ -593,7 +593,7 @@
                                                                       (~+ (list#each code.local parameters))))])))]
                        ((~ g!_) [])))))))))
 
-(def: .public documentation
+(def .public documentation
   (syntax (_ [[name parameters] ..declaration
               extra (<>.some .any)])
     (macro.with_symbols [g!_]
@@ -607,7 +607,7 @@
                                                                      (~+ extra))])))]
                        ((~ g!_) [])))))))))
 
-(def: definitions_documentation
+(def definitions_documentation
   (-> (List Definition) (Markdown Block))
   (|>> (list.sorted (function (_ left right)
                       (text#< (the #definition right)
@@ -615,11 +615,11 @@
        (list#each (the #documentation))
        (list#mix md.then md.empty)))
 
-(def: expected_separator
+(def expected_separator
   Text
   (text.of_char 31))
 
-(def: expected_format
+(def expected_format
   (-> (List Text) Text)
   (list#mix (function (_ short aggregate)
               (case aggregate
@@ -627,12 +627,12 @@
                 _ (format aggregate ..expected_separator short)))
             ""))
 
-(def: expected
+(def expected
   (-> Text (Set Text))
   (|>> (text.all_split_by ..expected_separator)
        (set.of_list text.hash)))
 
-(def: .public module
+(def .public module
   (syntax (_ [[name _] ..qualified_symbol
               description .any
               definitions (.tuple (<>.some .any))
@@ -652,7 +652,7 @@
                                  (at (~! list.monoid) (~' identity)))
                              (~+ subs))))))))))
 
-(def: listing
+(def listing
   (-> (List Text) (Markdown Block))
   (|>> (list.sorted text#<)
        (list#each (function (_ definition)
@@ -660,7 +660,7 @@
                      {.#None}]))
        md.numbered_list))
 
-(def: (module_documentation module)
+(def (module_documentation module)
   (-> Module (Markdown Block))
   (let [(open "_[0]") module]
     (all md.then
@@ -709,7 +709,7 @@
                 (..listing un_expected)))
          )))
 
-(def: .public markdown
+(def .public markdown
   (-> (List Module) Text)
   (|>> (list.sorted (function (_ left right)
                       (text#< (the #module right) (the #module left))))
diff --git a/stdlib/source/library/lux/extension.lux b/stdlib/source/library/lux/extension.lux
index 424cfcba8..1cbaf8642 100644
--- a/stdlib/source/library/lux/extension.lux
+++ b/stdlib/source/library/lux/extension.lux
@@ -31,7 +31,7 @@
     #archive Text
     #inputs (List Code)]))
 
-(def: (declaration default)
+(def (declaration default)
   (-> Code (Parser Declaration))
   (.form (all <>.and
                  .any
@@ -41,7 +41,7 @@
                  (.tuple (<>.some .any)))))
 
 (with_template [     ]
-  [(def: .public 
+  [(def .public 
      (syntax (_ [[name extension phase archive inputs] (..declaration (` ))
                  body .any])
        (let [g!name (code.local extension)
diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux
index 9fc79a2d9..49042f104 100644
--- a/stdlib/source/library/lux/ffi.jvm.lux
+++ b/stdlib/source/library/lux/ffi.jvm.lux
@@ -39,23 +39,23 @@
    ["[0]" type (.open: "[1]#[0]" equivalence)
     ["[0]" check]]]])
 
-(def: internal
+(def internal
   (-> External Text)
   (|>> name.internal
        name.read))
 
-(def: signature
+(def signature
   (All (_ category)
     (-> (Type category) Text))
   (|>> jvm.signature signature.signature))
 
-(def: reflection
+(def reflection
   (All (_ category)
     (-> (Type (<| Return' Value' category)) Text))
   (|>> jvm.reflection reflection.reflection))
 
 (with_template [ ]
-  [(`` (def: .public 
+  [(`` (def .public 
          .Type
          {.#Primitive  {.#End}}))]
 
@@ -71,7 +71,7 @@
   )
 
 (with_template [ ]
-  [(`` (def: .public 
+  [(`` (def .public 
          .Type
          {.#Primitive (reflection.reflection ) {.#End}}))]
 
@@ -86,20 +86,20 @@
   [char      reflection.char]
   )
 
-(def: (get_static_field class field)
+(def (get_static_field class field)
   (-> Text Text Code)
   (` ("jvm member get static"
       (~ (code.text class))
       (~ (code.text field)))))
 
-(def: (get_virtual_field class field object)
+(def (get_virtual_field class field object)
   (-> Text Text Code Code)
   (` ("jvm member get virtual"
       (~ (code.text class))
       (~ (code.text field))
       (~ object))))
 
-(def: boxes
+(def boxes
   (Dictionary (Type Value) Text)
   (|> (list [jvm.boolean box.boolean]
             [jvm.byte    box.byte]
@@ -112,7 +112,7 @@
       (dictionary.of_list jvm.hash)))
 
 (with_template [ 
 ]
-  [(def: ( unboxed boxed raw)
+  [(def ( unboxed boxed raw)
      (-> (Type Value) Text Code Code)
      (let [unboxed (..reflection unboxed)]
        (` (|> (~ raw)
@@ -125,7 +125,7 @@
   )
 
 (with_template [   ]
-  [(def: .public 
+  [(def .public 
      (template ( value)
        [(|> value
             (.is )
@@ -166,7 +166,7 @@
   )
 
 (with_template [   <0> <1>]
-  [(def: .public 
+  [(def .public 
      (template ( value)
        [(|> value <0> <1>)]))]
 
@@ -177,7 +177,7 @@
   [short_to_char ..Short ..Character ..short_to_int ..int_to_char]
   )
 
-(def: constructor_method_name
+(def constructor_method_name
   "")
 
 (type: Primitive_Mode
@@ -327,7 +327,7 @@
    {#MethodDecl      [ImportMethodCommons ImportMethodDecl]}
    {#FieldAccessDecl ImportFieldDecl}))
 
-(def: (primitive_type mode type)
+(def (primitive_type mode type)
   (-> Primitive_Mode (Type Primitive) Code)
   (case mode
     {#ManualPrM}
@@ -362,7 +362,7 @@
           ... else
           (undefined))))
 
-(def: (parameter_type value_type type)
+(def (parameter_type value_type type)
   (-> (-> (Type Value) Code)
       (-> (Type Parameter) Code))
   (`` (<| (~~ (with_template [  ]
@@ -390,7 +390,7 @@
           (undefined)
           )))
 
-(def: (value_type mode type)
+(def (value_type mode type)
   (-> Primitive_Mode (Type Value) Code)
   (`` (<| (~~ (with_template [  ]
                 [(case ( type)
@@ -404,25 +404,25 @@
           (undefined)
           )))
 
-(def: declaration_type$
+(def declaration_type$
   (-> (Type Declaration) Code)
   (|>> ..signature code.text))
 
-(def: (get_const_parser class_name field_name)
+(def (get_const_parser class_name field_name)
   (-> Text Text (Parser Code))
   (do <>.monad
     [.let [dotted_name (format "::" field_name)]
      _ (.this (code.symbol ["" dotted_name]))]
     (in (get_static_field class_name field_name))))
 
-(def: (get_var_parser class_name field_name self_name)
+(def (get_var_parser class_name field_name self_name)
   (-> Text Text Text (Parser Code))
   (do <>.monad
     [.let [dotted_name (format "::" field_name)]
      _ (.this (code.symbol ["" dotted_name]))]
     (in (get_virtual_field class_name field_name (code.local self_name)))))
 
-(def: (put_var_parser class_name field_name self_name)
+(def (put_var_parser class_name field_name self_name)
   (-> Text Text Text (Parser Code))
   (do <>.monad
     [.let [dotted_name (format "::" field_name)]
@@ -434,7 +434,7 @@
              (~ value)
              (~ (code.local self_name)))))))
 
-(def: (replaced f input)
+(def (replaced f input)
   (-> (-> Code Code) Code Code)
   (case (f input)
     (^.with_template []
@@ -447,7 +447,7 @@
     ast'
     ast'))
 
-(def: (parser->replacer p ast)
+(def (parser->replacer p ast)
   (-> (Parser Code) (-> Code Code))
   (case (<>.result p (list ast))
     {.#Right [{.#End} ast']}
@@ -457,7 +457,7 @@
     ast
     ))
 
-(def: (field->parser class_name self_name [[field_name _ _] field])
+(def (field->parser class_name self_name [[field_name _ _] field])
   (-> Text Text [Member_Declaration FieldDecl] (Parser Code))
   (case field
     {#ConstantField _}
@@ -467,11 +467,11 @@
     (<>.either (get_var_parser class_name field_name self_name)
                (put_var_parser class_name field_name self_name))))
 
-(def: (decorate_input [class value])
+(def (decorate_input [class value])
   (-> [(Type Value) Code] Code)
   (` [(~ (code.text (..signature class))) (~ value)]))
 
-(def: (constructor_parser class_name arguments)
+(def (constructor_parser class_name arguments)
   (-> Text (List Argument) (Parser Code))
   (do <>.monad
     [args (.is (Parser (List Code))
@@ -482,7 +482,7 @@
                     (list.zipped_2 (list#each product.right arguments))
                     (list#each ..decorate_input))))))))
 
-(def: (static_method_parser class_name method_name arguments)
+(def (static_method_parser class_name method_name arguments)
   (-> Text Text (List Argument) (Parser Code))
   (do <>.monad
     [.let [dotted_name (format "::" method_name "!")]
@@ -495,7 +495,7 @@
                     (list#each ..decorate_input))))))))
 
 (with_template [ ]
-  [(def: ( class_vars class_name type_vars method_name arguments self_name)
+  [(def ( 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
        [.let [dotted_name (format "::" method_name "!")]
@@ -514,7 +514,7 @@
   [virtual_method_parser "jvm member invoke virtual"]
   )
 
-(def: (method->parser class_vars class_name [[method_name _ _] meth_def])
+(def (method->parser class_vars class_name [[method_name _ _] meth_def])
   (-> (List (Type Var)) Text [Member_Declaration Method_Definition] (Parser Code))
   (case meth_def
     {#ConstructorMethod strict? type_vars self_name args constructor_args return_expr exs}
@@ -535,7 +535,7 @@
     {#NativeMethod type_vars args return_type exs}
     (virtual_method_parser class_vars class_name type_vars method_name args "")))
 
-(def: privacy_modifier^
+(def privacy_modifier^
   (Parser Privacy)
   (let [(open "[0]") <>.monad]
     (all <>.or
@@ -544,7 +544,7 @@
          (.this (' "protected"))
          (in []))))
 
-(def: inheritance_modifier^
+(def inheritance_modifier^
   (Parser Inheritance)
   (let [(open "[0]") <>.monad]
     (all <>.or
@@ -562,12 +562,12 @@
    "Name" (%.text name)
    "Type Variables" (exception.listing parser.name type_vars)))
 
-(def: (assertion exception payload test)
+(def (assertion exception payload test)
   (All (_ e) (-> (Exception e) e Bit (Parser Any)))
   (<>.assertion (exception.error exception payload)
                 test))
 
-(def: (valid_class_name type_vars)
+(def (valid_class_name type_vars)
   (-> (List (Type Var)) (Parser External))
   (do <>.monad
     [name .local
@@ -579,7 +579,7 @@
                                        name)))]
     (in name)))
 
-(def: (class^' parameter^ type_vars)
+(def (class^' parameter^ type_vars)
   (-> (-> (List (Type Var)) (Parser (Type Parameter)))
       (-> (List (Type Var)) (Parser (Type Class))))
   (do <>.monad
@@ -596,7 +596,7 @@
    "Unexpected Type Variable" (%.text name)
    "Expected Type Variables" (exception.listing parser.name type_vars)))
 
-(def: (type_variable options)
+(def (type_variable options)
   (-> (List (Type Var)) (Parser (Type Parameter)))
   (do <>.monad
     [name .local
@@ -604,14 +604,14 @@
                     (list.member? text.equivalence (list#each parser.name options) name))]
     (in (jvm.var name))))
 
-(def: wildcard^
+(def wildcard^
   (Parser (Type Parameter))
   (do <>.monad
     [_ (.this (' ?))]
     (in jvm.wildcard)))
 
 (with_template [  ]
-  [(def: 
+  [(def 
      (-> (Parser (Type Class)) (Parser (Type Parameter)))
      (|>> (<>.after (.this (' )))
           (<>.after ..wildcard^)
@@ -622,7 +622,7 @@
   [lower^ > jvm.lower]
   )
 
-(def: (parameter^ type_vars)
+(def (parameter^ type_vars)
   (-> (List (Type Var)) (Parser (Type Parameter)))
   (<>.rec
    (function (_ _)
@@ -635,7 +635,7 @@
             class^
             )))))
 
-(def: (itself^ type)
+(def (itself^ type)
   (All (_ category)
     (-> (Type (<| Return' Value' category))
         (Parser (Type (<| Return' Value' category)))))
@@ -643,7 +643,7 @@
     [_ (.this_symbol ["" (..reflection type)])]
     (in type)))
 
-(def: primitive^
+(def primitive^
   (Parser (Type Primitive))
   (all <>.either
        (itself^ jvm.boolean)
@@ -656,12 +656,12 @@
        (itself^ jvm.char)
        ))
 
-(def: array^
+(def array^
   (-> (Parser (Type Value)) (Parser (Type Array)))
   (|>> .tuple
        (at <>.monad each jvm.array)))
 
-(def: (type^ type_vars)
+(def (type^ type_vars)
   (-> (List (Type Var)) (Parser (Type Value)))
   (<>.rec
    (function (_ type^)
@@ -671,26 +671,26 @@
           (..array^ type^)
           ))))
 
-(def: void^
+(def void^
   (Parser (Type Void))
   (do <>.monad
     [_ (.this_symbol ["" (reflection.reflection reflection.void)])]
     (in jvm.void)))
 
-(def: (return^ type_vars)
+(def (return^ type_vars)
   (-> (List (Type Var)) (Parser (Type Return)))
   (<>.either ..void^
              (..type^ type_vars)))
 
-(def: var^
+(def var^
   (Parser (Type Var))
   (at <>.monad each jvm.var .local))
 
-(def: vars^
+(def vars^
   (Parser (List (Type Var)))
   (.tuple (<>.some var^)))
 
-(def: declaration^
+(def declaration^
   (Parser (Type Declaration))
   (do <>.monad
     [[name variables] (.is (Parser [External (List (Type Var))])
@@ -701,15 +701,15 @@
                                       ))]
     (in (jvm.declaration name variables))))
 
-(def: (class^ type_vars)
+(def (class^ type_vars)
   (-> (List (Type Var)) (Parser (Type Class)))
   (class^' parameter^ type_vars))
 
-(def: annotation_parameters^
+(def annotation_parameters^
   (Parser (List Annotation_Parameter))
   (.tuple (<>.some (<>.and .text .any))))
 
-(def: annotation^
+(def annotation^
   (Parser Annotation)
   (<>.either (do <>.monad
                [ann_name .local]
@@ -717,21 +717,21 @@
              (.form (<>.and .local
                                   annotation_parameters^))))
 
-(def: annotations^
+(def annotations^
   (Parser (List Annotation))
   (<| (<>.else (list))
       (do <>.monad
         [_ (.this (' "ann"))]
         (.tuple (<>.some ..annotation^)))))
 
-(def: (throws_decl^ type_vars)
+(def (throws_decl^ type_vars)
   (-> (List (Type Var)) (Parser (List (Type Class))))
   (<| (<>.else (list))
       (do <>.monad
         [_ (.this (' "throws"))]
         (.tuple (<>.some (..class^ type_vars))))))
 
-(def: (method_decl^ type_vars)
+(def (method_decl^ type_vars)
   (-> (List (Type Var)) (Parser [Member_Declaration MethodDecl]))
   (.form (do <>.monad
                  [tvars (<>.else (list) ..vars^)
@@ -746,14 +746,14 @@
                                               #method_output output
                                               #method_exs exs]]))))
 
-(def: state_modifier^
+(def state_modifier^
   (Parser State)
   (all <>.or
        (.this (' "volatile"))
        (.this (' "final"))
        (at <>.monad in [])))
 
-(def: (field_decl^ type_vars)
+(def (field_decl^ type_vars)
   (-> (List (Type Var)) (Parser [Member_Declaration FieldDecl]))
   (<>.either (.form (do <>.monad
                             [_ (.this (' "const"))
@@ -771,24 +771,24 @@
                              type (..type^ type_vars)]
                             (in [[name pm anns] {#VariableField [sm static? type]}])))))
 
-(def: (argument^ type_vars)
+(def (argument^ type_vars)
   (-> (List (Type Var)) (Parser Argument))
   (<>.and .local
           (..type^ type_vars)))
 
-(def: (arguments^ type_vars)
+(def (arguments^ type_vars)
   (-> (List (Type Var)) (Parser (List Argument)))
   (.tuple (<>.some (..argument^ type_vars))))
 
-(def: (constructor_arg^ type_vars)
+(def (constructor_arg^ type_vars)
   (-> (List (Type Var)) (Parser (Typed Code)))
   (<>.and (..type^ type_vars) .any))
 
-(def: (constructor_args^ type_vars)
+(def (constructor_args^ type_vars)
   (-> (List (Type Var)) (Parser (List (Typed Code))))
   (.tuple (<>.some (..constructor_arg^ type_vars))))
 
-(def: (constructor_method^ class_vars)
+(def (constructor_method^ class_vars)
   (-> (List (Type Var)) (Parser [Member_Declaration Method_Definition]))
   (.form (do <>.monad
                  [pm privacy_modifier^
@@ -808,7 +808,7 @@
                        #member_anns annotations]
                       {#ConstructorMethod strict_fp? method_vars self_name arguments constructor_args body exs}]))))
 
-(def: (virtual_method_def^ class_vars)
+(def (virtual_method_def^ class_vars)
   (-> (List (Type Var)) (Parser [Member_Declaration Method_Definition]))
   (.form (do <>.monad
                  [pm privacy_modifier^
@@ -829,7 +829,7 @@
                        #member_anns annotations]
                       {#VirtualMethod final? strict_fp? method_vars self_name arguments return_type body exs}]))))
 
-(def: overriden_method_def^
+(def overriden_method_def^
   (Parser [Member_Declaration Method_Definition])
   (.form (do <>.monad
                  [strict_fp? (<>.parses? (.this (' "strict")))
@@ -850,7 +850,7 @@
                        #member_anns annotations]
                       {#OverridenMethod strict_fp? owner_class method_vars self_name arguments return_type body exs}]))))
 
-(def: static_method_def^
+(def static_method_def^
   (Parser [Member_Declaration Method_Definition])
   (.form (do <>.monad
                  [pm privacy_modifier^
@@ -869,7 +869,7 @@
                        #member_anns annotations]
                       {#StaticMethod strict_fp? method_vars arguments return_type body exs}]))))
 
-(def: abstract_method_def^
+(def abstract_method_def^
   (Parser [Member_Declaration Method_Definition])
   (.form (do <>.monad
                  [pm privacy_modifier^
@@ -886,7 +886,7 @@
                        #member_anns annotations]
                       {#AbstractMethod method_vars arguments return_type exs}]))))
 
-(def: native_method_def^
+(def native_method_def^
   (Parser [Member_Declaration Method_Definition])
   (.form (do <>.monad
                  [pm privacy_modifier^
@@ -903,7 +903,7 @@
                        #member_anns annotations]
                       {#NativeMethod method_vars arguments return_type exs}]))))
 
-(def: (method_def^ class_vars)
+(def (method_def^ class_vars)
   (-> (List (Type Var)) (Parser [Member_Declaration Method_Definition]))
   (all <>.either
        (..constructor_method^ class_vars)
@@ -913,34 +913,34 @@
        ..abstract_method_def^
        ..native_method_def^))
 
-(def: partial_call^
+(def partial_call^
   (Parser Partial_Call)
   (.form (<>.and .symbol (<>.some .any))))
 
-(def: import_member_alias^
+(def import_member_alias^
   (Parser (Maybe Text))
   (<>.maybe (do <>.monad
               [_ (.this (' "as"))]
               .local)))
 
-(def: (import_member_args^ type_vars)
+(def (import_member_args^ type_vars)
   (-> (List (Type Var)) (Parser (List [Bit (Type Value)])))
   (.tuple (<>.some (<>.and (<>.parses? (.this (' "?")))
                                  (..type^ type_vars)))))
 
-(def: import_member_return_flags^
+(def import_member_return_flags^
   (Parser [Bit Bit Bit])
   (all <>.and
        (<>.parses? (.this (' "io")))
        (<>.parses? (.this (' "try")))
        (<>.parses? (.this (' "?")))))
 
-(def: primitive_mode^
+(def primitive_mode^
   (Parser Primitive_Mode)
   (<>.or (.this (' "manual"))
          (.this (' "auto"))))
 
-(def: (import_member_decl^ owner_vars)
+(def (import_member_decl^ owner_vars)
   (-> (List (Type Var)) (Parser Import_Member_Declaration))
   (all <>.either
        (.form (do <>.monad
@@ -1002,7 +1002,7 @@
                                              #import_field_type    gtype]})))
        ))
 
-(def: (privacy_modifier$ pm)
+(def (privacy_modifier$ pm)
   (-> Privacy Code)
   (case pm
     {#PublicP}    (code.text "public")
@@ -1010,23 +1010,23 @@
     {#ProtectedP} (code.text "protected")
     {#DefaultP}   (code.text "default")))
 
-(def: (inheritance_modifier$ im)
+(def (inheritance_modifier$ im)
   (-> Inheritance Code)
   (case im
     {#FinalI}    (code.text "final")
     {#AbstractI} (code.text "abstract")
     {#DefaultI}  (code.text "default")))
 
-(def: (annotation_parameter$ [name value])
+(def (annotation_parameter$ [name value])
   (-> Annotation_Parameter Code)
   (` [(~ (code.text name)) (~ value)]))
 
-(def: (annotation$ [name params])
+(def (annotation$ [name params])
   (-> Annotation Code)
   (` ((~ (code.text name)) (~+ (list#each annotation_parameter$ params)))))
 
 (with_template [ ]
-  [(def: 
+  [(def 
      (-> (Type ) Code)
      (|>> ..signature code.text))]
 
@@ -1038,11 +1038,11 @@
   [class$ Class]
   )
 
-(def: var$'
+(def var$'
   (-> (Type Var) Code)
   (|>> ..signature code.local))
 
-(def: (method_decl$ [[name pm anns] method_decl])
+(def (method_decl$ [[name pm anns] method_decl])
   (-> [Member_Declaration MethodDecl] Code)
   (let [(open "[0]") method_decl]
     (` ((~ (code.text name))
@@ -1052,14 +1052,14 @@
         [(~+ (list#each value$ #method_inputs))]
         (~ (return$ #method_output))))))
 
-(def: (state_modifier$ it)
+(def (state_modifier$ it)
   (-> State Code)
   (case it
     {#VolatileS} (' "volatile")
     {#FinalS}    (' "final")
     {#DefaultS}  (' "default")))
 
-(def: (field_decl$ [[name pm anns] field])
+(def (field_decl$ [[name pm anns] field])
   (-> [Member_Declaration FieldDecl] Code)
   (case field
     {#ConstantField class value}
@@ -1081,15 +1081,15 @@
         ))
     ))
 
-(def: (argument$ [name type])
+(def (argument$ [name type])
   (-> Argument Code)
   (` [(~ (code.text name)) (~ (value$ type))]))
 
-(def: (constructor_arg$ [class term])
+(def (constructor_arg$ [class term])
   (-> (Typed Code) Code)
   (` [(~ (value$ class)) (~ term)]))
 
-(def: (overriden_method_macro super_class name declaration type_vars self_name expected_arguments)
+(def (overriden_method_macro super_class name declaration type_vars self_name expected_arguments)
   (-> (Type Class) Text (Type Declaration) (List (Type Var)) Text (List Argument) Macro)
   (syntax (_ [_ (.this (' "super"))
               actual_arguments (.tuple (<>.exactly (list.size expected_arguments) .any))])
@@ -1104,7 +1104,7 @@
                           (list.zipped_2 (list#each product.right expected_arguments))
                           (list#each ..decorate_input)))))))))
 
-(def: (method_def$ fully_qualified_class_name method_parser super_class fields [[name pm anns] method_def])
+(def (method_def$ fully_qualified_class_name method_parser super_class fields [[name pm anns] method_def])
   (-> External (Parser Code) (Type Class) (List [Member_Declaration FieldDecl]) [Member_Declaration Method_Definition] (Meta Code))
   (case method_def
     {#ConstructorMethod strict_fp? type_vars self_name arguments constructor_args body exs}
@@ -1195,15 +1195,15 @@
                  (~ (return$ return_type)))))
     ))
 
-(def: (complete_call$ g!obj [method args])
+(def (complete_call$ g!obj [method args])
   (-> Code Partial_Call Code)
   (` ((~ (code.symbol method)) (~+ args) (~ g!obj))))
 
-(def: $Object
+(def $Object
   (Type Class)
   (jvm.class "java.lang.Object" (list)))
 
-(def: .public class
+(def .public class
   (syntax (_ [.let [! <>.monad]
               im inheritance_modifier^
               [full_class_name class_vars] (at ! each parser.declaration ..declaration^)
@@ -1230,7 +1230,7 @@
                     [(~+ (list#each field_decl$ fields))]
                     [(~+ methods)])))))))
 
-(def: .public interface
+(def .public interface
   (syntax (_ [.let [! <>.monad]
               [full_class_name class_vars] (at ! each parser.declaration ..declaration^)
               supers (<>.else (list)
@@ -1243,7 +1243,7 @@
                   [(~+ (list#each annotation$ annotations))]
                   (~+ (list#each method_decl$ members))))))))
 
-(def: .public object
+(def .public object
   (syntax (_ [class_vars ..vars^
               super (<>.else $Object
                              (class^ class_vars))
@@ -1260,15 +1260,15 @@
                     [(~+ (list#each constructor_arg$ constructor_args))]
                     [(~+ methods)])))))))
 
-(def: .public null
+(def .public null
   (syntax (_ [])
     (in (list (` ("jvm object null"))))))
 
-(def: .public (null? obj)
+(def .public (null? obj)
   (-> (.Primitive "java.lang.Object") Bit)
   ("jvm object null?" obj))
 
-(def: .public ???
+(def .public ???
   (syntax (_ [expr .any])
     (with_symbols [g!temp]
       (in (list (` (let [(~ g!temp) (~ expr)]
@@ -1276,7 +1276,7 @@
                        {.#Some (~ g!temp)}
                        {.#None}))))))))
 
-(def: .public !!!
+(def .public !!!
   (syntax (_ [expr .any])
     (with_symbols [g!value]
       (in (list (` (.case (~ expr)
@@ -1286,7 +1286,7 @@
                      {.#None}
                      ("jvm object null"))))))))
 
-(def: .public as
+(def .public as
   (syntax (_ [class (..type^ (list))
               unchecked (<>.maybe .any)])
     (with_symbols [g!_ g!unchecked]
@@ -1309,12 +1309,12 @@
                               (~ check_code))))))
           )))))
 
-(def: .public synchronized
+(def .public synchronized
   (syntax (_ [lock .any
               body .any])
     (in (list (` ("jvm object synchronized" (~ lock) (~ body)))))))
 
-(def: .public do_to
+(def .public do_to
   (syntax (_ [obj .any
               methods (<>.some partial_call^)])
     (with_symbols [g!obj]
@@ -1322,19 +1322,19 @@
                      (exec (~+ (list#each (complete_call$ g!obj) methods))
                        (~ g!obj)))))))))
 
-(def: (class_import$ declaration)
+(def (class_import$ declaration)
   (-> (Type Declaration) Code)
   (let [[full_name params] (parser.declaration declaration)
         def_name (..internal full_name)
         params' (list#each ..var$' params)]
     (template.with_locals [g!_]
-      (` (def: (~ (code.symbol ["" def_name]))
+      (` (def (~ (code.symbol ["" def_name]))
            .Type
            (All ((~ (' g!_)) (~+ params'))
              (.Primitive (~ (code.text full_name))
                          [(~+ params')])))))))
 
-(def: (member_type_vars class_tvars member)
+(def (member_type_vars class_tvars member)
   (-> (List (Type Var)) Import_Member_Declaration (List (Type Var)))
   (case member
     {#ConstructorDecl [commons _]}
@@ -1351,7 +1351,7 @@
     _
     class_tvars))
 
-(def: (member_def_arg_bindings vars member)
+(def (member_def_arg_bindings vars member)
   (-> (List (Type Var)) Import_Member_Declaration (Meta [(List [Bit Code]) (List (Type Value)) (List Code)]))
   (case member
     (^.or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]})
@@ -1376,7 +1376,7 @@
     _
     (at meta.monad in [(list) (list) (list)])))
 
-(def: (with_return_maybe member never_null? unboxed return_term)
+(def (with_return_maybe member never_null? unboxed return_term)
   (-> Import_Member_Declaration Bit (Type Value) Code Code)
   (case member
     (^.or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]})
@@ -1399,7 +1399,7 @@
     return_term))
 
 (with_template [  ]
-  [(def: ( member return_term)
+  [(def ( member return_term)
      (-> Import_Member_Declaration Code Code)
      (case member
        (^.or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]})
@@ -1415,7 +1415,7 @@
   )
 
 (with_template [   ]
-  [(def: ( mode [unboxed raw])
+  [(def ( mode [unboxed raw])
      (-> Primitive_Mode [(Type Value) Code] Code)
      (let [[unboxed refined post] (.is [(Type Value) Code (List Code)]
                                        (case mode
@@ -1472,11 +1472,11 @@
     [jvm.double (list) [(` (.is (.Primitive (~ (code.text box.double)))))]]]]
   )
 
-(def: (un_quoted quoted)
+(def (un_quoted quoted)
   (-> Code Code)
   (` ((~' ~) (~ quoted))))
 
-(def: (jvm_invoke_inputs mode classes inputs)
+(def (jvm_invoke_inputs mode classes inputs)
   (-> Primitive_Mode (List (Type Value)) (List [Bit Code]) (List Code))
   (|> inputs
       (list.zipped_2 classes)
@@ -1488,13 +1488,13 @@
                        [class]
                        (with_automatic_input_conversion mode))))))
 
-(def: (import_name format class member)
+(def (import_name format class member)
   (-> Text Text Text Text)
   (|> format
       (text.replaced "[1]" class)
       (text.replaced "[0]" member)))
 
-(def: syntax_inputs
+(def syntax_inputs
   (-> (List Code) (List Code))
   (|>> (list#each (function (_ name)
                     (list name (` (~! .any)))))
@@ -1506,7 +1506,7 @@
    "Class" (%.text class)
    "Field" (%.text field)))
 
-(def: (member_def_interop vars kind class [arg_function_inputs input_jvm_types arg_types] member method_prefix import_format)
+(def (member_def_interop vars kind class [arg_function_inputs input_jvm_types arg_types] member method_prefix import_format)
   (-> (List (Type Var)) Class_Kind (Type Declaration) [(List [Bit Code]) (List (Type Value)) (List Code)] Import_Member_Declaration Text Text (Meta (List Code)))
   (let [[full_name class_tvars] (parser.declaration class)]
     (case member
@@ -1525,7 +1525,7 @@
                  getter_interop (.is (-> Text Code)
                                      (function (_ name)
                                        (let [getter_name (code.symbol ["" (..import_name import_format method_prefix name)])]
-                                         (` (def: (~ getter_name)
+                                         (` (def (~ getter_name)
                                               (~ enum_type)
                                               (~ (get_static_field full_name name)))))))]]
           (in (list#each getter_interop enum_members))))
@@ -1546,7 +1546,7 @@
                                (with_return_maybe member true classT)
                                (with_return_try member)
                                (with_return_io member))]]
-        (in (list (` (def: (~ def_name)
+        (in (list (` (def (~ def_name)
                        ((~! syntax) ((~ def_name) [(~+ (syntax_inputs (list#each product.right arg_function_inputs)))])
                         ((~' in) (.list (.` (~ jvm_interop))))))))))
 
@@ -1601,7 +1601,7 @@
                                     (|> callC
                                         (with_return_try member)
                                         (with_return_io member))))]]
-          (in (list (` (def: (~ def_name)
+          (in (list (` (def (~ def_name)
                          ((~! syntax) ((~ def_name) [(~+ (syntax_inputs (list#each product.right arg_function_inputs)))
                                                      (~+ (syntax_inputs object_ast))])
                           ((~' in) (.list (.` (~ jvm_interop)))))))))))
@@ -1657,14 +1657,14 @@
                                  (` {.#Right []})
                                  (` {.#Right [(~ g!obj)]}))
                                (` ((~' in) (.list (.` (~ getter_body))))))]
-                (list (` (def: (~ g!name)
+                (list (` (def (~ g!name)
                            ((~! syntax) ((~ g!name) [(~ write|read) (~ parser)])
                             (case (~ write|read)
                               (~+ write)
                               (~+ read))))))))))
       )))
 
-(def: (member_import$ vars kind class [import_format member])
+(def (member_import$ vars kind class [import_format member])
   (-> (List (Type Var)) Class_Kind (Type Declaration) [Text Import_Member_Declaration] (Meta (List Code)))
   (let [[full_name _] (parser.declaration class)
         method_prefix (..internal full_name)]
@@ -1672,21 +1672,21 @@
       [=args (member_def_arg_bindings vars member)]
       (member_def_interop vars kind class =args member method_prefix import_format))))
 
-(def: interface?
+(def interface?
   (All (_ a) (-> (.Primitive "java.lang.Class" [a]) Bit))
   (|>> ("jvm member invoke virtual" [] "java.lang.Class" "isInterface" [])
        "jvm object cast"
        (.is ..Boolean)
        (.as Bit)))
 
-(def: load_class
+(def load_class
   (-> External (Try (.Primitive "java.lang.Class" [Any])))
   (|>> (.as (.Primitive "java.lang.String"))
        ["Ljava/lang/String;"]
        ("jvm member invoke static" [] "java.lang.Class" "forName" [])
        try))
 
-(def: (class_kind declaration)
+(def (class_kind declaration)
   (-> (Type Declaration) (Meta Class_Kind))
   (let [[class_name _] (parser.declaration declaration)]
     (case (load_class class_name)
@@ -1698,7 +1698,7 @@
       {.#Left _}
       (meta.failure (format "Unknown class: " class_name)))))
 
-(def: .public import
+(def .public import
   (syntax (_ [declaration ..declaration^
               .let [[class_name class_type_vars] (parser.declaration declaration)]
               import_format .text
@@ -1710,7 +1710,7 @@
                     (monad.each ! (member_import$ class_type_vars kind declaration)))]
       (in (list.partial (class_import$ declaration) (list#conjoint =members))))))
 
-(def: .public array
+(def .public array
   (syntax (_ [type (..type^ (list))
               size .any])
     (let [g!size (` (|> (~ size)
@@ -1740,7 +1740,7 @@
    "Lux Type" (%.type type)))
 
 (with_expansions [ (these (meta.failure (exception.error ..cannot_convert_to_jvm_type [type])))]
-  (def: (lux_type->jvm_type context type)
+  (def (lux_type->jvm_type context type)
     (-> Type_Context .Type (Meta (Type Value)))
     (if (type#= .Any type)
       (at meta.monad in $Object)
@@ -1838,7 +1838,7 @@
         _
         ))))
 
-(def: .public length
+(def .public length
   (syntax (_ [array .any])
     (case array
       [_ {.#Symbol array_name}]
@@ -1874,7 +1874,7 @@
         (in (list (` (let [(~ g!array) (~ array)]
                        (..length (~ g!array))))))))))
 
-(def: .public read!
+(def .public read!
   (syntax (_ [idx .any
               array .any])
     (case array
@@ -1913,7 +1913,7 @@
         (in (list (` (let [(~ g!array) (~ array)]
                        (..read! (~ idx) (~ g!array))))))))))
 
-(def: .public write!
+(def .public write!
   (syntax (_ [idx .any
               value .any
               array .any])
@@ -1954,11 +1954,11 @@
         (in (list (` (let [(~ g!array) (~ array)]
                        (..write! (~ idx) (~ value) (~ g!array))))))))))
 
-(def: .public class_for
+(def .public class_for
   (syntax (_ [type (..type^ (list))])
     (in (list (` ("jvm object class" (~ (code.text (..reflection type)))))))))
 
-(def: .public type
+(def .public type
   (syntax (_ [type (..type^ (list))])
     (in (list (..value_type {#ManualPrM} type)))))
 
@@ -1967,7 +1967,7 @@
    "Signature" (..signature type)
    "Reflection" (..reflection type)))
 
-(def: .public is
+(def .public is
   (syntax (_ [type (..type^ (list))
               object .any])
     (case [(parser.array? type)
@@ -1980,11 +1980,11 @@
       (meta.failure (exception.error ..cannot_cast_to_non_object [type])))))
 
 (with_template [   ]
-  [(def: .public 
+  [(def .public 
      (template ( it)
        [(|> it (.is ) (.as ))]))
 
-   (def: .public 
+   (def .public 
      (template ( it)
        [(|> it (.is ) (.as ))]))]
 
@@ -1995,11 +1995,11 @@
   )
 
 (with_template [  <$>  <$'>  ]
-  [(def: .public 
+  [(def .public 
      (template ( it)
        [(|> it (.is ) (.as ) <$> (.is ))]))
 
-   (def: .public 
+   (def .public 
      (template ( it)
        [(|> it (.is ) <$'> (.is ) (.as ))]))]
 
diff --git a/stdlib/source/library/lux/ffi.lux b/stdlib/source/library/lux/ffi.lux
index 65fb0ea9c..d63363c38 100644
--- a/stdlib/source/library/lux/ffi.lux
+++ b/stdlib/source/library/lux/ffi.lux
@@ -96,7 +96,7 @@
   (type: Alias
     (Maybe Text))
 
-  (def: alias
+  (def alias
     (Parser Alias)
     (<>.maybe (<>.after (.this (' "as")) .local)))
 
@@ -105,7 +105,7 @@
      [#optional? Bit
       #mandatory Code]))
 
-  (def: optional
+  (def optional
     (Parser Optional)
     (let [token "?"]
       (<| (<>.and (<>.parses? (.this_text token)))
@@ -119,7 +119,7 @@
       #anonymous a]))
 
   (with_template [ ]
-    [(def: 
+    [(def 
        (All (_ a) (-> (Parser a) (Parser (Named a))))
        (|>> (all <>.and
                  
@@ -133,18 +133,18 @@
   (type: Output
     Optional)
 
-  (def: output
+  (def output
     (Parser Output)
     ..optional)
 
   (type: Global
     (Named Output))
 
-  (def: variables
+  (def variables
     (Parser (List Text))
     (<>.else (list) (.tuple (<>.some .local))))
 
-  (def: (generalized $ it)
+  (def (generalized $ it)
     (All (_ a)
       (-> (-> (List Text) a a)
           (-> (Parser a) (Parser a))))
@@ -160,7 +160,7 @@
       #io? Bit
       #try? Bit]))
 
-  (def: input
+  (def input
     (Parser Input)
     (all <>.and
          (<>#in (list))
@@ -171,7 +171,7 @@
   (type: Constructor
     (Named Input))
 
-  (def: constructor
+  (def constructor
     (Parser Constructor)
     (<| .form
         (..generalized (has [#anonymous #variables]))
@@ -183,11 +183,11 @@
      [#static? Bit
       #member a]))
 
-  (def: static!
+  (def static!
     (Parser Any)
     (.this_text "static"))
 
-  (def: (member it)
+  (def (member it)
     (All (_ a)
       (-> (Parser a)
           (Parser (Member a))))
@@ -201,7 +201,7 @@
   (type: Field
     (Member (Named Output)))
 
-  (def: field
+  (def field
     (Parser Field)
     (<| .form
         ..member
@@ -213,7 +213,7 @@
      [#input Input
       #output Optional]))
 
-  (def: procedure
+  (def procedure
     (Parser (Named Procedure))
     (<| (..generalized (has [#anonymous #input #variables]))
         ..named
@@ -225,7 +225,7 @@
   (type: Method
     (Member (Named Procedure)))
 
-  (def: method
+  (def method
     (Parser Method)
     (<| .form
         ..member
@@ -239,7 +239,7 @@
              {#Field Field}
              {#Method Method}))))
 
-  (`` (`` (def: sub
+  (`` (`` (def sub
             (Parser Sub)
             (all <>.or
                  (~~ (for @.lua (~~ (these))
@@ -249,14 +249,14 @@
                  ..method
                  ))))
 
-  (def: parameters
+  (def parameters
     (-> (List Optional) (List Optional))
     (|>> list.enumeration
          (list#each (.function (_ [idx [optional? type]])
                       [#optional? optional?
                        #mandatory (|> idx %.nat code.local)]))))
 
-  (def: (output_type it)
+  (def (output_type it)
     (-> Optional Code)
     (if (the #optional? it)
       (` (.Maybe (~ (the #mandatory it))))
@@ -264,17 +264,17 @@
 
   (`` (with_template [ 
                        ]
-        [(def: .public ( _)
+        [(def .public ( _)
            (-> Any Nothing)
            (as_expected ()))
 
-         (def: .public 
+         (def .public 
            (-> Any Bit)
            (|>> ))
 
          (template.with_locals [g!it]
-           (these (def: g!it' (' g!it))
-                  (def: (host_optional it)
+           (these (def g!it' (' g!it))
+                  (def (host_optional it)
                     (-> Optional Code)
                     (.if (.the #optional? it)
                       (` (.case (~ (the #mandatory it))
@@ -285,7 +285,7 @@
                            ()))
                       (the #mandatory it)))
 
-                  (def: (lux_optional it output)
+                  (def (lux_optional it output)
                     (-> Optional Code Code)
                     (` (.let [(~ g!it') (~ output)]
                          (~ (if (the #optional? it)
@@ -319,7 +319,7 @@
       #namespace Namespace
       #members (List Sub)]))
 
-  (def: class
+  (def class
     (Parser Class)
     (all <>.and
          (<>.either (<>.and .local
@@ -336,14 +336,14 @@
      {#Procedure (Named Procedure)}
      {#Global Global}))
 
-  (def: importP
+  (def importP
     (Parser Import)
     (all <>.or
          ..class
          (.form ..procedure)
          (.form (..named ..output))))
 
-  (def: (input_type input :it:)
+  (def (input_type input :it:)
     (-> Input Code Code)
     (let [:it: (if (the #try? input)
                  (` (.Either .Text (~ :it:)))
@@ -352,7 +352,7 @@
         (` ((~! io.IO) (~ :it:)))
         :it:)))
 
-  (def: (input_term input term)
+  (def (input_term input term)
     (-> Input Code Code)
     (let [term (if (the #try? input)
                  (` (.try (~ term)))
@@ -361,7 +361,7 @@
         (` ((~! io.io) (~ term)))
         term)))
 
-  (def: (procedure_definition import! source it)
+  (def (procedure_definition import! source it)
     (-> (List Code) Code (Named Procedure) Code)
     (let [g!it (|> (the #alias it)
                    (maybe.else (the #name it))
@@ -377,7 +377,7 @@
                       
                       parameters
                       (list#each ..output_type :parameters:))]
-      (` (.def: ((~ g!it) (~+ (case g!parameters
+      (` (.def ((~ g!it) (~+ (case g!parameters
                                 {.#End} (list g!it)
                                 _ (list#each (the #mandatory) g!parameters))))
            (.All ((~ g!it) (~+ g!variables))
@@ -393,19 +393,19 @@
                      (` ( (.as_expected (~ source))
                                  [(~+ (list#each ..host_optional g!parameters))]))))))))))
 
-  (def: (namespaced namespace class alias member)
+  (def (namespaced namespace class alias member)
     (-> Namespace Text Alias Text Text)
     (|> namespace
         (text.replaced "[1]" (maybe.else class alias))
         (text.replaced "[0]" member)))
 
-  (def: class_separator ".")
+  (def class_separator ".")
 
-  (def: host_path
+  (def host_path
     (text.replaced .module_separator ..class_separator))
 
   (for @.js (these)
-       (def: (imported class)
+       (def (imported class)
          (-> Text Code)
          (case (text.all_split_by .module_separator class)
            {.#Item head tail}
@@ -419,13 +419,13 @@
            {.#End}
            (` ( (~ (code.text class)))))))
 
-  (def: (global_definition import! it)
+  (def (global_definition import! it)
     (-> (List Code) Global Code)
     (let [g!name (|> (the #alias it)
                      (maybe.else (the #name it))
                      code.local)
           :output: (the #anonymous it)]
-      (` (.def: (~ g!name)
+      (` (.def (~ g!name)
            (~ (..output_type :output:))
            (.exec
              (~+ import!)
@@ -435,7 +435,7 @@
   
   (for @.lua (these)
        @.ruby (these)
-       (def: (constructor_definition [class_name class_parameters] alias namespace it)
+       (def (constructor_definition [class_name class_parameters] alias namespace it)
          (-> Declaration Alias Namespace Constructor Code)
          (let [g!it (|> it
                         (the #alias)
@@ -449,7 +449,7 @@
                g!class_variables (list#each code.local class_parameters)
                g!class (` ((~ (code.local (maybe.else class_name alias))) (~+ g!class_variables)))
                :output: [#optional? false #mandatory g!class]]
-           (` (.def: ((~ g!it) (~+ (case g!parameters
+           (` (.def ((~ g!it) (~+ (case g!parameters
                                      {.#End} (list g!it)
                                      _ (list#each (the #mandatory) g!parameters))))
                 (.All ((~ g!it) (~+ g!class_variables) (~+ g!input_variables))
@@ -465,7 +465,7 @@
                                                            (~ (..imported class_name))))))
                                   [(~+ (list#each ..host_optional g!parameters))]))))))))))
 
-  (def: (static_field_definition import! [class_name class_parameters] alias namespace it)
+  (def (static_field_definition import! [class_name class_parameters] alias namespace it)
     (-> (List Code) Declaration Alias Namespace (Named Output) Code)
     (let [field (the #name it)
           g!it (|> (the #alias it)
@@ -473,7 +473,7 @@
                    (..namespaced namespace class_name alias)
                    code.local)
           :field: (the #anonymous it)]
-      (` (def: (~ g!it)
+      (` (def (~ g!it)
            ((~! syntax) ((~ g!it) [])
             (.at (~! meta.monad) (~' in)
                  (.list (`' (.exec
@@ -485,7 +485,7 @@
                                                (` ( (~ (code.text field))
                                                          (~ (..imported class_name)))))))))))))))))
 
-  (def: (virtual_field_definition [class_name class_parameters] alias namespace it)
+  (def (virtual_field_definition [class_name class_parameters] alias namespace it)
     (-> Declaration Alias Namespace (Named Output) Code)
     (let [name (the #name it)
           g!it (|> (the #alias it)
@@ -496,7 +496,7 @@
           :field: (the #anonymous it)
           g!variables (list#each code.local class_parameters)
           g!class (` ((~ (code.local (maybe.else class_name alias))) (~+ g!variables)))]
-      (` (.def: ((~ g!it) (~ g!it))
+      (` (.def ((~ g!it) (~ g!it))
            (.All ((~ g!it) (~+ g!variables))
              (.-> (~ g!class)
                   (~ (..output_type :field:))))
@@ -504,13 +504,13 @@
             (~ (<| (lux_optional :field:)
                    (` ( (~ (code.text name)) (~ g!it))))))))))
 
-  (def: (field_definition import! class alias namespace it)
+  (def (field_definition import! class alias namespace it)
     (-> (List Code) Declaration Alias Namespace Field Code)
     (if (the #static? it)
       (..static_field_definition import! class alias namespace (the #member it))
       (..virtual_field_definition class alias namespace (the #member it))))
 
-  (def: (static_method_definition import! [class_name class_parameters] alias namespace it)
+  (def (static_method_definition import! [class_name class_parameters] alias namespace it)
     (-> (List Code) Declaration Alias Namespace (Named Procedure) Code)
     (let [method (the #name it)
           name (|> (the #alias it)
@@ -525,7 +525,7 @@
                                                  (.as (..Object .Any)
                                                       (~ (..imported class_name))))))))))
 
-  (def: (virtual_method_definition [class_name class_parameters] alias namespace it)
+  (def (virtual_method_definition [class_name class_parameters] alias namespace it)
     (-> Declaration Alias Namespace (Named Procedure) Code)
     (let [method (the #name it)
           g!it (|> (the #alias it)
@@ -540,7 +540,7 @@
           g!class_variables (list#each code.local class_parameters)
           g!class (` ((~ (code.local (maybe.else class_name alias))) (~+ g!class_variables)))
           :output: (the #output procedure)]
-      (` (.def: ((~ g!it) (~+ (list#each (the #mandatory) g!parameters)) (~ g!it))
+      (` (.def ((~ g!it) (~+ (list#each (the #mandatory) g!parameters)) (~ g!it))
            (.All ((~ g!it) (~+ g!class_variables) (~+ g!input_variables))
              (.-> (~+ (list#each ..output_type :parameters:))
                   (~ g!class)
@@ -554,13 +554,13 @@
                             (~ g!it)
                             [(~+ (list#each ..host_optional g!parameters))])))))))))
 
-  (def: (method_definition import! class alias namespace it)
+  (def (method_definition import! class alias namespace it)
     (-> (List Code) Declaration Alias Namespace Method Code)
     (if (the #static? it)
       (static_method_definition import! class alias namespace (the #member it))
       (virtual_method_definition class alias namespace (the #member it))))
 
-  (def: .public import
+  (def .public import
     (syntax (_ [host_module (<>.maybe .text)
                 it ..importP])
       (let [host_module_import! (is (List Code)
@@ -606,7 +606,7 @@
           ))))
 
   (for @.ruby (these)
-       (def: .public function
+       (def .public function
          (syntax (_ [[self inputs] (.form
                                     (all <>.and
                                          .local
@@ -622,11 +622,11 @@
                              (.function ((~ (code.local self)) [(~+ (list#each product.left inputs))])
                                (~ term)))))))))
 
-  (for @.js (these (def: .public type_of
+  (for @.js (these (def .public type_of
                      (template (type_of object)
                        [("js type-of" object)]))
 
-                   (def: .public global
+                   (def .public global
                      (syntax (_ [type .any
                                  [head tail] (.tuple (<>.and .local (<>.some .local)))])
                        (with_symbols [g!_]
@@ -652,7 +652,7 @@
                                                   (..global (~ type) [(~ (code.local (%.format head "." next)))
                                                                       (~+ (list#each code.local tail))]))))))))))))
 
-                   (def: !defined?
+                   (def !defined?
                      (template (_ )
                        [(.case (..global Any )
                           {.#None}
@@ -662,7 +662,7 @@
                           .true)]))
 
                    (with_template [ ]
-                     [(def: .public 
+                     [(def .public 
                         Bit
                         (!defined? ))]
 
@@ -670,7 +670,7 @@
                      [on_nashorn? [java lang Object]]
                      )
 
-                   (def: .public on_node_js?
+                   (def .public on_node_js?
                      Bit
                      (|> (..global (Object Any) [process])
                          (maybe#each (|>> []
@@ -682,7 +682,7 @@
                    ... These extensions must be defined this way because importing any of the modules
                    ... normally used when writing extensions would introduce a circular dependency
                    ... because the Archive type depends on Binary, and that module depends on this ffi module.
-                   (def: extension_name
+                   (def extension_name
                      (syntax (_ [])
                        (do meta.monad
                          [module meta.current_module_name
@@ -692,15 +692,15 @@
                    (with_expansions [ (..extension_name)
                                       (..extension_name)
                                       (..extension_name)]
-                     (these (def: extension_analysis
+                     (these (def extension_analysis
                               (template (_  )
                                 [{5 #1 [ ]}]))
 
-                            (def: text_analysis
+                            (def text_analysis
                               (template (_ )
                                 [{0 #0 {5 #1 }}]))
 
-                            (def: analysis
+                            (def analysis
                               (template (_     )
                                 [("lux def analysis" 
                                   (.function (_ name phase archive inputs)
@@ -714,7 +714,7 @@
                                           {try.#Success }
                                           )))))]))
 
-                            (def: generation
+                            (def generation
                               (template (_    )
                                 [("lux def generation" 
                                   (.function (_ name phase archive inputs)
@@ -738,7 +738,7 @@
                                         (list)
                                         {try.#Success [state js.undefined]})
 
-                            (def: .public undefined
+                            (def .public undefined
                               (template (undefined)
                                 [(.is ..Undefined ())]))
 
@@ -757,7 +757,7 @@
                                           [[state it] (phase archive it state)]
                                           (in [state (js.= js.undefined it)])))
 
-                            (def: .public undefined?
+                            (def .public undefined?
                               (template (undefined? )
                                 [(.as .Bit (.is .Any ( )))]))
 
@@ -774,11 +774,11 @@
                                                                    it)]
                                         (in [state (extension_analysis name (list.reversed output))])))
 
-                            (def: text_synthesis
+                            (def text_synthesis
                               (template (_ )
                                 [{0 #0 {2 #1 }}]))
 
-                            (def: (pairs it)
+                            (def (pairs it)
                               (All (_ a) (-> (List a) (List [a a])))
                               (case it
                                 (pattern (list.partial left right tail))
@@ -808,7 +808,7 @@
                                                                      (pairs (list.partial head_key head_value tail)))]
                                           (in [state (js.object (list.reversed output))])))
 
-                            (def: .public object
+                            (def .public object
                               (syntax (_ [it (<>.some .any)])
                                 (in (list (` (.as (..Object .Any)
                                                   ( (~+ it))))))))
diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux
index 2fa4e5b7a..c7d8c3dd2 100644
--- a/stdlib/source/library/lux/ffi.old.lux
+++ b/stdlib/source/library/lux/ffi.old.lux
@@ -28,7 +28,7 @@
    ["[0]" meta]]])
 
 (with_template [   ]
-  [(def: .public ( value)
+  [(def .public ( value)
      (-> (Primitive ) (Primitive ))
      ( value))]
 
@@ -64,11 +64,11 @@
   )
 
 (with_template [   ]
-  [(def: .public 
+  [(def .public 
      (template ( it)
        [(|> it (.is ) (.as (Primitive )))]))
 
-   (def: .public 
+   (def .public 
      (template ( it)
        [(|> it (.is (Primitive )) (.as ))]))]
 
@@ -79,11 +79,11 @@
   )
 
 (with_template [  <$>  <$'>  ]
-  [(def: .public 
+  [(def .public 
      (template ( it)
        [(|> it (.is ) (.as (Primitive )) <$> (.is (Primitive )))]))
 
-   (def: .public 
+   (def .public 
      (template ( it)
        [(|> it (.is (Primitive )) <$'> (.is (Primitive )) (.as ))]))]
 
@@ -94,8 +94,8 @@
   )
 
 ... [Utils]
-(def: constructor_method_name "")
-(def: member_separator "::")
+(def constructor_method_name "")
+(def member_separator "::")
 
 ... Types
 (type: JVM_Code
@@ -282,7 +282,7 @@
    {#FieldAccessDecl ImportFieldDecl}))
 
 ... Utils
-(def: (manual_primitive_type class)
+(def (manual_primitive_type class)
   (-> Text (Maybe Code))
   (case class
     (^.with_template [ ]
@@ -301,7 +301,7 @@
     _
     {.#None}))
 
-(def: (auto_primitive_type class)
+(def (auto_primitive_type class)
   (-> Text (Maybe Code))
   (case class
     (^.with_template [ ]
@@ -319,11 +319,11 @@
     _
     {.#None}))
 
-(def: safe
+(def safe
   (-> Text Text)
   (text.replaced "/" "."))
 
-(def: (generic_class_type' mode type_params in_array? name+params
+(def (generic_class_type' mode type_params in_array? name+params
                            class_type')
   (-> Primitive_Mode (List Type_Parameter) Bit [Text (List GenericType)]
       (-> Primitive_Mode (List Type_Parameter) Bit GenericType Code)
@@ -344,7 +344,7 @@
           =params (list#each (class_type' mode type_params in_array?) params)]
       (` (Primitive (~ (code.text name)) [(~+ =params)])))))
 
-(def: (class_type' mode type_params in_array? class)
+(def (class_type' mode type_params in_array? class)
   (-> Primitive_Mode (List Type_Parameter) Bit GenericType Code)
   (case class
     {#GenericTypeVar name}
@@ -374,15 +374,15 @@
     (class_type' mode type_params in_array? upper_bound)
     ))
 
-(def: (class_type mode type_params class)
+(def (class_type mode type_params class)
   (-> Primitive_Mode (List Type_Parameter) GenericType Code)
   (class_type' mode type_params #0 class))
 
-(def: (type_param_type$ [name bounds])
+(def (type_param_type$ [name bounds])
   (-> Type_Parameter Code)
   (code.symbol ["" name]))
 
-(def: (class_decl_type$ (open "[0]"))
+(def (class_decl_type$ (open "[0]"))
   (-> Class_Declaration Code)
   (let [=params (list#each (.is (-> Type_Parameter Code)
                                 (function (_ [pname pbounds])
@@ -396,9 +396,9 @@
     (` (Primitive (~ (code.text (safe #class_name)))
                   [(~+ =params)]))))
 
-(def: type_var_class Text "java.lang.Object")
+(def type_var_class Text "java.lang.Object")
 
-(def: (simple_class$ env class)
+(def (simple_class$ env class)
   (-> (List Type_Parameter) GenericType Text)
   (case class
     {#GenericTypeVar name}
@@ -443,21 +443,21 @@
       (format "[L" (simple_class$ env param) ";"))
     ))
 
-(def: (get_const_parser class_name field_name)
+(def (get_const_parser class_name field_name)
   (-> Text Text (Parser Code))
   (do <>.monad
     [.let [dotted_name (format "::" field_name)]
      _ (.this (code.symbol ["" dotted_name]))]
     (in (`' ((~ (code.text (format "jvm getstatic" ":" class_name ":" field_name))))))))
 
-(def: (get_var_parser class_name field_name)
+(def (get_var_parser class_name field_name)
   (-> Text Text (Parser Code))
   (do <>.monad
     [.let [dotted_name (format "::" field_name)]
      _ (.this (code.symbol ["" dotted_name]))]
     (in (`' ((~ (code.text (format "jvm getfield" ":" class_name ":" field_name))) _jvm_this)))))
 
-(def: (put_var_parser class_name field_name)
+(def (put_var_parser class_name field_name)
   (-> Text Text (Parser Code))
   (do <>.monad
     [.let [dotted_name (format "::" field_name)]
@@ -465,7 +465,7 @@
                       (.form (all <>.and (.this (' :=)) (.this (code.symbol ["" dotted_name])) .any)))]
     (in (`' ((~ (code.text (format "jvm putfield" ":" class_name ":" field_name))) _jvm_this (~ value))))))
 
-(def: (pre_walk_replace f input)
+(def (pre_walk_replace f input)
   (-> (-> Code Code) Code Code)
   (case (f input)
     (^.with_template []
@@ -478,7 +478,7 @@
     ast'
     ast'))
 
-(def: (parser_replacer p ast)
+(def (parser_replacer p ast)
   (-> (Parser Code) (-> Code Code))
   (case (<>.result p (list ast))
     {.#Right [{.#End} ast']}
@@ -488,7 +488,7 @@
     ast
     ))
 
-(def: (field_parser class_name [[field_name _ _] field])
+(def (field_parser class_name [[field_name _ _] field])
   (-> Text [Member_Declaration FieldDecl] (Parser Code))
   (case field
     {#ConstantField _}
@@ -498,7 +498,7 @@
     (<>.either (get_var_parser class_name field_name)
                (put_var_parser class_name field_name))))
 
-(def: (constructor_parser params class_name arg_decls)
+(def (constructor_parser params class_name arg_decls)
   (-> (List Type_Parameter) Text (List ArgDecl) (Parser Code))
   (do <>.monad
     [args (.is (Parser (List Code))
@@ -508,7 +508,7 @@
     (in (` ((~ (code.text (format "jvm new" ":" class_name ":" (text.interposed "," arg_decls'))))
             (~+ args))))))
 
-(def: (static_method_parser params class_name method_name arg_decls)
+(def (static_method_parser params class_name method_name arg_decls)
   (-> (List Type_Parameter) Text Text (List ArgDecl) (Parser Code))
   (do <>.monad
     [.let [dotted_name (format "::" method_name "!")]
@@ -520,7 +520,7 @@
              (~+ args))))))
 
 (with_template [ ]
-  [(def: ( params class_name method_name arg_decls)
+  [(def ( params class_name method_name arg_decls)
      (-> (List Type_Parameter) Text Text (List ArgDecl) (Parser Code))
      (do <>.monad
        [.let [dotted_name (format "::" method_name "!")]
@@ -535,7 +535,7 @@
   [virtual_method_parser "jvm invokevirtual"]
   )
 
-(def: (method_parser params class_name [[method_name _ _] meth_def])
+(def (method_parser params class_name [[method_name _ _] meth_def])
   (-> (List Type_Parameter) Text [Member_Declaration Method_Definition] (Parser Code))
   (case meth_def
     {#ConstructorMethod strict? type_vars args constructor_args return_expr exs}
@@ -555,7 +555,7 @@
     (virtual_method_parser params class_name method_name args)))
 
 ... Parsers
-(def: privacy_modifier^
+(def privacy_modifier^
   (Parser Privacy)
   (let [(open "[0]") <>.monad]
     (all <>.or
@@ -564,7 +564,7 @@
          (.this (' "protected"))
          (in []))))
 
-(def: inheritance_modifier^
+(def inheritance_modifier^
   (Parser Inheritance)
   (let [(open "[0]") <>.monad]
     (all <>.or
@@ -572,17 +572,17 @@
          (.this (' "abstract"))
          (in []))))
 
-(def: bound_kind^
+(def bound_kind^
   (Parser BoundKind)
   (<>.or (.this (' <))
          (.this (' >))))
 
-(def: (no_periods_assertion name)
+(def (no_periods_assertion name)
   (-> Text (Parser Any))
   (<>.assertion "Names in class declarations cannot contain periods."
                 (not (text.contains? "." name))))
 
-(def: (generic_type^ type_vars)
+(def (generic_type^ type_vars)
   (-> (List Type_Parameter) (Parser GenericType))
   (<>.rec
    (function (_ again^)
@@ -627,7 +627,7 @@
                          (in {#GenericClass name params})))
           ))))
 
-(def: type_param^
+(def type_param^
   (Parser Type_Parameter)
   (<>.either (do <>.monad
                [param_name .local]
@@ -638,14 +638,14 @@
                               bounds (<>.many (..generic_type^ (list)))]
                              (in [param_name bounds])))))
 
-(def: type_params^
+(def type_params^
   (Parser (List Type_Parameter))
   (|> ..type_param^
       <>.some
       .tuple
       (<>.else (list))))
 
-(def: class_decl^
+(def class_decl^
   (Parser Class_Declaration)
   (<>.either (do <>.monad
                [name .local
@@ -658,7 +658,7 @@
                             (in [name params])))
              ))
 
-(def: (super_class_decl^ type_vars)
+(def (super_class_decl^ type_vars)
   (-> (List Type_Parameter) (Parser Super_Class_Decl))
   (<>.either (do <>.monad
                [name .local
@@ -670,11 +670,11 @@
                              params (<>.some (..generic_type^ type_vars))]
                             (in [name params])))))
 
-(def: annotation_params^
+(def annotation_params^
   (Parser (List AnnotationParam))
   (.tuple (<>.some (<>.and .text .any))))
 
-(def: annotation^
+(def annotation^
   (Parser Annotation)
   (<>.either (do <>.monad
                [ann_name .local]
@@ -682,31 +682,31 @@
              (.form (<>.and .local
                                   annotation_params^))))
 
-(def: annotations^'
+(def annotations^'
   (Parser (List Annotation))
   (do <>.monad
     [_ (.this (' "ann"))]
     (.tuple (<>.some ..annotation^))))
 
-(def: annotations^
+(def annotations^
   (Parser (List Annotation))
   (do <>.monad
     [anns?? (<>.maybe ..annotations^')]
     (in (maybe.else (list) anns??))))
 
-(def: (throws_decl'^ type_vars)
+(def (throws_decl'^ type_vars)
   (-> (List Type_Parameter) (Parser (List GenericType)))
   (do <>.monad
     [_ (.this (' "throws"))]
     (.tuple (<>.some (..generic_type^ type_vars)))))
 
-(def: (throws_decl^ type_vars)
+(def (throws_decl^ type_vars)
   (-> (List Type_Parameter) (Parser (List GenericType)))
   (do <>.monad
     [exs? (<>.maybe (throws_decl'^ type_vars))]
     (in (maybe.else (list) exs?))))
 
-(def: (method_decl^ type_vars)
+(def (method_decl^ type_vars)
   (-> (List Type_Parameter) (Parser [Member_Declaration MethodDecl]))
   (.form (do <>.monad
                  [tvars ..type_params^
@@ -720,14 +720,14 @@
                                               #method_output output
                                               #method_exs    exs]]))))
 
-(def: state_modifier^
+(def state_modifier^
   (Parser State)
   (all <>.or
        (.this (' "volatile"))
        (.this (' "final"))
        (at <>.monad in [])))
 
-(def: (field_decl^ type_vars)
+(def (field_decl^ type_vars)
   (-> (List Type_Parameter) (Parser [Member_Declaration FieldDecl]))
   (<>.either (.form (do <>.monad
                             [_ (.this (' "const"))
@@ -744,24 +744,24 @@
                              type (..generic_type^ type_vars)]
                             (in [[name pm anns] {#VariableField [sm type]}])))))
 
-(def: (arg_decl^ type_vars)
+(def (arg_decl^ type_vars)
   (-> (List Type_Parameter) (Parser ArgDecl))
   (<>.and .local
           (..generic_type^ type_vars)))
 
-(def: (arg_decls^ type_vars)
+(def (arg_decls^ type_vars)
   (-> (List Type_Parameter) (Parser (List ArgDecl)))
   (.tuple (<>.some (arg_decl^ type_vars))))
 
-(def: (constructor_arg^ type_vars)
+(def (constructor_arg^ type_vars)
   (-> (List Type_Parameter) (Parser ConstructorArg))
   (<>.and (..generic_type^ type_vars) .any))
 
-(def: (constructor_args^ type_vars)
+(def (constructor_args^ type_vars)
   (-> (List Type_Parameter) (Parser (List ConstructorArg)))
   (.tuple (<>.some (constructor_arg^ type_vars))))
 
-(def: (constructor_method^ class_vars)
+(def (constructor_method^ class_vars)
   (-> (List Type_Parameter) (Parser [Member_Declaration Method_Definition]))
   (.form (do <>.monad
                  [pm privacy_modifier^
@@ -779,7 +779,7 @@
                        #member_anns annotations]
                       {#ConstructorMethod strict_fp? method_vars arg_decls constructor_args body exs}]))))
 
-(def: (virtual_method_def^ class_vars)
+(def (virtual_method_def^ class_vars)
   (-> (List Type_Parameter) (Parser [Member_Declaration Method_Definition]))
   (.form (do <>.monad
                  [pm privacy_modifier^
@@ -803,7 +803,7 @@
                                       this_name arg_decls return_type
                                       body exs}]))))
 
-(def: overriden_method_def^
+(def overriden_method_def^
   (Parser [Member_Declaration Method_Definition])
   (.form (do <>.monad
                  [strict_fp? (<>.parses? (.this (' "strict")))
@@ -826,7 +826,7 @@
                                         this_name arg_decls return_type
                                         body exs}]))))
 
-(def: static_method_def^
+(def static_method_def^
   (Parser [Member_Declaration Method_Definition])
   (.form (do <>.monad
                  [pm privacy_modifier^
@@ -845,7 +845,7 @@
                        #member_anns annotations]
                       {#StaticMethod strict_fp? method_vars arg_decls return_type body exs}]))))
 
-(def: abstract_method_def^
+(def abstract_method_def^
   (Parser [Member_Declaration Method_Definition])
   (.form (do <>.monad
                  [pm privacy_modifier^
@@ -862,7 +862,7 @@
                        #member_anns annotations]
                       {#AbstractMethod method_vars arg_decls return_type exs}]))))
 
-(def: native_method_def^
+(def native_method_def^
   (Parser [Member_Declaration Method_Definition])
   (.form (do <>.monad
                  [pm privacy_modifier^
@@ -879,7 +879,7 @@
                        #member_anns annotations]
                       {#NativeMethod method_vars arg_decls return_type exs}]))))
 
-(def: (method_def^ class_vars)
+(def (method_def^ class_vars)
   (-> (List Type_Parameter) (Parser [Member_Declaration Method_Definition]))
   (all <>.either
        (..constructor_method^ class_vars)
@@ -889,30 +889,30 @@
        ..abstract_method_def^
        ..native_method_def^))
 
-(def: partial_call^
+(def partial_call^
   (Parser Partial_Call)
   (.form (<>.and .symbol (<>.some .any))))
 
-(def: import_member_alias^
+(def import_member_alias^
   (Parser (Maybe Text))
   (<>.maybe (do <>.monad
               [_ (.this (' "as"))]
               .local)))
 
-(def: (import_member_args^ type_vars)
+(def (import_member_args^ type_vars)
   (-> (List Type_Parameter) (Parser (List [Bit GenericType])))
   (.tuple (<>.some (<>.and (<>.parses? (.this (' "?"))) (..generic_type^ type_vars)))))
 
-(def: import_member_return_flags^
+(def import_member_return_flags^
   (Parser [Bit Bit Bit])
   (all <>.and (<>.parses? (.this (' "io"))) (<>.parses? (.this (' "try"))) (<>.parses? (.this (' "?")))))
 
-(def: primitive_mode^
+(def primitive_mode^
   (Parser Primitive_Mode)
   (<>.or (.this (' "manual"))
          (.this (' "auto"))))
 
-(def: (import_member_decl^ owner_vars)
+(def (import_member_decl^ owner_vars)
   (-> (List Type_Parameter) (Parser Import_Member_Declaration))
   (all <>.either
        (.form (do <>.monad
@@ -974,19 +974,19 @@
        ))
 
 ... Generators
-(def: with_parens
+(def with_parens
   (-> JVM_Code JVM_Code)
   (text.enclosed ["(" ")"]))
 
-(def: with_brackets
+(def with_brackets
   (-> JVM_Code JVM_Code)
   (text.enclosed ["[" "]"]))
 
-(def: spaced
+(def spaced
   (-> (List JVM_Code) JVM_Code)
   (text.interposed " "))
 
-(def: (privacy_modifier$ pm)
+(def (privacy_modifier$ pm)
   (-> Privacy JVM_Code)
   (case pm
     {#PublicP}    "public"
@@ -994,28 +994,28 @@
     {#ProtectedP} "protected"
     {#DefaultP}   "default"))
 
-(def: (inheritance_modifier$ im)
+(def (inheritance_modifier$ im)
   (-> Inheritance JVM_Code)
   (case im
     {#FinalI}    "final"
     {#AbstractI} "abstract"
     {#DefaultI}  "default"))
 
-(def: (annotation_param$ [name value])
+(def (annotation_param$ [name value])
   (-> AnnotationParam JVM_Code)
   (format name "=" (code.format value)))
 
-(def: (annotation$ [name params])
+(def (annotation$ [name params])
   (-> Annotation JVM_Code)
   (format "(" name " " "{" (text.interposed text.tab (list#each annotation_param$ params)) "}" ")"))
 
-(def: (bound_kind$ kind)
+(def (bound_kind$ kind)
   (-> BoundKind JVM_Code)
   (case kind
     {#UpperBound} "<"
     {#LowerBound} ">"))
 
-(def: (generic_type$ gtype)
+(def (generic_type$ gtype)
   (-> GenericType JVM_Code)
   (case gtype
     {#GenericTypeVar name}
@@ -1033,21 +1033,21 @@
     {#GenericWildcard {.#Some [bound_kind bound]}}
     (format (bound_kind$ bound_kind) (generic_type$ bound))))
 
-(def: (type_param$ [name bounds])
+(def (type_param$ [name bounds])
   (-> Type_Parameter JVM_Code)
   (format "(" name " " (spaced (list#each generic_type$ bounds)) ")"))
 
-(def: (class_decl$ (open "[0]"))
+(def (class_decl$ (open "[0]"))
   (-> Class_Declaration JVM_Code)
   (format "(" (safe #class_name) " " (spaced (list#each type_param$ #class_params)) ")"))
 
-(def: (super_class_decl$ (open "[0]"))
+(def (super_class_decl$ (open "[0]"))
   (-> Super_Class_Decl JVM_Code)
   (format "(" (safe #super_class_name)
           " " (spaced (list#each generic_type$ #super_class_params))
           ")"))
 
-(def: (method_decl$ [[name pm anns] method_decl])
+(def (method_decl$ [[name pm anns] method_decl])
   (-> [Member_Declaration MethodDecl] JVM_Code)
   (let [(open "[0]") method_decl]
     (with_parens
@@ -1059,14 +1059,14 @@
                     (generic_type$ #method_output))
               ))))
 
-(def: (state_modifier$ sm)
+(def (state_modifier$ sm)
   (-> State JVM_Code)
   (case sm
     {#VolatileS} "volatile"
     {#FinalS}    "final"
     {#DefaultS}  "default"))
 
-(def: (field_decl$ [[name pm anns] field])
+(def (field_decl$ [[name pm anns] field])
   (-> [Member_Declaration FieldDecl] JVM_Code)
   (case field
     {#ConstantField class value}
@@ -1087,17 +1087,17 @@
               ))
     ))
 
-(def: (arg_decl$ [name type])
+(def (arg_decl$ [name type])
   (-> ArgDecl JVM_Code)
   (with_parens
     (spaced (list name (generic_type$ type)))))
 
-(def: (constructor_arg$ [class term])
+(def (constructor_arg$ [class term])
   (-> ConstructorArg JVM_Code)
   (with_brackets
     (spaced (list (generic_type$ class) (code.format term)))))
 
-(def: (method_def$ replacer super_class [[name pm anns] method_def])
+(def (method_def$ replacer super_class [[name pm anns] method_def])
   (-> (-> Code Code) Super_Class_Decl [Member_Declaration Method_Definition] JVM_Code)
   (case method_def
     {#ConstructorMethod strict_fp? type_vars arg_decls constructor_args body exs}
@@ -1192,17 +1192,17 @@
                     (generic_type$ return_type))))
     ))
 
-(def: (complete_call$ g!obj [method args])
+(def (complete_call$ g!obj [method args])
   (-> Code Partial_Call Code)
   (` ((~ (code.symbol method)) (~+ args) (~ g!obj))))
 
 ... [Syntax]
-(def: object_super_class
+(def object_super_class
   Super_Class_Decl
   [#super_class_name   "java/lang/Object"
    #super_class_params (list)])
 
-(def: .public class
+(def .public class
   (syntax (_ [im inheritance_modifier^
               class_decl ..class_decl^
               .let [full_class_name (product.left class_decl)]
@@ -1232,7 +1232,7 @@
                                             (with_brackets (spaced (list#each (method_def$ replacer super) methods))))))]]
       (in (list (` ((~ (code.text def_code)))))))))
 
-(def: .public interface
+(def .public interface
   (syntax (_ [class_decl ..class_decl^
               .let [class_vars (product.right class_decl)]
               supers (<>.else (list)
@@ -1246,7 +1246,7 @@
                                          (spaced (list#each method_decl$ members)))))]
       (in (list (` ((~ (code.text def_code)))))))))
 
-(def: .public object
+(def .public object
   (syntax (_ [class_vars (.tuple (<>.some ..type_param^))
               super (<>.else object_super_class
                              (..super_class_decl^ class_vars))
@@ -1261,15 +1261,15 @@
                                          (with_brackets (spaced (list#each (method_def$ function.identity super) methods))))))]
       (in (list (` ((~ (code.text def_code)))))))))
 
-(def: .public null
+(def .public null
   (syntax (_ [])
     (in (list (` ("jvm object null"))))))
 
-(def: .public (null? obj)
+(def .public (null? obj)
   (-> (Primitive "java.lang.Object") Bit)
   ("jvm object null?" obj))
 
-(def: .public ???
+(def .public ???
   (syntax (_ [expr .any])
     (with_symbols [g!temp]
       (in (list (` (let [(~ g!temp) (~ expr)]
@@ -1277,7 +1277,7 @@
                        {.#None}
                        {.#Some (~ g!temp)}))))))))
 
-(def: .public !!!
+(def .public !!!
   (syntax (_ [expr .any])
     (with_symbols [g!value]
       (in (list (` (.case (~ expr)
@@ -1287,7 +1287,7 @@
                      {.#None}
                      ("jvm object null"))))))))
 
-(def: .public as
+(def .public as
   (syntax (_ [class (..generic_type^ (list))
               unchecked (<>.maybe .any)])
     (with_symbols [g!_ g!unchecked]
@@ -1310,12 +1310,12 @@
                               (~ check_code))))))
           )))))
 
-(def: .public synchronized
+(def .public synchronized
   (syntax (_ [lock .any
               body .any])
     (in (list (` ("jvm object synchronized" (~ lock) (~ body)))))))
 
-(def: .public do_to
+(def .public do_to
   (syntax (_ [obj .any
               methods (<>.some partial_call^)])
     (with_symbols [g!obj]
@@ -1323,17 +1323,17 @@
                      (exec (~+ (list#each (complete_call$ g!obj) methods))
                        (~ g!obj)))))))))
 
-(def: (class_import$ [full_name params])
+(def (class_import$ [full_name params])
   (-> Class_Declaration Code)
   (let [params' (list#each (|>> product.left code.local) params)]
     (template.with_locals [g!_]
-      (` (def: (~ (code.symbol ["" full_name]))
+      (` (def (~ (code.symbol ["" full_name]))
            Type
            (All ((~ (' g!_)) (~+ params'))
              (Primitive (~ (code.text (safe full_name)))
                         [(~+ params')])))))))
 
-(def: (member_type_vars class_tvars member)
+(def (member_type_vars class_tvars member)
   (-> (List Type_Parameter) Import_Member_Declaration (List Type_Parameter))
   (case member
     {#ConstructorDecl [commons _]}
@@ -1350,7 +1350,7 @@
     _
     class_tvars))
 
-(def: (member_def_arg_bindings type_params class member)
+(def (member_def_arg_bindings type_params class member)
   (-> (List Type_Parameter) Class_Declaration Import_Member_Declaration (Meta [(List [Bit Code]) (List Text) (List Code)]))
   (case member
     (^.or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]})
@@ -1377,7 +1377,7 @@
     _
     (at meta.monad in [(list) (list) (list)])))
 
-(def: (decorate_return_maybe class member return_term)
+(def (decorate_return_maybe class member return_term)
   (-> Class_Declaration Import_Member_Declaration Code Code)
   (case member
     (^.or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]})
@@ -1396,7 +1396,7 @@
     return_term))
 
 (with_template [  ]
-  [(def: ( member return_term)
+  [(def ( member return_term)
      (-> Import_Member_Declaration Code Code)
      (case member
        (^.or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]})
@@ -1411,18 +1411,18 @@
   [decorate_return_io  #import_member_io?  (` ((~! io.io) (~ return_term)))]
   )
 
-(def: (free_type_param? [name bounds])
+(def (free_type_param? [name bounds])
   (-> Type_Parameter Bit)
   (case bounds
     {.#End} #1
     _       #0))
 
-(def: (lux_type_parameter [name _])
+(def (lux_type_parameter [name _])
   (-> Type_Parameter Code)
   (code.symbol ["" name]))
 
 (with_template [    ]
-  [(def: ( mode [class expression])
+  [(def ( mode [class expression])
      (-> Primitive_Mode [Text Code] Code)
      (case mode
        {#ManualPrM}
@@ -1435,11 +1435,11 @@
   [auto_convert_output byte_to_long short_to_long int_to_long float_to_double]
   )
 
-(def: (un_quote quoted)
+(def (un_quote quoted)
   (-> Code Code)
   (` ((~' ~) (~ quoted))))
 
-(def: (jvm_extension_inputs mode classes inputs)
+(def (jvm_extension_inputs mode classes inputs)
   (-> Primitive_Mode (List Text) (List [Bit Code]) (List Code))
   (|> inputs
       (list#each (function (_ [maybe? input])
@@ -1449,19 +1449,19 @@
       (list.zipped_2 classes)
       (list#each (auto_convert_input mode))))
 
-(def: (import_name format class member)
+(def (import_name format class member)
   (-> Text Text Text Text)
   (|> format
       (text.replaced "[1]" class)
       (text.replaced "[0]" member)))
 
-(def: syntax_inputs
+(def syntax_inputs
   (-> (List Code) (List Code))
   (|>> (list#each (function (_ name)
                     (list name (` (~! .any)))))
        list#conjoint))
 
-(def: (member_def_interop type_params kind class [arg_function_inputs arg_classes arg_types] member method_prefix import_format)
+(def (member_def_interop type_params kind class [arg_function_inputs arg_classes arg_types] member method_prefix import_format)
   (-> (List Type_Parameter) Class_Kind Class_Declaration [(List [Bit Code]) (List Text) (List Code)] Import_Member_Declaration Text Text (Meta (List Code)))
   (let [[full_name class_tvars] class
         full_name (safe full_name)
@@ -1485,7 +1485,7 @@
                  getter_interop (.is (-> Text Code)
                                      (function (_ name)
                                        (let [getter_name (code.symbol ["" (..import_name import_format method_prefix name)])]
-                                         (` (def: (~ getter_name)
+                                         (` (def (~ getter_name)
                                               (~ enum_type)
                                               ((~ (code.text (format "jvm getstatic" ":" full_name ":" name)))))))))]]
           (in (list#each getter_interop enum_members))))
@@ -1499,7 +1499,7 @@
                                (decorate_return_maybe class member)
                                (decorate_return_try member)
                                (decorate_return_io member))]]
-        (in (list (` (def: (~ def_name)
+        (in (list (` (def (~ def_name)
                        ((~! syntax) ((~ def_name) [(~+ (syntax_inputs (list#each product.right arg_function_inputs)))])
                         ((~' in) (.list (.` (~ jvm_interop))))))))))
 
@@ -1533,7 +1533,7 @@
                                  (decorate_return_maybe class member)
                                  (decorate_return_try member)
                                  (decorate_return_io member))]]
-          (in (list (` (def: (~ def_name)
+          (in (list (` (def (~ def_name)
                          ((~! syntax) ((~ def_name) [(~+ (syntax_inputs (list#each product.right arg_function_inputs)))
                                                      (~+ (syntax_inputs object_ast))])
                           ((~' in) (.list (.` (~ jvm_interop)))))))))))
@@ -1569,7 +1569,7 @@
                                 getter_body (if #import_field_setter?
                                               (` ((~! io.io) (~ getter_body)))
                                               getter_body)]
-                            (in (` (def: (~ getter_name)
+                            (in (` (def (~ getter_name)
                                      ((~! syntax) (~ getter_call)
                                       ((~' in) (.list (.` (~ getter_body))))))))))
          setter_interop (.is (Meta (List Code))
@@ -1590,14 +1590,14 @@
                                                    (if #import_field_static?
                                                      (list)
                                                      (list (un_quote g!obj))))]
-                                   (in (list (` (def: (~ setter_name)
+                                   (in (list (` (def (~ setter_name)
                                                   ((~! syntax) (~ setter_call)
                                                    ((~' in) (.list (.` ((~! io.io) ((~ (code.text setter_command)) (~+ g!obj+) (~ setter_value)))))))))))))
                                (in (list))))]
         (in (list.partial getter_interop setter_interop)))
       )))
 
-(def: (member_import$ type_params kind class [import_format member])
+(def (member_import$ type_params kind class [import_format member])
   (-> (List Type_Parameter) Class_Kind Class_Declaration [Text Import_Member_Declaration] (Meta (List Code)))
   (let [[method_prefix _] class]
     (do meta.monad
@@ -1607,15 +1607,15 @@
 (type: (java/lang/Class a)
   (Primitive "java.lang.Class" [a]))
 
-(def: interface?
+(def interface?
   (All (_ a) (-> (java/lang/Class a) Bit))
   (|>> "jvm invokevirtual:java.lang.Class:isInterface:"))
 
-(def: (load_class class_name)
+(def (load_class class_name)
   (-> Text (Try (java/lang/Class Any)))
   (try ("jvm invokestatic:java.lang.Class:forName:java.lang.String" class_name)))
 
-(def: (class_kind [class_name _])
+(def (class_kind [class_name _])
   (-> Class_Declaration (Meta Class_Kind))
   (let [class_name (..safe class_name)]
     (case (..load_class class_name)
@@ -1628,7 +1628,7 @@
       (meta.failure (format "Cannot load class: " class_name text.new_line
                             error)))))
 
-(def: .public import
+(def .public import
   (syntax (_ [class_decl ..class_decl^
               import_format .text
               members (<>.some (..import_member_decl^ (product.right class_decl)))])
@@ -1639,7 +1639,7 @@
                     (monad.each ! (member_import$ (product.right class_decl) kind class_decl)))]
       (in (list.partial (class_import$ class_decl) (list#conjoint =members))))))
 
-(def: .public array
+(def .public array
   (syntax (_ [type (..generic_type^ (list))
               size .any])
     (case type
@@ -1658,11 +1658,11 @@
       _
       (in (list (` ("jvm anewarray" (~ (code.text (generic_type$ type))) (~ size))))))))
 
-(def: .public length
+(def .public length
   (syntax (_ [array .any])
     (in (list (` ("jvm arraylength" (~ array)))))))
 
-(def: (type_class_name type)
+(def (type_class_name type)
   (-> Type (Meta Text))
   (if (type#= Any type)
     (at meta.monad in "java.lang.Object")
@@ -1684,7 +1684,7 @@
       _
       (meta.failure (format "Cannot convert to JvmType: " (type.format type))))))
 
-(def: .public read!
+(def .public read!
   (syntax (_ [idx .any
               array .any])
     (case array
@@ -1713,7 +1713,7 @@
         (in (list (` (let [(~ g!array) (~ array)]
                        (..read! (~ idx) (~ g!array))))))))))
 
-(def: .public write!
+(def .public write!
   (syntax (_ [idx .any
               value .any
               array .any])
@@ -1743,14 +1743,14 @@
         (in (list (` (let [(~ g!array) (~ array)]
                        (..write! (~ idx) (~ value) (~ g!array))))))))))
 
-(def: .public class_for
+(def .public class_for
   (syntax (_ [type (..generic_type^ (list))])
     (in (list (` ("jvm object class" (~ (code.text (simple_class$ (list) type)))))))))
 
-(def: .public type
+(def .public type
   (syntax (_ [type (..generic_type^ (list))])
     (in (list (..class_type {#ManualPrM} (list) type)))))
 
-(def: .public is
+(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 f354972a3..36f828a48 100644
--- a/stdlib/source/library/lux/ffi.php.lux
+++ b/stdlib/source/library/lux/ffi.php.lux
@@ -48,7 +48,7 @@
 (type: Nullable
   [Bit Code])
 
-(def: nullable
+(def nullable
   (Parser Nullable)
   (let [token (' "?")]
     (<| (<>.and (<>.parses? (.this token)))
@@ -58,18 +58,18 @@
 (type: Alias
   Text)
 
-(def: alias
+(def alias
   (Parser Alias)
   (<>.after (.this (' "as")) .local))
 
 (type: Field
   [Bit Text (Maybe Alias) Nullable])
 
-(def: static!
+(def static!
   (Parser Any)
   (.this (' "static")))
 
-(def: field
+(def field
   (Parser Field)
   (.form (all <>.and
                     (<>.parses? ..static!)
@@ -77,7 +77,7 @@
                     (<>.maybe ..alias)
                     ..nullable)))
 
-(def: constant
+(def constant
   (Parser Field)
   (.form (all <>.and
                     (<>#in true)
@@ -102,7 +102,7 @@
    {#Static Static_Method}
    {#Virtual Virtual_Method}))
 
-(def: common_method
+(def common_method
   (Parser Common_Method)
   (all <>.and
        .local
@@ -112,10 +112,10 @@
        (<>.parses? (.this (' "try")))
        ..nullable))
 
-(def: static_method
+(def static_method
   (<>.after ..static! ..common_method))
 
-(def: method
+(def method
   (Parser Method)
   (.form (<>.or ..static_method
                       ..common_method)))
@@ -125,26 +125,26 @@
    {#Field Field}
    {#Method Method}))
 
-(def: member
+(def member
   (Parser Member)
   (all <>.or
        ..field
        ..method
        ))
 
-(def: input_variables
+(def input_variables
   (-> (List Nullable) (List [Bit Code]))
   (|>> list.enumeration
        (list#each (function (_ [idx [nullable? type]])
                     [nullable? (|> idx %.nat code.local)]))))
 
-(def: (nullable_type [nullable? type])
+(def (nullable_type [nullable? type])
   (-> Nullable Code)
   (if nullable?
     (` (.Maybe (~ type)))
     type))
 
-(def: (with_null g!temp [nullable? input])
+(def (with_null g!temp [nullable? input])
   (-> Code [Bit Code] Code)
   (if nullable?
     (` (case (~ input)
@@ -155,7 +155,7 @@
          ("php object null")))
     input))
 
-(def: (without_null g!temp [nullable? outputT] output)
+(def (without_null g!temp [nullable? outputT] output)
   (-> Code Nullable Code Code)
   (if nullable?
     (` (let [(~ g!temp) (~ output)]
@@ -173,7 +173,7 @@
    {#Function Static_Method}
    {#Constant Field}))
 
-(def: import
+(def import
   (Parser Import)
   (all <>.or
        (all <>.and
@@ -186,7 +186,7 @@
        ..constant
        ))
 
-(def: .public try
+(def .public try
   (syntax (_ [expression .any])
     ... {.#doc (example (case (try (risky_computation input))
     ...                   {.#Right success}
@@ -196,34 +196,34 @@
     ...                   (recover_from_failure error)))}
     (in (list (` ("lux try" ((~! io.io) (~ expression))))))))
 
-(def: (with_io with? without)
+(def (with_io with? without)
   (-> Bit Code Code)
   (if with?
     (` ((~! io.io) (~ without)))
     without))
 
-(def: (io_type io? rawT)
+(def (io_type io? rawT)
   (-> Bit Code Code)
   (if io?
     (` ((~! io.IO) (~ rawT)))
     rawT))
 
-(def: (with_try with? without_try)
+(def (with_try with? without_try)
   (-> Bit Code Code)
   (if with?
     (` (..try (~ without_try)))
     without_try))
 
-(def: (try_type try? rawT)
+(def (try_type try? rawT)
   (-> Bit Code Code)
   (if try?
     (` (.Either .Text (~ rawT)))
     rawT))
 
-(def: (make_function g!method g!temp source inputsT io? try? outputT)
+(def (make_function g!method g!temp source inputsT io? try? outputT)
   (-> Code Code Code (List Nullable) Bit Bit Nullable Code)
   (let [g!inputs (input_variables inputsT)]
-    (` (def: ((~ g!method)
+    (` (def ((~ g!method)
               [(~+ (list#each product.right g!inputs))])
          (-> [(~+ (list#each nullable_type inputsT))]
              (~ (|> (nullable_type outputT)
@@ -237,7 +237,7 @@
                      (as ..Function (~ source))
                      (~+ (list#each (with_null g!temp) g!inputs)))))))))))
 
-(def: .public import
+(def .public import
   (syntax (_ [import ..import])
     (with_symbols [g!temp]
       (case import
@@ -258,12 +258,12 @@
                                              {#Field [static? field alias fieldT]}
                                              (let [g!field (qualify (maybe.else field alias))]
                                                (if static?
-                                                 (` (def: (~ g!field)
+                                                 (` (def (~ g!field)
                                                       ((~! syntax) ((~ g!field) [])
                                                        (at (~! meta.monad) (~' in)
                                                            (list (` (.as (~ (nullable_type fieldT))
                                                                          ("php constant" (~ (code.text (%.format class "::" field)))))))))))
-                                                 (` (def: ((~ g!field) (~ g!object))
+                                                 (` (def ((~ g!field) (~ g!object))
                                                       (-> (~ g!type)
                                                           (~ (nullable_type fieldT)))
                                                       (as_expected
@@ -285,7 +285,7 @@
                                                
                                                {#Virtual [method alias inputsT io? try? outputT]}
                                                (let [g!inputs (input_variables inputsT)]
-                                                 (` (def: ((~ (qualify (maybe.else method alias)))
+                                                 (` (def ((~ (qualify (maybe.else method alias)))
                                                            [(~+ (list#each product.right g!inputs))]
                                                            (~ g!object))
                                                       (-> [(~+ (list#each nullable_type inputsT))]
@@ -316,7 +316,7 @@
         {#Constant [_ name alias fieldT]}
         (let [imported (` ("php constant" (~ (code.text name))))
               g!name (code.local (maybe.else name alias))]
-          (in (list (` (def: (~ g!name)
+          (in (list (` (def (~ g!name)
                          ((~! syntax) ((~ g!name) [])
                           (at (~! meta.monad) (~' in)
                               (list (` (.as (~ (nullable_type fieldT)) (~ imported)))))))))))
diff --git a/stdlib/source/library/lux/ffi.scm.lux b/stdlib/source/library/lux/ffi.scm.lux
index 79b59264d..0b4918927 100644
--- a/stdlib/source/library/lux/ffi.scm.lux
+++ b/stdlib/source/library/lux/ffi.scm.lux
@@ -48,7 +48,7 @@
 (type: Nilable
   [Bit Code])
 
-(def: nilable
+(def nilable
   (Parser Nilable)
   (let [token (' "?")]
     (<| (<>.and (<>.parses? (.this token)))
@@ -58,18 +58,18 @@
 (type: Alias
   Text)
 
-(def: alias
+(def alias
   (Parser Alias)
   (<>.after (.this (' "as")) .local))
 
 (type: Field
   [Bit Text (Maybe Alias) Nilable])
 
-(def: static!
+(def static!
   (Parser Any)
   (.this (' "static")))
 
-(def: field
+(def field
   (Parser Field)
   (.form (all <>.and
                     (<>.parses? ..static!)
@@ -77,7 +77,7 @@
                     (<>.maybe ..alias)
                     ..nilable)))
 
-(def: constant
+(def constant
   (Parser Field)
   (.form (all <>.and
                     (<>#in true)
@@ -94,7 +94,7 @@
     #try? Bit
     #output Nilable]))
 
-(def: common_method
+(def common_method
   (Parser Common_Method)
   (all <>.and
        .local
@@ -104,19 +104,19 @@
        (<>.parses? (.this (' "try")))
        ..nilable))
 
-(def: input_variables
+(def input_variables
   (-> (List Nilable) (List [Bit Code]))
   (|>> list.enumeration
        (list#each (function (_ [idx [nilable? type]])
                     [nilable? (|> idx %.nat code.local)]))))
 
-(def: (nilable_type [nilable? type])
+(def (nilable_type [nilable? type])
   (-> Nilable Code)
   (if nilable?
     (` (.Maybe (~ type)))
     type))
 
-(def: (with_nil g!temp [nilable? input])
+(def (with_nil g!temp [nilable? input])
   (-> Code [Bit Code] Code)
   (if nilable?
     (` (case (~ input)
@@ -127,7 +127,7 @@
          ("scheme object nil")))
     input))
 
-(def: (without_nil g!temp [nilable? outputT] output)
+(def (without_nil g!temp [nilable? outputT] output)
   (-> Code Nilable Code Code)
   (if nilable?
     (` (let [(~ g!temp) (~ output)]
@@ -144,14 +144,14 @@
    {#Function Common_Method}
    {#Constant Field}))
 
-(def: import
+(def import
   (Parser Import)
   (all <>.or
        (.form ..common_method)
        ..constant
        ))
 
-(def: .public try
+(def .public try
   (syntax (_ [expression .any])
     ... {.#doc (example (case (try (risky_computation input))
     ...                   {.#Right success}
@@ -161,34 +161,34 @@
     ...                   (recover_from_failure error)))}
     (in (list (` ("lux try" ((~! io.io) (~ expression))))))))
 
-(def: (with_io with? without)
+(def (with_io with? without)
   (-> Bit Code Code)
   (if with?
     (` ((~! io.io) (~ without)))
     without))
 
-(def: (io_type io? rawT)
+(def (io_type io? rawT)
   (-> Bit Code Code)
   (if io?
     (` ((~! io.IO) (~ rawT)))
     rawT))
 
-(def: (with_try with? without_try)
+(def (with_try with? without_try)
   (-> Bit Code Code)
   (if with?
     (` (..try (~ without_try)))
     without_try))
 
-(def: (try_type try? rawT)
+(def (try_type try? rawT)
   (-> Bit Code Code)
   (if try?
     (` (.Either .Text (~ rawT)))
     rawT))
 
-(def: (make_function g!method g!temp source inputsT io? try? outputT)
+(def (make_function g!method g!temp source inputsT io? try? outputT)
   (-> Code Code Code (List Nilable) Bit Bit Nilable Code)
   (let [g!inputs (input_variables inputsT)]
-    (` (def: ((~ g!method)
+    (` (def ((~ g!method)
               [(~+ (list#each product.right g!inputs))])
          (-> [(~+ (list#each nilable_type inputsT))]
              (~ (|> (nilable_type outputT)
@@ -202,7 +202,7 @@
                      (as ..Function (~ source))
                      (~+ (list#each (with_nil g!temp) g!inputs)))))))))))
 
-(def: .public import
+(def .public import
   (syntax (_ [import ..import])
     (with_symbols [g!temp]
       (case import
@@ -219,7 +219,7 @@
         {#Constant [_ name alias fieldT]}
         (let [imported (` ("scheme constant" (~ (code.text name))))
               g!name (code.local (maybe.else name alias))]
-          (in (list (` (def: (~ g!name)
+          (in (list (` (def (~ g!name)
                          ((~! syntax) ((~ g!name) [])
                           (at (~! meta.monad) (~' in)
                               (list (` (.as (~ (nilable_type fieldT)) (~ imported)))))))))))
diff --git a/stdlib/source/library/lux/ffi/export.js.lux b/stdlib/source/library/lux/ffi/export.js.lux
index d121509d5..001e58022 100644
--- a/stdlib/source/library/lux/ffi/export.js.lux
+++ b/stdlib/source/library/lux/ffi/export.js.lux
@@ -36,7 +36,7 @@
        [analysis
         ["[0]" type]]]]]]]])
 
-(def: definition
+(def definition
   (-> Code (Meta [Text Code]))
   (|>> (list)
        (.result (<| .form
@@ -85,7 +85,7 @@
             (generation.log! (%.format "Export " (%.text name)))))]
       (in directive.no_requirements)))
 
-  (def: .public export
+  (def .public export
     (syntax (_ [exports (<>.many .any)])
       (let [! meta.monad]
         (|> exports
diff --git a/stdlib/source/library/lux/ffi/export.jvm.lux b/stdlib/source/library/lux/ffi/export.jvm.lux
index ed68b06d6..402c8b8da 100644
--- a/stdlib/source/library/lux/ffi/export.jvm.lux
+++ b/stdlib/source/library/lux/ffi/export.jvm.lux
@@ -18,7 +18,7 @@
     #type Code
     #term Code]))
 
-(def: (api of)
+(def (api of)
   (All (_ of) (-> (Parser of) (Parser (API of))))
   (.form
    (all <>.and
@@ -30,7 +30,7 @@
 (type: Constant
   Text)
 
-(def: constant
+(def constant
   (Parser Constant)
   .local)
 
@@ -40,7 +40,7 @@
     #name Text
     #requirements (List [Text Code])]))
 
-(def: function
+(def function
   (Parser Function)
   (.form
    (all <>.and
@@ -57,14 +57,14 @@
    {#Constant (API Constant)}
    {#Function (API Function)}))
 
-(def: exportP
+(def exportP
   (Parser Export)
   (all <>.or
        (..api ..constant)
        (..api ..function)
        ))
 
-(def: .public export
+(def .public export
   (syntax (_ [api .local
               exports (<>.many ..exportP)])
     (let [initialization (is (List (API Constant))
diff --git a/stdlib/source/library/lux/ffi/export.lua.lux b/stdlib/source/library/lux/ffi/export.lua.lux
index 679c0e50d..2f4f8345e 100644
--- a/stdlib/source/library/lux/ffi/export.lua.lux
+++ b/stdlib/source/library/lux/ffi/export.lua.lux
@@ -36,7 +36,7 @@
        [analysis
         ["[0]" type]]]]]]]])
 
-(def: definition
+(def definition
   (-> Code (Meta [Text Code]))
   (|>> (list)
        (.result (<| .form
@@ -101,7 +101,7 @@
             (generation.log! (%.format "Export " (%.text name)))))]
       (in directive.no_requirements)))
 
-  (def: .public export
+  (def .public export
     (syntax (_ [exports (<>.many .any)])
       (let [! meta.monad]
         (|> exports
diff --git a/stdlib/source/library/lux/ffi/export.py.lux b/stdlib/source/library/lux/ffi/export.py.lux
index 6c0356abb..4ffa40ba8 100644
--- a/stdlib/source/library/lux/ffi/export.py.lux
+++ b/stdlib/source/library/lux/ffi/export.py.lux
@@ -36,7 +36,7 @@
        [analysis
         ["[0]" type]]]]]]]])
 
-(def: definition
+(def definition
   (-> Code (Meta [Text Code]))
   (|>> (list)
        (.result (<| .form
@@ -78,7 +78,7 @@
             (generation.log! (%.format "Export " (%.text name)))))]
       (in directive.no_requirements)))
 
-  (def: .public export
+  (def .public export
     (syntax (_ [exports (<>.many .any)])
       (let [! meta.monad]
         (|> exports
diff --git a/stdlib/source/library/lux/ffi/export.rb.lux b/stdlib/source/library/lux/ffi/export.rb.lux
index 16bc77b68..633164c92 100644
--- a/stdlib/source/library/lux/ffi/export.rb.lux
+++ b/stdlib/source/library/lux/ffi/export.rb.lux
@@ -38,12 +38,12 @@
        ["[0]" analysis
         ["[1]" type]]]]]]]])
 
-(def: upper! (.one_of! "ABCDEFGHIJKLMNOPQRSTUVWXYZ"))
-(def: lower! (.one_of! "abcdefghijklmnopqrstuvwxyz"))
-(def: decimal! (.one_of! "0123456789"))
-(def: sigil! (.one_of! "_"))
+(def upper! (.one_of! "ABCDEFGHIJKLMNOPQRSTUVWXYZ"))
+(def lower! (.one_of! "abcdefghijklmnopqrstuvwxyz"))
+(def decimal! (.one_of! "0123456789"))
+(def sigil! (.one_of! "_"))
 
-(def: tail!
+(def tail!
   (all <>.either
        ..upper!
        ..lower!
@@ -52,7 +52,7 @@
        ))
 
 (with_template [ ]
-  [(def: 
+  [(def 
      (Parser Text)
      (<| .slice
          (.and! )
@@ -68,13 +68,13 @@
    {#Method Text}
    {#Global Text}))
 
-(def: name
+(def name
   (Parser Name)
   (<>.or ..method
          (<>.either ..global
                     ..constant)))
 
-(def: definition
+(def definition
   (-> Code (Meta [Name Code]))
   (|>> (list)
        (.result (<| .form
@@ -127,7 +127,7 @@
             (generation.log! (%.format "Export " (%.text name)))))]
       (in directive.no_requirements)))
 
-  (def: .public export
+  (def .public export
     (syntax (_ [exports (<>.many .any)])
       (let [! meta.monad]
         (|> exports
diff --git a/stdlib/source/library/lux/ffi/node_js.js.lux b/stdlib/source/library/lux/ffi/node_js.js.lux
index 27d69787d..fb507fca0 100644
--- a/stdlib/source/library/lux/ffi/node_js.js.lux
+++ b/stdlib/source/library/lux/ffi/node_js.js.lux
@@ -7,7 +7,7 @@
     ["[0]" maybe (.open: "[1]#[0]" monoid functor)]]]])
 
 (with_template [ ]
-  [(def: 
+  [(def 
      (Maybe (-> Text Any))
      (ffi.global (-> Text Any) ))]
 
@@ -16,7 +16,7 @@
   [process_load [global process mainModule constructor _load]]
   )
 
-(def: .public (require module)
+(def .public (require module)
   (-> Text (Maybe Any))
   (maybe#each (function.on module)
               (all maybe#composite
diff --git a/stdlib/source/library/lux/locale.lux b/stdlib/source/library/lux/locale.lux
index 9587c8a8f..7b90f5386 100644
--- a/stdlib/source/library/lux/locale.lux
+++ b/stdlib/source/library/lux/locale.lux
@@ -19,10 +19,10 @@
 (primitive .public Locale
   Text
 
-  (def: territory_separator "_")
-  (def: encoding_separator ".")
+  (def territory_separator "_")
+  (def encoding_separator ".")
 
-  (def: .public (locale language territory encoding)
+  (def .public (locale language territory encoding)
     (-> Language (Maybe Territory) (Maybe Encoding) Locale)
     (abstraction (format (language.code language)
                          (|> territory
@@ -32,15 +32,15 @@
                              (maybe#each (|>> encoding.name (format ..encoding_separator)))
                              (maybe.else "")))))
 
-  (def: .public code
+  (def .public code
     (-> Locale Text)
     (|>> representation))
 
-  (def: .public hash
+  (def .public hash
     (Hash Locale)
     (at hash.functor each ..code text.hash))
 
-  (def: .public equivalence
+  (def .public equivalence
     (Equivalence Locale)
     (at ..hash equivalence))
   )
diff --git a/stdlib/source/library/lux/locale/language.lux b/stdlib/source/library/lux/locale/language.lux
index 21930e92f..0e6379d57 100644
--- a/stdlib/source/library/lux/locale/language.lux
+++ b/stdlib/source/library/lux/locale/language.lux
@@ -18,7 +18,7 @@
     #code Text])
 
   (with_template [ ]
-    [(def: .public 
+    [(def .public 
        (-> Language Text)
        (|>> representation (the )))]
 
@@ -29,12 +29,12 @@
   (with_template []
     [(with_expansions [' (template.spliced )]
        (with_template [   +]
-         [(def: .public 
+         [(def .public 
             Language
             (abstraction [#name 
                           #code ]))
           (`` (with_template []
-                [(def: .public 
+                [(def .public 
                    Language
                    )]
 
@@ -556,19 +556,19 @@
       ["zun" "Zuni" zuni []]
       ["zza" "Zaza; Dimili; Dimli; Kirdki; Kirmanjki; Zazaki" zaza [[dimili] [dimli] [kirdki] [kirmanjki] [zazaki]]]]])
 
-  (def: .public equivalence
+  (def .public equivalence
     (Equivalence Language)
     (implementation
-     (def: (= reference sample)
+     (def (= reference sample)
        (same? reference sample))))
 
-  (def: .public hash
+  (def .public hash
     (Hash Language)
     (implementation
-     (def: equivalence
+     (def equivalence
        ..equivalence)
      
-     (def: hash
+     (def hash
        (|>> ..code
             (at text.hash hash)))))
   )
diff --git a/stdlib/source/library/lux/locale/territory.lux b/stdlib/source/library/lux/locale/territory.lux
index b31531412..9dfed05f9 100644
--- a/stdlib/source/library/lux/locale/territory.lux
+++ b/stdlib/source/library/lux/locale/territory.lux
@@ -20,7 +20,7 @@
     #code Nat])
 
   (with_template [  ]
-    [(def: .public 
+    [(def .public 
        (-> Territory )
        (|>> representation
             (the )))]
@@ -32,7 +32,7 @@
     )
 
   (with_template [    
+] - [(def: .public
+ [(def .public
Territory (abstraction [#name #short @@ -40,7 +40,7 @@ #code ])) (`` (with_template [] - [(def: .public Territory
)] + [(def .public Territory
)] (~~ (template.spliced +))))] @@ -295,18 +295,18 @@ ["ZW" "ZWE" 716 "Zimbabwe" zimbabwe []] ) - (def: .public equivalence + (def .public equivalence (Equivalence Territory) (implementation - (def: (= reference sample) + (def (= reference sample) (same? reference sample)))) - (def: .public hash + (def .public hash (Hash Territory) (implementation - (def: equivalence ..equivalence) + (def equivalence ..equivalence) - (def: hash + (def hash (|>> representation (the #long) (at text.hash hash))))) diff --git a/stdlib/source/library/lux/macro.lux b/stdlib/source/library/lux/macro.lux index e7dda08c5..35d94cb88 100644 --- a/stdlib/source/library/lux/macro.lux +++ b/stdlib/source/library/lux/macro.lux @@ -18,7 +18,7 @@ ["[0]" location] ["[0]" symbol (.open: "[1]#[0]" codec)]]]]) -(def: .public (single_expansion syntax) +(def .public (single_expansion syntax) (-> Code (Meta (List Code))) (case syntax [_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}] @@ -34,7 +34,7 @@ _ (at //.monad in (list syntax)))) -(def: .public (expansion syntax) +(def .public (expansion syntax) (-> Code (Meta (List Code))) (case syntax [_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}] @@ -54,7 +54,7 @@ _ (at //.monad in (list syntax)))) -(def: .public (full_expansion syntax) +(def .public (full_expansion syntax) (-> Code (Meta (List Code))) (case syntax [_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}] @@ -91,7 +91,7 @@ _ (at //.monad in (list syntax)))) -(def: .public (symbol prefix) +(def .public (symbol prefix) (-> Text (Meta Code)) (do //.monad [id //.seed] @@ -100,7 +100,7 @@ (all text#composite "__gensym__" prefix) [""] code.symbol)))) -(def: (local ast) +(def (local ast) (-> Code (Meta Text)) (case ast [_ {.#Symbol [_ name]}] @@ -109,13 +109,13 @@ _ (//.failure (text#composite "Code is not a local symbol: " (code.format ast))))) -(def: .public wrong_syntax_error +(def .public wrong_syntax_error (-> Symbol Text) (|>> symbol#encoded (text.prefix (text#composite "Wrong syntax for " text.\'')) (text.suffix (text#composite text.\'' ".")))) -(def: .public with_symbols +(def .public with_symbols (.macro (_ tokens) (case tokens (pattern (list [_ {.#Tuple symbols}] body)) @@ -131,7 +131,7 @@ _ (//.failure (..wrong_syntax_error (.symbol ..with_symbols)))))) -(def: .public (one_expansion token) +(def .public (one_expansion token) (-> Code (Meta Code)) (do //.monad [token+ (..expansion token)] @@ -143,7 +143,7 @@ (//.failure "Macro expanded to more than 1 element.")))) (with_template [ ] - [(def: .public + [(def .public (.macro (_ tokens) (let [[module _] (.symbol .._) [_ short] (.symbol ) @@ -179,7 +179,7 @@ [log_full_expansion! ..full_expansion] ) -(def: .public times +(def .public times (.macro (_ tokens) (case tokens (pattern (list.partial [_ {.#Nat times}] terms)) @@ -199,17 +199,17 @@ _ (//.failure (..wrong_syntax_error (.symbol ..times)))))) -(def: .public final +(def .public final (.macro (_ it) (let [! //.monad] (|> it (monad.each ! ..expansion) (at ! each list#conjoint))))) -(def: .public function +(def .public function (-> Macro Macro') (|>> (as Macro'))) -(def: .public macro +(def .public macro (-> Macro' Macro) (|>> (as Macro))) diff --git a/stdlib/source/library/lux/macro/code.lux b/stdlib/source/library/lux/macro/code.lux index 72b09aff4..53b0d826e 100644 --- a/stdlib/source/library/lux/macro/code.lux +++ b/stdlib/source/library/lux/macro/code.lux @@ -37,7 +37,7 @@ ... (Ann Location (Code' (Ann Location)))) (with_template [ ] - [(def: .public ( x) + [(def .public ( x) (-> Code) [location.dummy { x}])] @@ -54,16 +54,16 @@ ) (with_template [ ] - [(def: .public ( name) + [(def .public ( name) (-> Text Code) [location.dummy { ["" name]}])] [local .#Symbol]) -(def: .public equivalence +(def .public equivalence (Equivalence Code) (implementation - (def: (= x y) + (def (= x y) (case [x y] (^.with_template [ ] [[[_ { x'}] [_ { y'}]] @@ -86,7 +86,7 @@ _ false)))) -(def: .public (format ast) +(def .public (format ast) (-> Code Text) (case ast (^.with_template [ ] @@ -119,7 +119,7 @@ [.#Tuple "[" "]"]) )) -(def: .public (replaced original substitute ast) +(def .public (replaced original substitute ast) (-> Code Code Code Code) (if (at ..equivalence = original ast) substitute diff --git a/stdlib/source/library/lux/macro/local.lux b/stdlib/source/library/lux/macro/local.lux index 2d93ea1fc..3538cc454 100644 --- a/stdlib/source/library/lux/macro/local.lux +++ b/stdlib/source/library/lux/macro/local.lux @@ -35,7 +35,7 @@ [unknown_definition] ) -(def: (with_module name body) +(def (with_module name body) (All (_ a) (-> Text (-> Module (Try [Module a])) (Meta a))) (function (_ compiler) (case (|> compiler (the .#modules) (plist.value name)) @@ -51,7 +51,7 @@ {.#None} (exception.except ..unknown_module [name])))) -(def: (push_one [name macro]) +(def (push_one [name macro]) (-> [Symbol Macro] (Meta Any)) (do meta.monad [[module_name definition_name] (meta.normal name) @@ -68,7 +68,7 @@ {.#Some _} (exception.except ..cannot_shadow_definition [module_name definition_name])))))) -(def: (pop_one name) +(def (pop_one name) (-> Symbol (Meta Any)) (do meta.monad [[module_name definition_name] (meta.normal name) @@ -84,7 +84,7 @@ {.#None} (exception.except ..unknown_definition [module_name definition_name])))))) -(def: (pop_all macros self) +(def (pop_all macros self) (-> (List Symbol) Symbol Macro) ("lux macro" (function (_ _) @@ -99,7 +99,7 @@ {.#None} (list))))))) -(def: .public (push macros) +(def .public (push macros) (-> (List [Symbol Macro]) (Meta Code)) (do meta.monad [_ (monad.each meta.monad ..push_one macros) @@ -110,7 +110,7 @@ (..push_one [g!pop (..pop_all (list#each product.left macros) g!pop)]))] (in (` ((~ g!pop)))))) -(def: .public (with macros expression? body) +(def .public (with macros expression? body) (-> (List [Symbol Macro]) Bit Code (Meta (List Code))) (do [! meta.monad] [g!pop (..push macros)] @@ -123,7 +123,7 @@ (in (list body g!pop))))) -(def: .public let +(def .public let (syntax (_ [locals (.tuple (<>.some (<>.and .local .any))) body .any]) (do [! meta.monad] diff --git a/stdlib/source/library/lux/macro/pattern.lux b/stdlib/source/library/lux/macro/pattern.lux index 9e8e64d70..7408d86e2 100644 --- a/stdlib/source/library/lux/macro/pattern.lux +++ b/stdlib/source/library/lux/macro/pattern.lux @@ -2,10 +2,10 @@ [library [lux (.except or let with_template |> `)]]) -(def: partial_list +(def partial_list (`` ("lux in-module" (~~ (static .prelude)) .partial_list))) -(def: locally +(def locally (macro (_ tokens lux) (.let [[prelude _] (symbol ._)] (case tokens @@ -17,7 +17,7 @@ {.#Left ""})))) (.with_template [] - [(def: (..locally ))] + [(def (..locally ))] [list#size] [list#composite] @@ -72,7 +72,7 @@ [frac$] ) -(def: .public or +(def .public or (macro (_ tokens) (case tokens (pattern (partial_list [_ {.#Form patterns}] body branches)) @@ -88,7 +88,7 @@ _ (failure (..wrong_syntax_error (symbol ..or)))))) -(def: .public with_template +(def .public with_template (macro (_ tokens) (case tokens (pattern (partial_list [_ {.#Form (list [_ {.#Tuple bindings}] @@ -118,7 +118,7 @@ _ (failure (..wrong_syntax_error (symbol ..with_template)))))) -(def: .public multi +(def .public multi (macro (_ tokens) (case tokens (pattern (partial_list [_meta {.#Form levels}] body next_branches)) @@ -150,7 +150,7 @@ _ (failure (..wrong_syntax_error (symbol ..multi)))))) -(def: .public let +(def .public let (macro (_ tokens) (case tokens (pattern (partial_list [_meta {.#Form (list [_ {.#Symbol ["" name]}] pattern)}] body branches)) @@ -162,7 +162,7 @@ _ (failure (..wrong_syntax_error (symbol ..let)))))) -(def: .public |> +(def .public |> (macro (_ tokens) (case tokens (pattern (partial_list [_meta {.#Form (list [_ {.#Symbol ["" name]}] [_ {.#Tuple steps}])}] body branches)) @@ -175,11 +175,11 @@ _ (failure (..wrong_syntax_error (symbol ..|>)))))) -(def: (name$ [module name]) +(def (name$ [module name]) (-> Symbol Code) (.` [(~ (text$ module)) (~ (text$ name))])) -(def: (untemplated_partial_list last inits) +(def (untemplated_partial_list last inits) (-> Code (List Code) Code) (case inits {.#End} @@ -189,7 +189,7 @@ (.` {.#Item (~ init) (~ (untemplated_partial_list last inits'))}))) (.with_template [ ] - [(def: ( g!meta untemplated_pattern elems) + [(def ( g!meta untemplated_pattern elems) (-> Code (-> Code (Meta Code)) (-> (List Code) (Meta Code))) (case (list#reversed elems) @@ -209,7 +209,7 @@ [.#Tuple untemplated_tuple] ) -(def: (untemplated_pattern pattern) +(def (untemplated_pattern pattern) (-> Code (Meta Code)) (do meta#monad [g!meta (..generated_symbol "g!meta")] @@ -239,7 +239,7 @@ [.#Tuple ..untemplated_tuple]) ))) -(def: .public ` +(def .public ` (macro (_ tokens) (case tokens (pattern (partial_list [_meta {.#Form (list template)}] body branches)) diff --git a/stdlib/source/library/lux/macro/syntax.lux b/stdlib/source/library/lux/macro/syntax.lux index 8c1a54eba..94ea416fe 100644 --- a/stdlib/source/library/lux/macro/syntax.lux +++ b/stdlib/source/library/lux/macro/syntax.lux @@ -24,7 +24,7 @@ ["[0]" / ["[1][0]" export]]) -(def: (self_documenting binding parser) +(def (self_documenting binding parser) (All (_ a) (-> Code (Parser a) (Parser a))) (function (_ tokens) (case (parser tokens) @@ -36,13 +36,13 @@ "Failed to parse: " (code.format binding) text.new_line error)}))) -(def: (un_paired pairs) +(def (un_paired pairs) (All (_ a) (-> (List [a a]) (List a))) (case pairs {.#End} {.#End} {.#Item [[x y] pairs']} (list.partial x y (un_paired pairs')))) -(def: syntaxP +(def syntaxP (Parser [[Text (Maybe Text) (List Code)] Code]) (all <>.and (.form (all <>.and @@ -51,7 +51,7 @@ (.tuple (<>.some .any)))) .any)) -(def: .public syntax +(def .public syntax (macro (_ tokens) (case (.result ..syntaxP tokens) {try.#Success [[name g!state args] body]} diff --git a/stdlib/source/library/lux/macro/syntax/check.lux b/stdlib/source/library/lux/macro/syntax/check.lux index 893f9bc88..774c59e17 100644 --- a/stdlib/source/library/lux/macro/syntax/check.lux +++ b/stdlib/source/library/lux/macro/syntax/check.lux @@ -14,7 +14,7 @@ [macro ["[0]" code]]]]) -(def: extension +(def extension "lux check") (type: .public Check @@ -22,20 +22,20 @@ [#type Code #value Code])) -(def: .public equivalence +(def .public equivalence (Equivalence Check) (all product.equivalence code.equivalence code.equivalence )) -(def: .public (format (open "_[0]")) +(def .public (format (open "_[0]")) (-> Check Code) (` ((~ (code.text ..extension)) (~ _#type) (~ _#value)))) -(def: .public parser +(def .public parser (Parser Check) (<| .form (<>.after (.this_text ..extension)) diff --git a/stdlib/source/library/lux/macro/syntax/declaration.lux b/stdlib/source/library/lux/macro/syntax/declaration.lux index b0c23e135..d5e7ab443 100644 --- a/stdlib/source/library/lux/macro/syntax/declaration.lux +++ b/stdlib/source/library/lux/macro/syntax/declaration.lux @@ -19,21 +19,21 @@ [#name Text #arguments (List Text)])) -(def: .public equivalence +(def .public equivalence (Equivalence Declaration) (all product.equivalence text.equivalence (list.equivalence text.equivalence) )) -(def: .public parser +(def .public parser (Parser Declaration) (<>.either (<>.and .local (<>#in (list))) (.form (<>.and .local (<>.some .local))))) -(def: .public (format value) +(def .public (format value) (-> Declaration Code) (let [g!name (code.local (the #name value))] (case (the #arguments value) diff --git a/stdlib/source/library/lux/macro/syntax/definition.lux b/stdlib/source/library/lux/macro/syntax/definition.lux index 7bc9a964f..02df002bb 100644 --- a/stdlib/source/library/lux/macro/syntax/definition.lux +++ b/stdlib/source/library/lux/macro/syntax/definition.lux @@ -30,7 +30,7 @@ Code) #export? Bit])) -(def: .public equivalence +(def .public equivalence (Equivalence Definition) (all product.equivalence text.equivalence @@ -41,16 +41,16 @@ bit.equivalence )) -(def: extension +(def extension "lux def") -(def: dummy +(def dummy Code (` [.#module (~ (code.text (the .#module location.dummy))) .#line (~ (code.nat (the .#line location.dummy))) .#column (~ (code.nat (the .#column location.dummy)))])) -(def: .public (format (open "_[0]")) +(def .public (format (open "_[0]")) (-> Definition Code) (` ((~ (code.text ..extension)) (~ (code.local _#name)) @@ -62,7 +62,7 @@ value)) (~ (code.bit _#export?))))) -(def: .public (parser compiler) +(def .public (parser compiler) (-> Lux (Parser Definition)) (do [! <>.monad] [raw .any @@ -84,7 +84,7 @@ (exception.report "Definition" (%.code (..format definition)))) -(def: .public (typed compiler) +(def .public (typed compiler) (-> Lux (Parser Definition)) (do <>.monad [definition (..parser compiler) diff --git a/stdlib/source/library/lux/macro/syntax/export.lux b/stdlib/source/library/lux/macro/syntax/export.lux index 323b9d3b5..0aedf4a21 100644 --- a/stdlib/source/library/lux/macro/syntax/export.lux +++ b/stdlib/source/library/lux/macro/syntax/export.lux @@ -9,11 +9,11 @@ [macro ["^" pattern]]]]) -(def: .public default_policy +(def .public default_policy Code (` .private)) -(def: policy +(def policy (Parser Code) (do [! <>.monad] [candidate .next] @@ -30,6 +30,6 @@ _ (in default_policy)))) -(def: .public parser +(def .public parser (All (_ a) (-> (Parser a) (Parser [Code a]))) (<>.and ..policy)) diff --git a/stdlib/source/library/lux/macro/syntax/input.lux b/stdlib/source/library/lux/macro/syntax/input.lux index bdac8cad3..bc6622bc6 100644 --- a/stdlib/source/library/lux/macro/syntax/input.lux +++ b/stdlib/source/library/lux/macro/syntax/input.lux @@ -18,14 +18,14 @@ [#binding Code #type Code])) -(def: .public equivalence +(def .public equivalence (Equivalence Input) (all product.equivalence code.equivalence code.equivalence )) -(def: .public format +(def .public format (-> (List Input) Code) (|>> (list#each (function (_ value) (list (the #binding value) @@ -33,7 +33,7 @@ list#conjoint code.tuple)) -(def: .public parser +(def .public parser (Parser (List Input)) (<| .tuple <>.some diff --git a/stdlib/source/library/lux/macro/syntax/type/variable.lux b/stdlib/source/library/lux/macro/syntax/type/variable.lux index ca141f0bd..fb0f0db06 100644 --- a/stdlib/source/library/lux/macro/syntax/type/variable.lux +++ b/stdlib/source/library/lux/macro/syntax/type/variable.lux @@ -14,14 +14,14 @@ (type: .public Variable Text) -(def: .public equivalence +(def .public equivalence (Equivalence Variable) text.equivalence) -(def: .public format +(def .public format (-> Variable Code) code.local) -(def: .public parser +(def .public parser (Parser Variable) .local) diff --git a/stdlib/source/library/lux/macro/template.lux b/stdlib/source/library/lux/macro/template.lux index 2251051d5..750f4fb8b 100644 --- a/stdlib/source/library/lux/macro/template.lux +++ b/stdlib/source/library/lux/macro/template.lux @@ -28,15 +28,15 @@ ["[0]" code] ["[0]" local]]) -(def: .public spliced +(def .public spliced (syntax (_ [parts (.tuple (<>.some .any))]) (in parts))) -(def: .public amount +(def .public amount (syntax (_ [parts (.tuple (<>.some .any))]) (in (list (code.nat (list.size parts)))))) -(def: .public with_locals +(def .public with_locals (syntax (_ [locals (.tuple (<>.some .local)) body .any]) (do [! meta.monad] @@ -49,7 +49,7 @@ list#conjoint))] (~ body)))))))) -(def: (symbol_side module_side? parser) +(def (symbol_side module_side? parser) (-> Bit (Parser Symbol) (Parser Text)) (do <>.monad [[module short] parser] @@ -59,7 +59,7 @@ _ module) short)))) -(def: (snippet module_side?) +(def (snippet module_side?) (-> Bit (Parser Text)) (.let [full_symbol (..symbol_side module_side? .symbol)] (all <>.either @@ -75,16 +75,16 @@ (<>#each frac#encoded .frac) ))) -(def: (part module_side?) +(def (part module_side?) (-> Bit (Parser (List Text))) (.tuple (<>.many (..snippet module_side?)))) -(def: .public text +(def .public text (syntax (_ [simple (..part false)]) (in (list (|> simple (text.interposed "") code.text))))) (with_template [ ] - [(def: .public + [(def .public (syntax (_ [name (<>.or (<>.and (..part true) (..part false)) (..part false))]) (case name @@ -101,7 +101,7 @@ (type: Environment (Dictionary Text Code)) -(def: (applied env template) +(def (applied env template) (-> Environment Code Code) (case template [_ {.#Symbol "" name}] @@ -134,7 +134,7 @@ "Expected" (at nat.decimal encoded expected) "Actual" (at nat.decimal encoded actual))) -(def: (macro (open "_[0]")) +(def (macro (open "_[0]")) (-> Local Macro) ("lux macro" (function (_ inputs compiler) @@ -147,7 +147,7 @@ {.#Right [compiler (list#each (..applied environment) _#template)]}) (exception.except ..irregular_arguments [parameters_amount inputs_amount])))))) -(def: local +(def local (Parser Local) (do <>.monad [[name parameters] (.form (<>.and .local @@ -158,7 +158,7 @@ #template template]))) ... TODO: Get rid of this (and any local definitions it depends on) once the bootstrapping compiler is gone. -(def: .public let +(def .public let (syntax (_ [locals (.tuple (<>.some ..local)) body .any]) (do meta.monad diff --git a/stdlib/source/library/lux/math.lux b/stdlib/source/library/lux/math.lux index 6bd87711b..913a5c1b0 100644 --- a/stdlib/source/library/lux/math.lux +++ b/stdlib/source/library/lux/math.lux @@ -44,7 +44,7 @@ (exception.report "Type" (%.type type))) -(def: (composite phase archive <+> last prevs) +(def (composite phase archive <+> last prevs) (-> Phase Archive Code Analysis (List Analysis) (Operation Analysis)) (case <+> [_ {.#Text $}] @@ -109,7 +109,7 @@ ... else (phase.except ..no_arithmetic_for [:it:]))))))) - (def: .public + (def .public (syntax (_ [operands (<>.some .any)]) (in (list (` ( (~+ operands)))))))))] @@ -162,7 +162,7 @@ ... else (phase.except ..no_arithmetic_for [:it:])))))) - (def: .public + (def .public (syntax (_ [left .any right .any]) (in (list (` ( (~ left) (~ right)))))))))] @@ -218,7 +218,7 @@ ... else (phase.except ..no_arithmetic_for [:it:])))))) - (def: .public + (def .public (syntax (_ [left .any right .any]) (in (list (` ( (~ left) (~ right)))))))))] diff --git a/stdlib/source/library/lux/math/infix.lux b/stdlib/source/library/lux/math/infix.lux index bb3039035..2a6456e4f 100644 --- a/stdlib/source/library/lux/math/infix.lux +++ b/stdlib/source/library/lux/math/infix.lux @@ -26,7 +26,7 @@ {#Unary Code Infix} {#Binary Infix Code Infix}))) -(def: literal +(def literal (Parser Code) (all <>.either (<>#each code.bit .bit) @@ -37,7 +37,7 @@ (<>#each code.text .text) (<>#each code.symbol .symbol))) -(def: expression +(def expression (Parser Infix) (<| <>.rec (function (_ expression)) (all <>.or @@ -55,7 +55,7 @@ steps)))) ))) -(def: (prefix infix) +(def (prefix infix) (-> Infix Code) (case infix {#Const value} @@ -70,6 +70,6 @@ {#Binary left op right} (` ((~ op) (~ (prefix right)) (~ (prefix left)))))) -(def: .public infix +(def .public infix (syntax (_ [expr ..expression]) (in (list (..prefix expr))))) diff --git a/stdlib/source/library/lux/math/logic/continuous.lux b/stdlib/source/library/lux/math/logic/continuous.lux index 195601894..738497496 100644 --- a/stdlib/source/library/lux/math/logic/continuous.lux +++ b/stdlib/source/library/lux/math/logic/continuous.lux @@ -8,34 +8,34 @@ [number ["/" rev (.open: "[1]#[0]" interval)]]]]]) -(def: .public false Rev /#bottom) -(def: .public true Rev /#top) +(def .public false Rev /#bottom) +(def .public true Rev /#top) (with_template [ ] - [(def: .public + [(def .public (-> Rev Rev Rev) ) - (def: .public + (def .public (Monoid Rev) (implementation - (def: identity ) - (def: composite )))] + (def identity ) + (def composite )))] [or /.max disjunction ..false] [and /.min conjunction ..true] ) -(def: .public (not input) +(def .public (not input) (-> Rev Rev) (/.- input ..true)) -(def: .public (implies consequent antecedent) +(def .public (implies consequent antecedent) (-> Rev Rev Rev) (or (not antecedent) consequent)) -(def: .public (= left right) +(def .public (= left right) (-> Rev Rev Rev) (and (or (not left) right) (or left (not right)))) diff --git a/stdlib/source/library/lux/math/logic/fuzzy.lux b/stdlib/source/library/lux/math/logic/fuzzy.lux index d21962ea6..6d337604e 100644 --- a/stdlib/source/library/lux/math/logic/fuzzy.lux +++ b/stdlib/source/library/lux/math/logic/fuzzy.lux @@ -19,14 +19,14 @@ (type: .public (Fuzzy a) (-> a Rev)) -(def: .public functor +(def .public functor (contravariant.Functor Fuzzy) (implementation - (def: (each f fb) + (def (each f fb) (|>> f fb)))) (with_template [ ] - [(def: .public + [(def .public Fuzzy (function (_ _) ))] @@ -35,12 +35,12 @@ [full //.true] ) -(def: .public (membership set elem) +(def .public (membership set elem) (All (_ a) (-> (Fuzzy a) a Rev)) (set elem)) (with_template [ ] - [(def: .public ( left right) + [(def .public ( left right) (All (_ a) (-> (Fuzzy a) (Fuzzy a) (Fuzzy a))) (function (_ elem) ( (left elem) @@ -50,31 +50,31 @@ [intersection //.and] ) -(def: .public (complement set) +(def .public (complement set) (All (_ a) (-> (Fuzzy a) (Fuzzy a))) (|>> set //.not)) -(def: .public (difference sub base) +(def .public (difference sub base) (All (_ a) (-> (Fuzzy a) (Fuzzy a) (Fuzzy a))) (..intersection (..complement sub) base)) -(def: .public (of_predicate predicate) +(def .public (of_predicate predicate) (All (_ a) (-> (Predicate a) (Fuzzy a))) (function (_ elem) (if (predicate elem) //.true //.false))) -(def: .public (predicate treshold set) +(def .public (predicate treshold set) (All (_ a) (-> Rev (Fuzzy a) (Predicate a))) (function (_ elem) (/.> treshold (set elem)))) -(def: .public of_set +(def .public of_set (All (_ a) (-> (Set a) (Fuzzy a))) (|>> set.member? ..of_predicate)) -(def: (ascending from to) +(def (ascending from to) (-> Rev Rev (Fuzzy Rev)) (let [measure (/.- from to)] (function (_ elem) @@ -91,23 +91,23 @@ ... above //.true)))) -(def: (descending from to) +(def (descending from to) (-> Rev Rev (Fuzzy Rev)) (..complement (..ascending from to))) -(def: .public (gradient from to) +(def .public (gradient from to) (-> Rev Rev (Fuzzy Rev)) (if (/.< to from) (..ascending from to) (..descending from to))) -(def: !sort_2 +(def !sort_2 (template (_ ) [(if (/.> ) [ ] [ ])])) -(def: .public (triangle bottom middle top) +(def .public (triangle bottom middle top) (-> Rev Rev Rev (Fuzzy Rev)) (let [[low_0 high_0] (!sort_2 bottom middle) [bottom' high_1] (!sort_2 low_0 top) @@ -115,7 +115,7 @@ (..intersection (..ascending bottom' middle') (..descending middle' top')))) -(def: .public (trapezoid bottom middle_bottom middle_top top) +(def .public (trapezoid bottom middle_bottom middle_top top) (-> Rev Rev Rev Rev (Fuzzy Rev)) (let [[low_0 high_0] (!sort_2 bottom middle_bottom) [low_1 high_1] (!sort_2 middle_top top) @@ -125,7 +125,7 @@ (..intersection (..ascending bottom' middle_bottom') (..descending middle_top' top')))) -(def: .public (cut treshold set) +(def .public (cut treshold set) (All (_ a) (-> Rev (Fuzzy a) (Fuzzy a))) (function (_ elem) (let [membership (set elem)] diff --git a/stdlib/source/library/lux/math/modular.lux b/stdlib/source/library/lux/math/modular.lux index c12f2111d..183679ce8 100644 --- a/stdlib/source/library/lux/math/modular.lux +++ b/stdlib/source/library/lux/math/modular.lux @@ -31,13 +31,13 @@ [#modulus (Modulus m) #value Int]) - (def: .public (modular modulus value) + (def .public (modular modulus value) (All (_ %) (-> (Modulus %) Int (Mod %))) (abstraction [#modulus modulus #value (i.mod (//.divisor modulus) value)])) (with_template [ ] - [(def: .public + [(def .public (All (_ %) (-> (Mod %) )) (|>> representation ))] @@ -51,25 +51,25 @@ "Expected" (i#encoded (//.divisor modulus)) "Actual" (i#encoded parsed))) - (def: separator + (def separator " mod ") - (def: intL + (def intL (Parser Int) (<>.codec i.decimal (.and (.one_of "-+") (.many .decimal)))) - (def: .public (codec expected) + (def .public (codec expected) (All (_ %) (-> (Modulus %) (Codec Text (Mod %)))) (implementation - (def: (encoded modular) + (def (encoded modular) (let [[_ value] (representation modular)] (all text#composite (i#encoded value) ..separator (i#encoded (//.divisor expected))))) - (def: decoded + (def decoded (.result (do <>.monad [[value _ actual] (all <>.and intL (.this ..separator) intL) @@ -78,7 +78,7 @@ (in (..modular expected value))))))) (with_template [ ] - [(def: .public ( reference subject) + [(def .public ( reference subject) (All (_ %) (-> (Mod %) (Mod %) Bit)) (let [[_ reference] (representation reference) [_ subject] (representation subject)] @@ -91,19 +91,19 @@ [>= i.>=] ) - (def: .public equivalence + (def .public equivalence (All (_ %) (Equivalence (Mod %))) (implementation - (def: = ..=))) + (def = ..=))) - (def: .public order + (def .public order (All (_ %) (Order (Mod %))) (implementation - (def: equivalence ..equivalence) - (def: < ..<))) + (def equivalence ..equivalence) + (def < ..<))) (with_template [ ] - [(def: .public ( param subject) + [(def .public ( param subject) (All (_ %) (-> (Mod %) (Mod %) (Mod %))) (let [[modulus param] (representation param) [_ subject] (representation subject)] @@ -118,19 +118,19 @@ ) (with_template [ ] - [(def: .public ( modulus) + [(def .public ( modulus) (All (_ %) (-> (Modulus %) (Monoid (Mod %)))) (implementation - (def: identity + (def identity (..modular modulus )) - (def: composite + (def composite )))] [..+ +0 addition] [..* +1 multiplication] ) - (def: .public (inverse modular) + (def .public (inverse modular) (All (_ %) (-> (Mod %) (Maybe (Mod %)))) (let [[modulus value] (representation modular) [[vk mk] gcd] (i.extended_gcd value (//.divisor modulus))] @@ -145,7 +145,7 @@ "Reference" (i#encoded (//.divisor reference)) "Subject" (i#encoded (//.divisor subject)))) -(def: .public (adapter reference subject) +(def .public (adapter reference subject) (All (_ r% s%) (-> (Modulus r%) (Modulus s%) (Try (-> (Mod s%) (Mod r%))))) diff --git a/stdlib/source/library/lux/math/modulus.lux b/stdlib/source/library/lux/math/modulus.lux index 7071c834a..3f976476a 100644 --- a/stdlib/source/library/lux/math/modulus.lux +++ b/stdlib/source/library/lux/math/modulus.lux @@ -23,22 +23,22 @@ (primitive .public (Modulus %) Int - (def: .public (modulus value) + (def .public (modulus value) (Ex (_ %) (-> Int (Try (Modulus %)))) (if (i.= +0 value) (exception.except ..zero_cannot_be_a_modulus []) {try.#Success (abstraction value)})) - (def: .public divisor + (def .public divisor (All (_ %) (-> (Modulus %) Int)) (|>> representation)) - (def: .public (= reference subject) + (def .public (= reference subject) (All (_ %r %s) (-> (Modulus %r) (Modulus %s) Bit)) (i.= (representation reference) (representation subject))) - (def: .public (congruent? modulus reference subject) + (def .public (congruent? modulus reference subject) (All (_ %) (-> (Modulus %) Int Int Bit)) (|> subject (i.- reference) @@ -46,7 +46,7 @@ (i.= +0))) ) -(def: .public literal +(def .public literal (syntax (_ [divisor .int]) (meta.lifted (do try.monad diff --git a/stdlib/source/library/lux/math/number.lux b/stdlib/source/library/lux/math/number.lux index 59310fc99..4e1beb005 100644 --- a/stdlib/source/library/lux/math/number.lux +++ b/stdlib/source/library/lux/math/number.lux @@ -15,10 +15,10 @@ ["[1][0]" rev] ["[1][0]" frac]]) -(def: separator +(def separator ",") -(def: (separator_prefixed? number) +(def (separator_prefixed? number) (-> Text Bit) (case ("lux text index" 0 ..separator number) {.#Some 0} @@ -27,12 +27,12 @@ _ #0)) -(def: without_separators +(def without_separators (-> Text Text) (text.replaced ..separator "")) (with_template [ ] - [(def: .public + [(def .public (macro (_ tokens state) (case tokens {.#Item [meta {.#Text repr'}] {.#End}} diff --git a/stdlib/source/library/lux/math/number/complex.lux b/stdlib/source/library/lux/math/number/complex.lux index 8708b9c7f..58a8cd4be 100644 --- a/stdlib/source/library/lux/math/number/complex.lux +++ b/stdlib/source/library/lux/math/number/complex.lux @@ -22,34 +22,34 @@ [#real Frac #imaginary Frac])) -(def: .public complex +(def .public complex (syntax (_ [real .any ?imaginary (<>.maybe .any)]) (in (list (` [..#real (~ real) ..#imaginary (~ (maybe.else (' +0.0) ?imaginary))]))))) -(def: .public i +(def .public i Complex (..complex +0.0 +1.0)) -(def: .public +one +(def .public +one Complex (..complex +1.0 +0.0)) -(def: .public -one +(def .public -one Complex (..complex -1.0 +0.0)) -(def: .public zero +(def .public zero Complex (..complex +0.0 +0.0)) -(def: .public (not_a_number? complex) +(def .public (not_a_number? complex) (-> Complex Bit) (or (f.not_a_number? (the #real complex)) (f.not_a_number? (the #imaginary complex)))) -(def: .public (= param input) +(def .public (= param input) (-> Complex Complex Bit) (and (f.= (the #real param) (the #real input)) @@ -57,7 +57,7 @@ (the #imaginary input)))) (with_template [ ] - [(def: .public ( param input) + [(def .public ( param input) (-> Complex Complex Complex) [#real ( (the #real param) (the #real input)) @@ -68,13 +68,13 @@ [- f.-] ) -(def: .public equivalence +(def .public equivalence (Equivalence Complex) (implementation - (def: = ..=))) + (def = ..=))) (with_template [ ] - [(def: .public + [(def .public (-> Complex Complex) (|>> (revised #real ) (revised #imaginary )))] @@ -83,18 +83,18 @@ [signum f.signum] ) -(def: .public conjugate +(def .public conjugate (-> Complex Complex) (revised #imaginary f.opposite)) -(def: .public (*' param input) +(def .public (*' param input) (-> Frac Complex Complex) [#real (f.* param (the #real input)) #imaginary (f.* param (the #imaginary input))]) -(def: .public (* param input) +(def .public (* param input) (-> Complex Complex Complex) [#real (f.- (f.* (the #imaginary param) (the #imaginary input)) @@ -105,7 +105,7 @@ (f.* (the #imaginary param) (the #real input)))]) -(def: .public (/ param input) +(def .public (/ param input) (-> Complex Complex Complex) (let [(open "[0]") param] (if (f.< (f.abs #imaginary) @@ -119,13 +119,13 @@ [..#real (|> (the ..#imaginary input) (f.* quot) (f.+ (the ..#real input)) (f./ denom)) ..#imaginary (|> (the ..#imaginary input) (f.- (f.* quot (the ..#real input))) (f./ denom))])))) -(def: .public (/' param subject) +(def .public (/' param subject) (-> Frac Complex Complex) (let [(open "[0]") subject] [..#real (f./ param #real) ..#imaginary (f./ param #imaginary)])) -(def: .public (% param input) +(def .public (% param input) (-> Complex Complex Complex) (let [scaled (/ param input) quotient (|> scaled @@ -134,7 +134,7 @@ (- (* quotient param) input))) -(def: .public (cos subject) +(def .public (cos subject) (-> Complex Complex) (let [(open "[0]") subject] [..#real (f.* (f.cosh #imaginary) @@ -142,7 +142,7 @@ ..#imaginary (f.opposite (f.* (f.sinh #imaginary) (f.sin #real)))])) -(def: .public (cosh subject) +(def .public (cosh subject) (-> Complex Complex) (let [(open "[0]") subject] [..#real (f.* (f.cos #imaginary) @@ -150,7 +150,7 @@ ..#imaginary (f.* (f.sin #imaginary) (f.sinh #real))])) -(def: .public (sin subject) +(def .public (sin subject) (-> Complex Complex) (let [(open "[0]") subject] [..#real (f.* (f.cosh #imaginary) @@ -158,7 +158,7 @@ ..#imaginary (f.* (f.sinh #imaginary) (f.cos #real))])) -(def: .public (sinh subject) +(def .public (sinh subject) (-> Complex Complex) (let [(open "[0]") subject] [..#real (f.* (f.cos #imaginary) @@ -166,7 +166,7 @@ ..#imaginary (f.* (f.sin #imaginary) (f.cosh #real))])) -(def: .public (tan subject) +(def .public (tan subject) (-> Complex Complex) (let [(open "[0]") subject r2 (f.* +2.0 #real) @@ -175,7 +175,7 @@ [..#real (f./ d (f.sin r2)) ..#imaginary (f./ d (f.sinh i2))])) -(def: .public (tanh subject) +(def .public (tanh subject) (-> Complex Complex) (let [(open "[0]") subject r2 (f.* +2.0 #real) @@ -184,7 +184,7 @@ [..#real (f./ d (f.sinh r2)) ..#imaginary (f./ d (f.sin i2))])) -(def: .public (abs subject) +(def .public (abs subject) (-> Complex Frac) (let [(open "[0]") subject] (if (f.< (f.abs #imaginary) @@ -200,21 +200,21 @@ (f.* (f.pow +0.5 (f.+ +1.0 (f.* q q))) (f.abs #real))))))) -(def: .public (exp subject) +(def .public (exp subject) (-> Complex Complex) (let [(open "[0]") subject r_exp (f.exp #real)] [..#real (f.* r_exp (f.cos #imaginary)) ..#imaginary (f.* r_exp (f.sin #imaginary))])) -(def: .public (log subject) +(def .public (log subject) (-> Complex Complex) (let [(open "[0]") subject] [..#real (|> subject ..abs f.log) ..#imaginary (f.atan_2 #real #imaginary)])) (with_template [ ] - [(def: .public ( param input) + [(def .public ( param input) (-> Complex Complex) (|> input log ( param) exp))] @@ -222,11 +222,11 @@ [pow' Frac ..*'] ) -(def: (with_sign sign magnitude) +(def (with_sign sign magnitude) (-> Frac Frac Frac) (f.* (f.signum sign) magnitude)) -(def: .public (root_2 input) +(def .public (root_2 input) (-> Complex Complex) (let [(open "[0]") input t (|> input ..abs (f.+ (f.abs #real)) (f./ +2.0) (f.pow +0.5))] @@ -238,11 +238,11 @@ ..#imaginary (f./ (f.* +2.0 t) #imaginary)]))) -(def: (root_2-1z input) +(def (root_2-1z input) (-> Complex Complex) (|> (complex +1.0) (- (* input input)) ..root_2)) -(def: .public (reciprocal (open "[0]")) +(def .public (reciprocal (open "[0]")) (-> Complex Complex) (if (f.< (f.abs #imaginary) (f.abs #real)) @@ -257,14 +257,14 @@ [..#real scale ..#imaginary (|> scale f.opposite (f.* q))]))) -(def: .public (acos input) +(def .public (acos input) (-> Complex Complex) (|> input (..+ (|> input ..root_2-1z (..* ..i))) ..log (..* (..opposite ..i)))) -(def: .public (asin input) +(def .public (asin input) (-> Complex Complex) (|> input ..root_2-1z @@ -272,7 +272,7 @@ ..log (..* (..opposite ..i)))) -(def: .public (atan input) +(def .public (atan input) (-> Complex Complex) (|> input (..+ ..i) @@ -280,11 +280,11 @@ ..log (..* (../ (..complex +2.0) ..i)))) -(def: .public (argument (open "[0]")) +(def .public (argument (open "[0]")) (-> Complex Frac) (f.atan_2 #real #imaginary)) -(def: .public (roots nth input) +(def .public (roots nth input) (-> Nat Complex (List Complex)) (case nth 0 (list) @@ -304,7 +304,7 @@ [..#real real ..#imaginary imaginary]))))))) -(def: .public (approximately? margin_of_error standard value) +(def .public (approximately? margin_of_error standard value) (-> Frac Complex Complex Bit) (and (f.approximately? margin_of_error (the ..#real standard) diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux index ea62f7c92..c3203335a 100644 --- a/stdlib/source/library/lux/math/number/frac.lux +++ b/stdlib/source/library/lux/math/number/frac.lux @@ -24,7 +24,7 @@ ["[1][0]" rev]]) (with_template [ ] - [(def: .public + [(def .public )] [e +2.7182818284590452354] @@ -36,7 +36,7 @@ (for @.old (these (with_template [ ] - [(def: .public ( it) + [(def .public ( it) (-> Frac Frac) ( it))] @@ -57,18 +57,18 @@ [root_2 "jvm invokestatic:java.lang.Math:sqrt:double"] [root_3 "jvm invokestatic:java.lang.Math:cbrt:double"] ) - (def: .public (pow param subject) + (def .public (pow param subject) (-> Frac Frac Frac) ("jvm invokestatic:java.lang.Math:pow:double,double" subject param))) @.jvm - (these (def: !double + (these (def !double (template (_ value) [(|> value (as (Primitive "java.lang.Double")) "jvm object cast")])) - (def: !frac + (def !frac (template (_ value) [(|> value "jvm object cast" @@ -76,7 +76,7 @@ (as Frac))])) (with_template [ ] - [(def: .public + [(def .public (-> Frac Frac) (|>> !double ["D"] @@ -101,7 +101,7 @@ [root_3 "cbrt"] ) - (def: .public (pow param subject) + (def .public (pow param subject) (-> Frac Frac Frac) (|> ("jvm member invoke static" [] "java.lang.Math" "pow" [] ["D" (!double subject)] ["D" (!double param)]) @@ -109,7 +109,7 @@ @.js (these (with_template [ ] - [(def: .public + [(def .public (-> Frac Frac) (|>> [] ("js apply" ("js constant" )) @@ -133,13 +133,13 @@ [root_3 "Math.cbrt"] ) - (def: .public (pow param subject) + (def .public (pow param subject) (-> Frac Frac Frac) (as Frac ("js apply" ("js constant" "Math.pow") [subject param])))) @.python (these (with_template [ ] - [(def: .public + [(def .public (-> Frac Frac) (|>> [] ("python object do" ("python import" "math")) @@ -162,11 +162,11 @@ [root_2 "sqrt"] ) - (def: .public (pow param subject) + (def .public (pow param subject) (-> Frac Frac Frac) (as Frac ("python object do" "pow" ("python import" "math") [subject param]))) - (def: .public (root_3 it) + (def .public (root_3 it) (-> Frac Frac) (if ("lux f64 <" +0.0 it) (|> it @@ -178,7 +178,7 @@ @.lua (these (with_template [ ] - [(def: .public + [(def .public (-> Frac Frac) (|>> [] ("lua apply" ("lua constant" )) @@ -201,11 +201,11 @@ [root_2 "math.sqrt"] ) - (def: .public (pow param subject) + (def .public (pow param subject) (-> Frac Frac Frac) ("lua power" param subject)) - (def: .public (root_3 it) + (def .public (root_3 it) (-> Frac Frac) (if ("lux f64 <" +0.0 it) (|> it @@ -217,7 +217,7 @@ @.ruby (these (with_template [ ] - [(def: .public + [(def .public (-> Frac Frac) (|>> [] ("ruby apply" ("ruby constant" )) @@ -239,7 +239,7 @@ ) (with_template [ ] - [(def: .public ( it) + [(def .public ( it) (-> Frac Frac) (|> ("ruby object do" it []) (as Int) @@ -249,13 +249,13 @@ [floor "floor"] ) - (def: .public (pow param subject) + (def .public (pow param subject) (-> Frac Frac Frac) (as Frac ("ruby object do" "**" subject [param])))) @.php (these (with_template [ ] - [(def: .public + [(def .public (-> Frac Frac) (|>> ("php apply" ("php constant" )) (as Frac)))] @@ -277,17 +277,17 @@ [root_2 "sqrt"] ) - (def: .public (pow param subject) + (def .public (pow param subject) (-> Frac Frac Frac) (as Frac ("php apply" ("php constant" "pow") subject param))) - (def: .public root_3 + (def .public root_3 (-> Frac Frac) (..pow ("lux f64 /" +3.0 +1.0)))) @.scheme (these (with_template [ ] - [(def: .public + [(def .public (-> Frac Frac) (|>> ("scheme apply" ("scheme constant" )) (as Frac)))] @@ -309,16 +309,16 @@ [root_2 "sqrt"] ) - (def: .public (pow param subject) + (def .public (pow param subject) (-> Frac Frac Frac) (as Frac ("scheme apply" ("scheme constant" "expt") subject param))) - (def: .public root_3 + (def .public root_3 (-> Frac Frac) (..pow ("lux f64 /" +3.0 +1.0)))) ) -(def: .public (round it) +(def .public (round it) (-> Frac Frac) (let [floored (floor it) diff ("lux f64 -" floored it)] @@ -331,7 +331,7 @@ ... else floored))) -(def: .public (atan_2 x y) +(def .public (atan_2 x y) (-> Frac Frac Frac) (cond ("lux f64 <" x +0.0) (..atan ("lux f64 /" x y)) @@ -352,13 +352,13 @@ ... ("lux f64 =" +0.0 y) ("lux f64 /" +0.0 +0.0)))) -(def: .public (log_by base it) +(def .public (log_by base it) (-> Frac Frac Frac) ("lux f64 /" (..log base) (..log it))) -(def: .public (factorial it) +(def .public (factorial it) (-> Nat Nat) (loop (again [acc 1 it it]) @@ -366,7 +366,7 @@ (again (//nat.* it acc) (-- it)) acc))) -(def: .public (hypotenuse catA catB) +(def .public (hypotenuse catA catB) (-> Frac Frac Frac) (..pow +0.5 ("lux f64 +" (..pow +2.0 catA) @@ -375,11 +375,11 @@ ... Hyperbolic functions ... https://en.wikipedia.org/wiki/Hyperbolic_function#Definitions (with_template [ ] - [(def: .public ( it) + [(def .public ( it) (-> Frac Frac) (|> (..exp it) ( (..exp ("lux f64 *" -1.0 it))) ("lux f64 /" +2.0))) - (def: .public ( it) + (def .public ( it) (-> Frac Frac) (|> +2.0 ("lux f64 /" (|> (..exp it) ( (..exp ("lux f64 *" -1.0 it)))))))] @@ -388,7 +388,7 @@ ) (with_template [ ] - [(def: .public ( it) + [(def .public ( it) (-> Frac Frac) (let [e+ (exp it) e- (exp ("lux f64 *" -1.0 it)) @@ -402,7 +402,7 @@ ... https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions#Definitions_in_terms_of_logarithms (with_template [ ] - [(def: .public ( it) + [(def .public ( it) (-> Frac Frac) (|> it (pow +2.0) ( +1.0) (pow +0.5) ("lux f64 +" it) log))] @@ -411,7 +411,7 @@ ) (with_template [ ] - [(def: .public ( it) + [(def .public ( it) (-> Frac Frac) (let [it+ (|> ("lux f64 +" )) it- (|> ("lux f64 -" ))] @@ -422,7 +422,7 @@ ) (with_template [ ] - [(def: .public ( it) + [(def .public ( it) (-> Frac Frac) (let [it^2 (|> it (pow +2.0))] (|> +1.0 ( it^2) (pow +0.5) ("lux f64 +" +1.0) ("lux f64 /" it) log)))] @@ -432,7 +432,7 @@ ) (with_template [ ] - [(def: .public ( param subject) + [(def .public ( param subject) (-> Frac Frac Bit) ( param subject))] @@ -440,22 +440,22 @@ [< "lux f64 <"] ) -(def: .public (<= reference sample) +(def .public (<= reference sample) (-> Frac Frac Bit) (or ("lux f64 <" reference sample) ("lux f64 =" reference sample))) -(def: .public (> reference sample) +(def .public (> reference sample) (-> Frac Frac Bit) ("lux f64 <" sample reference)) -(def: .public (>= reference sample) +(def .public (>= reference sample) (-> Frac Frac Bit) (or ("lux f64 <" sample reference) ("lux f64 =" sample reference))) (with_template [ ] - [(def: .public + [(def .public (Predicate Frac) ( +0.0))] @@ -465,7 +465,7 @@ ) (with_template [ ] - [(def: .public ( param subject) + [(def .public ( param subject) (-> Frac Frac Frac) ( param subject))] @@ -476,33 +476,33 @@ [% "lux f64 %"] ) -(def: .public (/% param subject) +(def .public (/% param subject) (-> Frac Frac [Frac Frac]) [(../ param subject) (..% param subject)]) -(def: .public opposite +(def .public opposite (-> Frac Frac) (..* -1.0)) -(def: .public (abs it) +(def .public (abs it) (-> Frac Frac) (if (..< +0.0 it) (..* -1.0 it) it)) -(def: .public (signum it) +(def .public (signum it) (-> Frac Frac) (cond (..= +0.0 it) +0.0 (..< +0.0 it) -1.0 ... else +1.0)) -(def: min_exponent -1022) -(def: max_exponent (//int.frac +1023)) +(def min_exponent -1022) +(def max_exponent (//int.frac +1023)) (with_template [ ] - [(def: .public ( left right) + [(def .public ( left right) (-> Frac Frac Frac) (if ( right left) left @@ -512,23 +512,23 @@ [max ..>] ) -(def: .public nat +(def .public nat (-> Frac Nat) (|>> "lux f64 i64" .nat)) -(def: .public int +(def .public int (-> Frac Int) (|>> "lux f64 i64")) -(def: mantissa_size Nat 52) -(def: exponent_size Nat 11) +(def mantissa_size Nat 52) +(def exponent_size Nat 11) -(def: frac_denominator +(def frac_denominator (|> -1 ("lux i64 right-shift" ..exponent_size) "lux i64 f64")) -(def: .public rev +(def .public rev (-> Frac Rev) (|>> ..abs (..% +1.0) @@ -537,7 +537,7 @@ ("lux i64 left-shift" ..exponent_size))) (with_template [ ] - [(def: .public + [(def .public Frac (../ +0.0 ))] @@ -545,40 +545,40 @@ [positive_infinity +1.0] ) -(def: .public negative_infinity +(def .public negative_infinity Frac (..* -1.0 ..positive_infinity)) -(def: .public (not_a_number? it) +(def .public (not_a_number? it) (-> Frac Bit) (not (..= it it))) -(def: .public (number? it) +(def .public (number? it) (-> Frac Bit) (not (or (..not_a_number? it) (..= ..positive_infinity it) (..= ..negative_infinity it)))) -(def: .public equivalence +(def .public equivalence (Equivalence Frac) (implementation - (def: (= left right) + (def (= left right) (or (..= left right) (and (..not_a_number? left) (..not_a_number? right)))))) -(def: .public order +(def .public order (Order Frac) (implementation - (def: equivalence ..equivalence) - (def: < ..<))) + (def equivalence ..equivalence) + (def < ..<))) -(def: .public smallest +(def .public smallest Frac (..pow (//int.frac (//int.- (.int ..mantissa_size) ..min_exponent)) +2.0)) -(def: .public biggest +(def .public biggest Frac (let [f2^-52 (..pow (//nat.frac (//nat.- ..mantissa_size 0)) +2.0) f2^+1023 (..pow ..max_exponent +2.0)] @@ -587,11 +587,11 @@ (..* f2^+1023)))) (with_template [ ] - [(def: .public + [(def .public (Monoid Frac) (implementation - (def: identity ) - (def: composite )))] + (def identity ) + (def composite )))] [addition ..+ +0.0] [multiplication ..* +1.0] @@ -599,10 +599,10 @@ [maximum ..max (..* -1.0 ..biggest)] ) -(def: .public decimal +(def .public decimal (Codec Text Frac) (implementation - (def: (encoded x) + (def (encoded x) (case x -0.0 (let [output ("lux f64 encode" x)] (if (text.starts_with? "-" output) @@ -612,7 +612,7 @@ ("lux f64 encode" x) ("lux text concat" "+" ("lux f64 encode" x))))) - (def: (decoded input) + (def (decoded input) (case ("lux f64 decode" input) {.#Some value} {try.#Success value} @@ -620,20 +620,20 @@ {.#None} {try.#Failure "Could not decode Frac"})))) -(def: log/2 +(def log/2 (-> Frac Frac) (|>> ..log (../ (..log +2.0)))) -(def: double_bias Nat 1023) +(def double_bias Nat 1023) -(def: exponent_mask (//i64.mask ..exponent_size)) +(def exponent_mask (//i64.mask ..exponent_size)) -(def: exponent_offset ..mantissa_size) -(def: sign_offset (//nat.+ ..exponent_size ..exponent_offset)) +(def exponent_offset ..mantissa_size) +(def sign_offset (//nat.+ ..exponent_size ..exponent_offset)) (with_template [ ] - [(def: + [(def (|> (at //nat.hex decoded) try.trusted @@ -647,10 +647,10 @@ [.nat "7FF" special_exponent_bits] ) -(def: smallest_exponent +(def smallest_exponent (..log/2 ..smallest)) -(def: .public (bits it) +(def .public (bits it) (-> Frac I64) (.i64 (cond (..not_a_number? it) ..not_a_number_bits @@ -703,7 +703,7 @@ ))) (with_template [ ] - [(def: + [(def (-> (I64 Any) I64) (let [mask (|> 1 (//i64.left_shifted ) -- (//i64.left_shifted ))] (|>> (//i64.and mask) (//i64.right_shifted ) .i64)))] @@ -713,7 +713,7 @@ [sign 1 ..sign_offset] ) -(def: .public (of_bits it) +(def .public (of_bits it) (-> I64 Frac) (case [(is Nat (..exponent it)) (is Nat (..mantissa it)) @@ -752,7 +752,7 @@ (..* exponent) (..* sign))))) -(def: (representation_exponent codec representation) +(def (representation_exponent codec representation) (-> (Codec Text Nat) Text (Try [Text Int])) (case [("lux text index" 0 "e+" representation) ("lux text index" 0 "E+" representation) @@ -777,10 +777,10 @@ {try.#Success [representation +0]})) (with_template [ ] - [(def: .public + [(def .public (Codec Text Frac) (implementation - (def: (encoded value) + (def (encoded value) (let [bits (..bits value) mantissa (..mantissa bits) exponent (//int.- (.int ..double_bias) (..exponent bits)) @@ -794,7 +794,7 @@ ".0E" (at encoded exponent)))) - (def: (decoded representation) + (def (decoded representation) (let [negative? (text.starts_with? "-" representation) positive? (text.starts_with? "+" representation)] (if (or negative? positive?) @@ -830,20 +830,20 @@ [hex //nat.hex //int.hex "Invalid hexadecimal syntax: "] ) -(def: .public hash +(def .public hash (Hash Frac) (implementation - (def: equivalence ..equivalence) - (def: hash ..bits))) + (def equivalence ..equivalence) + (def hash ..bits))) -(def: .public (approximately? margin_of_error standard value) +(def .public (approximately? margin_of_error standard value) (-> Frac Frac Frac Bit) (|> value (..- standard) ..abs (..< margin_of_error))) -(def: .public (mod divisor dividend) +(def .public (mod divisor dividend) (All (_ m) (-> Frac Frac Frac)) (let [remainder (..% divisor dividend)] (if (or (and (..< +0.0 divisor) diff --git a/stdlib/source/library/lux/math/number/i16.lux b/stdlib/source/library/lux/math/number/i16.lux index 76488032d..7f1cfda9b 100644 --- a/stdlib/source/library/lux/math/number/i16.lux +++ b/stdlib/source/library/lux/math/number/i16.lux @@ -9,10 +9,10 @@ [// ["[0]" i64 (.only Sub)]]) -(def: sub +(def sub (maybe.trusted (i64.sub 16))) -(def: .public I16 +(def .public I16 Type ... TODO: Switch to the cleaner approach ASAP. (case (type_of ..sub) @@ -27,7 +27,7 @@ ... (I64 size)) ) -(def: .public equivalence (Equivalence I16) (at ..sub sub_equivalence)) -(def: .public width Nat (at ..sub bits)) -(def: .public i16 (-> I64 I16) (at ..sub narrow)) -(def: .public i64 (-> I16 I64) (at ..sub wide)) +(def .public equivalence (Equivalence I16) (at ..sub sub_equivalence)) +(def .public width Nat (at ..sub bits)) +(def .public i16 (-> I64 I16) (at ..sub narrow)) +(def .public i64 (-> I16 I64) (at ..sub wide)) diff --git a/stdlib/source/library/lux/math/number/i32.lux b/stdlib/source/library/lux/math/number/i32.lux index 42a35144c..65958842e 100644 --- a/stdlib/source/library/lux/math/number/i32.lux +++ b/stdlib/source/library/lux/math/number/i32.lux @@ -9,12 +9,12 @@ [// ["[0]" i64 (.only Sub)]]) -(def: sub +(def sub ... TODO: Stop needing this coercion. (as (Sub (I64 (Primitive "#I32"))) (maybe.trusted (i64.sub 32)))) -(def: .public I32 +(def .public I32 Type ... TODO: Switch to the cleaner approach ASAP. (case (type_of ..sub) @@ -29,7 +29,7 @@ ... (I64 size)) ) -(def: .public equivalence (Equivalence I32) (at ..sub sub_equivalence)) -(def: .public width Nat (at ..sub bits)) -(def: .public i32 (-> I64 I32) (at ..sub narrow)) -(def: .public i64 (-> I32 I64) (at ..sub wide)) +(def .public equivalence (Equivalence I32) (at ..sub sub_equivalence)) +(def .public width Nat (at ..sub bits)) +(def .public i32 (-> I64 I32) (at ..sub narrow)) +(def .public i64 (-> I32 I64) (at ..sub wide)) diff --git a/stdlib/source/library/lux/math/number/i64.lux b/stdlib/source/library/lux/math/number/i64.lux index 78a5c798f..c476676a5 100644 --- a/stdlib/source/library/lux/math/number/i64.lux +++ b/stdlib/source/library/lux/math/number/i64.lux @@ -10,19 +10,19 @@ [// ["n" nat]]) -(def: .public bits_per_byte +(def .public bits_per_byte 8) -(def: .public bytes_per_i64 +(def .public bytes_per_i64 8) -(def: .public width +(def .public width Nat (n.* ..bits_per_byte ..bytes_per_i64)) (with_template [ ] - [(def: .public ( parameter subject) + [(def .public ( parameter subject) (All (_ s) (-> (I64 s) (I64 s))) ( parameter subject))] @@ -38,27 +38,27 @@ (type: .public Mask I64) -(def: .public (bit position) +(def .public (bit position) (-> Nat Mask) (|> 1 .i64 (..left_shifted (n.% ..width position)))) -(def: .public sign +(def .public sign Mask (..bit (-- ..width))) -(def: .public not +(def .public not (All (_ s) (-> (I64 s) (I64 s))) (..xor (.i64 (-- 0)))) -(def: .public false +(def .public false Mask (.i64 0)) -(def: .public true +(def .public true Mask (..not ..false)) -(def: .public (mask amount_of_bits) +(def .public (mask amount_of_bits) (-> Nat Mask) (case amount_of_bits 0 ..false @@ -66,11 +66,11 @@ 0 ..true bits (|> 1 .i64 (..left_shifted (n.% ..width bits)) .--)))) -(def: (with_shift shift value) +(def (with_shift shift value) (-> Nat Nat Nat) (|> value (right_shifted shift) (n.+ value))) -(def: .public (ones it) +(def .public (ones it) (-> (I64 Any) Nat) (let [ones' (n.- (|> it (right_shifted 1) (..and 6148914691236517205) i64) (i64 it))] @@ -82,12 +82,12 @@ (with_shift 32) (..and 127)))) -(def: .public (zero index input) +(def .public (zero index input) (All (_ s) (-> Nat (I64 s) (I64 s))) (|> index ..bit ..not (..and input))) (with_template [ ] - [(def: .public ( index input) + [(def .public ( index input) (All (_ s) (-> Nat (I64 s) (I64 s))) (|> index ..bit ( input)))] @@ -95,16 +95,16 @@ [flipped ..xor] ) -(def: .public (one? index input) +(def .public (one? index input) (-> Nat (I64 Any) Bit) (|> input .i64 (..and (..bit index)) (n.= 0) .not)) -(def: .public (zero? index input) +(def .public (zero? index input) (-> Nat (I64 Any) Bit) (.not (..one? index input))) (with_template [ ] - [(def: .public ( distance input) + [(def .public ( distance input) (All (_ s) (-> Nat (I64 s) (I64 s))) (..or ( distance input) ( (n.- (n.% ..width distance) ..width) input)))] @@ -113,35 +113,35 @@ [right_rotated ..right_shifted ..left_shifted] ) -(def: .public (region offset size) +(def .public (region offset size) (-> Nat Nat Mask) (..left_rotated offset (..mask size))) -(def: .public equivalence +(def .public equivalence (All (_ a) (Equivalence (I64 a))) (implementation - (def: (= reference sample) + (def (= reference sample) ("lux i64 =" reference sample)))) -(def: .public hash +(def .public hash (All (_ a) (Hash (I64 a))) (implementation - (def: equivalence ..equivalence) + (def equivalence ..equivalence) - (def: hash (|>> .nat)))) + (def hash (|>> .nat)))) (with_template [ ] - [(def: .public + [(def .public (All (_ a) (Monoid (I64 a))) (implementation - (def: identity ) - (def: composite )))] + (def identity ) + (def composite )))] [disjunction ..false ..or] [conjunction ..true ..and] ) -(def: .public reversed +(def .public reversed (All (_ a) (-> (I64 a) (I64 a))) (let [swapper (is (-> Nat (All (_ a) (-> (I64 a) (I64 a)))) (function (_ power) @@ -189,7 +189,7 @@ (is (-> (I64 size) I64) wide))) -(def: .public (sub width) +(def .public (sub width) (Ex (_ size) (-> Nat (Maybe (Sub size)))) (if (.and (n.> 0 width) (n.< ..width width)) @@ -199,12 +199,12 @@ co_mantissa (..xor (.i64 -1) mantissa)] {.#Some (is Sub (implementation - (def: sub_equivalence ..equivalence) - (def: bits width) - (def: (narrow value) + (def sub_equivalence ..equivalence) + (def bits width) + (def (narrow value) (..or (|> value (..and ..sign) (..right_shifted sign_shift)) (|> value (..and mantissa)))) - (def: (wide value) + (def (wide value) (.i64 (case (.nat (..and sign value)) 0 value _ (..or co_mantissa value))))))}) diff --git a/stdlib/source/library/lux/math/number/i8.lux b/stdlib/source/library/lux/math/number/i8.lux index 36bafd4d6..6c13fc7ab 100644 --- a/stdlib/source/library/lux/math/number/i8.lux +++ b/stdlib/source/library/lux/math/number/i8.lux @@ -9,10 +9,10 @@ [// ["[0]" i64 (.only Sub)]]) -(def: sub +(def sub (maybe.trusted (i64.sub 8))) -(def: .public I8 +(def .public I8 Type ... TODO: Switch to the cleaner approach ASAP. (case (type_of ..sub) @@ -27,7 +27,7 @@ ... (I64 size)) ) -(def: .public equivalence (Equivalence I8) (at ..sub sub_equivalence)) -(def: .public width Nat (at ..sub bits)) -(def: .public i8 (-> I64 I8) (at ..sub narrow)) -(def: .public i64 (-> I8 I64) (at ..sub wide)) +(def .public equivalence (Equivalence I8) (at ..sub sub_equivalence)) +(def .public width Nat (at ..sub bits)) +(def .public i8 (-> I64 I8) (at ..sub narrow)) +(def .public i64 (-> I8 I64) (at ..sub wide)) diff --git a/stdlib/source/library/lux/math/number/int.lux b/stdlib/source/library/lux/math/number/int.lux index 19d2459f9..2f13df457 100644 --- a/stdlib/source/library/lux/math/number/int.lux +++ b/stdlib/source/library/lux/math/number/int.lux @@ -22,7 +22,7 @@ ["[1][0]" i64]]) (with_template [ ] - [(def: .public ( param subject) + [(def .public ( param subject) (-> Int Int Bit) ( param subject))] @@ -30,24 +30,24 @@ [< "lux i64 <"] ) -(def: .public (<= reference sample) +(def .public (<= reference sample) (-> Int Int Bit) (if ("lux i64 <" reference sample) #1 ("lux i64 =" reference sample))) -(def: .public (> reference sample) +(def .public (> reference sample) (-> Int Int Bit) ("lux i64 <" sample reference)) -(def: .public (>= reference sample) +(def .public (>= reference sample) (-> Int Int Bit) (if ("lux i64 <" sample reference) #1 ("lux i64 =" reference sample))) (with_template [ ] - [(def: .public + [(def .public (Predicate Int) ( +0))] @@ -57,7 +57,7 @@ ) (with_template [ ] - [(def: .public ( left right) + [(def .public ( left right) (-> Int Int Int) (if ( right left) left @@ -68,7 +68,7 @@ ) (with_template [ ] - [(def: .public ( param subject) + [(def .public ( param subject) (-> Int Int Int) ( param subject))] @@ -79,22 +79,22 @@ [% "lux i64 %"] ) -(def: .public (/% param subject) +(def .public (/% param subject) (-> Int Int [Int Int]) [(../ param subject) (..% param subject)]) -(def: .public (opposite it) +(def .public (opposite it) (-> Int Int) (..- it +0)) -(def: .public (abs it) +(def .public (abs it) (-> Int Int) (if (..< +0 it) (..* -1 it) it)) -(def: .public (signum it) +(def .public (signum it) (-> Int Int) (cond (..= +0 it) +0 (..< +0 it) -1 @@ -102,7 +102,7 @@ +1)) ... https://rob.conery.io/2018/08/21/mod-and-remainder-are-not-the-same/ -(def: .public (mod divisor dividend) +(def .public (mod divisor dividend) (All (_ m) (-> Int Int Int)) (let [remainder (..% divisor dividend)] (if (or (and (..< +0 divisor) @@ -112,27 +112,27 @@ (..+ divisor remainder) remainder))) -(def: .public even? +(def .public even? (-> Int Bit) (|>> (..% +2) ("lux i64 =" +0))) -(def: .public odd? +(def .public odd? (-> Int Bit) (|>> ..even? not)) ... https://en.wikipedia.org/wiki/Greatest_common_divisor -(def: .public (gcd a b) +(def .public (gcd a b) (-> Int Int Int) (case b +0 a _ (gcd b (..% b a)))) -(def: .public (co_prime? a b) +(def .public (co_prime? a b) (-> Int Int Bit) (..= +1 (..gcd a b))) ... https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm -(def: .public (extended_gcd a b) +(def .public (extended_gcd a b) (-> Int Int [[Int Int] Int]) (loop (again [x +1 x1 +0 y +0 y1 +1 @@ -145,7 +145,7 @@ b1 (- (* q b1) a1)))))) ... https://en.wikipedia.org/wiki/Least_common_multiple -(def: .public (lcm a b) +(def .public (lcm a b) (-> Int Int Int) (case [a b] (^.or [_ +0] [+0 _]) @@ -154,48 +154,48 @@ _ (|> a (/ (gcd a b)) (* b)))) -(def: .public frac +(def .public frac (-> Int Frac) (|>> "lux i64 f64")) -(def: .public equivalence +(def .public equivalence (Equivalence Int) (implementation - (def: = ..=))) + (def = ..=))) -(def: .public order +(def .public order (Order Int) (implementation - (def: equivalence ..equivalence) - (def: < ..<))) + (def equivalence ..equivalence) + (def < ..<))) -(def: .public enum +(def .public enum (Enum Int) (implementation - (def: order ..order) - (def: succ ++) - (def: pred --))) + (def order ..order) + (def succ ++) + (def pred --))) ... TODO: Find out why the numeric literals fail during JS compilation. -(def: .public interval +(def .public interval (Interval Int) (implementation - (def: enum ..enum) - (def: top + (def enum ..enum) + (def top ... +9,223,372,036,854,775,807 (let [half (//i64.left_shifted 62 +1)] (+ half (-- half)))) - (def: bottom + (def bottom ... -9,223,372,036,854,775,808 (//i64.left_shifted 63 +1)))) (with_template [ ] - [(def: .public + [(def .public (Monoid Int) (implementation - (def: identity ) - (def: composite )))] + (def identity ) + (def composite )))] [addition ..+ +0] [multiplication ..* +1] @@ -203,19 +203,19 @@ [minimum ..min (at ..interval top)] ) -(def: -sign "-") -(def: +sign "+") +(def -sign "-") +(def +sign "+") (with_template [ ] - [(def: .public + [(def .public (Codec Text Int) (implementation - (def: (encoded value) + (def (encoded value) (if (..< +0 value) (|> value ++ ..opposite .nat ++ (at encoded) ("lux text concat" ..-sign)) (|> value .nat (at encoded) ("lux text concat" ..+sign)))) - (def: (decoded repr) + (def (decoded repr) (let [input_size ("lux text size" repr)] (if (//nat.> 1 input_size) (case ("lux text clip" 0 1 repr) @@ -241,13 +241,13 @@ [hex //nat.hex "Invalid hexadecimal syntax for Int: "] ) -(def: .public hash +(def .public hash (Hash Int) (implementation - (def: equivalence ..equivalence) - (def: hash (|>> .nat)))) + (def equivalence ..equivalence) + (def hash (|>> .nat)))) -(def: .public (right_shifted parameter subject) +(def .public (right_shifted parameter subject) (-> Nat Int Int) (with_expansions [ (//i64.right_shifted parameter subject)] (if (< +0 subject) diff --git a/stdlib/source/library/lux/math/number/nat.lux b/stdlib/source/library/lux/math/number/nat.lux index 206a6fe46..53828d2fa 100644 --- a/stdlib/source/library/lux/math/number/nat.lux +++ b/stdlib/source/library/lux/math/number/nat.lux @@ -17,7 +17,7 @@ ["^" pattern]]]]) (with_template [ ] - [(def: .public ( parameter subject) + [(def .public ( parameter subject) (-> Nat Nat ) ( parameter subject))] @@ -26,16 +26,16 @@ ["lux i64 -" Nat -] ) -(def: high +(def high (-> (I64 Any) I64) (|>> ("lux i64 right-shift" 32))) -(def: low +(def low (-> (I64 Any) I64) (let [mask (|> 1 ("lux i64 left-shift" 32) ("lux i64 -" 1))] (|>> ("lux i64 and" mask)))) -(def: .public (< reference sample) +(def .public (< reference sample) (-> Nat Nat Bit) (let [referenceH (..high reference) sampleH (..high sample)] @@ -47,22 +47,22 @@ (..low sample)) #0)))) -(def: .public (<= reference sample) +(def .public (<= reference sample) (-> Nat Nat Bit) (or (..< reference sample) ("lux i64 =" reference sample))) -(def: .public (> reference sample) +(def .public (> reference sample) (-> Nat Nat Bit) (..< sample reference)) -(def: .public (>= reference sample) +(def .public (>= reference sample) (-> Nat Nat Bit) (or (..< sample reference) ("lux i64 =" reference sample))) (with_template [ ] - [(def: .public ( left right) + [(def .public ( left right) (-> Nat Nat Nat) (if ( right left) left @@ -72,13 +72,13 @@ [max ..>] ) -(def: .public (* parameter subject) +(def .public (* parameter subject) (-> Nat Nat Nat) (.nat ("lux i64 *" (.int parameter) (.int subject)))) -(def: .public (/ parameter subject) +(def .public (/ parameter subject) (-> Nat Nat Nat) (if ("lux i64 <" +0 (.int parameter)) (if (..< parameter subject) @@ -96,7 +96,7 @@ quotient ("lux i64 +" 1 quotient))))) -(def: .public (/% parameter subject) +(def .public (/% parameter subject) (-> Nat Nat [Nat Nat]) (let [quotient (../ parameter subject) flat ("lux i64 *" @@ -104,24 +104,24 @@ (.int quotient))] [quotient ("lux i64 -" flat subject)])) -(def: .public (% parameter subject) +(def .public (% parameter subject) (-> Nat Nat Nat) (let [flat ("lux i64 *" (.int parameter) (.int (../ parameter subject)))] ("lux i64 -" flat subject))) -(def: .public (gcd a b) +(def .public (gcd a b) (-> Nat Nat Nat) (case b 0 a _ (gcd b (..% b a)))) -(def: .public (co_prime? a b) +(def .public (co_prime? a b) (-> Nat Nat Bit) (..= 1 (..gcd a b))) -(def: .public (lcm a b) +(def .public (lcm a b) (-> Nat Nat Nat) (case [a b] (^.or [_ 0] [0 _]) @@ -130,49 +130,49 @@ _ (|> a (../ (..gcd a b)) (..* b)))) -(def: .public even? +(def .public even? (-> Nat Bit) (|>> (..% 2) ("lux i64 =" 0))) -(def: .public odd? +(def .public odd? (-> Nat Bit) (|>> ..even? not)) -(def: .public frac +(def .public frac (-> Nat Frac) (|>> .int "lux i64 f64")) -(def: .public equivalence +(def .public equivalence (Equivalence Nat) (implementation - (def: = ..=))) + (def = ..=))) -(def: .public order +(def .public order (Order Nat) (implementation - (def: equivalence ..equivalence) - (def: < ..<))) + (def equivalence ..equivalence) + (def < ..<))) -(def: .public enum +(def .public enum (Enum Nat) (implementation - (def: order ..order) - (def: succ ++) - (def: pred --))) + (def order ..order) + (def succ ++) + (def pred --))) -(def: .public interval +(def .public interval (Interval Nat) (implementation - (def: enum ..enum) - (def: top (-- 0)) - (def: bottom 0))) + (def enum ..enum) + (def top (-- 0)) + (def bottom 0))) (with_template [ ] - [(def: .public + [(def .public (Monoid Nat) (implementation - (def: identity ) - (def: composite )))] + (def identity ) + (def composite )))] [addition ..+ 0] [multiplication ..* 1] @@ -180,21 +180,21 @@ [maximum ..max (at ..interval bottom)] ) -(def: (binary_character value) +(def (binary_character value) (-> Nat Text) (case value 0 "0" 1 "1" _ (undefined))) -(def: (binary_value digit) +(def (binary_value digit) (-> Nat (Maybe Nat)) (case digit (pattern (char "0")) {.#Some 0} (pattern (char "1")) {.#Some 1} _ {.#None})) -(def: (octal_character value) +(def (octal_character value) (-> Nat Text) (case value 0 "0" @@ -207,7 +207,7 @@ 7 "7" _ (undefined))) -(def: (octal_value digit) +(def (octal_value digit) (-> Nat (Maybe Nat)) (case digit (pattern (char "0")) {.#Some 0} @@ -220,7 +220,7 @@ (pattern (char "7")) {.#Some 7} _ {.#None})) -(def: (decimal_character value) +(def (decimal_character value) (-> Nat Text) (case value 0 "0" @@ -235,7 +235,7 @@ 9 "9" _ (undefined))) -(def: (decimal_value digit) +(def (decimal_value digit) (-> Nat (Maybe Nat)) (case digit (pattern (char "0")) {.#Some 0} @@ -250,7 +250,7 @@ (pattern (char "9")) {.#Some 9} _ {.#None})) -(def: (hexadecimal_character value) +(def (hexadecimal_character value) (-> Nat Text) (case value 0 "0" @@ -271,7 +271,7 @@ 15 "F" _ (undefined))) -(def: (hexadecimal_value digit) +(def (hexadecimal_value digit) (-> Nat (Maybe Nat)) (case digit (^.with_template [ ] @@ -286,10 +286,10 @@ _ {.#None})) (with_template [ ] - [(def: .public + [(def .public (Codec Text Nat) (implementation - (def: encoded + (def encoded (let [mask (|> 1 ("lux i64 left-shift" ) --)] (function (_ value) (loop (again [input value @@ -304,7 +304,7 @@ input' (again input' output'))))))) - (def: (decoded repr) + (def (decoded repr) (let [input_size ("lux text size" repr)] (if (..> 0 input_size) (loop (again [idx 0 @@ -327,10 +327,10 @@ [4 hex hexadecimal_character hexadecimal_value "Invalid hexadecimal syntax for Nat: "] ) -(def: .public decimal +(def .public decimal (Codec Text Nat) (implementation - (def: (encoded value) + (def (encoded value) (loop (again [input value output ""]) (let [digit (decimal_character (..% 10 input)) @@ -342,7 +342,7 @@ input' (again input' output'))))) - (def: (decoded repr) + (def (decoded repr) (let [input_size ("lux text size" repr)] (with_expansions [ {try.#Failure ("lux text concat" "Invalid decimal syntax for Nat: " repr)}] (if (..> 0 input_size) @@ -359,8 +359,8 @@ {try.#Success output})) )))))) -(def: .public hash +(def .public hash (Hash Nat) (implementation - (def: equivalence ..equivalence) - (def: hash function.identity))) + (def equivalence ..equivalence) + (def hash function.identity))) diff --git a/stdlib/source/library/lux/math/number/ratio.lux b/stdlib/source/library/lux/math/number/ratio.lux index 225b8da06..c4fe7a26d 100644 --- a/stdlib/source/library/lux/math/number/ratio.lux +++ b/stdlib/source/library/lux/math/number/ratio.lux @@ -27,117 +27,117 @@ [#numerator Nat #denominator Nat])) -(def: .public (nat value) +(def .public (nat value) (-> Ratio (Maybe Nat)) (case (the #denominator value) 1 {.#Some (the #numerator value)} _ {.#None})) -(def: (normal (open "_[0]")) +(def (normal (open "_[0]")) (-> Ratio Ratio) (let [common (n.gcd _#numerator _#denominator)] [..#numerator (n./ common _#numerator) ..#denominator (n./ common _#denominator)])) -(def: .public ratio +(def .public ratio (syntax (_ [numerator .any ?denominator (<>.maybe .any)]) (in (list (` ((~! ..normal) [..#numerator (~ numerator) ..#denominator (~ (maybe.else (' 1) ?denominator))])))))) -(def: .public (= parameter subject) +(def .public (= parameter subject) (-> Ratio Ratio Bit) (and (n.= (the #numerator parameter) (the #numerator subject)) (n.= (the #denominator parameter) (the #denominator subject)))) -(def: .public equivalence +(def .public equivalence (Equivalence Ratio) (implementation - (def: = ..=))) + (def = ..=))) -(def: (equalized parameter subject) +(def (equalized parameter subject) (-> Ratio Ratio [Nat Nat]) [(n.* (the #denominator subject) (the #numerator parameter)) (n.* (the #denominator parameter) (the #numerator subject))]) -(def: .public (< parameter subject) +(def .public (< parameter subject) (-> Ratio Ratio Bit) (let [[parameter' subject'] (..equalized parameter subject)] (n.< parameter' subject'))) -(def: .public (<= parameter subject) +(def .public (<= parameter subject) (-> Ratio Ratio Bit) (or (< parameter subject) (= parameter subject))) -(def: .public (> parameter subject) +(def .public (> parameter subject) (-> Ratio Ratio Bit) (..< subject parameter)) -(def: .public (>= parameter subject) +(def .public (>= parameter subject) (-> Ratio Ratio Bit) (or (> parameter subject) (= parameter subject))) -(def: .public order +(def .public order (Order Ratio) (implementation - (def: equivalence ..equivalence) - (def: < ..<))) + (def equivalence ..equivalence) + (def < ..<))) -(def: .public (+ parameter subject) +(def .public (+ parameter subject) (-> Ratio Ratio Ratio) (let [[parameter' subject'] (..equalized parameter subject)] (normal [(n.+ parameter' subject') (n.* (the #denominator parameter) (the #denominator subject))]))) -(def: .public (- parameter subject) +(def .public (- parameter subject) (-> Ratio Ratio Ratio) (let [[parameter' subject'] (..equalized parameter subject)] (normal [(n.- parameter' subject') (n.* (the #denominator parameter) (the #denominator subject))]))) -(def: .public (* parameter subject) +(def .public (* parameter subject) (-> Ratio Ratio Ratio) (normal [(n.* (the #numerator parameter) (the #numerator subject)) (n.* (the #denominator parameter) (the #denominator subject))])) -(def: .public (/ parameter subject) +(def .public (/ parameter subject) (-> Ratio Ratio Ratio) (let [[parameter' subject'] (..equalized parameter subject)] (normal [subject' parameter']))) -(def: .public (% parameter subject) +(def .public (% parameter subject) (-> Ratio Ratio Ratio) (let [[parameter' subject'] (..equalized parameter subject) quot (n./ parameter' subject')] (..- (revised #numerator (n.* quot) parameter) subject))) -(def: .public (reciprocal (open "_[0]")) +(def .public (reciprocal (open "_[0]")) (-> Ratio Ratio) [..#numerator _#denominator ..#denominator _#numerator]) -(def: separator ":") +(def separator ":") -(def: .public codec +(def .public codec (Codec Text Ratio) (implementation - (def: (encoded (open "_[0]")) + (def (encoded (open "_[0]")) (all text#composite (n#encoded _#numerator) ..separator (n#encoded _#denominator))) - (def: (decoded input) + (def (decoded input) (case (text.split_by ..separator input) {.#Some [num denom]} (do try.monad @@ -150,11 +150,11 @@ {.#Left (text#composite "Invalid syntax for ratio: " input)})))) (with_template [ ] - [(def: .public + [(def .public (Monoid Ratio) (implementation - (def: identity (..ratio )) - (def: composite )))] + (def identity (..ratio )) + (def composite )))] [0 ..+ addition] [1 ..* multiplication] diff --git a/stdlib/source/library/lux/math/number/rev.lux b/stdlib/source/library/lux/math/number/rev.lux index f7200c908..d74da6b2e 100644 --- a/stdlib/source/library/lux/math/number/rev.lux +++ b/stdlib/source/library/lux/math/number/rev.lux @@ -20,12 +20,12 @@ ["[1][0]" nat] ["[1][0]" int]]) -(def: .public /1 +(def .public /1 Rev (.rev -1)) (with_template [ ] - [(def: .public + [(def .public Rev (.rev (//i64.left_shifted (//nat.- //i64.width) 1)))] @@ -43,30 +43,30 @@ [12 /4096] ) -(def: .public (= reference sample) +(def .public (= reference sample) (-> Rev Rev Bit) ("lux i64 =" reference sample)) -(def: .public (< reference sample) +(def .public (< reference sample) (-> Rev Rev Bit) (//nat.< (.nat reference) (.nat sample))) -(def: .public (<= reference sample) +(def .public (<= reference sample) (-> Rev Rev Bit) (or (//nat.< (.nat reference) (.nat sample)) ("lux i64 =" reference sample))) -(def: .public (> reference sample) +(def .public (> reference sample) (-> Rev Rev Bit) (..< sample reference)) -(def: .public (>= reference sample) +(def .public (>= reference sample) (-> Rev Rev Bit) (or (..< sample reference) ("lux i64 =" reference sample))) (with_template [ ] - [(def: .public ( left right) + [(def .public ( left right) (-> Rev Rev Rev) (if ( right left) left @@ -77,7 +77,7 @@ ) (with_template [ ] - [(def: .public ( param subject) + [(def .public ( param subject) (-> Rev Rev Rev) ( param subject))] @@ -85,16 +85,16 @@ [- "lux i64 -"] ) -(def: high +(def high (-> (I64 Any) I64) (|>> ("lux i64 right-shift" 32))) -(def: low +(def low (-> (I64 Any) I64) (let [mask (|> 1 ("lux i64 left-shift" 32) ("lux i64 -" 1))] (|>> ("lux i64 and" mask)))) -(def: .public (* param subject) +(def .public (* param subject) (-> Rev Rev Rev) (let [subjectH (..high subject) subjectL (..low subject) @@ -112,26 +112,26 @@ ..high ("lux i64 +" top)))) -(def: even_one (//i64.right_rotated 1 1)) -(def: odd_one (-- 0)) +(def even_one (//i64.right_rotated 1 1)) +(def odd_one (-- 0)) -(def: (even_reciprocal numerator) +(def (even_reciprocal numerator) (-> Nat Nat) (//nat./ (//i64.right_shifted 1 numerator) ..even_one)) -(def: (odd_reciprocal numerator) +(def (odd_reciprocal numerator) (-> Nat Nat) (//nat./ numerator ..odd_one)) (with_expansions [ 1] - (def: .public (reciprocal numerator) + (def .public (reciprocal numerator) (-> Nat Rev) (.rev (case (is Nat ("lux i64 and" numerator)) 0 (..even_reciprocal numerator) _ (..odd_reciprocal numerator)))) - (def: .public (/ param subject) + (def .public (/ param subject) (-> Rev Rev Rev) (if ("lux i64 =" +0 param) (panic! "Cannot divide Rev by zero!") @@ -141,7 +141,7 @@ (.rev (//nat.* reciprocal (.nat subject))))))) (with_template [ ] - [(def: .public ( param subject) + [(def .public ( param subject) (-> Rev Rev ) ( ( (.nat param) (.nat subject))))] @@ -150,7 +150,7 @@ ) (with_template [ ] - [(def: .public ( scale subject) + [(def .public ( scale subject) (-> Nat Rev Rev) (.rev ( (.nat scale) (.nat subject))))] @@ -158,76 +158,76 @@ [//nat./ down] ) -(def: .public (/% param subject) +(def .public (/% param subject) (-> Rev Rev [Rev Rev]) [(../ param subject) (..% param subject)]) -(def: mantissa +(def mantissa (-> (I64 Any) Frac) (|>> ("lux i64 right-shift" 11) "lux i64 f64")) -(def: frac_denominator +(def frac_denominator (..mantissa -1)) -(def: .public frac +(def .public frac (-> Rev Frac) (|>> ..mantissa ("lux f64 /" ..frac_denominator))) -(def: .public equivalence +(def .public equivalence (Equivalence Rev) (implementation - (def: = ..=))) + (def = ..=))) -(def: .public hash +(def .public hash (Hash Rev) (implementation - (def: equivalence ..equivalence) - (def: hash (|>> .nat)))) + (def equivalence ..equivalence) + (def hash (|>> .nat)))) -(def: .public order +(def .public order (Order Rev) (implementation - (def: equivalence ..equivalence) - (def: < ..<))) + (def equivalence ..equivalence) + (def < ..<))) -(def: .public enum +(def .public enum (Enum Rev) (implementation - (def: order ..order) - (def: succ ++) - (def: pred --))) + (def order ..order) + (def succ ++) + (def pred --))) -(def: .public interval +(def .public interval (Interval Rev) (implementation - (def: enum ..enum) - (def: top (.rev -1)) - (def: bottom (.rev 0)))) + (def enum ..enum) + (def top (.rev -1)) + (def bottom (.rev 0)))) (with_template [ ] - [(def: .public + [(def .public (Monoid Rev) (implementation - (def: identity (at interval )) - (def: composite )))] + (def identity (at interval )) + (def composite )))] [addition ..+ bottom] [maximum ..max bottom] [minimum ..min top] ) -(def: (decimals input) +(def (decimals input) (-> Text Text) ("lux text clip" 1 (-- ("lux text size" input)) input)) (with_template [ ] [(with_expansions [ (these {try.#Failure ("lux text concat" repr)})] - (def: .public + (def .public (Codec Text Rev) (implementation - (def: (encoded value) + (def (encoded value) (let [raw_output (at encoded (.nat value)) max_num_chars (//nat.+ (//nat./ //i64.width) (case (//nat.% //i64.width) @@ -245,7 +245,7 @@ ("lux text concat" zero_padding) ("lux text concat" ".")))) - (def: (decoded repr) + (def (decoded repr) (let [repr_size ("lux text size" repr)] (if (//nat.> 1 repr_size) (case ("lux text char" 0 repr) @@ -279,21 +279,21 @@ (type: Digits (Array Nat)) -(def: (digits _) +(def (digits _) (-> Any Digits) (array.empty //i64.width)) -(def: (digit idx digits) +(def (digit idx digits) (-> Nat Digits Nat) (|> digits (array.item idx) (maybe.else 0))) -(def: digits#put! +(def digits#put! (-> Nat Nat Digits Digits) array.has!) -(def: (digits#times_5! idx output) +(def (digits#times_5! idx output) (-> Nat Digits Digits) (loop (again [idx idx carry 0 @@ -307,7 +307,7 @@ (//nat./ 10 raw) (digits#put! idx (//nat.% 10 raw) output)))))) -(def: (power_digits power) +(def (power_digits power) (-> Nat Digits) (loop (again [times power output (|> (..digits []) @@ -317,7 +317,7 @@ (again (-- times) (digits#times_5! power output))))) -(def: (format digits) +(def (format digits) (-> Digits Text) (loop (again [idx (-- //i64.width) all_zeroes? true @@ -336,7 +336,7 @@ (at //nat.decimal encoded digit) output))))))) -(def: (digits#+! param subject) +(def (digits#+! param subject) (-> Digits Digits Digits) (loop (again [idx (-- //i64.width) carry 0 @@ -351,7 +351,7 @@ (//nat./ 10 raw) (digits#put! idx (//nat.% 10 raw) output)))))) -(def: (text_digits input) +(def (text_digits input) (-> Text (Maybe Digits)) (let [length ("lux text size" input)] (if (//nat.> //i64.width length) @@ -368,7 +368,7 @@ (digits#put! idx digit output))) {.#Some output}))))) -(def: (digits#< param subject) +(def (digits#< param subject) (-> Digits Digits Bit) (loop (again [idx 0]) (and (//nat.< //i64.width idx) @@ -378,7 +378,7 @@ (again (++ idx)) (//nat.< pd sd)))))) -(def: (digits#-!' idx param subject) +(def (digits#-!' idx param subject) (-> Nat Nat Digits Digits) (let [sd (..digit idx subject)] (if (//nat.< param sd) @@ -390,7 +390,7 @@ (digits#-!' (-- idx) 1))) (digits#put! idx (//nat.- param sd) subject)))) -(def: (digits#-! param subject) +(def (digits#-! param subject) (-> Digits Digits Digits) (loop (again [idx (-- //i64.width) output subject]) @@ -399,10 +399,10 @@ (again (-- idx) (digits#-!' idx (..digit idx param) output))))) -(def: .public decimal +(def .public decimal (Codec Text Rev) (implementation - (def: (encoded input) + (def (encoded input) (case (.nat input) 0 ".0" @@ -421,7 +421,7 @@ (again (-- idx) digits))))))) - (def: (decoded input) + (def (decoded input) (let [dotted? (case ("lux text index" 0 "." input) {.#Some 0} true diff --git a/stdlib/source/library/lux/math/random.lux b/stdlib/source/library/lux/math/random.lux index a1a94b0a1..c7e6d0663 100644 --- a/stdlib/source/library/lux/math/random.lux +++ b/stdlib/source/library/lux/math/random.lux @@ -44,40 +44,40 @@ (type: .public (Random a) (-> PRNG [PRNG a])) -(def: .public functor +(def .public functor (Functor Random) (implementation - (def: (each f fa) + (def (each f fa) (function (_ state) (let [[state' a] (fa state)] [state' (f a)]))))) -(def: .public apply +(def .public apply (Apply Random) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (on fa ff) + (def (on fa ff) (function (_ state) (let [[state' f] (ff state) [state'' a] (fa state')] [state'' (f a)]))))) -(def: .public monad +(def .public monad (Monad Random) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (in a) + (def (in a) (function (_ state) [state a])) - (def: (conjoint ffa) + (def (conjoint ffa) (function (_ state) (let [[state' fa] (ffa state)] (fa state')))))) -(def: .public (only pred gen) +(def .public (only pred gen) (All (_ a) (-> (-> a Bit) (Random a) (Random a))) (do ..monad [sample gen] @@ -85,7 +85,7 @@ (in sample) (only pred gen)))) -(def: .public (one check random) +(def .public (one check random) (All (_ a b) (-> (-> a (Maybe b)) (Random a) (Random b))) (do ..monad @@ -97,7 +97,7 @@ {.#None} (one check random)))) -(def: .public (refined refiner gen) +(def .public (refined refiner gen) (All (_ t r) (-> (Refiner t r) (Random t) (Random (Refined t r)))) (do ..monad [sample gen] @@ -108,13 +108,13 @@ {.#None} (refined refiner gen)))) -(def: .public bit +(def .public bit (Random Bit) (function (_ prng) (let [[prng output] (prng [])] [prng (|> output (i64.and 1) (n.= 1))]))) -(def: .public i64 +(def .public i64 (Random I64) (function (_ prng) (let [[prng left] (prng []) @@ -124,7 +124,7 @@ ("lux i64 +" right))]))) (with_template [ ] - [(def: .public + [(def .public (Random ) (at ..functor each (|>> ) ..i64))] @@ -133,11 +133,11 @@ [rev Rev .rev] ) -(def: .public frac +(def .public frac (Random Frac) (at ..functor each (|>> .i64 f.of_bits) ..nat)) -(def: .public safe_frac +(def .public safe_frac (Random Frac) (let [mantissa_range (.int (i64.left_shifted 53 1)) mantissa_max (i.frac (-- mantissa_range))] @@ -147,7 +147,7 @@ (f./ mantissa_max)) ..int))) -(def: .public (char set) +(def .public (char set) (-> unicode.Set (Random Char)) (let [start (unicode.start set) end (unicode.end set) @@ -158,7 +158,7 @@ (at ..functor each in_range) (..only (unicode.member? set))))) -(def: .public (text char_gen size) +(def .public (text char_gen size) (-> (Random Char) Nat (Random Text)) (if (n.= 0 size) (at ..monad in "") @@ -168,7 +168,7 @@ (in (text#composite (text.of_char x) xs))))) (with_template [ ] - [(def: .public + [(def .public (-> Nat (Random Text)) (..text (..char )))] @@ -182,7 +182,7 @@ ) (with_template [ ] - [(def: .public + [(def .public (Random ) (do ..monad [left @@ -193,14 +193,14 @@ [complex c.Complex c.complex ..safe_frac] ) -(def: .public (and left right) +(def .public (and left right) (All (_ a b) (-> (Random a) (Random b) (Random [a b]))) (function (_ prng) (let [[prng left] (left prng) [prng right] (right prng)] [prng [left right]]))) -(def: .public (or left right) +(def .public (or left right) (All (_ a b) (-> (Random a) (Random b) (Random (Or a b)))) (function (_ prng) (let [[prng ?] (..bit prng)] @@ -210,7 +210,7 @@ (let [[prng right] (right prng)] [prng {0 #1 right}]))))) -(def: .public (either left right) +(def .public (either left right) (All (_ a) (-> (Random a) (Random a) (Random a))) (function (_ prng) (let [[prng ?] (..bit prng)] @@ -218,13 +218,13 @@ (left prng) (right prng))))) -(def: .public (rec gen) +(def .public (rec gen) (All (_ a) (-> (-> (Random a) (Random a)) (Random a))) (function (_ state) (let [gen' (gen (rec gen))] (gen' state)))) -(def: .public (maybe value_gen) +(def .public (maybe value_gen) (All (_ a) (-> (Random a) (Random (Maybe a)))) (do [! ..monad] [some? bit] @@ -234,7 +234,7 @@ (in {.#Some value})) (in {.#None})))) -(def: .public (list size value_gen) +(def .public (list size value_gen) (All (_ a) (-> Nat (Random a) (Random (List a)))) (if (n.> 0 size) (do ..monad @@ -243,7 +243,7 @@ (in {.#Item x xs})) (at ..monad in (.list)))) -(def: .public (sequence size value_gen) +(def .public (sequence size value_gen) (All (_ a) (-> Nat (Random a) (Random (Sequence a)))) (if (n.> 0 size) (do ..monad @@ -253,7 +253,7 @@ (at ..monad in sequence.empty))) (with_template [ ] - [(def: .public ( size value_gen) + [(def .public ( size value_gen) (All (_ a) (-> Nat (Random a) (Random ( a)))) (do ..monad [values (list size value_gen)] @@ -264,7 +264,7 @@ [stack Stack (list#mix stack.top stack.empty)] ) -(def: .public (set hash size value_gen) +(def .public (set hash size value_gen) (All (_ a) (-> (Hash a) Nat (Random a) (Random (Set a)))) (if (n.> 0 size) (do [! ..monad] @@ -278,7 +278,7 @@ (again []))))) (at ..monad in (set.empty hash)))) -(def: .public (dictionary hash size key_gen value_gen) +(def .public (dictionary hash size key_gen value_gen) (All (_ k v) (-> (Hash k) Nat (Random k) (Random v) (Random (Dictionary k v)))) (if (n.> 0 size) (do [! ..monad] @@ -293,23 +293,23 @@ (again []))))) (at ..monad in (dictionary.empty hash)))) -(def: .public instant +(def .public instant (Random Instant) (at ..functor each instant.of_millis ..int)) -(def: .public date +(def .public date (Random Date) (at ..functor each instant.date ..instant)) -(def: .public time +(def .public time (Random Time) (at ..functor each instant.time ..instant)) -(def: .public duration +(def .public duration (Random Duration) (at ..functor each duration.of_millis ..int)) -(def: .public month +(def .public month (Random Month) (let [(open "_#[0]") ..monad] (..either (..either (..either (_#in {month.#January}) @@ -325,7 +325,7 @@ (..either (_#in {month.#November}) (_#in {month.#December}))))))) -(def: .public day +(def .public day (Random Day) (let [(open "_#[0]") ..monad] (..either (..either (_#in {day.#Sunday}) @@ -336,18 +336,18 @@ (..either (_#in {day.#Friday}) (_#in {day.#Saturday})))))) -(def: .public (result prng calc) +(def .public (result prng calc) (All (_ a) (-> PRNG (Random a) [PRNG a])) (calc prng)) -(def: .public (prng update return) +(def .public (prng update return) (All (_ a) (-> (-> a a) (-> a I64) (-> a PRNG))) (function (again state) (function (_ _) [(again (update state)) (return state)]))) -(def: .public (pcg_32 [increase seed]) +(def .public (pcg_32 [increase seed]) (-> [(I64 Any) (I64 Any)] PRNG) (let [magic 6364136223846793005] (function (_ _) @@ -360,7 +360,7 @@ (i64.right_rotated rot) .i64))]))) -(def: .public (xoroshiro_128+ [s0 s1]) +(def .public (xoroshiro_128+ [s0 s1]) (-> [(I64 Any) (I64 Any)] PRNG) (function (_ _) [(let [s01 (i64.xor s0 s1)] @@ -373,7 +373,7 @@ ... https://en.wikipedia.org/wiki/Xorshift#Initialization ... http://xorshift.di.unimi.it/splitmix64.c -(def: .public split_mix_64 +(def .public split_mix_64 (-> Nat PRNG) (let [twist (is (-> Nat Nat Nat) (function (_ shift value) diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux index a4a6d6ec3..3c0e85615 100644 --- a/stdlib/source/library/lux/meta.lux +++ b/stdlib/source/library/lux/meta.lux @@ -30,10 +30,10 @@ ... (type: (Meta a) ... (-> Lux (Try [Lux a]))) -(def: .public functor +(def .public functor (Functor Meta) (implementation - (def: (each f fa) + (def (each f fa) (function (_ lux) (case (fa lux) {try.#Failure msg} @@ -42,12 +42,12 @@ {try.#Success [lux' a]} {try.#Success [lux' (f a)]}))))) -(def: .public apply +(def .public apply (Apply Meta) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (on fa ff) + (def (on fa ff) (function (_ lux) (case (ff lux) {try.#Success [lux' f]} @@ -61,16 +61,16 @@ {try.#Failure msg} {try.#Failure msg}))))) -(def: .public monad +(def .public monad (Monad Meta) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (in x) + (def (in x) (function (_ lux) {try.#Success [lux x]})) - (def: (conjoint mma) + (def (conjoint mma) (function (_ lux) (case (mma lux) {try.#Failure msg} @@ -79,11 +79,11 @@ {try.#Success [lux' ma]} (ma lux')))))) -(def: .public (result' lux action) +(def .public (result' lux action) (All (_ a) (-> Lux (Meta a) (Try [Lux a]))) (action lux)) -(def: .public (result lux action) +(def .public (result lux action) (All (_ a) (-> Lux (Meta a) (Try a))) (case (action lux) {try.#Failure error} @@ -92,7 +92,7 @@ {try.#Success [_ output]} {try.#Success output})) -(def: .public (either left right) +(def .public (either left right) (All (_ a) (-> (Meta a) (Meta a) (Meta a))) (function (_ lux) (case (left lux) @@ -102,20 +102,20 @@ {try.#Success [lux' output]} {try.#Success [lux' output]}))) -(def: .public (assertion message test) +(def .public (assertion message test) (-> Text Bit (Meta Any)) (function (_ lux) (if test {try.#Success [lux []]} {try.#Failure message}))) -(def: .public (failure error) +(def .public (failure error) (All (_ a) (-> Text (Meta a))) (function (_ state) {try.#Failure (location.with (the .#location state) error)})) -(def: .public (module name) +(def .public (module name) (-> Text (Meta Module)) (function (_ lux) (case (plist.value name (the .#modules lux)) @@ -125,7 +125,7 @@ _ {try.#Failure (all text#composite "Unknown module: " name)}))) -(def: .public current_module_name +(def .public current_module_name (Meta Text) (function (_ lux) (case (the .#current_module lux) @@ -135,14 +135,14 @@ _ {try.#Failure "No current module."}))) -(def: .public current_module +(def .public current_module (Meta Module) (let [(open "#[0]") ..monad] (|> ..current_module_name (#each ..module) #conjoint))) -(def: (macro_type? type) +(def (macro_type? type) (-> Type Bit) (`` (case type {.#Named [(~~ (static .prelude)) "Macro"] {.#Primitive "#Macro" {.#End}}} @@ -151,7 +151,7 @@ _ false))) -(def: .public (normal name) +(def .public (normal name) (-> Symbol (Meta Symbol)) (case name ["" name] @@ -162,7 +162,7 @@ _ (at ..monad in name))) -(def: .public (macro full_name) +(def .public (macro full_name) (-> Symbol (Meta (Maybe Macro))) (do ..monad [[module name] (..normal full_name)] @@ -202,13 +202,13 @@ {.#Slot _} {.#None})))))]})))) -(def: .public seed +(def .public seed (Meta Nat) (function (_ lux) {try.#Success [(revised .#seed ++ lux) (the .#seed lux)]})) -(def: .public (module_exists? module) +(def .public (module_exists? module) (-> Text (Meta Bit)) (function (_ lux) {try.#Success [lux (case (plist.value module (the .#modules lux)) @@ -218,14 +218,14 @@ {.#None} #0)]})) -(def: (on_either f x1 x2) +(def (on_either f x1 x2) (All (_ a b) (-> (-> a (Maybe b)) a a (Maybe b))) (case (f x1) {.#None} (f x2) {.#Some y} {.#Some y})) -(def: (type_variable idx bindings) +(def (type_variable idx bindings) (-> Nat (List [Nat (Maybe Type)]) (Maybe Type)) (case bindings {.#End} @@ -236,7 +236,7 @@ bound (type_variable idx bindings')))) -(def: (clean_type type) +(def (clean_type type) (-> Type (Meta Type)) (case type {.#Var var} @@ -253,7 +253,7 @@ _ (at ..monad in type))) -(def: .public (var_type name) +(def .public (var_type name) (-> Text (Meta Type)) (function (_ lux) (let [test (is (-> [Text [Type Any]] Bit) @@ -277,23 +277,23 @@ {.#None} {try.#Failure (all text#composite "Unknown variable: " name)})))) -(def: without_lux_runtime +(def without_lux_runtime (-> (List Text) (List Text)) ... The Lux runtime shows up as "" ... so I'm excluding it. (list.only (|>> text.empty? not))) -(def: listing_separator +(def listing_separator Text (all text#composite text.new_line " ")) -(def: module_listing +(def module_listing (-> (List Text) Text) (|>> ..without_lux_runtime (list.sorted text#<) (text.interposed ..listing_separator))) -(def: .public (definition name) +(def .public (definition name) (-> Symbol (Meta Global)) (do ..monad [name (..normal name) @@ -361,7 +361,7 @@ "") " All known modules: " all_known_modules text.new_line)}))))) -(def: .public (export name) +(def .public (export name) (-> Symbol (Meta Definition)) (do ..monad [definition (..definition name)] @@ -392,7 +392,7 @@ "Slots are not considered exports: " (symbol#encoded name)))))) -(def: .public (definition_type name) +(def .public (definition_type name) (-> Symbol (Meta Type)) (do ..monad [definition (definition name)] @@ -416,7 +416,7 @@ "Slots have no type: " (symbol#encoded name)))))) -(def: .public (type name) +(def .public (type name) (-> Symbol (Meta Type)) (case name ["" _name] @@ -426,7 +426,7 @@ _ (definition_type name))) -(def: .public (type_definition name) +(def .public (type_definition name) (-> Symbol (Meta Type)) (do ..monad [definition (definition name)] @@ -452,7 +452,7 @@ {.#Slot _} (..failure (all text#composite "Slot is not a type: " (symbol#encoded name)))))) -(def: .public (globals module) +(def .public (globals module) (-> Text (Meta (List [Text Global]))) (function (_ lux) (case (plist.value module (the .#modules lux)) @@ -462,7 +462,7 @@ {.#Some module} {try.#Success [lux (the .#definitions module)]}))) -(def: .public (definitions module) +(def .public (definitions module) (-> Text (Meta (List [Text Definition]))) (at ..monad each (list.all (function (_ [name global]) @@ -483,7 +483,7 @@ {.#None}))) (..globals module))) -(def: .public (exports module_name) +(def .public (exports module_name) (-> Text (Meta (List [Text Definition]))) (do ..monad [constants (..definitions module_name)] @@ -493,7 +493,7 @@ (in [name [exported? def_type def_value]]) (list)))))) -(def: .public modules +(def .public modules (Meta (List [Text Module])) (function (_ lux) (|> lux @@ -501,7 +501,7 @@ [lux] {try.#Success}))) -(def: .public (tags_of type_name) +(def .public (tags_of type_name) (-> Symbol (Meta (Maybe (List Symbol)))) (do ..monad [.let [[module_name name] type_name] @@ -517,12 +517,12 @@ _ (in {.#None})))) -(def: .public location +(def .public location (Meta Location) (function (_ lux) {try.#Success [lux (the .#location lux)]})) -(def: .public expected_type +(def .public expected_type (Meta Type) (function (_ lux) (case (the .#expected lux) @@ -532,26 +532,26 @@ {.#None} {try.#Failure "Not expecting any type."}))) -(def: .public (imported_modules module_name) +(def .public (imported_modules module_name) (-> Text (Meta (List Text))) (do ..monad [(open "_[0]") (..module module_name)] (in _#imports))) -(def: .public (imported_by? import module) +(def .public (imported_by? import module) (-> Text Text (Meta Bit)) (do ..monad [(open "_[0]") (..module module)] (in (list.any? (text#= import) _#imports)))) -(def: .public (imported? import) +(def .public (imported? import) (-> Text (Meta Bit)) (at ..functor each (|>> (the .#imports) (list.any? (text#= import))) ..current_module)) (with_template [ ] - [(def: .public ( label_name) + [(def .public ( label_name) (-> Symbol (Meta [Nat (List Symbol) Type])) (do ..monad [.let [[module name] label_name] @@ -572,7 +572,7 @@ [slot .#Slot "slot"] ) -(def: .public (tag_lists module) +(def .public (tag_lists module) (-> Text (Meta (List [(List Symbol) Type]))) (do ..monad [=module (..module module) @@ -596,7 +596,7 @@ {.#None})) (the .#definitions =module))))) -(def: .public locals +(def .public locals (Meta (List (List [Text Type]))) (function (_ lux) (case (list.inits (the .#scopes lux)) @@ -610,7 +610,7 @@ [name type]))) scopes)]}))) -(def: .public (de_aliased def_name) +(def .public (de_aliased def_name) (-> Symbol (Meta Symbol)) (do ..monad [constant (..definition def_name)] @@ -630,17 +630,17 @@ {.#Slot _} def_name)))) -(def: .public compiler_state +(def .public compiler_state (Meta Lux) (function (_ lux) {try.#Success [lux lux]})) -(def: .public type_context +(def .public type_context (Meta Type_Context) (function (_ lux) {try.#Success [lux (the .#type_context lux)]})) -(def: .public (lifted result) +(def .public (lifted result) (All (_ a) (-> (Try a) (Meta a))) (case result {try.#Success output} @@ -649,14 +649,14 @@ {try.#Failure error} (..failure error))) -(def: .public (eval type code) +(def .public (eval type code) (-> Type Code (Meta Any)) (do [! ..monad] [eval (at ! each (the .#eval) ..compiler_state)] (eval type code))) -(def: .public (try computation) +(def .public (try computation) (All (_ it) (-> (Meta it) (Meta (Try it)))) (function (_ lux) (case (computation lux) @@ -667,7 +667,7 @@ {try.#Success [lux {try.#Failure error}]}))) (with_template [ ] - [(def: .public + [(def .public (Meta ) (function (_ lux) {try.#Success [lux diff --git a/stdlib/source/library/lux/meta/configuration.lux b/stdlib/source/library/lux/meta/configuration.lux index abd48664e..9d30b3590 100644 --- a/stdlib/source/library/lux/meta/configuration.lux +++ b/stdlib/source/library/lux/meta/configuration.lux @@ -28,20 +28,20 @@ (type: .public Configuration (/.PList Text)) -(def: .public equivalence +(def .public equivalence (Equivalence Configuration) (/.equivalence text.equivalence)) -(def: .public monoid +(def .public monoid (Monoid Configuration) /.monoid) -(def: .public empty +(def .public empty Configuration /.empty) (with_template [ ] - [(def: + [(def Text (text.of_char (hex )))] @@ -49,17 +49,17 @@ ["03" end] ) -(def: format' +(def format' (-> Text Text) (text.enclosed [..start ..end])) -(def: .public format +(def .public format (%.Format Configuration) (|>> (list#each (function (_ [feature value]) (%.format (..format' feature) (..format' value)))) text.together)) -(def: .public parser +(def .public parser (Parser Configuration) (let [parser' (is (Parser Text) (<| (<>.after (.this ..start)) @@ -69,11 +69,11 @@ (exception: .public invalid) -(def: configuration +(def configuration (.Parser Configuration) (.tuple (<>.some (<>.and .text .text)))) -(def: (subsumes? actual expected) +(def (subsumes? actual expected) (-> Configuration Configuration Bit) (case expected {.#End} @@ -86,7 +86,7 @@ (maybe.else false)) (subsumes? expected tail)))) -(def: .public for +(def .public for (syntax (_ [specializations (<>.some (<>.and ..configuration .any)) default (<>.maybe .any)]) (do meta.monad diff --git a/stdlib/source/library/lux/meta/location.lux b/stdlib/source/library/lux/meta/location.lux index c71dcd094..acb911ab8 100644 --- a/stdlib/source/library/lux/meta/location.lux +++ b/stdlib/source/library/lux/meta/location.lux @@ -4,21 +4,21 @@ [abstract [equivalence (.only Equivalence)]]]]) -(def: .public equivalence +(def .public equivalence (Equivalence Location) (implementation - (def: (= reference subject) + (def (= reference subject) (and ("lux text =" (the .#module reference) (the .#module subject)) ("lux i64 =" (the .#line reference) (the .#line subject)) ("lux i64 =" (the .#column reference) (the .#column subject)))))) -(def: .public dummy +(def .public dummy Location [.#module "" .#line 0 .#column 0]) -(def: .public here +(def .public here (macro (_ tokens compiler) (case tokens {.#End} @@ -32,7 +32,7 @@ _ {.#Left (`` (("lux in-module" (~~ (static .prelude)) wrong_syntax_error) (symbol ..here)))}))) -(def: .public (format it) +(def .public (format it) (-> Location Text) (let [separator "," [file line column] it] @@ -42,10 +42,10 @@ (`` (("lux in-module" (~~ (static .prelude)) .nat#encoded) line)) separator (`` (("lux in-module" (~~ (static .prelude)) .nat#encoded) column))))) -(def: \n +(def \n ("lux i64 char" +10)) -(def: .public (with location error) +(def .public (with location error) (-> Location Text Text) (all "lux text concat" (..format location) \n error)) diff --git a/stdlib/source/library/lux/meta/symbol.lux b/stdlib/source/library/lux/meta/symbol.lux index 7966482ce..fba56c993 100644 --- a/stdlib/source/library/lux/meta/symbol.lux +++ b/stdlib/source/library/lux/meta/symbol.lux @@ -14,7 +14,7 @@ ... [Text Text]) (with_template [] - [(def: .public ( [module short]) + [(def .public ( [module short]) (-> Symbol Text) )] @@ -22,35 +22,35 @@ [short] ) -(def: .public hash +(def .public hash (Hash Symbol) (product.hash text.hash text.hash)) -(def: .public equivalence +(def .public equivalence (Equivalence Symbol) (at ..hash equivalence)) -(def: .public order +(def .public order (Order Symbol) (implementation - (def: equivalence ..equivalence) - (def: (< [moduleP shortP] [moduleS shortS]) + (def equivalence ..equivalence) + (def (< [moduleP shortP] [moduleS shortS]) (if (text#= moduleP moduleS) (at text.order < shortP shortS) (at text.order < moduleP moduleS))))) -(def: .public separator +(def .public separator ".") -(def: .public codec +(def .public codec (Codec Text Symbol) (implementation - (def: (encoded [module short]) + (def (encoded [module short]) (case module "" short _ (all text#composite module ..separator short))) - (def: (decoded input) + (def (decoded input) (case (text.all_split_by ..separator input) (pattern (list short)) {.#Right ["" short]} diff --git a/stdlib/source/library/lux/meta/version.lux b/stdlib/source/library/lux/meta/version.lux index 4fc4b2409..e90c95a53 100644 --- a/stdlib/source/library/lux/meta/version.lux +++ b/stdlib/source/library/lux/meta/version.lux @@ -19,11 +19,11 @@ [compiler [version (.only Version)]]]]]) -(def: .public latest +(def .public latest Version 00,07,00) -(def: .public current +(def .public current (syntax (_ []) (do meta.monad [it meta.version] @@ -31,7 +31,7 @@ (exception: .public invalid) -(def: .public for +(def .public for (syntax (_ [specializations (<>.some (<>.and .text .any)) default (<>.maybe .any)]) (do meta.monad diff --git a/stdlib/source/library/lux/program.lux b/stdlib/source/library/lux/program.lux index 11ddcdd16..1e4622bcc 100644 --- a/stdlib/source/library/lux/program.lux +++ b/stdlib/source/library/lux/program.lux @@ -20,12 +20,12 @@ {#Raw Text} {#Parsed (List Code)})) -(def: arguments^ +(def arguments^ (.Parser Arguments) (<>.or .local (.tuple (<>.some .any)))) -(def: .public program: +(def .public program: (syntax (_ [args ..arguments^ body .any]) (with_symbols [g!program g!args g!_ g!output g!message] diff --git a/stdlib/source/library/lux/static.lux b/stdlib/source/library/lux/static.lux index ea40d2733..4fd6c1674 100644 --- a/stdlib/source/library/lux/static.lux +++ b/stdlib/source/library/lux/static.lux @@ -18,7 +18,7 @@ ["[0]" random (.only Random)]]]]) (with_template [ ] - [(def: .public + [(def .public (syntax (_ [expression .any]) (at meta.monad each (|>> (as ) list) @@ -32,14 +32,14 @@ [text .Text code.text] ) -(def: pcg_32_magic_inc +(def pcg_32_magic_inc Nat (hex "FEDCBA9876543210")) (with_expansions [ (Ex (_ a) [(-> a Code) a])] - (def: .public literal + (def .public literal (syntax (_ [format .any expression .any]) (do meta.monad @@ -51,7 +51,7 @@ (with_expansions [ (Ex (_ a) [(-> a Code) (List a)])] - (def: .public literals + (def .public literals (syntax (_ [format .any expression .any]) (do meta.monad @@ -60,12 +60,12 @@ .let [[format expression] (as pair)]] (in (list#each format expression)))))) -(def: .public seed +(def .public seed (syntax (_ []) (meta#each (|>> code.nat list) meta.seed))) (with_template [ ] - [(def: .public + [(def .public (syntax (_ []) (do meta.monad [seed meta.seed @@ -83,7 +83,7 @@ (with_expansions [ (Ex (_ a) [(-> a Code) (Random a)])] - (def: .public random + (def .public random (syntax (_ [format .any random .any]) (do meta.monad @@ -98,7 +98,7 @@ (with_expansions [ (Ex (_ a) [(-> a Code) (Random (List a))])] - (def: .public randoms + (def .public randoms (syntax (_ [format .any random .any]) (do meta.monad @@ -110,7 +110,7 @@ random)]] (in (list#each format result)))))) -(def: .public if +(def .public if (syntax (_ [test .any then .any else .any]) @@ -120,7 +120,7 @@ then else)))))) -(def: .public cond +(def .public cond (syntax (_ [test,then/* (<>.some (<>.and .any .any)) else .any]) (in (list (list#mix (function (_ [test then] else) @@ -130,7 +130,7 @@ else (list.reversed test,then/*)))))) -(def: .public when +(def .public when (syntax (_ [test .any then .any]) (do meta.monad diff --git a/stdlib/source/library/lux/target.lux b/stdlib/source/library/lux/target.lux index 66e8ea31b..cee1e3084 100644 --- a/stdlib/source/library/lux/target.lux +++ b/stdlib/source/library/lux/target.lux @@ -1,12 +1,12 @@ (.using - [library - [lux (.except)]]) + [library + [lux (.except)]]) (type: .public Target Text) (with_template [ ] - [(def: .public + [(def .public Target )] diff --git a/stdlib/source/library/lux/target/common_lisp.lux b/stdlib/source/library/lux/target/common_lisp.lux index a95e1df67..b0107d234 100644 --- a/stdlib/source/library/lux/target/common_lisp.lux +++ b/stdlib/source/library/lux/target/common_lisp.lux @@ -16,18 +16,18 @@ [type [primitive (.except)]]]]) -(def: as_form +(def as_form (-> Text Text) (text.enclosed ["(" ")"])) (primitive .public (Code brand) Text - (def: .public manual + (def .public manual (-> Text Code) (|>> abstraction)) - (def: .public code + (def .public code (-> (Code Any) Text) (|>> representation)) @@ -62,29 +62,29 @@ [#input Var/* #output (Expression Any)])) - (def: .public nil + (def .public nil Literal (abstraction "()")) (with_template [ ] - [(def: .public + [(def .public (-> Text Literal) (|>> (format ) abstraction))] ["'" symbol] [":" keyword]) - (def: .public bool + (def .public bool (-> Bit Literal) (|>> (pipe.case #0 ..nil #1 (..symbol "t")))) - (def: .public int + (def .public int (-> Int Literal) (|>> %.int abstraction)) - (def: .public float + (def .public float (-> Frac Literal) (|>> (pipe.cond [(f.= f.positive_infinity)] [(pipe.new "(/ 1.0 0.0)" [])] @@ -99,7 +99,7 @@ [%.frac]) abstraction)) - (def: .public (double value) + (def .public (double value) (-> Frac Literal) (abstraction (.cond (f.= f.positive_infinity value) @@ -117,7 +117,7 @@ (text.replaced_once "E" "d" raw) (format raw "d0")))))) - (def: safe + (def safe (-> Text Text) (`` (|>> (~~ (with_template [ ] [(text.replaced )] @@ -134,24 +134,24 @@ )) ))) - (def: .public string + (def .public string (-> Text Literal) (|>> ..safe (text.enclosed' text.double_quote) abstraction)) - (def: .public var + (def .public var (-> Text Var/1) (|>> abstraction)) - (def: .public args + (def .public args (-> (List Var/1) Var/*) (|>> (list#each ..code) (text.interposed " ") ..as_form abstraction)) - (def: .public (args& singles rest) + (def .public (args& singles rest) (-> (List Var/1) Var/1 Var/*) (|> (case singles {.#End} @@ -166,19 +166,19 @@ ..as_form abstraction)) - (def: form + (def form (-> (List (Expression Any)) Expression) (|>> (list#each ..code) (text.interposed " ") ..as_form abstraction)) - (def: .public (call/* func) + (def .public (call/* func) (-> (Expression Any) (-> (List (Expression Any)) (Computation Any))) (|>> {.#Item func} ..form)) (with_template [ ] - [(def: .public + [(def .public (-> (List (Expression Any)) (Computation Any)) (..call/* (..var )))] @@ -186,7 +186,7 @@ [list/* "list"] ) - (def: .public (labels definitions body) + (def .public (labels definitions body) (-> (List [Var/1 Lambda]) (Expression Any) (Computation Any)) (..form (list (..var "labels") (..form (list#each (function (_ [def_name [def_args def_body]]) @@ -194,19 +194,19 @@ definitions)) body))) - (def: .public (destructuring_bind [bindings expression] body) + (def .public (destructuring_bind [bindings expression] body) (-> [Var/* (Expression Any)] (List (Expression Any)) (Computation Any)) (..form (list.partial (..var "destructuring-bind") (transmutation bindings) expression body))) (with_template [ + + +] - [(`` (def: .public ( [(~~ (template.spliced +))] function) + [(`` (def .public ( [(~~ (template.spliced +))] function) (-> [(~~ (template.spliced +))] (Expression Any) (Computation Any)) (..call/* function (list (~~ (template.spliced +)))))) (`` (with_template [ ] - [(def: .public ( args) + [(def .public ( args) (-> [(~~ (template.spliced +))] (Computation Any)) ( args (..var )))] @@ -264,7 +264,7 @@ (with_template [ + +] [(`` (with_template [ ] - [(def: .public ( args) + [(def .public ( args) (-> [(~~ (template.spliced +))] (Access Any)) (transmutation ( args (..var ))))] @@ -281,29 +281,29 @@ [gethash/2 "gethash"]]] ) - (def: .public (make_hash_table/with_size size) + (def .public (make_hash_table/with_size size) (-> (Expression Any) (Computation Any)) (..call/* (..var "make-hash-table") (list (..keyword "size") size))) - (def: .public (funcall/+ [func args]) + (def .public (funcall/+ [func args]) (-> [(Expression Any) (List (Expression Any))] (Computation Any)) (..call/* (..var "funcall") (list.partial func args))) - (def: .public (search/3 [reference space start]) + (def .public (search/3 [reference space start]) (-> [(Expression Any) (Expression Any) (Expression Any)] (Computation Any)) (..call/* (..var "search") (list reference space (..keyword "start2") start))) - (def: .public (concatenate/2|string [left right]) + (def .public (concatenate/2|string [left right]) (-> [(Expression Any) (Expression Any)] (Computation Any)) (concatenate/3 [(..symbol "string") left right])) (with_template [ ] - [(def: .public ( left right) + [(def .public ( left right) (-> (Expression Any) (Expression Any) (Computation Any)) (..form (list (..var ) left right)))] @@ -312,7 +312,7 @@ ) (with_template [ ] - [(def: .public ( [param subject]) + [(def .public ( [param subject]) (-> [(Expression Any) (Expression Any)] (Computation Any)) (..form (list (..var ) subject param)))] @@ -332,20 +332,20 @@ [logxor/2 "logxor"] ) - (def: .public (if test then else) + (def .public (if test then else) (-> (Expression Any) (Expression Any) (Expression Any) (Computation Any)) (..form (list (..var "if") test then else))) - (def: .public (when test then) + (def .public (when test then) (-> (Expression Any) (Expression Any) (Computation Any)) (..form (list (..var "when") test then))) - (def: .public (lambda input body) + (def .public (lambda input body) (-> Var/* (Expression Any) Literal) (..form (list (..var "lambda") (transmutation input) body))) (with_template [ ] - [(def: .public ( bindings body) + [(def .public ( bindings body) (-> (List [Var/1 (Expression Any)]) (List (Expression Any)) (Computation Any)) (..form (list.partial (..var ) (|> bindings @@ -358,16 +358,16 @@ [let* "let*"] ) - (def: .public (defparameter name body) + (def .public (defparameter name body) (-> Var/1 (Expression Any) (Expression Any)) (..form (list (..var "defparameter") name body))) - (def: .public (defun name inputs body) + (def .public (defun name inputs body) (-> Var/1 Var/* (Expression Any) (Expression Any)) (..form (list (..var "defun") name (transmutation inputs) body))) (with_template [ ] - [(def: .public + [(def .public (-> (List (Expression Any)) (Computation Any)) (|>> (list.partial (..var )) ..form))] @@ -376,11 +376,11 @@ [values/* "values"] ) - (def: .public (setq name value) + (def .public (setq name value) (-> Var/1 (Expression Any) (Expression Any)) (..form (list (..var "setq") name value))) - (def: .public (setf access value) + (def .public (setf access value) (-> (Access Any) (Expression Any) (Expression Any)) (..form (list (..var "setf") access value))) @@ -390,7 +390,7 @@ #condition Var/1 #body (Expression Any)])) - (def: .public (handler_case handlers body) + (def .public (handler_case handlers body) (-> (List Handler) (Expression Any) (Computation Any)) (..form (list.partial (..var "handler-case") body @@ -401,7 +401,7 @@ handlers)))) (with_template [ ] - [(def: .public ( conditions expression) + [(def .public ( conditions expression) (-> (List Text) (Expression Any) (Expression Any)) (case conditions {.#End} @@ -421,23 +421,23 @@ [conditional+ "#+"] [conditional- "#-"]) - (def: .public label + (def .public label (-> Text Label) (|>> abstraction)) - (def: .public (block name body) + (def .public (block name body) (-> Label (List (Expression Any)) (Computation Any)) (..form (list.partial (..var "block") (transmutation name) body))) - (def: .public (return_from target value) + (def .public (return_from target value) (-> Label (Expression Any) (Computation Any)) (..form (list (..var "return-from") (transmutation target) value))) - (def: .public (return value) + (def .public (return value) (-> (Expression Any) (Computation Any)) (..form (list (..var "return") value))) - (def: .public (cond clauses else) + (def .public (cond clauses else) (-> (List [(Expression Any) (Expression Any)]) (Expression Any) (Computation Any)) (..form (list.partial (..var "cond") (list#composite (list#each (function (_ [test then]) @@ -445,28 +445,28 @@ clauses) (list (..form (list (..bool true) else))))))) - (def: .public tag + (def .public tag (-> Text Tag) (|>> abstraction)) - (def: .public go + (def .public go (-> Tag (Expression Any)) (|>> (list (..var "go")) ..form)) - (def: .public values_list/1 + (def .public values_list/1 (-> (Expression Any) (Expression Any)) (|>> (list (..var "values-list")) ..form)) - (def: .public (multiple_value_setq bindings values) + (def .public (multiple_value_setq bindings values) (-> Var/* (Expression Any) (Expression Any)) (..form (list (..var "multiple-value-setq") (transmutation bindings) values))) ) -(def: .public (while condition body) +(def .public (while condition body) (-> (Expression Any) (Expression Any) (Computation Any)) (..form (list (..var "loop") (..var "while") condition (..var "do") body))) diff --git a/stdlib/source/library/lux/target/js.lux b/stdlib/source/library/lux/target/js.lux index ae5ffe9d1..5b057a697 100644 --- a/stdlib/source/library/lux/target/js.lux +++ b/stdlib/source/library/lux/target/js.lux @@ -17,18 +17,18 @@ [type [primitive (.except)]]]]) -(def: expression +(def expression (text.enclosed ["(" ")"])) -(def: element +(def element (text.enclosed ["[" "]"])) ... Added the carriage return for better Windows compatibility. -(def: \n+ +(def \n+ Text (format text.carriage_return text.new_line)) -(def: nested +(def nested (-> Text Text) (|>> (format \n+) (text.replaced text.new_line (format text.new_line text.tab)))) @@ -36,7 +36,7 @@ (primitive .public (Code brand) Text - (def: .public code + (def .public code (-> (Code Any) Text) (|>> representation)) @@ -64,20 +64,20 @@ ) (with_template [ ] - [(def: .public Literal (abstraction ))] + [(def .public Literal (abstraction ))] [null "null"] [undefined "undefined"] ) - (def: .public boolean + (def .public boolean (-> Bit Literal) (|>> (pipe.case #0 "false" #1 "true") abstraction)) - (def: .public (number value) + (def .public (number value) (-> Frac Literal) (abstraction (cond (f.not_a_number? value) @@ -92,7 +92,7 @@ ... else (|> value %.frac ..expression)))) - (def: safe + (def safe (-> Text Text) (`` (|>> (~~ (with_template [ ] [(text.replaced )] @@ -110,36 +110,36 @@ )) ))) - (def: .public string + (def .public string (-> Text Literal) (|>> ..safe (text.enclosed [text.double_quote text.double_quote]) abstraction)) - (def: argument_separator ", ") - (def: field_separator ": ") - (def: statement_suffix ";") + (def argument_separator ", ") + (def field_separator ": ") + (def statement_suffix ";") - (def: .public array + (def .public array (-> (List Expression) Computation) (|>> (list#each ..code) (text.interposed ..argument_separator) ..element abstraction)) - (def: .public var + (def .public var (-> Text Var) (|>> abstraction)) - (def: .public (at index array_or_object) + (def .public (at index array_or_object) (-> Expression Expression Access) (abstraction (format (representation array_or_object) (..element (representation index))))) - (def: .public (the field object) + (def .public (the field object) (-> Text Expression Access) (abstraction (format (representation object) "." field))) - (def: .public (apply function inputs) + (def .public (apply function inputs) (-> Expression (List Expression) Computation) (|> inputs (list#each ..code) @@ -148,11 +148,11 @@ (format (representation function)) abstraction)) - (def: .public (do method inputs object) + (def .public (do method inputs object) (-> Text (List Expression) Expression Computation) (apply (..the method object) inputs)) - (def: .public object + (def .public object (-> (List [Text Expression]) Computation) (|>> (list#each (.function (_ [key val]) (format (representation (..string key)) ..field_separator (representation val)))) @@ -161,19 +161,19 @@ ..expression abstraction)) - (def: .public (, pre post) + (def .public (, pre post) (-> Expression Expression Computation) (|> (format (representation pre) ..argument_separator (representation post)) ..expression abstraction)) - (def: .public (then pre post) + (def .public (then pre post) (-> Statement Statement Statement) (abstraction (format (representation pre) \n+ (representation post)))) - (def: block + (def block (-> Statement Text) (let [close (format \n+ "}")] (|>> representation @@ -181,7 +181,7 @@ (text.enclosed ["{" close])))) - (def: .public (function_definition name inputs body) + (def .public (function_definition name inputs body) (-> Var (List Var) Statement Statement) (|> body ..block @@ -193,14 +193,14 @@ " ") abstraction)) - (def: .public (function name inputs body) + (def .public (function name inputs body) (-> Var (List Var) Statement Computation) (|> (..function_definition name inputs body) representation ..expression abstraction)) - (def: .public (closure inputs body) + (def .public (closure inputs body) (-> (List Var) Statement Computation) (|> body ..block @@ -214,7 +214,7 @@ abstraction)) (with_template [ ] - [(def: .public ( param subject) + [(def .public ( param subject) (-> Expression Expression Computation) (|> (format (representation subject) " " " " (representation param)) ..expression @@ -244,7 +244,7 @@ ) (with_template [ ] - [(def: .public + [(def .public (-> Expression Computation) (|>> representation (text.prefix ) ..expression abstraction))] @@ -255,7 +255,7 @@ (with_template [ ] [... A 32-bit integer expression. - (def: .public ( value) + (def .public ( value) (-> Computation) (abstraction (..expression (format ( value) "|0"))))] @@ -263,13 +263,13 @@ [i32 Int %.int] ) - (def: .public (int value) + (def .public (int value) (-> Int Literal) (abstraction (.if (i.< +0 value) (%.int value) (%.nat (.nat value))))) - (def: .public (? test then else) + (def .public (? test then else) (-> Expression Expression Expression Computation) (|> (format (representation test) " ? " (representation then) @@ -277,14 +277,14 @@ ..expression abstraction)) - (def: .public type_of + (def .public type_of (-> Expression Computation) (|>> representation (format "typeof ") ..expression abstraction)) - (def: .public (new constructor inputs) + (def .public (new constructor inputs) (-> Expression (List Expression) Computation) (|> (format "new " (representation constructor) (|> inputs @@ -294,71 +294,71 @@ ..expression abstraction)) - (def: .public statement + (def .public statement (-> Expression Statement) (|>> representation (text.suffix ..statement_suffix) abstraction)) - (def: .public use_strict + (def .public use_strict Statement (abstraction (format text.double_quote "use strict" text.double_quote ..statement_suffix))) - (def: .public (declare name) + (def .public (declare name) (-> Var Statement) (abstraction (format "var " (representation name) ..statement_suffix))) - (def: .public (define name value) + (def .public (define name value) (-> Var Expression Statement) (abstraction (format "var " (representation name) " = " (representation value) ..statement_suffix))) - (def: .public (set name value) + (def .public (set name value) (-> Location Expression Statement) (abstraction (format (representation name) " = " (representation value) ..statement_suffix))) - (def: .public (throw message) + (def .public (throw message) (-> Expression Statement) (abstraction (format "throw " (representation message) ..statement_suffix))) - (def: .public (return value) + (def .public (return value) (-> Expression Statement) (abstraction (format "return " (representation value) ..statement_suffix))) - (def: .public delete + (def .public delete (-> Location Expression) (|>> representation (format "delete ") ..expression abstraction)) - (def: .public (if test then! else!) + (def .public (if test then! else!) (-> Expression Statement Statement Statement) (abstraction (format "if(" (representation test) ") " (..block then!) " else " (..block else!)))) - (def: .public (when test then!) + (def .public (when test then!) (-> Expression Statement Statement) (abstraction (format "if(" (representation test) ") " (..block then!)))) - (def: .public (while test body) + (def .public (while test body) (-> Expression Statement Loop) (abstraction (format "while(" (representation test) ") " (..block body)))) - (def: .public (do_while test body) + (def .public (do_while test body) (-> Expression Statement Loop) (abstraction (format "do " (..block body) " while(" (representation test) ")" ..statement_suffix))) - (def: .public (try body [exception catch]) + (def .public (try body [exception catch]) (-> Statement [Var Statement] Statement) (abstraction (format "try " (..block body) " catch(" (representation exception) ") " (..block catch)))) - (def: .public (for var init condition update iteration) + (def .public (for var init condition update iteration) (-> Var Expression Expression Expression Statement Loop) (abstraction (format "for(" (representation (..define var init)) " " (representation condition) @@ -366,20 +366,20 @@ ")" (..block iteration)))) - (def: .public label + (def .public label (-> Text Label) (|>> abstraction)) - (def: .public (with_label label loop) + (def .public (with_label label loop) (-> Label Loop Statement) (abstraction (format (representation label) ": " (representation loop)))) (with_template [ <0> <1>] - [(def: .public <0> + [(def .public <0> Statement (abstraction (format ..statement_suffix))) - (def: .public (<1> label) + (def .public (<1> label) (-> Label Statement) (abstraction (format " " (representation label) ..statement_suffix)))] @@ -388,7 +388,7 @@ ) (with_template [ ] - [(def: .public + [(def .public (-> Location Expression) (|>> representation (text.suffix ) @@ -398,11 +398,11 @@ [-- "--"] ) - (def: .public (comment commentary on) + (def .public (comment commentary on) (All (_ kind) (-> Text (Code kind) (Code kind))) (abstraction (format "/* " commentary " */" " " (representation on)))) - (def: .public (switch input cases default) + (def .public (switch input cases default) (-> Expression (List [(List Literal) Statement]) (Maybe Statement) Statement) (abstraction (format "switch (" (representation input) ") " (|> (format (|> cases @@ -425,13 +425,13 @@ ) (with_template [ + + +] - [(`` (def: .public ( function) + [(`` (def .public ( function) (-> Expression (~~ (template.spliced +)) Computation) (.function (_ (~~ (template.spliced +))) (..apply function (list (~~ (template.spliced +))))))) (`` (with_template [ ] - [(def: .public ( (..var )))] + [(def .public ( (..var )))] (~~ (template.spliced +))))] diff --git a/stdlib/source/library/lux/target/jvm/attribute.lux b/stdlib/source/library/lux/target/jvm/attribute.lux index 30a3fe5f3..eb6fd8566 100644 --- a/stdlib/source/library/lux/target/jvm/attribute.lux +++ b/stdlib/source/library/lux/target/jvm/attribute.lux @@ -35,7 +35,7 @@ #length U4 #info about])) -(def: .public (info_equivalence Equivalence) +(def .public (info_equivalence Equivalence) (All (_ about) (-> (Equivalence about) (Equivalence (Info about)))) @@ -44,7 +44,7 @@ //unsigned.equivalence Equivalence)) -(def: (info_writer writer) +(def (info_writer writer) (All (_ about) (-> (Writer about) (Writer (Info about)))) @@ -67,7 +67,7 @@ ) ) -(def: .public equivalence +(def .public equivalence (Equivalence Attribute) (equivalence.rec (function (_ equivalence) @@ -77,7 +77,7 @@ (info_equivalence //index.equivalence) )))) -(def: common_attribute_length +(def common_attribute_length (all n.+ ... u2 attribute_name_index; //unsigned.bytes/2 @@ -85,7 +85,7 @@ //unsigned.bytes/4 )) -(def: (length attribute) +(def (length attribute) (-> Attribute Nat) (case attribute (^.with_template [] @@ -96,19 +96,19 @@ [#Signature]))) ... TODO: Inline ASAP -(def: (constant' index @name) +(def (constant' index @name) (-> (Constant Any) (Index UTF8) Attribute) {#Constant [#name @name ... https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.2 #length (|> /constant.length //unsigned.u4 try.trusted) #info index]}) -(def: .public (constant index) +(def .public (constant index) (-> (Constant Any) (Resource Attribute)) (//pool#each (constant' index) (//pool.utf8 "ConstantValue"))) ... TODO: Inline ASAP -(def: (code' specification @name) +(def (code' specification @name) (-> Code (Index UTF8) Attribute) {#Code [#name @name ... https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3 @@ -118,26 +118,26 @@ try.trusted) #info specification]}) -(def: .public (code specification) +(def .public (code specification) (-> Code (Resource Attribute)) (//pool#each (code' specification) (//pool.utf8 "Code"))) ... TODO: Inline ASAP -(def: (signature' it @name) +(def (signature' it @name) (-> (Index UTF8) (Index UTF8) Attribute) {#Signature [#name @name ... https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.9 #length (|> //index.length //unsigned.u4 try.trusted) #info it]}) -(def: .public (signature it) +(def .public (signature it) (All (_ category) (-> (Signature category) (Resource Attribute))) (do [! //pool.monad] [it (|> it //signature.signature //pool.utf8)] (at ! each (signature' it) (//pool.utf8 "Signature")))) -(def: .public (writer it) +(def .public (writer it) (Writer Attribute) (case it {#Constant it} diff --git a/stdlib/source/library/lux/target/jvm/attribute/code.lux b/stdlib/source/library/lux/target/jvm/attribute/code.lux index cc795b920..835b6726a 100644 --- a/stdlib/source/library/lux/target/jvm/attribute/code.lux +++ b/stdlib/source/library/lux/target/jvm/attribute/code.lux @@ -29,7 +29,7 @@ #exception_table (Sequence Exception) #attributes (Sequence Attribute)])) -(def: .public (length length code) +(def .public (length length code) (All (_ Attribute) (-> (-> Attribute Nat) (Code Attribute) Nat)) (all n.+ ... u2 max_stack; @@ -54,7 +54,7 @@ (sequence#each length) (sequence#mix n.+ 0)))) -(def: .public (equivalence attribute_equivalence) +(def .public (equivalence attribute_equivalence) (All (_ attribute) (-> (Equivalence attribute) (Equivalence (Code attribute)))) (all product.equivalence @@ -65,7 +65,7 @@ )) ... https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3 -(def: .public (writer writer code) +(def .public (writer writer code) (All (_ Attribute) (-> (Writer Attribute) (Writer (Code Attribute)))) (all binaryF#composite ... u2 max_stack; diff --git a/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux b/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux index b71573669..f71d52cfd 100644 --- a/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux +++ b/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux @@ -26,7 +26,7 @@ #handler Address #catch (Index Class)])) -(def: .public equivalence +(def .public equivalence (Equivalence Exception) (all product.equivalence ////address.equivalence @@ -36,7 +36,7 @@ )) ... https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3 -(def: .public length +(def .public length Nat (all n.+ ... u2 start_pc; @@ -49,7 +49,7 @@ ////unsigned.bytes/2 )) -(def: .public writer +(def .public writer (Writer Exception) (all \\format.and ////address.writer diff --git a/stdlib/source/library/lux/target/jvm/attribute/constant.lux b/stdlib/source/library/lux/target/jvm/attribute/constant.lux index 6e20c2ad1..34c8582ca 100644 --- a/stdlib/source/library/lux/target/jvm/attribute/constant.lux +++ b/stdlib/source/library/lux/target/jvm/attribute/constant.lux @@ -15,13 +15,13 @@ (type: .public (Constant a) (Index (Value a))) -(def: .public equivalence +(def .public equivalence (All (_ a) (Equivalence (Constant a))) ///index.equivalence) -(def: .public length +(def .public length ///index.length) -(def: .public writer +(def .public writer (All (_ a) (Writer (Constant a))) ///index.writer) diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux index 882c0dfdf..99901a4a3 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode.lux @@ -64,7 +64,7 @@ #next Label #known Resolver])) -(def: fresh +(def fresh Tracker [#program_counter /address.start #next 0 @@ -73,16 +73,16 @@ (type: .public Relative (-> Resolver (Try [(Sequence Exception) Instruction]))) -(def: no_exceptions +(def no_exceptions (Sequence Exception) sequence.empty) -(def: relative#identity +(def relative#identity Relative (function (_ _) {try.#Success [..no_exceptions _.empty]})) -(def: try|do +(def try|do (template (_ ) [(.case {try.#Success } @@ -91,11 +91,11 @@ failure (as_expected failure))])) -(def: try|in +(def try|in (template (_ ) [{try.#Success }])) -(def: (relative#composite left right) +(def (relative#composite left right) (-> Relative Relative Relative) (cond (same? ..relative#identity left) right @@ -110,16 +110,16 @@ (try|in [(at sequence.monoid composite left_exceptions right_exceptions) (_#composite left_instruction right_instruction)]))))) -(def: relative_monoid +(def relative_monoid (Monoid Relative) (implementation - (def: identity ..relative#identity) - (def: composite ..relative#composite))) + (def identity ..relative#identity) + (def composite ..relative#composite))) (type: .public (Bytecode a) (+State Try [Pool Environment Tracker] (Writer Relative a))) -(def: .public new_label +(def .public new_label (Bytecode Label) (function (_ [pool environment tracker]) {try.#Success [[pool @@ -144,7 +144,7 @@ "Expected" (/stack.format expected) "Actual" (/stack.format actual))) -(def: .public (set? label) +(def .public (set? label) (-> Label (Bytecode (Maybe [Stack Address]))) (function (_ state) (let [[pool environment tracker] state] @@ -157,7 +157,7 @@ _ {.#None})]]}))) -(def: .public (acknowledged? label) +(def .public (acknowledged? label) (-> Label (Bytecode (Maybe Stack))) (function (_ state) (let [[pool environment tracker] state] @@ -170,7 +170,7 @@ _ {.#None})]]}))) -(def: .public stack +(def .public stack (Bytecode (Maybe Stack)) (function (_ state) (let [[pool environment tracker] state] @@ -185,7 +185,7 @@ tracker)] [..relative#identity []]]))] - (def: .public (set_label label) + (def .public (set_label label) (-> Label (Bytecode Any)) (function (_ [pool environment tracker]) (let [@here (the #program_counter tracker)] @@ -205,10 +205,10 @@ environment)) )))))) -(def: .public functor +(def .public functor (Functor Bytecode) (implementation - (def: (each $ it) + (def (each $ it) (function (_ state) (case (it state) {try.#Success [state' [relative it]]} @@ -218,16 +218,16 @@ failure (as_expected failure)))))) -(def: .public monad +(def .public monad (Monad Bytecode) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (in it) + (def (in it) (function (_ state) {try.#Success [state [relative#identity it]]})) - (def: (conjoint ^^it) + (def (conjoint ^^it) (function (_ state) (case (^^it state) {try.#Success [state' [left ^it]]} @@ -243,7 +243,7 @@ failure (as_expected failure)))))) -(def: .public (when_continuous it) +(def .public (when_continuous it) (-> (Bytecode Any) (Bytecode Any)) (do ..monad [stack ..stack] @@ -255,7 +255,7 @@ _ (in [])))) -(def: .public (when_acknowledged @ it) +(def .public (when_acknowledged @ it) (-> Label (Bytecode Any) (Bytecode Any)) (do ..monad [?@ (..acknowledged? @)] @@ -267,27 +267,27 @@ _ (in [])))) -(def: .public (failure error) +(def .public (failure error) (-> Text Bytecode) (function (_ _) {try.#Failure error})) -(def: .public (except exception value) +(def .public (except exception value) (All (_ e) (-> (exception.Exception e) e Bytecode)) (..failure (exception.error exception value))) -(def: .public (resolve environment bytecode) +(def .public (resolve environment bytecode) (All (_ a) (-> Environment (Bytecode a) (Resource [Environment (Sequence Exception) Instruction a]))) (function (_ pool) (<| (try|do [[pool environment tracker] [relative output]] (bytecode [pool environment ..fresh])) (try|do [exceptions instruction] (relative (the #known tracker))) (try|in [pool [environment exceptions instruction output]])))) -(def: (step estimator counter) +(def (step estimator counter) (-> Estimator Address (Try Address)) (/address.move (estimator counter) counter)) -(def: (bytecode consumption production registry [estimator bytecode] input) +(def (bytecode consumption production registry [estimator bytecode] input) (All (_ a) (-> U2 U2 Registry [Estimator (-> [a] Instruction)] a (Bytecode Any))) (function (_ [pool environment tracker]) (<| (try|do environment' (|> environment @@ -304,7 +304,7 @@ []]])))) (with_template [ ] - [(def: U2 + [(def U2 (|> //unsigned.u2 try.trusted))] [$0 0] @@ -317,7 +317,7 @@ ) (with_template [ ] - [(def: Registry (|> //unsigned.u2 try.trusted /registry.registry))] + [(def Registry (|> //unsigned.u2 try.trusted /registry.registry))] [@_ 0] [@0 1] @@ -328,7 +328,7 @@ ) (with_template [ ] - [(def: .public + [(def .public (Bytecode Any) (..bytecode @@ -511,7 +511,7 @@ [monitorexit $1 $0 @_ _.monitorexit] ) -(def: discontinuity! +(def discontinuity! (Bytecode Any) (function (_ [pool environment tracker]) (<| (try|do _ (/environment.stack environment)) @@ -522,7 +522,7 @@ []]])))) (with_template [ ] - [(def: .public + [(def .public (Bytecode Any) (do ..monad [_ (..bytecode $0 @_ [])] @@ -538,11 +538,11 @@ [athrow $1 _.athrow] ) -(def: .public (bipush byte) +(def .public (bipush byte) (-> S1 (Bytecode Any)) (..bytecode $0 $1 @_ _.bipush [byte])) -(def: (lifted resource) +(def (lifted resource) (All (_ a) (-> (Resource a) (Bytecode a))) @@ -552,7 +552,7 @@ [..relative#identity output]])))) -(def: .public (string value) +(def .public (string value) (-> //constant.UTF8 (Bytecode Any)) (do ..monad [index (..lifted (//constant/pool.string value))] @@ -572,7 +572,7 @@ ("static" doubleToRawLongBits "manual" [double] long)) (with_template [ ] - [(def: .public ( value) + [(def .public ( value) (-> (Bytecode Any)) (case (|> value ) (^.with_template [ ] @@ -599,7 +599,7 @@ [+5 _.iconst_5])] ) -(def: (arbitrary_float value) +(def (arbitrary_float value) (-> java/lang/Float (Bytecode Any)) (do ..monad [index (..lifted (//constant/pool.float (//constant.float value)))] @@ -610,16 +610,16 @@ {try.#Failure _} (..bytecode $0 $1 @_ _.ldc_w/float [index])))) -(def: float_bits +(def float_bits (-> java/lang/Float Int) (|>> java/lang/Float::floatToRawIntBits ffi.int_to_long (as Int))) -(def: negative_zero_float_bits +(def negative_zero_float_bits (|> -0.0 (as java/lang/Double) ffi.double_to_float ..float_bits)) -(def: .public (float value) +(def .public (float value) (-> java/lang/Float (Bytecode Any)) (if (i.= ..negative_zero_float_bits (..float_bits value)) @@ -634,7 +634,7 @@ _ (..arbitrary_float value)))) (with_template [ ] - [(def: .public ( value) + [(def .public ( value) (-> (Bytecode Any)) (case (|> value ) (^.with_template [ ] @@ -651,21 +651,21 @@ [+1 _.lconst_1])] ) -(def: (arbitrary_double value) +(def (arbitrary_double value) (-> java/lang/Double (Bytecode Any)) (do ..monad [index (..lifted (//constant/pool.double (//constant.double (as Frac value))))] (..bytecode $0 $2 @_ _.ldc2_w/double [index]))) -(def: double_bits +(def double_bits (-> java/lang/Double Int) (|>> java/lang/Double::doubleToRawLongBits (as Int))) -(def: negative_zero_double_bits +(def negative_zero_double_bits (..double_bits (as java/lang/Double -0.0))) -(def: .public (double value) +(def .public (double value) (-> java/lang/Double (Bytecode Any)) (if (i.= ..negative_zero_double_bits (..double_bits value)) @@ -682,7 +682,7 @@ (exception.report "ID" (%.nat id))) -(def: (register id) +(def (register id) (-> Nat (Bytecode Register)) (case (//unsigned.u1 id) {try.#Success register} @@ -692,7 +692,7 @@ (..except ..invalid_register [id]))) (with_template [ ] - [(def: .public ( local) + [(def .public ( local) (-> Nat (Bytecode Any)) (with_expansions [' (template.spliced )] (`` (case local @@ -732,7 +732,7 @@ ) (with_template [ ] - [(def: .public ( local) + [(def .public ( local) (-> Nat (Bytecode Any)) (with_expansions [' (template.spliced )] (`` (case local @@ -772,7 +772,7 @@ ) (with_template [ ] - [(def: .public + [(def .public (-> (Bytecode Any)) (..bytecode @_ ))] @@ -796,7 +796,7 @@ (Either Big_Jump Jump)) -(def: (jump @from @to) +(def (jump @from @to) (-> Address Address (Try Any_Jump)) (<| (try|do jump (try#each //signed.value (/address.jump @from @to))) @@ -812,7 +812,7 @@ (exception.report "Label" (%.nat label))) -(def: (resolve_label label resolver) +(def (resolve_label label resolver) (-> Label Resolver (Try [Stack Address])) (case (dictionary.value label resolver) {.#Some [actual {.#Some address}]} @@ -825,7 +825,7 @@ _ (exception.except ..unknown_label [label]))) -(def: (acknowledge_label stack label tracker) +(def (acknowledge_label stack label tracker) (-> Stack Label Tracker Tracker) (case (dictionary.value label (the #known tracker)) {.#Some _} @@ -836,7 +836,7 @@ (revised #known (dictionary.has label [stack {.#None}]) tracker))) (with_template [ ] - [(def: .public ( label) + [(def .public ( label) (-> Label (Bytecode Any)) (let [[estimator bytecode] ] (function (_ [pool environment tracker]) @@ -886,7 +886,7 @@ ) (with_template [ ] - [(def: .public ( label) + [(def .public ( label) (-> Label (Bytecode Any)) (let [[estimator bytecode] ] (function (_ [pool environment tracker]) @@ -928,7 +928,7 @@ (try|in [..no_exceptions (bytecode (/jump.lifted jump))])] ) -(def: (big_jump jump) +(def (big_jump jump) (-> Any_Jump Big_Jump) (case jump {.#Left big} @@ -939,7 +939,7 @@ (exception: .public invalid_tableswitch) -(def: .public (tableswitch minimum default [at_minimum afterwards]) +(def .public (tableswitch minimum default [at_minimum afterwards]) (-> S4 Label [Label (List Label)] (Bytecode Any)) (let [[estimator bytecode] _.tableswitch] (function (_ [pool environment tracker]) @@ -977,7 +977,7 @@ (exception: .public invalid_lookupswitch) -(def: .public (lookupswitch default cases) +(def .public (lookupswitch default cases) (-> Label (List [S4 Label]) (Bytecode Any)) (let [cases (list.sorted (function (_ [left _] [right _]) (i.< (//signed.value left) @@ -1016,13 +1016,13 @@ (exception.except ..invalid_lookupswitch [])))) []]])))))) -(def: reflection +(def reflection (All (_ category) (-> (Type (<| Return' Value' category)) Text)) (|>> type.reflection reflection.reflection)) (with_template [ ] - [(def: .public ( class) + [(def .public ( class) (-> (Type ) (Bytecode Any)) (do ..monad [... TODO: Make sure it's impossible to have indexes greater than U2. @@ -1035,7 +1035,7 @@ [$1 $1 instanceof Object _.instanceof] ) -(def: .public (iinc register increase) +(def .public (iinc register increase) (-> Nat U1 (Bytecode Any)) (do ..monad [register (..register register)] @@ -1045,7 +1045,7 @@ (exception.report "Class" (..reflection class))) -(def: .public (multianewarray class dimensions) +(def .public (multianewarray class dimensions) (-> (Type Object) U1 (Bytecode Any)) (do ..monad [_ (is (Bytecode Any) @@ -1055,7 +1055,7 @@ index (..lifted (//constant/pool.class (//name.internal (..reflection class))))] (..bytecode (//unsigned.lifted/2 dimensions) $1 @_ _.multianewarray [index dimensions]))) -(def: (type_size type) +(def (type_size type) (-> (Type Return) Nat) (cond (same? type.void type) 0 @@ -1068,7 +1068,7 @@ 1)) (with_template [ ] - [(def: .public ( class method type) + [(def .public ( class method type) (-> (Type Class) Text (Type Method) (Bytecode Any)) (let [[type_variables inputs output exceptions] (parser.method type)] (do ..monad @@ -1094,7 +1094,7 @@ ) (with_template [ <1> <2>] - [(def: .public ( class field type) + [(def .public ( class field type) (-> (Type Class) Text (Type Value) (Bytecode Any)) (do ..monad [index (<| ..lifted @@ -1111,7 +1111,7 @@ ) (with_template [ <1> <2>] - [(def: .public ( class field type) + [(def .public ( class field type) (-> (Type Class) Text (Type Value) (Bytecode Any)) (do [! ..monad] [index (<| ..lifted @@ -1133,7 +1133,7 @@ "Start" (|> start /address.value //unsigned.value %.nat) "End" (|> end /address.value //unsigned.value %.nat))) -(def: .public (try @start @end @handler catch) +(def .public (try @start @end @handler catch) (-> Label Label Label (Type Class) (Bytecode Any)) (do ..monad [@catch (..lifted (//constant/pool.class (//name.internal (..reflection catch))))] @@ -1157,7 +1157,7 @@ _.empty]))) []]]}))) -(def: .public (composite pre post) +(def .public (composite pre post) (All (_ pre post) (-> (Bytecode pre) (Bytecode post) (Bytecode post))) (function (_ state) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/address.lux b/stdlib/source/library/lux/target/jvm/bytecode/address.lux index ddb1331dc..5c2dd04d2 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/address.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/address.lux @@ -26,49 +26,49 @@ (primitive .public Address U2 - (def: .public value + (def .public value (-> Address U2) (|>> representation)) - (def: .public start + (def .public start Address (|> 0 ///unsigned.u2 try.trusted abstraction)) - (def: .public (move distance) + (def .public (move distance) (-> U2 (-> Address (Try Address))) (|>> representation (///unsigned.+/2 distance) (at try.functor each (|>> abstraction)))) - (def: with_sign + (def with_sign (-> Address (Try S4)) (|>> representation ///unsigned.value .int ///signed.s4)) - (def: .public (jump from to) + (def .public (jump from to) (-> Address Address (Try Big_Jump)) (do try.monad [from (with_sign from) to (with_sign to)] (///signed.-/4 from to))) - (def: .public (after? reference subject) + (def .public (after? reference subject) (-> Address Address Bit) (n.> (|> reference representation ///unsigned.value) (|> subject representation ///unsigned.value))) - (def: .public equivalence + (def .public equivalence (Equivalence Address) (implementation - (def: (= reference subject) + (def (= reference subject) (at ///unsigned.equivalence = (representation reference) (representation subject))))) - (def: .public writer + (def .public writer (Writer Address) (|>> representation ///unsigned.writer/2)) - (def: .public format + (def .public format (Format Address) (|>> representation ///unsigned.value %.nat)) ) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment.lux index cc3ff123c..14e8d5543 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment.lux @@ -23,7 +23,7 @@ #stack (Maybe Stack)])) (with_template [ ] - [(def: .public ( type) + [(def .public ( type) (-> (Type Method) (Try Environment)) (do try.monad [limit ( type)] @@ -37,13 +37,13 @@ (type: .public Condition (-> Environment (Try Environment))) -(def: .public monoid +(def .public monoid (Monoid Condition) (implementation - (def: identity + (def identity (|>> {try.#Success})) - (def: (composite left right) + (def (composite left right) (function (_ environment) (do try.monad [environment (left environment)] @@ -51,7 +51,7 @@ (exception: .public discontinuity) -(def: .public (stack environment) +(def .public (stack environment) (-> Environment (Try Stack)) (case (the ..#stack environment) {.#Some stack} @@ -60,7 +60,7 @@ {.#None} (exception.except ..discontinuity []))) -(def: .public discontinue +(def .public discontinue (-> Environment Environment) (.has ..#stack {.#None})) @@ -70,7 +70,7 @@ "Expected" (/stack.format expected) "Actual" (/stack.format actual))) -(def: .public (continue expected environment) +(def .public (continue expected environment) (-> Stack Environment (Try [Stack Environment])) (case (the ..#stack environment) {.#Some actual} @@ -81,7 +81,7 @@ {.#None} {try.#Success [expected (.has ..#stack {.#Some expected} environment)]})) -(def: .public (consumes amount) +(def .public (consumes amount) (-> U2 Condition) ... TODO: Revisit this definition once lenses/optics have been implemented, ... since it can probably be simplified with them. @@ -91,7 +91,7 @@ current (/stack.pop amount previous)] (in (.has ..#stack {.#Some current} environment))))) -(def: .public (produces amount) +(def .public (produces amount) (-> U2 Condition) (function (_ environment) (do try.monad @@ -104,7 +104,7 @@ (.has ..#stack {.#Some current}) (.has [..#limit /limit.#stack] limit)))))) -(def: .public (has registry) +(def .public (has registry) (-> Registry Condition) (|>> (revised [..#limit /limit.#registry] (/registry.has registry)) {try.#Success})) 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 7702e24e7..261e9a5ce 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux @@ -26,7 +26,7 @@ #registry Registry])) (with_template [ ] - [(def: .public ( type) + [(def .public ( type) (-> (Type Method) (Try Limit)) (do try.monad [registry ( type)] @@ -37,21 +37,21 @@ [virtual /registry.virtual] ) -(def: .public length +(def .public length (all n.+ ... u2 max_stack; /stack.length ... u2 max_locals; /registry.length)) -(def: .public equivalence +(def .public equivalence (Equivalence Limit) (all product.equivalence /stack.equivalence /registry.equivalence )) -(def: .public (writer limit) +(def .public (writer limit) (Writer Limit) (all \\format#composite (/stack.writer (the #stack limit)) 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 6e3642501..3aae9a289 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 @@ -25,17 +25,17 @@ (type: .public Register U1) -(def: normal 1) -(def: wide 2) +(def normal 1) +(def wide 2) (primitive .public Registry U2 - (def: .public registry + (def .public registry (-> U2 Registry) (|>> abstraction)) - (def: (minimal type) + (def (minimal type) (-> (Type Method) Nat) (let [[type_variables inputs output exceptions] (/////type/parser.method type)] (|> inputs @@ -47,7 +47,7 @@ (list#mix n.+ 0)))) (with_template [ ] - [(def: .public + [(def .public (-> (Type Method) (Try Registry)) (|>> ..minimal (n.+ ) @@ -58,24 +58,24 @@ [1 virtual] ) - (def: .public equivalence + (def .public equivalence (Equivalence Registry) (at equivalence.functor each (|>> representation) /////unsigned.equivalence)) - (def: .public writer + (def .public writer (Writer Registry) (|>> representation /////unsigned.writer/2)) - (def: .public (has needed) + (def .public (has needed) (-> Registry Registry Registry) (|>> representation (/////unsigned.max/2 (representation needed)) abstraction)) (with_template [ ] - [(def: .public + [(def .public (-> Register Registry) (let [extra (|> /////unsigned.u2 try.trusted)] (|>> /////unsigned.lifted/2 @@ -88,5 +88,5 @@ ) ) -(def: .public length +(def .public length /////unsigned.bytes/2) 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 a3cec4224..59c3c50ce 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 @@ -21,7 +21,7 @@ U2 (with_template [ ] - [(def: .public + [(def .public Stack (|> /////unsigned.u2 maybe.trusted abstraction))] @@ -29,22 +29,22 @@ [1 catch] ) - (def: .public equivalence + (def .public equivalence (Equivalence Stack) (at equivalence.functor each (|>> representation) /////unsigned.equivalence)) - (def: .public writer + (def .public writer (Writer Stack) (|>> representation /////unsigned.writer/2)) - (def: stack + (def stack (-> U2 Stack) (|>> abstraction)) (with_template [ ] - [(def: .public ( amount) + [(def .public ( amount) (-> U2 (-> Stack (Try Stack))) (|>> representation ( amount) @@ -54,16 +54,16 @@ [/////unsigned.-/2 pop] ) - (def: .public (max left right) + (def .public (max left right) (-> Stack Stack Stack) (abstraction (/////unsigned.max/2 (representation left) (representation right)))) - (def: .public format + (def .public format (Format Stack) (|>> representation /////unsigned.value %.nat)) ) -(def: .public length +(def .public length /////unsigned.bytes/2) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux index 9345f2ec2..ca4dfcff6 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux @@ -44,18 +44,18 @@ (type: .public Estimator (-> Address Size)) -(def: fixed +(def fixed (-> Size Estimator) function.constant) (type: .public Instruction (-> Specification Specification)) -(def: .public empty +(def .public empty Instruction function.identity) -(def: .public result +(def .public result (-> Instruction Specification) (function.on \\format.no_op)) @@ -63,7 +63,7 @@ Nat) (with_template [ ] - [(def: Size (|> ///unsigned.u2 try.trusted))] + [(def Size (|> ///unsigned.u2 try.trusted))] [1 opcode_size] [1 register_size] @@ -73,14 +73,14 @@ [4 integer_size] ) -(def: (nullary' opcode) +(def (nullary' opcode) (-> Opcode Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value ..opcode_size) offset) (binary.has_8! offset opcode binary)])) -(def: nullary +(def nullary [Estimator (-> Opcode Instruction)] [(..fixed ..opcode_size) (function (_ opcode [size mutation]) @@ -89,7 +89,7 @@ (|>> mutation ((nullary' opcode)))])]) (with_template [ ] - [(def: + [(def Size (|> ..opcode_size (///unsigned.+/2 ) @@ -102,7 +102,7 @@ (with_template [ ] [(with_expansions [ (template.symbol ["'" ])] - (def: ( opcode input0) + (def ( opcode input0) (-> Opcode Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value ) offset) @@ -111,7 +111,7 @@ ( (n.+ (///unsigned.value ..opcode_size) offset) ( input0)))])) - (def: + (def [Estimator (-> Opcode Instruction)] [(..fixed ) (function (_ opcode input0 [size mutation]) @@ -126,7 +126,7 @@ (with_template [ ] [(with_expansions [ (template.symbol ["'" ])] - (def: ( opcode input0) + (def ( opcode input0) (-> Opcode Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value ) offset) @@ -135,7 +135,7 @@ ( (n.+ (///unsigned.value ..opcode_size) offset) (///signed.value input0)))])) - (def: + (def [Estimator (-> Opcode Instruction)] [(..fixed ) (function (_ opcode input0 [size mutation]) @@ -146,13 +146,13 @@ [..size/2 unary/2' S2 binary.has_16!] ) -(def: size/11 +(def size/11 Size (|> ..opcode_size (///unsigned.+/2 ..register_size) try.trusted (///unsigned.+/2 ..byte_size) try.trusted)) -(def: (binary/11' opcode input0 input1) +(def (binary/11' opcode input0 input1) (-> Opcode U1 U1 Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value ..size/11) offset) @@ -163,20 +163,20 @@ (binary.has_8! (n.+ (///unsigned.value ..size/1) offset) (///unsigned.value input1)))])) -(def: binary/11 +(def binary/11 [Estimator (-> Opcode U1 U1 Instruction)] [(..fixed ..size/11) (function (_ opcode input0 input1 [size mutation]) [(n.+ (///unsigned.value ..size/11) size) (|>> mutation ((binary/11' opcode input0 input1)))])]) -(def: size/21 +(def size/21 Size (|> ..opcode_size (///unsigned.+/2 ..index_size) try.trusted (///unsigned.+/2 ..byte_size) try.trusted)) -(def: (binary/21' opcode input0 input1) +(def (binary/21' opcode input0 input1) (-> Opcode U2 U1 Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value ..size/21) offset) @@ -187,21 +187,21 @@ (binary.has_8! (n.+ (///unsigned.value ..size/2) offset) (///unsigned.value input1)))])) -(def: binary/21 +(def binary/21 [Estimator (-> Opcode U2 U1 Instruction)] [(..fixed ..size/21) (function (_ opcode input0 input1 [size mutation]) [(n.+ (///unsigned.value ..size/21) size) (|>> mutation ((binary/21' opcode input0 input1)))])]) -(def: size/211 +(def size/211 Size (|> ..opcode_size (///unsigned.+/2 ..index_size) try.trusted (///unsigned.+/2 ..byte_size) try.trusted (///unsigned.+/2 ..byte_size) try.trusted)) -(def: (trinary/211' opcode input0 input1 input2) +(def (trinary/211' opcode input0 input1 input2) (-> Opcode U2 U1 U1 Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value ..size/211) offset) @@ -214,7 +214,7 @@ (binary.has_8! (n.+ (///unsigned.value ..size/21) offset) (///unsigned.value input2)))])) -(def: trinary/211 +(def trinary/211 [Estimator (-> Opcode U2 U1 U1 Instruction)] [(..fixed ..size/211) (function (_ opcode input0 input1 input2 [size mutation]) @@ -224,12 +224,12 @@ (primitive .public Primitive_Array_Type U1 - (def: code + (def code (-> Primitive_Array_Type U1) (|>> representation)) (with_template [ ] - [(def: .public + [(def .public (|> ///unsigned.u1 try.trusted abstraction))] [04 t_boolean] @@ -481,7 +481,7 @@ [] ')] - (def: .public + (def .public [Estimator (-> [] Instruction)] (let [[estimator '] ] [estimator @@ -564,7 +564,7 @@ [["B9" invokeinterface [[index (Index (Reference Method))] [count U1] [output_count U1]] [(///index.value index) count (try.trusted (///unsigned.u1 0))]]]] )) -(def: (switch_padding offset) +(def (switch_padding offset) (-> Nat Nat) (let [parameter_start (n.+ (///unsigned.value ..opcode_size) offset)] @@ -572,7 +572,7 @@ (n.- (n.% 4 parameter_start) 4)))) -(def: .public tableswitch +(def .public tableswitch [(-> Nat Estimator) (-> S4 Big_Jump [Big_Jump (List Big_Jump)] Instruction)] (let [estimator (is (-> Nat Estimator) @@ -636,7 +636,7 @@ size) (|>> mutation tableswitch_mutation)]))))])) -(def: .public lookupswitch +(def .public lookupswitch [(-> Nat Estimator) (-> Big_Jump (List [S4 Big_Jump]) Instruction)] (let [case_size (n.+ (///unsigned.value ..integer_size) @@ -694,10 +694,10 @@ size) (|>> mutation lookupswitch_mutation)]))))])) -(def: .public monoid +(def .public monoid (Monoid Instruction) (implementation - (def: identity ..empty) + (def identity ..empty) - (def: (composite left right) + (def (composite left right) (|>> left right)))) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/jump.lux b/stdlib/source/library/lux/target/jvm/bytecode/jump.lux index 7d608a8e5..676930f65 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/jump.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/jump.lux @@ -13,17 +13,17 @@ (type: .public Jump S2) -(def: .public equivalence +(def .public equivalence (Equivalence Jump) ///signed.equivalence) -(def: .public writer +(def .public writer (Writer Jump) ///signed.writer/2) (type: .public Big_Jump S4) -(def: .public lifted +(def .public lifted (-> Jump Big_Jump) ///signed.lifted/4) diff --git a/stdlib/source/library/lux/target/jvm/class.lux b/stdlib/source/library/lux/target/jvm/class.lux index f93320b4c..cbbc47502 100644 --- a/stdlib/source/library/lux/target/jvm/class.lux +++ b/stdlib/source/library/lux/target/jvm/class.lux @@ -57,7 +57,7 @@ ["4000" enum] ) -(def: .public equivalence +(def .public equivalence (Equivalence Class) (all product.equivalence //unsigned.equivalence @@ -72,7 +72,7 @@ (sequence.equivalence //method.equivalence) (sequence.equivalence //attribute.equivalence))) -(def: (install_classes this super interfaces) +(def (install_classes this super interfaces) (-> Internal Internal (List Internal) (Resource [(Index //constant.Class) (Index //constant.Class) (Sequence (Index //constant.Class))])) (do [! //pool.monad] @@ -87,7 +87,7 @@ interfaces))] (in [@this @super @interfaces]))) -(def: .public (class version modifier +(def .public (class version modifier this signature super interfaces fields methods attributes) (-> Major (Modifier Class) @@ -127,7 +127,7 @@ {.#None} attributes)]))) -(def: .public (writer class) +(def .public (writer class) (Writer Class) (`` (all binaryF#composite (~~ (with_template [ ] diff --git a/stdlib/source/library/lux/target/jvm/constant.lux b/stdlib/source/library/lux/target/jvm/constant.lux index 8539fbf13..ebeccfaa4 100644 --- a/stdlib/source/library/lux/target/jvm/constant.lux +++ b/stdlib/source/library/lux/target/jvm/constant.lux @@ -36,28 +36,28 @@ (type: .public UTF8 Text) -(def: utf8_writer +(def utf8_writer (Writer UTF8) binaryF.utf8_16) (primitive .public Class (Index UTF8) - (def: .public index + (def .public index (-> Class (Index UTF8)) (|>> representation)) - (def: .public class + (def .public class (-> (Index UTF8) Class) (|>> abstraction)) - (def: .public class_equivalence + (def .public class_equivalence (Equivalence Class) (at equivalence.functor each ..index //index.equivalence)) - (def: class_writer + (def class_writer (Writer Class) (|>> representation //index.writer)) ) @@ -66,10 +66,10 @@ "[1]::[0]" ("static" floatToRawIntBits "manual" [float] int)) -(def: .public float_equivalence +(def .public float_equivalence (Equivalence java/lang/Float) (implementation - (def: (= parameter subject) + (def (= parameter subject) (for @.old ("jvm feq" parameter subject) @@ -85,11 +85,11 @@ (primitive .public (Value kind) kind - (def: .public value + (def .public value (All (_ kind) (-> (Value kind) kind)) (|>> representation)) - (def: .public (value_equivalence Equivalence) + (def .public (value_equivalence Equivalence) (All (_ kind) (-> (Equivalence kind) (Equivalence (Value kind)))) @@ -101,7 +101,7 @@ [(type: .public (Value )) - (def: .public + (def .public (-> ) (|>> abstraction))] @@ -113,7 +113,7 @@ ) (with_template [ ] - [(def: + [(def (Writer ) (`` (|>> representation (~~ (template.spliced )) @@ -138,13 +138,13 @@ #name_and_type (Index (Name_And_Type of))])) (with_template [ ] - [(def: .public + [(def .public (Equivalence ( Any)) (all product.equivalence //index.equivalence //index.equivalence)) - (def: + (def (Writer ( Any)) (all binaryF.and //index.writer @@ -168,7 +168,7 @@ {#Interface_Method (Reference //category.Method)} {#Name_And_Type (Name_And_Type Any)})) -(def: .public (size constant) +(def .public (size constant) (-> Constant Nat) (case constant (^.or {#Long _} {#Double _}) @@ -177,12 +177,12 @@ _ 1)) -(def: .public equivalence +(def .public equivalence (Equivalence Constant) ... TODO: Delete the explicit "implementation" and use the combinator ... version below as soon as the new format for variants is implemented. (implementation - (def: (= reference sample) + (def (= reference sample) (case [reference sample] (^.with_template [ ] [[{ reference} { sample}] @@ -223,7 +223,7 @@ ... ) ) -(def: .public writer +(def .public writer (Writer Constant) (with_expansions [ (these [#UTF8 /tag.utf8 ..utf8_writer] [#Integer /tag.integer ..integer_writer] diff --git a/stdlib/source/library/lux/target/jvm/constant/pool.lux b/stdlib/source/library/lux/target/jvm/constant/pool.lux index b953600bf..787af5c99 100644 --- a/stdlib/source/library/lux/target/jvm/constant/pool.lux +++ b/stdlib/source/library/lux/target/jvm/constant/pool.lux @@ -35,7 +35,7 @@ (type: .public Pool [Index (Sequence [Index Constant])]) -(def: .public equivalence +(def .public equivalence (Equivalence Pool) (product.equivalence //index.equivalence (sequence.equivalence (product.equivalence //index.equivalence @@ -44,10 +44,10 @@ (type: .public (Resource a) (+State Try Pool a)) -(def: .public functor +(def .public functor (Functor Resource) (implementation - (def: (each $ it) + (def (each $ it) (|>> it (pipe.case {try.#Success [state output]} @@ -57,16 +57,16 @@ failure (as_expected failure)))))) -(def: .public monad +(def .public monad (Monad Resource) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (in it) + (def (in it) (function (_ state) {try.#Success [state it]})) - (def: (conjoint it) + (def (conjoint it) (function (_ state) (case (it state) {try.#Success [state' it']} @@ -76,7 +76,7 @@ failure (as_expected failure)))))) -(def: try|each +(def try|each (template (_ ) [(case {try.#Success } @@ -86,11 +86,11 @@ failure (as_expected failure))])) -(def: try|in +(def try|in (template (_ ) [{try.#Success }])) -(def: !add +(def !add (template (_ ) [(let [[current pool] ' ] @@ -120,12 +120,12 @@ (sequence.suffix [current new] pool)] current]))))))])) -(def: /|do +(def /|do (template (_ ) [(function (_ ) )])) -(def: /|each +(def /|each (template (_ ) [(case ( ) {try.#Success [ ]} @@ -139,7 +139,7 @@ (-> of (Resource (Index of)))) (with_template [ ] - [(def: .public ( value) + [(def .public ( value) (Adder ) (<| (/|do %) (!add % value)))] @@ -151,21 +151,21 @@ [utf8 UTF8 //.#UTF8 text.equivalence] ) -(def: .public (string value) +(def .public (string value) (-> Text (Resource (Index String))) (<| (/|do %) (/|each % @value (utf8 value)) (let [value (//.string @value)]) (!add % //.#String (//.value_equivalence //index.equivalence) value))) -(def: .public (class name) +(def .public (class name) (-> Internal (Resource (Index Class))) (<| (/|do %) (/|each % @name (utf8 (//name.read name))) (let [value (//.class @name)]) (!add % //.#Class //.class_equivalence value))) -(def: .public (descriptor value) +(def .public (descriptor value) (All (_ kind) (-> (Descriptor kind) (Resource (Index (Descriptor kind))))) @@ -178,7 +178,7 @@ [#name UTF8 #descriptor (Descriptor of)])) -(def: .public (name_and_type [name descriptor]) +(def .public (name_and_type [name descriptor]) (All (_ of) (-> (Member of) (Resource (Index (Name_And_Type of))))) (<| (/|do %) @@ -187,7 +187,7 @@ (!add % //.#Name_And_Type //.name_and_type_equivalence [//.#name @name //.#descriptor @descriptor]))) (with_template [ ] - [(def: .public ( class member) + [(def .public ( class member) (-> External (Member ) (Resource (Index (Reference )))) (<| (/|do %) (/|each % @class (..class (//name.internal class))) @@ -199,11 +199,11 @@ [interface_method //.#Interface_Method Method] ) -(def: !index +(def !index (template (_ ) [(|> //index.value //unsigned.value)])) -(def: .public writer +(def .public writer (Writer Pool) (function (_ [next pool]) (sequence#mix (function (_ [_index post] pre) @@ -211,7 +211,7 @@ (\\format.bits_16 (!index next)) pool))) -(def: .public empty +(def .public empty Pool [(|> 1 //unsigned.u2 try.trusted //index.index) sequence.empty]) diff --git a/stdlib/source/library/lux/target/jvm/constant/tag.lux b/stdlib/source/library/lux/target/jvm/constant/tag.lux index 2ac10790f..58684f493 100644 --- a/stdlib/source/library/lux/target/jvm/constant/tag.lux +++ b/stdlib/source/library/lux/target/jvm/constant/tag.lux @@ -17,15 +17,15 @@ (primitive .public Tag U1 - (def: .public equivalence + (def .public equivalence (Equivalence Tag) (implementation - (def: (= reference sample) + (def (= reference sample) (u1//= (representation reference) (representation sample))))) (with_template [ ] - [(def: .public + [(def .public Tag (|> ///unsigned.u1 try.trusted abstraction))] @@ -45,7 +45,7 @@ [18 invoke_dynamic] ) - (def: .public writer + (def .public writer (Writer Tag) (|>> representation ///unsigned.writer/1)) ) diff --git a/stdlib/source/library/lux/target/jvm/encoding/name.lux b/stdlib/source/library/lux/target/jvm/encoding/name.lux index 2a322bace..068c11a36 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/name.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/name.lux @@ -7,8 +7,8 @@ [type [primitive (.except)]]]]) -(def: .public internal_separator "/") -(def: .public external_separator ".") +(def .public internal_separator "/") +(def .public external_separator ".") (type: .public External Text) @@ -16,26 +16,26 @@ (primitive .public Internal Text - (def: .public internal + (def .public internal (-> External Internal) (|>> (text.replaced ..external_separator ..internal_separator) abstraction)) - (def: .public read + (def .public read (-> Internal Text) (|>> representation)) - (def: .public external + (def .public external (-> Internal External) (|>> representation (text.replaced ..internal_separator ..external_separator)))) -(def: .public safe +(def .public safe (-> Text External) (|>> ..internal ..external)) -(def: .public (qualify package class) +(def .public (qualify package class) (-> Text External External) (format (..safe package) ..external_separator class)) diff --git a/stdlib/source/library/lux/target/jvm/encoding/signed.lux b/stdlib/source/library/lux/target/jvm/encoding/signed.lux index 822e420b2..b00ff6ba3 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/signed.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/signed.lux @@ -25,21 +25,21 @@ (primitive .public (Signed brand) Int - (def: .public value + (def .public value (-> (Signed Any) Int) (|>> representation)) - (def: .public equivalence + (def .public equivalence (All (_ brand) (Equivalence (Signed brand))) (implementation - (def: (= reference sample) + (def (= reference sample) (i.= (representation reference) (representation sample))))) - (def: .public order + (def .public order (All (_ brand) (Order (Signed brand))) (implementation - (def: equivalence ..equivalence) - (def: (< reference sample) + (def equivalence ..equivalence) + (def (< reference sample) (i.< (representation reference) (representation sample))))) (exception: .public (value_exceeds_the_scope [value Int @@ -53,18 +53,18 @@ (primitive Any) (type: .public (Signed ))) - (def: .public ) + (def .public ) - (def: .public + (def .public (|> (n.* i64.bits_per_byte) -- i64.mask abstraction)) - (def: .public + (def .public (let [it (representation )] (abstraction (-- (i.- it +0))))) - (def: .public + (def .public (-> Int (Try )) (let [positive (representation ) negative (i64.not positive)] @@ -77,7 +77,7 @@ (exception.except ..value_exceeds_the_scope [value ]))))) (with_template [ ] - [(def: .public ( parameter subject) + [(def .public ( parameter subject) (-> (Try )) ( ( (representation parameter) @@ -93,7 +93,7 @@ ) (with_template [ ] - [(def: .public + [(def .public (-> ) (|>> transmutation))] @@ -102,7 +102,7 @@ ) (with_template [ ] - [(def: .public + [(def .public (Writer ) (|>> representation ))] diff --git a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux index bdda3b8a5..0d2a16d52 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux @@ -24,22 +24,22 @@ (primitive .public (Unsigned brand) Nat - (def: .public value + (def .public value (-> (Unsigned Any) Nat) (|>> representation)) - (def: .public equivalence + (def .public equivalence (All (_ brand) (Equivalence (Unsigned brand))) (implementation - (def: (= reference sample) + (def (= reference sample) (n.= (representation reference) (representation sample))))) - (def: .public order + (def .public order (All (_ brand) (Order (Unsigned brand))) (implementation - (def: equivalence ..equivalence) - (def: (< reference sample) + (def equivalence ..equivalence) + (def (< reference sample) (n.< (representation reference) (representation sample))))) @@ -65,25 +65,25 @@ (primitive .public Any) (type: .public (Unsigned ))) - (def: .public ) + (def .public ) - (def: .public + (def .public (|> (n.* i64.bits_per_byte) i64.mask abstraction)) - (def: .public ( value) + (def .public ( value) (-> Nat (Try )) (if (n.> (representation ) value) (exception.except ..value_exceeds_the_maximum [(symbol ) value ]) {try.#Success (abstraction value)})) - (def: .public (<+> parameter subject) + (def .public (<+> parameter subject) (-> (Try )) ( (n.+ (representation parameter) (representation subject)))) - (def: .public (<-> parameter subject) + (def .public (<-> parameter subject) (-> (Try )) (let [parameter' (representation parameter) subject' (representation subject)] @@ -91,7 +91,7 @@ (exception.except ..subtraction_cannot_yield_negative_value [(symbol ) parameter subject]) {try.#Success (abstraction (n.- parameter' subject'))}))) - (def: .public ( left right) + (def .public ( left right) (-> ) (abstraction (n.max (representation left) (representation right))))] @@ -102,7 +102,7 @@ ) (with_template [ ] - [(def: .public + [(def .public (-> ) (|>> transmutation))] @@ -111,7 +111,7 @@ ) (with_template [ ] - [(def: .public + [(def .public (Writer ) (|>> representation ))] diff --git a/stdlib/source/library/lux/target/jvm/field.lux b/stdlib/source/library/lux/target/jvm/field.lux index b41782db2..fa84b191b 100644 --- a/stdlib/source/library/lux/target/jvm/field.lux +++ b/stdlib/source/library/lux/target/jvm/field.lux @@ -41,7 +41,7 @@ ["4000" enum] ) -(def: .public equivalence +(def .public equivalence (Equivalence Field) (all product.equivalence modifier.equivalence @@ -49,7 +49,7 @@ //index.equivalence (sequence.equivalence //attribute.equivalence))) -(def: .public (writer field) +(def .public (writer field) (Writer Field) (`` (all binaryF#composite (~~ (with_template [ ] @@ -61,7 +61,7 @@ [(binaryF.sequence_16 //attribute.writer) #attributes])) ))) -(def: .public (field modifier name with_signature? type attributes) +(def .public (field modifier name with_signature? type attributes) (-> (Modifier Field) UTF8 Bit (Type Value) (Sequence Attribute) (Resource Field)) (do [! //constant/pool.monad] diff --git a/stdlib/source/library/lux/target/jvm/index.lux b/stdlib/source/library/lux/target/jvm/index.lux index e3421fd14..f21318b91 100644 --- a/stdlib/source/library/lux/target/jvm/index.lux +++ b/stdlib/source/library/lux/target/jvm/index.lux @@ -12,27 +12,27 @@ [encoding ["[1][0]" unsigned (.only U2)]]]) -(def: .public length +(def .public length //unsigned.bytes/2) (primitive .public (Index kind) U2 - (def: .public index + (def .public index (All (_ kind) (-> U2 (Index kind))) (|>> abstraction)) - (def: .public value + (def .public value (-> (Index Any) U2) (|>> representation)) - (def: .public equivalence + (def .public equivalence (All (_ kind) (Equivalence (Index kind))) (at equivalence.functor each ..value //unsigned.equivalence)) - (def: .public writer + (def .public writer (All (_ kind) (Writer (Index kind))) (|>> representation //unsigned.writer/2)) ) diff --git a/stdlib/source/library/lux/target/jvm/loader.lux b/stdlib/source/library/lux/target/jvm/loader.lux index ee54b8aef..a16372f06 100644 --- a/stdlib/source/library/lux/target/jvm/loader.lux +++ b/stdlib/source/library/lux/target/jvm/loader.lux @@ -65,7 +65,7 @@ "io" "try" (java/lang/Class java/lang/Object))) (with_expansions [ (these (java/lang/Class java/lang/Object))] - (def: java/lang/ClassLoader::defineClass + (def java/lang/ClassLoader::defineClass java/lang/reflect/Method (let [signature (|> (ffi.array 4) (ffi.write! 0 (as @@ -80,7 +80,7 @@ (ffi.class_for java/lang/ClassLoader)) (java/lang/reflect/AccessibleObject::setAccessible true))))) -(def: .public (define class_name bytecode loader) +(def .public (define class_name bytecode loader) (-> Text Binary java/lang/ClassLoader (Try java/lang/Object)) (let [signature (array.of_list (list (as java/lang/Object class_name) @@ -97,11 +97,11 @@ ffi.long_to_int))))] (java/lang/reflect/Method::invoke loader signature java/lang/ClassLoader::defineClass))) -(def: .public (new_library _) +(def .public (new_library _) (-> Any Library) (atom.atom (dictionary.empty text.hash))) -(def: .public (memory library) +(def .public (memory library) (-> Library java/lang/ClassLoader) (with_expansions [ (for @.old (<|) @@ -128,7 +128,7 @@ {.#None} (panic! (exception.error ..unknown [class_name]))))))))) -(def: .public (store name bytecode library) +(def .public (store name bytecode library) (-> Text Binary Library (IO (Try Any))) (do [! io.monad] [library' (atom.read! library)] @@ -138,7 +138,7 @@ [_ (atom.update! (dictionary.has name bytecode) library)] (in {try.#Success []}))))) -(def: .public (load name loader) +(def .public (load name loader) (-> Text java/lang/ClassLoader (IO (Try (java/lang/Class java/lang/Object)))) (java/lang/ClassLoader::loadClass (ffi.as_string name) loader)) diff --git a/stdlib/source/library/lux/target/jvm/magic.lux b/stdlib/source/library/lux/target/jvm/magic.lux index 72f5ef52c..a4064361e 100644 --- a/stdlib/source/library/lux/target/jvm/magic.lux +++ b/stdlib/source/library/lux/target/jvm/magic.lux @@ -12,11 +12,11 @@ (type: .public Magic U4) -(def: .public code +(def .public code Magic (|> (hex "CAFEBABE") //unsigned.u4 try.trusted)) -(def: .public writer +(def .public writer //unsigned.writer/4) diff --git a/stdlib/source/library/lux/target/jvm/method.lux b/stdlib/source/library/lux/target/jvm/method.lux index bdbe58f87..082ede18b 100644 --- a/stdlib/source/library/lux/target/jvm/method.lux +++ b/stdlib/source/library/lux/target/jvm/method.lux @@ -52,7 +52,7 @@ ["1000" synthetic] ) -(def: .public (method modifier name with_signature? type attributes code) +(def .public (method modifier name with_signature? type attributes code) (-> (Modifier Method) UTF8 Bit (Type //category.Method) (List (Resource Attribute)) (Maybe (Bytecode Any)) (Resource Method)) (do [! //pool.monad] @@ -89,7 +89,7 @@ #descriptor @descriptor #attributes attributes]))) -(def: .public equivalence +(def .public equivalence (Equivalence Method) (all product.equivalence //modifier.equivalence @@ -98,7 +98,7 @@ (sequence.equivalence //attribute.equivalence) )) -(def: .public (writer field) +(def .public (writer field) (Writer Method) (`` (all \\format#composite (~~ (with_template [ ] diff --git a/stdlib/source/library/lux/target/jvm/modifier.lux b/stdlib/source/library/lux/target/jvm/modifier.lux index 04db97f3f..1034f5cab 100644 --- a/stdlib/source/library/lux/target/jvm/modifier.lux +++ b/stdlib/source/library/lux/target/jvm/modifier.lux @@ -26,66 +26,66 @@ (primitive .public (Modifier of) //unsigned.U2 - (def: .public code + (def .public code (-> (Modifier Any) //unsigned.U2) (|>> representation)) - (def: .public equivalence + (def .public equivalence (All (_ of) (Equivalence (Modifier of))) (implementation - (def: (= reference sample) + (def (= reference sample) (at //unsigned.equivalence = (representation reference) (representation sample))))) - (def: !wrap + (def !wrap (template (_ value) [(|> value //unsigned.u2 try.trusted abstraction)])) - (def: !unwrap + (def !unwrap (template (_ value) [(|> value representation //unsigned.value)])) - (def: .public (has? sub super) + (def .public (has? sub super) (All (_ of) (-> (Modifier of) (Modifier of) Bit)) (let [sub (!unwrap sub)] (|> (!unwrap super) (i64.and sub) (at i64.equivalence = sub)))) - (def: .public monoid + (def .public monoid (All (_ of) (Monoid (Modifier of))) (implementation - (def: identity + (def identity (!wrap (hex "0000"))) - (def: (composite left right) + (def (composite left right) (!wrap (i64.or (!unwrap left) (!unwrap right)))))) - (def: .public empty + (def .public empty Modifier (at ..monoid identity)) - (def: .public writer + (def .public writer (All (_ of) (Writer (Modifier of))) (|>> representation //unsigned.writer/2)) - (def: modifier + (def modifier (-> Nat Modifier) (|>> !wrap)) ) -(def: .public modifiers +(def .public modifiers (syntax (_ [ofT .any options (<>.many .any)]) (with_symbols [g!modifier g!code] (in (list (` (with_template [(~ g!code) (~ g!modifier)] - [(def: (~' .public) (~ 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 8369ce2f0..e09c3d85a 100644 --- a/stdlib/source/library/lux/target/jvm/reflection.lux +++ b/stdlib/source/library/lux/target/jvm/reflection.lux @@ -109,7 +109,7 @@ [cannot_convert_to_a_lux_type] ) -(def: .public (load class_loader name) +(def .public (load class_loader name) (-> java/lang/ClassLoader External (Try (java/lang/Class java/lang/Object))) (case (java/lang/Class::forName name false class_loader) {try.#Failure _} @@ -118,14 +118,14 @@ success success)) -(def: .public (sub? class_loader super sub) +(def .public (sub? class_loader super sub) (-> java/lang/ClassLoader External External (Try Bit)) (do try.monad [super (..load class_loader super) sub (..load class_loader sub)] (in (java/lang/Class::isAssignableFrom sub super)))) -(def: (class' parameter reflection) +(def (class' parameter reflection) (-> (-> java/lang/reflect/Type (Try (/.Type Parameter))) java/lang/reflect/Type (Try (/.Type Class))) @@ -171,7 +171,7 @@ ... else (exception.except ..cannot_convert_to_a_lux_type [reflection]))) -(def: .public (parameter type reflection) +(def .public (parameter type reflection) (-> (-> java/lang/reflect/Type (Try (/.Type Value))) (-> java/lang/reflect/Type (Try (/.Type Parameter)))) (<| (case (ffi.as java/lang/reflect/TypeVariable reflection) @@ -218,7 +218,7 @@ _) (..class' (parameter type) reflection))) -(def: .public (type reflection) +(def .public (type reflection) (-> java/lang/reflect/Type (Try (/.Type Value))) (<| (case (ffi.as java/lang/Class reflection) {.#Some reflection} @@ -245,12 +245,12 @@ ... else (..parameter type reflection))) -(def: .public class +(def .public class (-> java/lang/reflect/Type (Try (/.Type Class))) (..class' (..parameter ..type))) -(def: .public (return reflection) +(def .public (return reflection) (-> java/lang/reflect/Type (Try (/.Type Return))) (with_expansions [ (these (..type reflection))] (case (ffi.as java/lang/Class reflection) @@ -286,7 +286,7 @@ (exception.report "Type" (%.type type))) -(def: .public (correspond class type) +(def .public (correspond class type) (-> (java/lang/Class java/lang/Object) Type (Try Mapping)) (case type (pattern {.#Primitive (static array.type_name) (list :member:)}) @@ -346,7 +346,7 @@ [not_a_virtual_field] ) -(def: .public (field field target) +(def .public (field field target) (-> Text (java/lang/Class java/lang/Object) (Try java/lang/reflect/Field)) (case (java/lang/Class::getDeclaredField field target) {try.#Success field} @@ -358,7 +358,7 @@ {try.#Failure _} (exception.except ..unknown_field [field target]))) -(def: .public deprecated? +(def .public deprecated? (-> (array.Array java/lang/annotation/Annotation) Bit) (|>> (array.list {.#None}) (list.all (|>> (ffi.as java/lang/Deprecated))) @@ -366,7 +366,7 @@ not)) (with_template [ ] - [(def: .public ( field class) + [(def .public ( field class) (-> Text (java/lang/Class java/lang/Object) (Try [Bit Bit (/.Type Value)])) (do [! try.monad] [fieldJ (..field field class) diff --git a/stdlib/source/library/lux/target/jvm/type.lux b/stdlib/source/library/lux/target/jvm/type.lux index 18c21263c..3734c5e99 100644 --- a/stdlib/source/library/lux/target/jvm/type.lux +++ b/stdlib/source/library/lux/target/jvm/type.lux @@ -43,7 +43,7 @@ #super_interfaces (List (Type Class))])) (with_template [