From d3f5e1f4baa667bc2eb72edd542cf5d8cd3924ce Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 3 Jul 2018 18:40:16 -0400 Subject: - Re-named ":!" to ":coerce". --- lux-mode/lux-mode.el | 2 +- luxdoc/source/program.lux | 2 +- new-luxc/source/luxc/lang/extension/statement.lux | 6 +- new-luxc/source/luxc/lang/host.jvm.lux | 46 ++++---- new-luxc/source/luxc/lang/macro.lux | 10 +- new-luxc/source/luxc/lang/translation.lux | 6 +- .../source/luxc/lang/translation/common-lisp.lux | 34 +++--- .../luxc/lang/translation/common-lisp/case.jvm.lux | 10 +- .../luxc/lang/translation/common-lisp/eval.jvm.lux | 44 ++++---- .../lang/translation/common-lisp/primitive.jvm.lux | 4 +- .../lang/translation/common-lisp/runtime.jvm.lux | 2 +- .../lang/translation/common-lisp/statement.jvm.lux | 2 +- new-luxc/source/luxc/lang/translation/js.lux | 78 ++++++------- .../source/luxc/lang/translation/js/eval.jvm.lux | 30 ++--- .../luxc/lang/translation/js/primitive.jvm.lux | 2 +- .../luxc/lang/translation/js/statement.jvm.lux | 2 +- .../source/luxc/lang/translation/jvm/case.jvm.lux | 4 +- .../luxc/lang/translation/jvm/common.jvm.lux | 22 ++-- .../luxc/lang/translation/jvm/statement.jvm.lux | 2 +- new-luxc/source/luxc/lang/translation/lua.lux | 36 +++--- .../source/luxc/lang/translation/lua/case.jvm.lux | 10 +- .../source/luxc/lang/translation/lua/eval.jvm.lux | 20 ++-- .../luxc/lang/translation/lua/primitive.jvm.lux | 4 +- .../luxc/lang/translation/lua/statement.jvm.lux | 2 +- new-luxc/source/luxc/lang/translation/php.lux | 34 +++--- .../source/luxc/lang/translation/php/case.jvm.lux | 10 +- .../source/luxc/lang/translation/php/eval.jvm.lux | 32 +++--- .../luxc/lang/translation/php/expression.jvm.lux | 4 +- .../luxc/lang/translation/php/reference.jvm.lux | 4 +- .../luxc/lang/translation/php/statement.jvm.lux | 2 +- new-luxc/source/luxc/lang/translation/python.lux | 34 +++--- .../luxc/lang/translation/python/case.jvm.lux | 10 +- .../luxc/lang/translation/python/eval.jvm.lux | 14 +-- .../luxc/lang/translation/python/primitive.jvm.lux | 4 +- .../luxc/lang/translation/python/statement.jvm.lux | 2 +- new-luxc/source/luxc/lang/translation/r.lux | 36 +++--- .../source/luxc/lang/translation/r/case.jvm.lux | 10 +- .../source/luxc/lang/translation/r/eval.jvm.lux | 44 ++++---- .../luxc/lang/translation/r/primitive.jvm.lux | 4 +- .../luxc/lang/translation/r/statement.jvm.lux | 2 +- new-luxc/source/luxc/lang/translation/ruby.lux | 34 +++--- .../source/luxc/lang/translation/ruby/case.jvm.lux | 10 +- .../source/luxc/lang/translation/ruby/eval.jvm.lux | 30 ++--- .../luxc/lang/translation/ruby/primitive.jvm.lux | 4 +- .../luxc/lang/translation/ruby/statement.jvm.lux | 2 +- new-luxc/source/luxc/lang/translation/scheme.lux | 36 +++--- .../luxc/lang/translation/scheme/eval.jvm.lux | 40 +++---- .../luxc/lang/translation/scheme/statement.jvm.lux | 2 +- new-luxc/source/luxc/repl.lux | 42 +++---- new-luxc/test/test/luxc/lang/translation/case.lux | 4 +- .../test/test/luxc/lang/translation/common.lux | 122 ++++++++++----------- .../test/test/luxc/lang/translation/function.lux | 54 ++++----- new-luxc/test/test/luxc/lang/translation/js.lux | 20 ++-- new-luxc/test/test/luxc/lang/translation/jvm.lux | 50 ++++----- .../test/test/luxc/lang/translation/primitive.lux | 2 +- .../test/test/luxc/lang/translation/reference.lux | 4 +- .../test/test/luxc/lang/translation/structure.lux | 16 +-- stdlib/source/lux.lux | 10 +- stdlib/source/lux/concurrency/stm.lux | 16 +-- stdlib/source/lux/data/bit.lux | 8 +- stdlib/source/lux/data/number.lux | 32 +++--- stdlib/source/lux/data/text.lux | 2 +- stdlib/source/lux/host.js.lux | 16 +-- stdlib/source/lux/host.jvm.lux | 4 +- stdlib/source/lux/io.lux | 8 +- stdlib/source/lux/lang/compiler/analysis/case.lux | 4 +- .../lang/compiler/extension/analysis/common.lux | 4 +- .../lang/compiler/extension/analysis/host.jvm.lux | 22 ++-- stdlib/source/lux/lang/compiler/synthesis/case.lux | 2 +- .../lang/compiler/translation/scheme/case.jvm.lux | 2 +- stdlib/source/lux/macro.lux | 4 +- stdlib/source/lux/world/blob.jvm.lux | 4 +- stdlib/source/lux/world/console.lux | 2 +- stdlib/test/test/lux.lux | 2 +- .../test/lux/lang/compiler/analysis/function.lux | 2 +- .../test/lux/lang/compiler/analysis/primitive.lux | 2 +- .../test/lux/lang/compiler/analysis/reference.lux | 2 +- .../test/lux/lang/compiler/analysis/structure.lux | 2 +- .../test/lux/lang/compiler/synthesis/primitive.lux | 2 +- 79 files changed, 625 insertions(+), 625 deletions(-) diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el index 7dfcdecc8..894b7148c 100644 --- a/lux-mode/lux-mode.el +++ b/lux-mode/lux-mode.el @@ -224,7 +224,7 @@ Called by `imenu--generic-function'." "word:" "abstract:" "unit:" "scale:" - ":" ":!" ":assume" "@abstraction" "@representation" "^@representation" + ":" ":coerce" ":assume" "@abstraction" "@representation" "^@representation" "function" "case" "undefined" "ident-for" "static" "and" "or" "char" diff --git a/luxdoc/source/program.lux b/luxdoc/source/program.lux index 4e1c1c6b4..4e2888c82 100644 --- a/luxdoc/source/program.lux +++ b/luxdoc/source/program.lux @@ -357,7 +357,7 @@ (def: (add-def [name [def-type def-meta def-value]] org) (-> [Text Def] DefOrg DefOrg) (cond (compiler;type? def-meta) - (update@ #types (cons [name def-meta (:! Type def-value)]) org) + (update@ #types (cons [name def-meta (:coerce Type def-value)]) org) (compiler;macro? def-meta) (update@ #macros (cons [name def-meta]) org) diff --git a/new-luxc/source/luxc/lang/extension/statement.lux b/new-luxc/source/luxc/lang/extension/statement.lux index a92995630..9b7b9da52 100644 --- a/new-luxc/source/luxc/lang/extension/statement.lux +++ b/new-luxc/source/luxc/lang/extension/statement.lux @@ -49,7 +49,7 @@ (expressionA.analyser evalL.eval annsC))) annsI (expressionT.translate (expressionS.synthesize syntheses annsA)) annsV (evalT.eval annsI)] - (wrap [annsI (:! Code annsV)]))) + (wrap [annsI (:coerce Code annsV)]))) (def: (ensure-valid-alias def-name annotations value) (-> Text Code Code (Meta Any)) @@ -82,7 +82,7 @@ #.None (do @ [[_ valueT valueA] (lang.with-scope - (if (macro.type? (:! Code annotationsV)) + (if (macro.type? (:coerce Code annotationsV)) (do @ [valueA (lang.with-type Type (expressionA.analyser evalL.eval valueC))] @@ -130,7 +130,7 @@ syntheses //.all-syntheses valueI (expressionT.translate (expressionS.synthesize syntheses valueA)) valueV (evalT.eval valueI) - _ ( name (:! valueV))] + _ ( name (:coerce valueV))] (wrap [])) _ diff --git a/new-luxc/source/luxc/lang/host.jvm.lux b/new-luxc/source/luxc/lang/host.jvm.lux index 9a959bb48..0491cae25 100644 --- a/new-luxc/source/luxc/lang/host.jvm.lux +++ b/new-luxc/source/luxc/lang/host.jvm.lux @@ -40,10 +40,10 @@ Method (case (Class::getDeclaredMethod ["defineClass" (|> (host.array (Class Object) +4) - (host.array-write +0 (:! (Class Object) (host.class-for String))) + (host.array-write +0 (:coerce (Class Object) (host.class-for String))) (host.array-write +1 (Object::getClass [] (host.array byte +0))) - (host.array-write +2 (:! (Class Object) Integer::TYPE)) - (host.array-write +3 (:! (Class Object) Integer::TYPE)))] + (host.array-write +2 (:coerce (Class Object) Integer::TYPE)) + (host.array-write +3 (:coerce (Class Object) Integer::TYPE)))] (host.class-for java/lang/ClassLoader)) (#e.Success method) (do-to method @@ -55,10 +55,10 @@ (def: (define-class class-name byte-code loader) (-> Text commonT.Bytecode ClassLoader (e.Error Object)) (Method::invoke [loader - (array.from-list (list (:! Object class-name) - (:! Object byte-code) - (:! Object (host.long-to-int 0)) - (:! Object (host.long-to-int (.int (host.array-length byte-code))))))] + (array.from-list (list (:coerce Object class-name) + (:coerce Object byte-code) + (:coerce Object (host.long-to-int 0)) + (:coerce Object (host.long-to-int (.int (host.array-length byte-code))))))] ClassLoader::defineClass)) (def: (fetch-byte-code class-name store) @@ -72,7 +72,7 @@ (ClassLoader (findClass [class-name String]) Class (case (fetch-byte-code class-name store) (#.Some bytecode) - (case (define-class class-name bytecode (:! ClassLoader _jvm_this)) + (case (define-class class-name bytecode (:coerce ClassLoader _jvm_this)) (#e.Success class) (:assume class) @@ -96,15 +96,15 @@ (def: #export (with-anchor anchor expr) (All [a] (-> [Label Register] (Meta a) (Meta a))) (.function (_ compiler) - (let [old (:! commonT.Host (get@ #.host compiler))] + (let [old (:coerce commonT.Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Nothing (set@ #commonT.anchor (#.Some anchor) old)) + (:coerce Nothing (set@ #commonT.anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! commonT.Host) + (|>> (:coerce commonT.Host) (set@ #commonT.anchor (get@ #commonT.anchor old)) - (:! Nothing)) + (:coerce Nothing)) compiler') output]) @@ -117,7 +117,7 @@ (def: #export anchor (Meta [Label Register]) (.function (_ compiler) - (case (|> compiler (get@ #.host) (:! commonT.Host) (get@ #commonT.anchor)) + (case (|> compiler (get@ #.host) (:coerce commonT.Host) (get@ #commonT.anchor)) (#.Some anchor) (#e.Success [compiler anchor]) @@ -128,15 +128,15 @@ (def: #export (with-context name expr) (All [a] (-> Text (Meta a) (Meta a))) (.function (_ compiler) - (let [old (:! commonT.Host (get@ #.host compiler))] + (let [old (:coerce commonT.Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Nothing (set@ #commonT.context [(lang.normalize-name name) +0] old)) + (:coerce Nothing (set@ #commonT.context [(lang.normalize-name name) +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! commonT.Host) + (|>> (:coerce commonT.Host) (set@ #commonT.context (get@ #commonT.context old)) - (:! Nothing)) + (:coerce Nothing)) compiler') output]) @@ -146,17 +146,17 @@ (def: #export (with-sub-context expr) (All [a] (-> (Meta a) (Meta [Text a]))) (.function (_ compiler) - (let [old (:! commonT.Host (get@ #.host compiler)) + (let [old (:coerce commonT.Host (get@ #.host compiler)) [old-name old-sub] (get@ #commonT.context old) new-name (format old-name "$" (%i (.int old-sub)))] (case (expr (set@ #.host - (:! Nothing (set@ #commonT.context [new-name +0] old)) + (:coerce Nothing (set@ #commonT.context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! commonT.Host) + (|>> (:coerce commonT.Host) (set@ #commonT.context [old-name (inc old-sub)]) - (:! Nothing)) + (:coerce Nothing)) compiler') [new-name output]]) @@ -168,7 +168,7 @@ (.function (_ compiler) (#e.Success [compiler (|> (get@ #.host compiler) - (:! commonT.Host) + (:coerce commonT.Host) (get@ #commonT.context) (let> [name sub] name))]))) @@ -179,7 +179,7 @@ (#e.Success [compiler (|> compiler (get@ #.host) - (:! commonT.Host) + (:coerce commonT.Host) (get@ #commonT.loader))]))) (def: #export runtime-class Text "LuxRuntime") diff --git a/new-luxc/source/luxc/lang/macro.lux b/new-luxc/source/luxc/lang/macro.lux index 043f0df93..4e22047b2 100644 --- a/new-luxc/source/luxc/lang/macro.lux +++ b/new-luxc/source/luxc/lang/macro.lux @@ -25,11 +25,11 @@ (function (_ compiler) (do e.Monad [apply-method (Class::getMethod ["apply" _apply-args] class) - output (Method::invoke [(:! Object macro) + output (Method::invoke [(:coerce Object macro) (|> (host.array Object +2) - (host.array-write +0 (:! Object inputs)) - (host.array-write +1 (:! Object compiler)))] + (host.array-write +0 (:coerce Object inputs)) + (host.array-write +1 (:coerce Object compiler)))] apply-method)] - (:! (e.Error [Lux (List Code)]) - output)))))) + (:coerce (e.Error [Lux (List Code)]) + output)))))) }) diff --git a/new-luxc/source/luxc/lang/translation.lux b/new-luxc/source/luxc/lang/translation.lux index 0ed495c31..0ed65378d 100644 --- a/new-luxc/source/luxc/lang/translation.lux +++ b/new-luxc/source/luxc/lang/translation.lux @@ -64,7 +64,7 @@ syntheses extensionL.all-syntheses annsI (expressionT.translate (expressionS.synthesize syntheses annsA)) annsV (evalT.eval annsI)] - (wrap [annsI (:! Code annsV)]))) + (wrap [annsI (:coerce Code annsV)]))) (def: (switch-compiler new-compiler) (-> Lux (Meta Aliases)) @@ -107,7 +107,7 @@ (&.throw Invalid-Macro (%code code))) expansion (: (Meta (List Code)) (function (_ compiler) - (case (macroL.expand (:! Macro _macroV) argsC+ compiler) + (case (macroL.expand (:coerce Macro _macroV) argsC+ compiler) (#e.Error error) ((&.throw Macro-Expansion-Failed error) compiler) @@ -167,7 +167,7 @@ (def: text-to-blob (-> Text Blob) - (|>> (:! String) + (|>> (:coerce String) (String::getBytes ["UTF-8"]) e.assume)))}) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp.lux b/new-luxc/source/luxc/lang/translation/common-lisp.lux index 36926833c..4341e5e4c 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp.lux @@ -83,26 +83,26 @@ (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Nothing)) + (:coerce Nothing)) compiler) []]))) (def: #export (with-sub-context expr) (All [a] (-> (Meta a) (Meta [Text a]))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler)) + (let [old (:coerce Host (get@ #.host compiler)) [old-name old-sub] (get@ #context old) new-name (format old-name "f___" (%i (.int old-sub)))] (case (expr (set@ #.host - (:! Nothing (set@ #context [new-name +0] old)) + (:coerce Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #context [old-name (inc old-sub)]) - (:! Nothing)) + (:coerce Nothing)) compiler') [new-name output]]) @@ -114,7 +114,7 @@ (function (_ compiler) (#e.Success [compiler (|> (get@ #.host compiler) - (:! Host) + (:coerce Host) (get@ #context) (let> [name sub] name))]))) @@ -122,15 +122,15 @@ (def: #export (with-anchor anchor expr) (All [a] (-> Anchor (Meta a) (Meta a))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler))] + (let [old (:coerce Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Nothing (set@ #anchor (#.Some anchor) old)) + (:coerce Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #anchor (get@ #anchor old)) - (:! Nothing)) + (:coerce Nothing)) compiler') output]) @@ -140,7 +140,7 @@ (def: #export anchor (Meta Anchor) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #anchor)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #anchor)) (#.Some anchor) (#e.Success [compiler anchor]) @@ -150,7 +150,7 @@ (def: #export module-buffer (Meta StringBuilder) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #module-buffer)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #module-buffer)) #.None ((lang.throw No-Active-Module-Buffer "") compiler) @@ -160,13 +160,13 @@ (def: #export program-buffer (Meta StringBuilder) (function (_ compiler) - (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))]))) + (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) (do-template [ ] [(def: ( code) (-> Expression (Meta )) (function (_ compiler) - (let [runner (|> compiler (get@ #.host) (:! Host) (get@ ))] + (let [runner (|> compiler (get@ #.host) (:coerce Host) (get@ ))] (case (runner code) (#e.Error error) ((lang.throw Cannot-Execute error) compiler) @@ -190,7 +190,7 @@ (-> Expression (Meta Any)) (do macro.Monad [module-buffer module-buffer - #let [_ (Appendable::append [(:! CharSequence (_.expression code))] + #let [_ (Appendable::append [(:coerce CharSequence (_.expression code))] module-buffer)]] (load! code))) @@ -203,7 +203,7 @@ module-buffer module-buffer program-buffer program-buffer #let [module-code (StringBuilder::toString [] module-buffer) - _ (Appendable::append [(:! CharSequence (format module-code "\n"))] + _ (Appendable::append [(:coerce CharSequence (format module-code "\n"))] program-buffer)]] (wrap (ioC.write target (format (lang.normalize-name module) "/" r-module-name) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/case.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/case.jvm.lux index d132ba0b8..41e93c13b 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/case.jvm.lux @@ -37,7 +37,7 @@ (let [method (if tail? runtimeT.product//right runtimeT.product//left)] - (method source (_.int (:! Int idx))))) + (method source (_.int (:coerce Int idx))))) valueO pathP)))) @@ -116,21 +116,21 @@ (meta/wrap (_.when (|> value (<=> cursor-top) _.not) fail-pm!))) ([#.Bool _.bool _.equal] - [#.Nat (<| _.int (:! Int)) _.=] + [#.Nat (<| _.int (:coerce Int)) _.=] [#.Int _.int _.=] - [#.Deg (<| _.int (:! Int)) _.=] + [#.Deg (<| _.int (:coerce Int)) _.=] [#.Frac _.float _.=] [#.Text _.string _.equal]) (^template [ ] (^code ( (~ [_ (#.Nat idx)]))) - (meta/wrap (push-cursor! ( cursor-top (_.int (:! Int idx)))))) + (meta/wrap (push-cursor! ( cursor-top (_.int (:coerce Int idx)))))) (["lux case tuple left" runtimeT.product//left] ["lux case tuple right" runtimeT.product//right]) (^template [ ] (^code ( (~ [_ (#.Nat idx)]))) - (meta/wrap (_.progn (list (_.setq! $temp (runtimeT.sum//get cursor-top (_.int (:! Int idx)) )) + (meta/wrap (_.progn (list (_.setq! $temp (runtimeT.sum//get cursor-top (_.int (:coerce Int idx)) )) (_.if (_.null (@@ $temp)) fail-pm! (push-cursor! (@@ $temp))))))) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/eval.jvm.lux index cb6f03d17..0108d2e83 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/eval.jvm.lux @@ -42,8 +42,8 @@ ) (exception: #export (Unknown-Kind-Of-Host-Object {host-object Object}) - (let [object-class (:! Text (Object::toString [] (Object::getClass [] (:! Object host-object)))) - text-representation (:! Text (Object::toString [] (:! Object host-object)))] + (let [object-class (:coerce Text (Object::toString [] (Object::getClass [] (:coerce Object host-object)))) + text-representation (:coerce Text (Object::toString [] (:coerce Object host-object)))] (format object-class " --- " text-representation))) (host.import org/armedbear/lisp/LispObject) @@ -72,21 +72,21 @@ (def: (parse-tuple lux-object host-object) (-> (-> Object (Error Any)) SimpleVector (Error Any)) - (let [size (:! Nat (SimpleVector::length [] host-object))] + (let [size (:coerce Nat (SimpleVector::length [] host-object))] (loop [idx +0 - output (:! (Array Any) (array.new size))] + output (:coerce (Array Any) (array.new size))] (if (n/< size idx) - (case (lux-object (SimpleVector::elt [(:! Int idx)] host-object)) + (case (lux-object (SimpleVector::elt [(:coerce Int idx)] host-object)) (#e.Error error) (#e.Error error) (#e.Success lux-value) - (recur (inc idx) (array.write idx (:! Any lux-value) output))) + (recur (inc idx) (array.write idx (:coerce Any lux-value) output))) (#e.Success output))))) (def: (variant tag flag value) (-> Nat Bool Any Any) - [(Long::intValue [] (:! Long tag)) + [(Long::intValue [] (:coerce Long tag)) (: Any (if flag //.unit @@ -101,52 +101,52 @@ (-> (-> Object (Error Any)) Cons (Error Any)) (let [variant-tag (Cons::car host-object)] (if (and (host.instance? org/armedbear/lisp/Symbol variant-tag) - (text/= //.variant-tag (Symbol::getName [] (:! Symbol variant-tag)))) + (text/= //.variant-tag (Symbol::getName [] (:coerce Symbol variant-tag)))) (do e.Monad - [#let [host-object (:! Cons (Cons::cdr host-object))] + [#let [host-object (:coerce Cons (Cons::cdr host-object))] tag (lux-object (Cons::car host-object)) - #let [host-object (:! Cons (Cons::cdr host-object))] + #let [host-object (:coerce Cons (Cons::cdr host-object))] #let [flag (host.instance? org/armedbear/lisp/SimpleString (Cons::car host-object))] value (lux-object (Cons::cdr host-object))] - (wrap (..variant (:! Nat tag) flag value))) - (ex.throw invalid-variant (:! Text (Object::toString [] (:! Object host-object))))))) + (wrap (..variant (:coerce Nat tag) flag value))) + (ex.throw invalid-variant (:coerce Text (Object::toString [] (:coerce Object host-object))))))) (def: (lux-object host-object) (-> Object (Error Any)) (cond (host.instance? org/armedbear/lisp/Bignum host-object) - (#e.Success (Bignum::longValue [] (:! Bignum host-object))) + (#e.Success (Bignum::longValue [] (:coerce Bignum host-object))) (host.instance? org/armedbear/lisp/Fixnum host-object) - (#e.Success (Fixnum::longValue [] (:! Fixnum host-object))) + (#e.Success (Fixnum::longValue [] (:coerce Fixnum host-object))) (host.instance? org/armedbear/lisp/DoubleFloat host-object) - (#e.Success (DoubleFloat::doubleValue [] (:! DoubleFloat host-object))) + (#e.Success (DoubleFloat::doubleValue [] (:coerce DoubleFloat host-object))) (host.instance? org/armedbear/lisp/Nil host-object) (#e.Success false) (host.instance? org/armedbear/lisp/Symbol host-object) - (if (is? Symbol::T (:! Symbol host-object)) + (if (is? Symbol::T (:coerce Symbol host-object)) (#e.Success true) - (ex.throw Unknown-Kind-Of-Host-Object (:! Object host-object))) + (ex.throw Unknown-Kind-Of-Host-Object (:coerce Object host-object))) (host.instance? org/armedbear/lisp/SimpleString host-object) - (#e.Success (SimpleString::getStringValue [] (:! SimpleString host-object))) + (#e.Success (SimpleString::getStringValue [] (:coerce SimpleString host-object))) (host.instance? org/armedbear/lisp/SimpleVector host-object) - (parse-tuple lux-object (:! SimpleVector host-object)) + (parse-tuple lux-object (:coerce SimpleVector host-object)) (host.instance? org/armedbear/lisp/Cons host-object) - (parse-variant lux-object (:! Cons host-object)) + (parse-variant lux-object (:coerce Cons host-object)) ## else - (ex.throw Unknown-Kind-Of-Host-Object (:! Object host-object)))) + (ex.throw Unknown-Kind-Of-Host-Object (:coerce Object host-object)))) (def: #export (eval code) (-> Expression (Meta Any)) (function (_ compiler) - (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] + (let [interpreter (|> compiler (get@ #.host) (:coerce //.Host) (get@ #//.interpreter))] (case (interpreter code) (#e.Error error) (exec (log! (format "eval #e.Error\n" diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/primitive.jvm.lux index 6bb4ec140..4e26c4218 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/primitive.jvm.lux @@ -15,11 +15,11 @@ (def: #export translate-nat (-> Nat (Meta Expression)) - (|>> (:! Int) _.int meta/wrap)) + (|>> (:coerce Int) _.int meta/wrap)) (def: #export translate-deg (-> Deg (Meta Expression)) - (|>> (:! Int) _.int meta/wrap)) + (|>> (:coerce Int) _.int meta/wrap)) (def: #export translate-frac (-> Frac (Meta Expression)) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux index 1819a8601..cd12328e2 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux @@ -33,7 +33,7 @@ (def: #export (variant tag last? value) (-> Nat Bool Expression Expression) - (variant' (_.int (:! Int tag)) (flag last?) value)) + (variant' (_.int (:coerce Int tag)) (flag last?) value)) (def: #export none Expression diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/statement.jvm.lux index dab065e62..549142f3f 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/statement.jvm.lux @@ -34,7 +34,7 @@ (wrap []) tags - (moduleL.declare-tags tags (macro.export? metaV) (:! Type expressionV))) + (moduleL.declare-tags tags (macro.export? metaV) (:coerce Type expressionV))) (wrap [])) #let [_ (log! (format "DEF " (%ident def-ident)))]] (wrap [])) diff --git a/new-luxc/source/luxc/lang/translation/js.lux b/new-luxc/source/luxc/lang/translation/js.lux index d38409b10..9fd2d098f 100644 --- a/new-luxc/source/luxc/lang/translation/js.lux +++ b/new-luxc/source/luxc/lang/translation/js.lux @@ -93,26 +93,26 @@ (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Nothing)) + (:coerce Nothing)) compiler) []]))) (def: #export (with-sub-context expr) (All [a] (-> (Meta a) (Meta [Text a]))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler)) + (let [old (:coerce Host (get@ #.host compiler)) [old-name old-sub] (get@ #context old) new-name (format old-name "$" (%i (.int old-sub)))] (case (expr (set@ #.host - (:! Nothing (set@ #context [new-name +0] old)) + (:coerce Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #context [old-name (inc old-sub)]) - (:! Nothing)) + (:coerce Nothing)) compiler') [new-name output]]) @@ -124,7 +124,7 @@ (function (_ compiler) (#e.Success [compiler (|> (get@ #.host compiler) - (:! Host) + (:coerce Host) (get@ #context) (let> [name sub] name))]))) @@ -132,15 +132,15 @@ (def: #export (with-anchor anchor expr) (All [a] (-> Anchor (Meta a) (Meta a))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler))] + (let [old (:coerce Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Nothing (set@ #anchor (#.Some anchor) old)) + (:coerce Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #anchor (get@ #anchor old)) - (:! Nothing)) + (:coerce Nothing)) compiler') output]) @@ -150,7 +150,7 @@ (def: #export anchor (Meta Anchor) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #anchor)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #anchor)) (#.Some anchor) (#e.Success [compiler anchor]) @@ -160,7 +160,7 @@ (def: #export module-buffer (Meta StringBuilder) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #module-buffer)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #module-buffer)) #.None ((lang.throw No-Active-Module-Buffer "") compiler) @@ -170,14 +170,14 @@ (def: #export program-buffer (Meta StringBuilder) (function (_ compiler) - (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))]))) + (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) (def: (execute code) (-> Expression (Meta Any)) (function (_ compiler) (case (|> compiler (get@ #.host) - (:! Host) + (:coerce Host) (get@ #interpreter) (ScriptEngine::eval [code])) (#e.Error error) @@ -193,7 +193,7 @@ (AbstractJSObject (isFunction) boolean true) (AbstractJSObject (call [args (Array Object)]) Object - (Object::toString [] (:! Object js-object))) + (Object::toString [] (:coerce Object js-object))) )) (def: (::slice js-object value) @@ -203,10 +203,10 @@ (AbstractJSObject (isFunction) boolean true) (AbstractJSObject (call [args (Array Object)]) Object - (:! Object - (js-object (Arrays::copyOfRange [value - (|> args (array.read +0) maybe.assume (:! Int)) - (.int (array.size value))])))) + (:coerce Object + (js-object (Arrays::copyOfRange [value + (|> args (array.read +0) maybe.assume (:coerce Int)) + (.int (array.size value))])))) )) (def: #export int-high-field Text "H") @@ -218,7 +218,7 @@ (def: jvm-int (-> Nat Integer) - (|>> (:! Long) (Long::intValue []))) + (|>> (:coerce Long) (Long::intValue []))) (def: low-mask Nat @@ -238,7 +238,7 @@ [] ## Methods (IntValue (getValue) Long - (:! Long value)) + (:coerce Long value)) (AbstractJSObject (getMember [member String]) Object (cond (text/= int-high-field member) (|> value .nat high jvm-int) @@ -262,13 +262,13 @@ [] ## Methods (StructureValue (getValue) (Array Object) - (:! (Array Object) value)) + (:coerce (Array Object) value)) (AbstractJSObject (isArray) boolean true) (AbstractJSObject (getMember [member String]) Object (cond (text/= "toString" member) - (:! Object - (::toString value)) + (:coerce Object + (::toString value)) (text/= "length" member) (jvm-int (array.size value)) @@ -276,32 +276,32 @@ (text/= "slice" member) (let [js-object (: (-> Object JSObject) (|>> (cond> [(host.instance? (Array Object))] - [(:! (Array Object)) js-structure] + [(:coerce (Array Object)) js-structure] [(host.instance? Long)] - [(:! Int) js-int] + [(:coerce Int) js-int] ## else - [(:! JSObject)])))] - (:! Object - (::slice js-object value))) + [(:coerce JSObject)])))] + (:coerce Object + (::slice js-object value))) ## else - (error! (ex.construct Unknown-Member (format " member = " (:! Text member) "\n" - "object(structure) = " (Object::toString [] (:! Object value)) "\n"))))) + (error! (ex.construct Unknown-Member (format " member = " (:coerce Text member) "\n" + "object(structure) = " (Object::toString [] (:coerce Object value)) "\n"))))) (AbstractJSObject (getSlot [idx int]) Object (|> value - (array.read (|> idx (Integer::longValue []) (:! Nat))) + (array.read (|> idx (Integer::longValue []) (:coerce Nat))) maybe.assume (cond> [(host.instance? (Array Object))] - [(:! (Array Object)) js-structure] + [(:coerce (Array Object)) js-structure] [(host.instance? Long)] - [(:! Int) js-int] + [(:coerce Int) js-int] ## else - [(:! JSObject)]) - (:! Object))) + [(:coerce JSObject)]) + (:coerce Object))) )) (def: #export unit Text "") @@ -320,7 +320,7 @@ (-> JS (Meta Any)) (do macro.Monad [module-buffer module-buffer - #let [_ (Appendable::append [(:! CharSequence code)] + #let [_ (Appendable::append [(:coerce CharSequence code)] module-buffer)]] (execute code))) @@ -335,7 +335,7 @@ module-buffer module-buffer program-buffer program-buffer #let [module-code (StringBuilder::toString [] module-buffer) - _ (Appendable::append [(:! CharSequence (format module-code "\n"))] + _ (Appendable::append [(:coerce CharSequence (format module-code "\n"))] program-buffer)]] (wrap (ioC.write target (format (module-name module) "/" module-js-name) diff --git a/new-luxc/source/luxc/lang/translation/js/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/js/eval.jvm.lux index 94136f356..8019ded53 100644 --- a/new-luxc/source/luxc/lang/translation/js/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/eval.jvm.lux @@ -61,13 +61,13 @@ (^multi [(#.Some high) (#.Some low)] (and (host.instance? Number high) (host.instance? Number low)) - [[(Number::longValue [] (:! Number high)) - (Number::longValue [] (:! Number low))] + [[(Number::longValue [] (:coerce Number high)) + (Number::longValue [] (:coerce Number low))] [high low]]) - (#.Some (.int (n/+ (|> high (:! Nat) (bit.left-shift +32)) - (if (i/< 0 (:! Int low)) - (|> low (:! Nat) (bit.left-shift +32) (bit.logical-right-shift +32)) - (|> low (:! Nat)))))) + (#.Some (.int (n/+ (|> high (:coerce Nat) (bit.left-shift +32)) + (if (i/< 0 (:coerce Int low)) + (|> low (:coerce Nat) (bit.left-shift +32) (bit.logical-right-shift +32)) + (|> low (:coerce Nat)))))) _ #.None)) @@ -79,7 +79,7 @@ (JSObject::getMember [//.variant-value-field] js-object)] (^multi [(#.Some tag) ?flag (#.Some value)] (host.instance? Number tag) - [[(Number::intValue [] (:! Number tag)) + [[(Number::intValue [] (:coerce Number tag)) (lux-object value)] [tag (#.Some value)]]) (#.Some [tag (maybe.default (host.null) ?flag) value]) @@ -101,7 +101,7 @@ (#.Some member) (case (lux-object member) (#e.Success parsed-member) - (recur num-keys (inc idx) (array.write idx (:! Object parsed-member) output)) + (recur num-keys (inc idx) (array.write idx (:coerce Object parsed-member) output)) (#e.Error error) #.None) @@ -117,24 +117,24 @@ (ex.throw Null-Has-No-Lux-Representation "") (host.instance? Integer js-object) - (ex.return (Integer::longValue [] (:! Integer js-object))) + (ex.return (Integer::longValue [] (:coerce Integer js-object))) (or (host.instance? java/lang/Boolean js-object) (host.instance? java/lang/String js-object)) (ex.return js-object) (host.instance? Number js-object) - (ex.return (Number::doubleValue [] (:! Number js-object))) + (ex.return (Number::doubleValue [] (:coerce Number js-object))) (~~ (do-template [ ] [(host.instance? js-object) - (ex.return ( [] (:! js-object)))] + (ex.return ( [] (:coerce js-object)))] [StructureValue StructureValue::getValue] [IntValue IntValue::getValue])) (host.instance? ScriptObjectMirror js-object) - (let [js-object (:! ScriptObjectMirror js-object)] + (let [js-object (:coerce ScriptObjectMirror js-object)] (case (int js-object) (#.Some value) (ex.return value) @@ -154,17 +154,17 @@ ## js-object ## else - (ex.throw Unknown-Kind-Of-JS-Object (Object::toString [] (:! Object js-object))))))) + (ex.throw Unknown-Kind-Of-JS-Object (Object::toString [] (:coerce Object js-object))))))) ## else - (ex.throw Unknown-Kind-Of-JS-Object (Object::toString [] (:! Object js-object)))))) + (ex.throw Unknown-Kind-Of-JS-Object (Object::toString [] (:coerce Object js-object)))))) (def: #export (eval code) (-> Expression (Meta Any)) (function (_ compiler) (case (|> compiler (get@ #.host) - (:! //.Host) + (:coerce //.Host) (get@ #//.interpreter) (ScriptEngine::eval [code])) (#e.Error error) diff --git a/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux index 305f46adf..5fedc9a9e 100644 --- a/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux @@ -31,7 +31,7 @@ (def: deg-to-nat (-> Deg Nat) - (|>> (:! Nat))) + (|>> (:coerce Nat))) (def: #export translate-deg (-> Deg (Meta Expression)) diff --git a/new-luxc/source/luxc/lang/translation/js/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/js/statement.jvm.lux index 849ae76c2..317193691 100644 --- a/new-luxc/source/luxc/lang/translation/js/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/statement.jvm.lux @@ -33,7 +33,7 @@ (wrap []) tags - (moduleL.declare-tags tags (macro.export? metaV) (:! Type expressionV))) + (moduleL.declare-tags tags (macro.export? metaV) (:coerce Type expressionV))) (wrap [])) #let [_ (log! (format "DEF " (%ident def-ident)))]] (wrap [])) diff --git a/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux index 28560854d..f5d288827 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux @@ -86,9 +86,9 @@ ($i.long (|> value )) $i.LCMP ($i.IFNE @else)))) - ([#.Nat (:! Int)] + ([#.Nat (:coerce Int)] [#.Int (: Int)] - [#.Deg (:! Int)]) + [#.Deg (:coerce Int)]) [_ (#.Frac value)] (macro/wrap (|>> peekI diff --git a/new-luxc/source/luxc/lang/translation/jvm/common.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/common.jvm.lux index b678677ce..2f35bad7c 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/common.jvm.lux @@ -65,17 +65,17 @@ (All [a] (-> (Meta a) (Meta [Artifacts a]))) (function (_ compiler) (case (action (update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #artifacts (dict.new text.Hash)) - (:! Nothing)) + (:coerce Nothing)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) - (set@ #artifacts (|> (get@ #.host compiler) (:! Host) (get@ #artifacts))) - (:! Nothing)) + (|>> (:coerce Host) + (set@ #artifacts (|> (get@ #.host compiler) (:coerce Host) (get@ #artifacts))) + (:coerce Nothing)) compiler') - [(|> compiler' (get@ #.host) (:! Host) (get@ #artifacts)) + [(|> compiler' (get@ #.host) (:coerce Host) (get@ #artifacts)) output]]) (#e.Error error) @@ -84,12 +84,12 @@ (def: #export (record-artifact name content) (-> Text Blob (Meta Any)) (function (_ compiler) - (if (|> compiler (get@ #.host) (:! Host) (get@ #artifacts) (dict.contains? name)) + (if (|> compiler (get@ #.host) (:coerce Host) (get@ #artifacts) (dict.contains? name)) (ex.throw Cannot-Overwrite-Artifact name) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (update@ #artifacts (dict.put name content)) - (:! Nothing)) + (:coerce Nothing)) compiler) []])))) @@ -97,7 +97,7 @@ (-> Text Bytecode (Meta Any)) (function (_ compiler) (let [store (|> (get@ #.host compiler) - (:! Host) + (:coerce Host) (get@ #store))] (if (dict.contains? name (|> store atom.read io.run)) (ex.throw Class-Already-Stored name) @@ -107,7 +107,7 @@ (def: #export (load-class name) (-> Text (Meta (Class Object))) (function (_ compiler) - (let [host (:! Host (get@ #.host compiler)) + (let [host (:coerce Host (get@ #.host compiler)) store (|> host (get@ #store) atom.read io.run)] (if (dict.contains? name store) (#e.Success [compiler (ClassLoader::loadClass [name] (get@ #loader host))]) diff --git a/new-luxc/source/luxc/lang/translation/jvm/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/statement.jvm.lux index 4c52231f3..07c85e58c 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/statement.jvm.lux @@ -87,7 +87,7 @@ (wrap []) tags - (&module.declare-tags tags (macro.export? metaV) (:! Type valueV))) + (&module.declare-tags tags (macro.export? metaV) (:coerce Type valueV))) (wrap [])) #let [_ (log! (format "DEF " (%ident def-ident)))]] (commonT.record-artifact (format bytecode-name ".class") bytecode))))) diff --git a/new-luxc/source/luxc/lang/translation/lua.lux b/new-luxc/source/luxc/lang/translation/lua.lux index d09746351..307b6a181 100644 --- a/new-luxc/source/luxc/lang/translation/lua.lux +++ b/new-luxc/source/luxc/lang/translation/lua.lux @@ -96,7 +96,7 @@ (function (_ code) (let [lua-function (ChunkLoader::loadTextChunk [variable "lux compilation" code] loader)] - ("lux try" (io (DirectCallExecutor::call [state-context (:! Object lua-function) (array.new +0)] + ("lux try" (io (DirectCallExecutor::call [state-context (:coerce Object lua-function) (array.new +0)] executor)))))) #module-buffer #.None #program-buffer (StringBuilder::new [])})) @@ -107,26 +107,26 @@ (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Nothing)) + (:coerce Nothing)) compiler) []]))) (def: #export (with-sub-context expr) (All [a] (-> (Meta a) (Meta [Text a]))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler)) + (let [old (:coerce Host (get@ #.host compiler)) [old-name old-sub] (get@ #context old) new-name (format old-name "___" (%i (.int old-sub)))] (case (expr (set@ #.host - (:! Nothing (set@ #context [new-name +0] old)) + (:coerce Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #context [old-name (inc old-sub)]) - (:! Nothing)) + (:coerce Nothing)) compiler') [new-name output]]) @@ -138,7 +138,7 @@ (function (_ compiler) (#e.Success [compiler (|> (get@ #.host compiler) - (:! Host) + (:coerce Host) (get@ #context) (let> [name sub] name))]))) @@ -146,15 +146,15 @@ (def: #export (with-anchor anchor expr) (All [a] (-> Anchor (Meta a) (Meta a))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler))] + (let [old (:coerce Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Nothing (set@ #anchor (#.Some anchor) old)) + (:coerce Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #anchor (get@ #anchor old)) - (:! Nothing)) + (:coerce Nothing)) compiler') output]) @@ -164,7 +164,7 @@ (def: #export anchor (Meta Anchor) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #anchor)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #anchor)) (#.Some anchor) (#e.Success [compiler anchor]) @@ -174,7 +174,7 @@ (def: #export module-buffer (Meta StringBuilder) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #module-buffer)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #module-buffer)) #.None ((lang.throw No-Active-Module-Buffer "") compiler) @@ -184,12 +184,12 @@ (def: #export program-buffer (Meta StringBuilder) (function (_ compiler) - (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))]))) + (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) (def: (execute code) (-> Expression (Meta Any)) (function (_ compiler) - (let [interpreter (|> compiler (get@ #.host) (:! Host) (get@ #interpreter))] + (let [interpreter (|> compiler (get@ #.host) (:coerce Host) (get@ #interpreter))] (case (interpreter code) (#e.Error error) ((lang.throw Cannot-Execute error) compiler) @@ -211,7 +211,7 @@ (-> Lua (Meta Any)) (do macro.Monad [module-buffer module-buffer - #let [_ (Appendable::append [(:! CharSequence code)] + #let [_ (Appendable::append [(:coerce CharSequence code)] module-buffer)]] (execute code))) @@ -222,7 +222,7 @@ module-buffer module-buffer program-buffer program-buffer #let [module-code (StringBuilder::toString [] module-buffer) - _ (Appendable::append [(:! CharSequence (format module-code "\n"))] + _ (Appendable::append [(:coerce CharSequence (format module-code "\n"))] program-buffer)]] (wrap (ioC.write target (format (lang.normalize-name module) "/" lua-module-name) diff --git a/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux index ed084b44d..a72bf0011 100644 --- a/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux @@ -38,7 +38,7 @@ (let [method (if tail? runtimeT.product//right runtimeT.product//left)] - (method source (lua.int (:! Int idx))))) + (method source (lua.int (:coerce Int idx))))) valueO path)))) @@ -102,22 +102,22 @@ [_ ( value)] (meta/wrap (lua.when! (lua.not (lua.= (|> value ) cursor-top)) (lua.return! pm-error)))) - ([#.Nat (<| lua.int (:! Int))] + ([#.Nat (<| lua.int (:coerce Int))] [#.Int lua.int] - [#.Deg (<| lua.int (:! Int))] + [#.Deg (<| lua.int (:coerce Int))] [#.Bool lua.bool] [#.Frac lua.float] [#.Text lua.string]) (^template [ ] (^code ( (~ [_ (#.Nat idx)]))) - (meta/wrap (push-cursor! ( cursor-top (lua.int (:! Int idx)))))) + (meta/wrap (push-cursor! ( cursor-top (lua.int (:coerce Int idx)))))) (["lux case tuple left" runtimeT.product//left] ["lux case tuple right" runtimeT.product//right]) (^template [ ] (^code ( (~ [_ (#.Nat idx)]))) - (meta/wrap (lua.block! (list (lua.set! "temp" (runtimeT.sum//get cursor-top (lua.int (:! Int idx)) )) + (meta/wrap (lua.block! (list (lua.set! "temp" (runtimeT.sum//get cursor-top (lua.int (:coerce Int idx)) )) (lua.if! (lua.= lua.nil "temp") (lua.return! pm-error) (push-cursor! "temp")))))) diff --git a/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux index 0e413e7ad..0330f79c2 100644 --- a/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux @@ -45,7 +45,7 @@ (^multi [(#.Some tag) ?flag (#.Some value)] [(lux-object value) (#.Some value)]) - (#.Some [(Long::intValue [] (:! Long tag)) + (#.Some [(Long::intValue [] (:coerce Long tag)) (: Any (case ?flag (#.Some _) "" #.None (host.null))) value]) @@ -54,17 +54,17 @@ (def: (array lux-object host-object) (-> (-> Object (Error Any)) DefaultTable (Maybe (Array Object))) - (let [init-num-keys (:! Nat (Table::rawlen [] host-object))] + (let [init-num-keys (:coerce Nat (Table::rawlen [] host-object))] (loop [num-keys init-num-keys idx +0 output (: (Array Object) (array.new init-num-keys))] (if (n/< num-keys idx) - (case (Table::get-idx (:! Long (inc idx)) host-object) + (case (Table::get-idx (:coerce Long (inc idx)) host-object) (#.Some member) (case (lux-object member) (#e.Success parsed-member) - (recur num-keys (inc idx) (array.write idx (:! Object parsed-member) output)) + (recur num-keys (inc idx) (array.write idx (:coerce Object parsed-member) output)) (#e.Error error) #.None) @@ -85,10 +85,10 @@ (ex.return host-object) (host.instance? ByteString host-object) - (ex.return (ByteString::decode [] (:! ByteString host-object))) + (ex.return (ByteString::decode [] (:coerce ByteString host-object))) (host.instance? DefaultTable host-object) - (let [host-object (:! DefaultTable host-object)] + (let [host-object (:coerce DefaultTable host-object)] (case (variant lux-object host-object) (#.Some value) (ex.return value) @@ -99,23 +99,23 @@ (ex.return value) #.None - (ex.throw Unknown-Kind-Of-Host-Object (format "SECOND " (Object::toString [] (:! Object host-object))))))) + (ex.throw Unknown-Kind-Of-Host-Object (format "SECOND " (Object::toString [] (:coerce Object host-object))))))) ## else - (ex.throw Unknown-Kind-Of-Host-Object (format "FIRST " (Object::toString [] (:! Object host-object)))) + (ex.throw Unknown-Kind-Of-Host-Object (format "FIRST " (Object::toString [] (:coerce Object host-object)))) )) (def: #export (eval code) (-> Expression (Meta Any)) (function (_ compiler) - (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] + (let [interpreter (|> compiler (get@ #.host) (:coerce //.Host) (get@ #//.interpreter))] (case (interpreter (format "return " code ";")) (#e.Error error) ((lang.throw Cannot-Evaluate error) compiler) (#e.Success output) (case (lux-object (|> output - (:! (Array Object)) + (:coerce (Array Object)) (array.read +0) maybe.assume)) (#e.Success parsed-output) diff --git a/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux index c322e5005..5769f6890 100644 --- a/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux @@ -16,11 +16,11 @@ (def: #export translate-nat (-> Nat (Meta Expression)) - (|>> (:! Int) %i meta/wrap)) + (|>> (:coerce Int) %i meta/wrap)) (def: #export translate-deg (-> Deg (Meta Expression)) - (|>> (:! Int) %i meta/wrap)) + (|>> (:coerce Int) %i meta/wrap)) (def: #export translate-frac (-> Frac (Meta Expression)) diff --git a/new-luxc/source/luxc/lang/translation/lua/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/statement.jvm.lux index 3a438ae65..8ff9c1ccd 100644 --- a/new-luxc/source/luxc/lang/translation/lua/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/statement.jvm.lux @@ -34,7 +34,7 @@ (wrap []) tags - (moduleL.declare-tags tags (macro.export? metaV) (:! Type expressionV))) + (moduleL.declare-tags tags (macro.export? metaV) (:coerce Type expressionV))) (wrap [])) #let [_ (log! (format "DEF " (%ident def-ident)))]] (wrap [])) diff --git a/new-luxc/source/luxc/lang/translation/php.lux b/new-luxc/source/luxc/lang/translation/php.lux index 8ee0f9c14..fe4e6095c 100644 --- a/new-luxc/source/luxc/lang/translation/php.lux +++ b/new-luxc/source/luxc/lang/translation/php.lux @@ -80,26 +80,26 @@ (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Nothing)) + (:coerce Nothing)) compiler) []]))) (def: #export (with-sub-context expr) (All [a] (-> (Meta a) (Meta [Text a]))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler)) + (let [old (:coerce Host (get@ #.host compiler)) [old-name old-sub] (get@ #context old) new-name (format old-name "___" (%i (.int old-sub)))] (case (expr (set@ #.host - (:! Nothing (set@ #context [new-name +0] old)) + (:coerce Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #context [old-name (inc old-sub)]) - (:! Nothing)) + (:coerce Nothing)) compiler') [new-name output]]) @@ -111,7 +111,7 @@ (function (_ compiler) (#e.Success [compiler (|> (get@ #.host compiler) - (:! Host) + (:coerce Host) (get@ #context) (let> [name sub] name))]))) @@ -119,15 +119,15 @@ (def: #export (with-anchor anchor expr) (All [a] (-> Anchor (Meta a) (Meta a))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler))] + (let [old (:coerce Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Nothing (set@ #anchor (#.Some anchor) old)) + (:coerce Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #anchor (get@ #anchor old)) - (:! Nothing)) + (:coerce Nothing)) compiler') output]) @@ -137,7 +137,7 @@ (def: #export anchor (Meta Anchor) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #anchor)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #anchor)) (#.Some anchor) (#e.Success [compiler anchor]) @@ -147,7 +147,7 @@ (def: #export module-buffer (Meta StringBuilder) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #module-buffer)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #module-buffer)) #.None ((lang.throw No-Active-Module-Buffer "") compiler) @@ -157,13 +157,13 @@ (def: #export program-buffer (Meta StringBuilder) (function (_ compiler) - (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))]))) + (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) (do-template [ ] [(def: ( code) (-> (Meta )) (function (_ compiler) - (let [runner (|> compiler (get@ #.host) (:! Host) (get@ ))] + (let [runner (|> compiler (get@ #.host) (:coerce Host) (get@ ))] (case (runner code) (#e.Error error) ((lang.throw Cannot-Execute error) compiler) @@ -189,7 +189,7 @@ (-> Statement (Meta Any)) (do macro.Monad [module-buffer module-buffer - #let [_ (Appendable::append [(:! CharSequence (_.code code))] + #let [_ (Appendable::append [(:coerce CharSequence (_.code code))] module-buffer)]] (load! code))) @@ -200,7 +200,7 @@ module-buffer module-buffer program-buffer program-buffer #let [module-code (StringBuilder::toString [] module-buffer) - _ (Appendable::append [(:! CharSequence (format module-code "\n"))] + _ (Appendable::append [(:coerce CharSequence (format module-code "\n"))] program-buffer)]] (wrap (ioC.write target (format (lang.normalize-name module) "/" ..module-name) diff --git a/new-luxc/source/luxc/lang/translation/php/case.jvm.lux b/new-luxc/source/luxc/lang/translation/php/case.jvm.lux index 3a5eff053..6f78637cf 100644 --- a/new-luxc/source/luxc/lang/translation/php/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/case.jvm.lux @@ -39,7 +39,7 @@ (let [method (if tail? runtimeT.product//right runtimeT.product//left)] - (method source (_.int (:! Int idx))))) + (method source (_.int (:coerce Int idx))))) valueO pathP)))) @@ -114,22 +114,22 @@ [_ ( value)] (meta/wrap (_.when! (_.not (_.= (|> value ) cursor-top)) fail-pm!))) - ([#.Nat (<| _.int (:! Int))] + ([#.Nat (<| _.int (:coerce Int))] [#.Int _.int] - [#.Deg (<| _.int (:! Int))] + [#.Deg (<| _.int (:coerce Int))] [#.Bool _.bool] [#.Frac _.float] [#.Text _.string]) (^template [ ] (^code ( (~ [_ (#.Nat idx)]))) - (meta/wrap (push-cursor! ( cursor-top (_.int (:! Int idx)))))) + (meta/wrap (push-cursor! ( cursor-top (_.int (:coerce Int idx)))))) (["lux case tuple left" runtimeT.product//left] ["lux case tuple right" runtimeT.product//right]) (^template [ ] (^code ( (~ [_ (#.Nat idx)]))) - (meta/wrap (|> (_.set! @temp (runtimeT.sum//get cursor-top (_.int (:! Int idx)) )) + (meta/wrap (|> (_.set! @temp (runtimeT.sum//get cursor-top (_.int (:coerce Int idx)) )) (_.then! (_.if! (_.is-null/1 @temp) fail-pm! (push-cursor! @temp)))))) diff --git a/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux index 54ec6abc2..4b954c4f1 100644 --- a/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux @@ -29,8 +29,8 @@ (intValue [] Integer)) (exception: #export (Unknown-Kind-Of-Host-Object {host-object Object}) - (let [object-class (:! Text (Object::toString [] (Object::getClass [] (:! Object host-object)))) - text-representation (:! Text (Object::toString [] (:! Object host-object)))] + (let [object-class (:coerce Text (Object::toString [] (Object::getClass [] (:coerce Object host-object)))) + text-representation (:coerce Text (Object::toString [] (:coerce Object host-object)))] (format object-class " --- " text-representation))) (host.import php/runtime/Memory) @@ -63,18 +63,18 @@ (-> (-> Object (Error Any)) ArrayMemory (Error Any)) (let [size (ArrayMemory::size [] host-object)] (loop [idx 0 - output (: (Array Any) (array.new (:! Nat size)))] + output (: (Array Any) (array.new (:coerce Nat size)))] (if (i/< size idx) (let [value (|> host-object (ArrayMemory::get [(LongMemory::new [idx])]) - (:! ReferenceMemory) (ReferenceMemory::getValue []))] + (:coerce ReferenceMemory) (ReferenceMemory::getValue []))] (if (host.instance? php/runtime/memory/NullMemory value) (recur (inc idx) - (array.write (:! Nat idx) (host.null) output)) + (array.write (:coerce Nat idx) (host.null) output)) (do e.Monad [lux-value (lux-object value)] (recur (inc idx) - (array.write (:! Nat idx) lux-value output))))) + (array.write (:coerce Nat idx) lux-value output))))) (ex.return output))))) (def: (variant lux-object host-object) @@ -83,11 +83,11 @@ [variant-tag (lux-object (ArrayMemory::get [(StringMemory::new [//.variant-tag-field])] host-object)) variant-value (lux-object (ArrayMemory::get [(StringMemory::new [//.variant-value-field])] host-object))] (wrap (: Any - [(Long::intValue [] (:! Long variant-tag)) + [(Long::intValue [] (:coerce Long variant-tag)) (: Any (if (|> host-object (ArrayMemory::get [(StringMemory::new [//.variant-flag-field])]) - (:! ReferenceMemory) + (:coerce ReferenceMemory) (ReferenceMemory::getValue []) (host.instance? php/runtime/memory/NullMemory)) (host.null) @@ -103,21 +103,21 @@ (ex.return true) (host.instance? php/runtime/memory/LongMemory host-object) - (ex.return (LongMemory::toLong [] (:! LongMemory host-object))) + (ex.return (LongMemory::toLong [] (:coerce LongMemory host-object))) (host.instance? php/runtime/memory/DoubleMemory host-object) - (ex.return (DoubleMemory::toDouble [] (:! DoubleMemory host-object))) + (ex.return (DoubleMemory::toDouble [] (:coerce DoubleMemory host-object))) (host.instance? php/runtime/memory/StringMemory host-object) - (ex.return (StringMemory::toString [] (:! StringMemory host-object))) + (ex.return (StringMemory::toString [] (:coerce StringMemory host-object))) (host.instance? php/runtime/memory/ReferenceMemory host-object) - (lux-object (ReferenceMemory::getValue [] (:! ReferenceMemory host-object))) + (lux-object (ReferenceMemory::getValue [] (:coerce ReferenceMemory host-object))) (host.instance? php/runtime/memory/ArrayMemory host-object) - (if (ArrayMemory::isMap [] (:! ArrayMemory host-object)) - (variant lux-object (:! ArrayMemory host-object)) - (tuple lux-object (:! ArrayMemory host-object))) + (if (ArrayMemory::isMap [] (:coerce ArrayMemory host-object)) + (variant lux-object (:coerce ArrayMemory host-object)) + (tuple lux-object (:coerce ArrayMemory host-object))) ## else (ex.throw Unknown-Kind-Of-Host-Object host-object))) @@ -125,7 +125,7 @@ (def: #export (eval code) (-> Expression (Meta Any)) (function (_ compiler) - (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] + (let [interpreter (|> compiler (get@ #.host) (:coerce //.Host) (get@ #//.interpreter))] (case (interpreter code) (#e.Error error) ((lang.throw Cannot-Evaluate error) compiler) diff --git a/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux index 43497c93e..cd67be0f0 100644 --- a/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux @@ -37,9 +37,9 @@ [_ ( value)] (|> value )) ([#.Bool primitiveT.translate-bool] - [#.Nat (<| primitiveT.translate-int (:! Int))] + [#.Nat (<| primitiveT.translate-int (:coerce Int))] [#.Int primitiveT.translate-int] - [#.Deg (<| primitiveT.translate-int (:! Int))] + [#.Deg (<| primitiveT.translate-int (:coerce Int))] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) diff --git a/new-luxc/source/luxc/lang/translation/php/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/php/reference.jvm.lux index 9146684e4..4364d87ea 100644 --- a/new-luxc/source/luxc/lang/translation/php/reference.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/reference.jvm.lux @@ -12,7 +12,7 @@ (do-template [ ] [(def: #export (-> Register Var) - (|>> (:! Int) %i (format ) _.var))] + (|>> (:coerce Int) %i (format ) _.var))] [closure "c"] [variable "v"]) @@ -21,7 +21,7 @@ (-> Variable Var) (if (variableL.captured? var) (closure (variableL.captured-register var)) - (variable (:! Nat var)))) + (variable (:coerce Nat var)))) (def: #export global (-> Ident Var) diff --git a/new-luxc/source/luxc/lang/translation/php/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/php/statement.jvm.lux index a20e164ca..70a39a575 100644 --- a/new-luxc/source/luxc/lang/translation/php/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/statement.jvm.lux @@ -34,7 +34,7 @@ (wrap []) tags - (moduleL.declare-tags tags (macro.export? metaV) (:! Type expressionV))) + (moduleL.declare-tags tags (macro.export? metaV) (:coerce Type expressionV))) (wrap [])) #let [_ (log! (format "DEF " (%ident def-ident)))]] (wrap [])) diff --git a/new-luxc/source/luxc/lang/translation/python.lux b/new-luxc/source/luxc/lang/translation/python.lux index 3dde69d2a..8dac22fca 100644 --- a/new-luxc/source/luxc/lang/translation/python.lux +++ b/new-luxc/source/luxc/lang/translation/python.lux @@ -77,26 +77,26 @@ (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Nothing)) + (:coerce Nothing)) compiler) []]))) (def: #export (with-sub-context expr) (All [a] (-> (Meta a) (Meta [Text a]))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler)) + (let [old (:coerce Host (get@ #.host compiler)) [old-name old-sub] (get@ #context old) new-name (format old-name "___" (%i (.int old-sub)))] (case (expr (set@ #.host - (:! Nothing (set@ #context [new-name +0] old)) + (:coerce Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #context [old-name (inc old-sub)]) - (:! Nothing)) + (:coerce Nothing)) compiler') [new-name output]]) @@ -108,7 +108,7 @@ (function (_ compiler) (#e.Success [compiler (|> (get@ #.host compiler) - (:! Host) + (:coerce Host) (get@ #context) (let> [name sub] name))]))) @@ -116,15 +116,15 @@ (def: #export (with-anchor anchor expr) (All [a] (-> Anchor (Meta a) (Meta a))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler))] + (let [old (:coerce Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Nothing (set@ #anchor (#.Some anchor) old)) + (:coerce Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #anchor (get@ #anchor old)) - (:! Nothing)) + (:coerce Nothing)) compiler') output]) @@ -134,7 +134,7 @@ (def: #export anchor (Meta Anchor) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #anchor)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #anchor)) (#.Some anchor) (#e.Success [compiler anchor]) @@ -144,7 +144,7 @@ (def: #export module-buffer (Meta StringBuilder) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #module-buffer)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #module-buffer)) #.None ((lang.throw No-Active-Module-Buffer "") compiler) @@ -154,13 +154,13 @@ (def: #export program-buffer (Meta StringBuilder) (function (_ compiler) - (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))]))) + (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) (do-template [ ] [(def: ( code) (-> (Meta )) (function (_ compiler) - (let [runner (|> compiler (get@ #.host) (:! Host) (get@ ))] + (let [runner (|> compiler (get@ #.host) (:coerce Host) (get@ ))] (case (runner code) (#e.Error error) ((lang.throw Cannot-Execute error) compiler) @@ -187,7 +187,7 @@ (-> (Meta )) (do macro.Monad [module-buffer module-buffer - #let [_ (Appendable::append [(:! CharSequence ( code))] + #let [_ (Appendable::append [(:coerce CharSequence ( code))] module-buffer)]] ( code)))] @@ -202,7 +202,7 @@ module-buffer module-buffer program-buffer program-buffer #let [module-code (StringBuilder::toString [] module-buffer) - _ (Appendable::append [(:! CharSequence (format module-code "\n"))] + _ (Appendable::append [(:coerce CharSequence (format module-code "\n"))] program-buffer)]] (wrap (ioC.write target (format (lang.normalize-name module) "/" python-module-name) diff --git a/new-luxc/source/luxc/lang/translation/python/case.jvm.lux b/new-luxc/source/luxc/lang/translation/python/case.jvm.lux index f51acc402..aedf2a6e1 100644 --- a/new-luxc/source/luxc/lang/translation/python/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/case.jvm.lux @@ -38,7 +38,7 @@ (let [method (if tail? runtimeT.product//right runtimeT.product//left)] - (method source (python.int (:! Int idx))))) + (method source (python.int (:coerce Int idx))))) valueO pathP)))) @@ -115,23 +115,23 @@ [_ ( value)] (meta/wrap (python.when! (python.not (python.= (|> value ) cursor-top)) fail-pm!))) - ([#.Nat (<| python.int (:! Int))] + ([#.Nat (<| python.int (:coerce Int))] [#.Int python.int] - [#.Deg (<| python.int (:! Int))] + [#.Deg (<| python.int (:coerce Int))] [#.Bool python.bool] [#.Frac python.float] [#.Text python.string]) (^template [ ] (^code ( (~ [_ (#.Nat idx)]))) - (meta/wrap (push-cursor! ( cursor-top (python.int (:! Int idx)))))) + (meta/wrap (push-cursor! ( cursor-top (python.int (:coerce Int idx)))))) (["lux case tuple left" runtimeT.product//left] ["lux case tuple right" runtimeT.product//right]) (^template [ ] (^code ( (~ [_ (#.Nat idx)]))) (meta/wrap ($_ python.then! - (python.set! (list $temp) (runtimeT.sum//get cursor-top (python.int (:! Int idx)) )) + (python.set! (list $temp) (runtimeT.sum//get cursor-top (python.int (:coerce Int idx)) )) (python.if! (python.= python.none (@@ $temp)) fail-pm! (push-cursor! (@@ $temp)))))) diff --git a/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux index df1e7004c..88fdd3173 100644 --- a/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux @@ -46,11 +46,11 @@ (def: (tuple lux-object host-object) (-> (-> PyObject (Error Any)) PyObject (Error Any)) - (let [size (:! Nat (PyObject::__len__ [] host-object))] + (let [size (:coerce Nat (PyObject::__len__ [] host-object))] (loop [idx +0 - output (:! (Array Any) (array.new size))] + output (:coerce (Array Any) (array.new size))] (if (n/< size idx) - (case (PyObject::__getitem__ [(:! Int idx)] host-object) + (case (PyObject::__getitem__ [(:coerce Int idx)] host-object) (#e.Error error) (#e.Error error) @@ -65,7 +65,7 @@ (def: python-type (-> PyObject Text) - (|>> (PyObject::getType []) (PyType::getName []) (:! Text))) + (|>> (PyObject::getType []) (PyType::getName []) (:coerce Text))) (def: tag-field (PyString::new [//.variant-tag-field])) (def: flag-field (PyString::new [//.variant-flag-field])) @@ -84,9 +84,9 @@ (#e.Success tag)] [(lux-object value) (#e.Success value)]) - (#e.Success [(Long::intValue [] (:! Long tag)) + (#e.Success [(Long::intValue [] (:coerce Long tag)) (: Any - (case (python-type (:! PyObject flag)) + (case (python-type (:coerce PyObject flag)) "NoneType" (host.null) @@ -127,7 +127,7 @@ (def: #export (eval code) (-> Expression (Meta Any)) (function (_ compiler) - (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] + (let [interpreter (|> compiler (get@ #.host) (:coerce //.Host) (get@ #//.interpreter))] (case (interpreter code) (#e.Error error) (exec (log! (format "eval #e.Error\n" diff --git a/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux index 7b2ba1786..f1cf731a2 100644 --- a/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux @@ -13,11 +13,11 @@ (def: #export translate-nat (-> Nat (Meta Expression)) - (|>> (:! Int) python.int meta/wrap)) + (|>> (:coerce Int) python.int meta/wrap)) (def: #export translate-deg (-> Deg (Meta Expression)) - (|>> (:! Int) python.int meta/wrap)) + (|>> (:coerce Int) python.int meta/wrap)) (def: #export translate-frac (-> Frac (Meta Expression)) diff --git a/new-luxc/source/luxc/lang/translation/python/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/python/statement.jvm.lux index 23b51371c..c241afa8a 100644 --- a/new-luxc/source/luxc/lang/translation/python/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/statement.jvm.lux @@ -34,7 +34,7 @@ (wrap []) tags - (moduleL.declare-tags tags (macro.export? metaV) (:! Type expressionV))) + (moduleL.declare-tags tags (macro.export? metaV) (:coerce Type expressionV))) (wrap [])) #let [_ (log! (format "DEF " (%ident def-ident)))]] (wrap [])) diff --git a/new-luxc/source/luxc/lang/translation/r.lux b/new-luxc/source/luxc/lang/translation/r.lux index 4864cc286..e9c984636 100644 --- a/new-luxc/source/luxc/lang/translation/r.lux +++ b/new-luxc/source/luxc/lang/translation/r.lux @@ -74,7 +74,7 @@ #interpreter (function (_ code) (do e.Monad [output (ScriptEngine::eval [(r.expression code)] interpreter)] - (wrap (maybe.default (:! Object []) + (wrap (maybe.default (:coerce Object []) output)))) #module-buffer #.None #program-buffer (StringBuilder::new [])}))) @@ -85,26 +85,26 @@ (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Nothing)) + (:coerce Nothing)) compiler) []]))) (def: #export (with-sub-context expr) (All [a] (-> (Meta a) (Meta [Text a]))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler)) + (let [old (:coerce Host (get@ #.host compiler)) [old-name old-sub] (get@ #context old) new-name (format old-name "f___" (%i (.int old-sub)))] (case (expr (set@ #.host - (:! Nothing (set@ #context [new-name +0] old)) + (:coerce Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #context [old-name (inc old-sub)]) - (:! Nothing)) + (:coerce Nothing)) compiler') [new-name output]]) @@ -116,7 +116,7 @@ (function (_ compiler) (#e.Success [compiler (|> (get@ #.host compiler) - (:! Host) + (:coerce Host) (get@ #context) (let> [name sub] name))]))) @@ -124,15 +124,15 @@ (def: #export (with-anchor anchor expr) (All [a] (-> Anchor (Meta a) (Meta a))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler))] + (let [old (:coerce Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Nothing (set@ #anchor (#.Some anchor) old)) + (:coerce Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #anchor (get@ #anchor old)) - (:! Nothing)) + (:coerce Nothing)) compiler') output]) @@ -142,7 +142,7 @@ (def: #export anchor (Meta Anchor) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #anchor)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #anchor)) (#.Some anchor) (#e.Success [compiler anchor]) @@ -152,7 +152,7 @@ (def: #export module-buffer (Meta StringBuilder) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #module-buffer)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #module-buffer)) #.None ((lang.throw No-Active-Module-Buffer "") compiler) @@ -162,13 +162,13 @@ (def: #export program-buffer (Meta StringBuilder) (function (_ compiler) - (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))]))) + (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) (do-template [ ] [(def: ( code) (-> Expression (Meta )) (function (_ compiler) - (let [runner (|> compiler (get@ #.host) (:! Host) (get@ ))] + (let [runner (|> compiler (get@ #.host) (:coerce Host) (get@ ))] (case (runner code) (#e.Error error) ((lang.throw Cannot-Execute error) compiler) @@ -197,7 +197,7 @@ (-> Expression (Meta Any)) (do macro.Monad [module-buffer module-buffer - #let [_ (Appendable::append [(:! CharSequence (r.expression code))] + #let [_ (Appendable::append [(:coerce CharSequence (r.expression code))] module-buffer)]] (load! code))) @@ -210,7 +210,7 @@ module-buffer module-buffer program-buffer program-buffer #let [module-code (StringBuilder::toString [] module-buffer) - _ (Appendable::append [(:! CharSequence (format module-code "\n"))] + _ (Appendable::append [(:coerce CharSequence (format module-code "\n"))] program-buffer)]] (wrap (ioC.write target (format (lang.normalize-name module) "/" r-module-name) diff --git a/new-luxc/source/luxc/lang/translation/r/case.jvm.lux b/new-luxc/source/luxc/lang/translation/r/case.jvm.lux index 21d8f1def..3aa3d4a8a 100644 --- a/new-luxc/source/luxc/lang/translation/r/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/case.jvm.lux @@ -39,7 +39,7 @@ (let [method (if tail? runtimeT.product//right runtimeT.product//left)] - (method source (r.int (:! Int idx))))) + (method source (r.int (:coerce Int idx))))) valueO pathP)))) @@ -124,20 +124,20 @@ [_ ( value)] (meta/wrap (r.when (r.not (runtimeT.int//= (|> value ) cursor-top)) fail-pm!))) - ([#.Nat (<| runtimeT.int (:! Int))] + ([#.Nat (<| runtimeT.int (:coerce Int))] [#.Int runtimeT.int] - [#.Deg (<| runtimeT.int (:! Int))]) + [#.Deg (<| runtimeT.int (:coerce Int))]) (^template [ ] (^code ( (~ [_ (#.Nat idx)]))) - (meta/wrap (push-cursor! ( cursor-top (r.int (:! Int idx)))))) + (meta/wrap (push-cursor! ( cursor-top (r.int (:coerce Int idx)))))) (["lux case tuple left" runtimeT.product//left] ["lux case tuple right" runtimeT.product//right]) (^template [ ] (^code ( (~ [_ (#.Nat idx)]))) (meta/wrap ($_ r.then - (r.set! $temp (runtimeT.sum//get cursor-top (r.int (:! Int idx)) )) + (r.set! $temp (runtimeT.sum//get cursor-top (r.int (:coerce Int idx)) )) (r.if (r.= r.null (@@ $temp)) fail-pm! (push-cursor! (@@ $temp)))))) diff --git a/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux index e3a255e41..eb20d73c5 100644 --- a/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux @@ -51,21 +51,21 @@ (def: (parse-tuple lux-object host-object) (-> (-> Object (Error Any)) ListVector (Error Any)) - (let [size (:! Nat (ListVector::length [] host-object))] + (let [size (:coerce Nat (ListVector::length [] host-object))] (loop [idx +0 - output (:! (Array Any) (array.new size))] + output (:coerce (Array Any) (array.new size))] (if (n/< size idx) - (case (ListVector::getElementAsSEXP [(:! Int idx)] host-object) + (case (ListVector::getElementAsSEXP [(:coerce Int idx)] host-object) (#e.Error error) (#e.Error error) (#e.Success value) - (case (lux-object (:! Object value)) + (case (lux-object (:coerce Object value)) (#e.Error error) (#e.Error error) (#e.Success lux-value) - (recur (inc idx) (array.write idx (:! Any lux-value) output)))) + (recur (inc idx) (array.write idx (:coerce Any lux-value) output)))) (#e.Success output))))) (def: (parse-variant lux-object host-object) @@ -74,9 +74,9 @@ [tag (ListVector::get-field-sexp [//.variant-tag-field] host-object) flag (ListVector::get-field-sexp [//.variant-flag-field] host-object) value (ListVector::get-field-sexp [//.variant-value-field] host-object) - value (lux-object (:! Object value))] + value (lux-object (:coerce Object value))] (wrap [(|> tag - (:! IntArrayVector) + (:coerce IntArrayVector) (IntArrayVector::getElementAsInt [0]) (Long::intValue [])) (: Any @@ -90,35 +90,35 @@ (do e.Monad [high (ListVector::get-field-sexp [//.int-high-field] host-object) low (ListVector::get-field-sexp [//.int-low-field] host-object) - #let [get-int-32 (|>> (IntArrayVector::getElementAsInt [0]) (:! Nat)) - high (get-int-32 (:! IntArrayVector high)) - low (get-int-32 (:! IntArrayVector low))]] - (wrap (:! Int + #let [get-int-32 (|>> (IntArrayVector::getElementAsInt [0]) (:coerce Nat)) + high (get-int-32 (:coerce IntArrayVector high)) + low (get-int-32 (:coerce IntArrayVector low))]] + (wrap (:coerce Int (n/+ (|> high (bit.left-shift +32)) - (if (i/< 0 (:! Int low)) + (if (i/< 0 (:coerce Int low)) (|> low (bit.left-shift +32) (bit.logical-right-shift +32)) low)))))) (def: (lux-object host-object) (-> Object (Error Any)) (cond (host.instance? StringArrayVector host-object) - (#e.Success (StringArrayVector::getElementAsString [0] (:! StringArrayVector host-object))) + (#e.Success (StringArrayVector::getElementAsString [0] (:coerce StringArrayVector host-object))) (host.instance? LogicalArrayVector host-object) - (#e.Success (i/= 1 (LogicalArrayVector::getElementAsRawLogical [0] (:! LogicalArrayVector host-object)))) + (#e.Success (i/= 1 (LogicalArrayVector::getElementAsRawLogical [0] (:coerce LogicalArrayVector host-object)))) (host.instance? IntArrayVector host-object) - (#e.Success (IntArrayVector::getElementAsInt [0] (:! IntArrayVector host-object))) + (#e.Success (IntArrayVector::getElementAsInt [0] (:coerce IntArrayVector host-object))) (host.instance? DoubleArrayVector host-object) - (#e.Success (DoubleArrayVector::getElementAsDouble [0] (:! DoubleArrayVector host-object))) + (#e.Success (DoubleArrayVector::getElementAsDouble [0] (:coerce DoubleArrayVector host-object))) (host.instance? ListVector host-object) - (case (parse-int (:! ListVector host-object)) + (case (parse-int (:coerce ListVector host-object)) (#e.Error error) - (case (parse-variant lux-object (:! ListVector host-object)) + (case (parse-variant lux-object (:coerce ListVector host-object)) (#e.Error error) - (parse-tuple lux-object (:! ListVector host-object)) + (parse-tuple lux-object (:coerce ListVector host-object)) output output) @@ -127,14 +127,14 @@ output) ## else - (let [object-class (:! Text (Object::toString [] (Object::getClass [] (:! Object host-object)))) - text-representation (:! Text (Object::toString [] (:! Object host-object)))] + (let [object-class (:coerce Text (Object::toString [] (Object::getClass [] (:coerce Object host-object)))) + text-representation (:coerce Text (Object::toString [] (:coerce Object host-object)))] (ex.throw Unknown-Kind-Of-Host-Object (format object-class " --- " text-representation))))) (def: #export (eval code) (-> Expression (Meta Any)) (function (_ compiler) - (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] + (let [interpreter (|> compiler (get@ #.host) (:coerce //.Host) (get@ #//.interpreter))] (case (interpreter code) (#e.Error error) (exec (log! (format "eval #e.Error\n" diff --git a/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux index a6101f749..ad89f2e31 100644 --- a/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux @@ -15,11 +15,11 @@ (def: #export translate-nat (-> Nat (Meta Expression)) - (|>> (:! Int) runtimeT.int meta/wrap)) + (|>> (:coerce Int) runtimeT.int meta/wrap)) (def: #export translate-deg (-> Deg (Meta Expression)) - (|>> (:! Int) runtimeT.int meta/wrap)) + (|>> (:coerce Int) runtimeT.int meta/wrap)) (def: #export translate-frac (-> Frac (Meta Expression)) diff --git a/new-luxc/source/luxc/lang/translation/r/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/r/statement.jvm.lux index 62349abcf..e09410f40 100644 --- a/new-luxc/source/luxc/lang/translation/r/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/statement.jvm.lux @@ -34,7 +34,7 @@ (wrap []) tags - (moduleL.declare-tags tags (macro.export? metaV) (:! Type expressionV))) + (moduleL.declare-tags tags (macro.export? metaV) (:coerce Type expressionV))) (wrap [])) #let [_ (log! (format "DEF " (%ident def-ident)))]] (wrap [])) diff --git a/new-luxc/source/luxc/lang/translation/ruby.lux b/new-luxc/source/luxc/lang/translation/ruby.lux index 808d8105c..1ed9f30e1 100644 --- a/new-luxc/source/luxc/lang/translation/ruby.lux +++ b/new-luxc/source/luxc/lang/translation/ruby.lux @@ -71,26 +71,26 @@ (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Nothing)) + (:coerce Nothing)) compiler) []]))) (def: #export (with-sub-context expr) (All [a] (-> (Meta a) (Meta [Text a]))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler)) + (let [old (:coerce Host (get@ #.host compiler)) [old-name old-sub] (get@ #context old) new-name (format old-name "___" (%i (.int old-sub)))] (case (expr (set@ #.host - (:! Nothing (set@ #context [new-name +0] old)) + (:coerce Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #context [old-name (inc old-sub)]) - (:! Nothing)) + (:coerce Nothing)) compiler') [new-name output]]) @@ -102,7 +102,7 @@ (function (_ compiler) (#e.Success [compiler (|> (get@ #.host compiler) - (:! Host) + (:coerce Host) (get@ #context) (let> [name sub] name))]))) @@ -110,15 +110,15 @@ (def: #export (with-anchor anchor expr) (All [a] (-> Anchor (Meta a) (Meta a))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler))] + (let [old (:coerce Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Nothing (set@ #anchor (#.Some anchor) old)) + (:coerce Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #anchor (get@ #anchor old)) - (:! Nothing)) + (:coerce Nothing)) compiler') output]) @@ -128,7 +128,7 @@ (def: #export anchor (Meta Anchor) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #anchor)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #anchor)) (#.Some anchor) (#e.Success [compiler anchor]) @@ -138,7 +138,7 @@ (def: #export module-buffer (Meta StringBuilder) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #module-buffer)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #module-buffer)) #.None ((lang.throw No-Active-Module-Buffer "") compiler) @@ -148,12 +148,12 @@ (def: #export program-buffer (Meta StringBuilder) (function (_ compiler) - (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))]))) + (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) (def: (execute code) (-> Expression (Meta Any)) (function (_ compiler) - (let [interpreter (|> compiler (get@ #.host) (:! Host) (get@ #interpreter))] + (let [interpreter (|> compiler (get@ #.host) (:coerce Host) (get@ #interpreter))] (case (interpreter code) (#e.Error error) ((lang.throw Cannot-Execute error) compiler) @@ -175,7 +175,7 @@ (-> Ruby (Meta Any)) (do macro.Monad [module-buffer module-buffer - #let [_ (Appendable::append [(:! CharSequence code)] + #let [_ (Appendable::append [(:coerce CharSequence code)] module-buffer)]] (execute code))) @@ -186,7 +186,7 @@ module-buffer module-buffer program-buffer program-buffer #let [module-code (StringBuilder::toString [] module-buffer) - _ (Appendable::append [(:! CharSequence (format module-code "\n"))] + _ (Appendable::append [(:coerce CharSequence (format module-code "\n"))] program-buffer)]] (wrap (ioC.write target (format (lang.normalize-name module) "/" ruby-module-name) diff --git a/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux index d76b2a757..b7b1f131d 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux @@ -38,7 +38,7 @@ (let [method (if tail? runtimeT.product//right runtimeT.product//left)] - (method source (ruby.int (:! Int idx))))) + (method source (ruby.int (:coerce Int idx))))) valueO path)))) @@ -107,22 +107,22 @@ [_ ( value)] (meta/wrap (ruby.when! (ruby.not (ruby.= (|> value ) cursor-top)) (ruby.raise pm-error)))) - ([#.Nat (<| ruby.int (:! Int))] + ([#.Nat (<| ruby.int (:coerce Int))] [#.Int ruby.int] - [#.Deg (<| ruby.int (:! Int))] + [#.Deg (<| ruby.int (:coerce Int))] [#.Bool ruby.bool] [#.Frac ruby.float] [#.Text ruby.string]) (^template [ ] (^code ( (~ [_ (#.Nat idx)]))) - (meta/wrap (push-cursor! ( cursor-top (ruby.int (:! Int idx)))))) + (meta/wrap (push-cursor! ( cursor-top (ruby.int (:coerce Int idx)))))) (["lux case tuple left" runtimeT.product//left] ["lux case tuple right" runtimeT.product//right]) (^template [ ] (^code ( (~ [_ (#.Nat idx)]))) - (meta/wrap (ruby.block! (list (ruby.set! (list "temp") (runtimeT.sum//get cursor-top (ruby.int (:! Int idx)) )) + (meta/wrap (ruby.block! (list (ruby.set! (list "temp") (runtimeT.sum//get cursor-top (ruby.int (:coerce Int idx)) )) (ruby.if! (ruby.= ruby.nil "temp") (ruby.raise pm-error) (push-cursor! "temp")))))) diff --git a/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux index 7d43e5460..3c590e8ee 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux @@ -37,11 +37,11 @@ (def: (tuple lux-object host-object) (-> (-> Object (Error Any)) RubyArray (Error Any)) - (let [size (:! Nat (RubyArray::getLength [] host-object))] + (let [size (:coerce Nat (RubyArray::getLength [] host-object))] (loop [idx +0 - output (:! (Array Any) (array.new size))] + output (:coerce (Array Any) (array.new size))] (if (n/< size idx) - (case (RubyArray::get [(:! Int idx)] host-object) + (case (RubyArray::get [(:coerce Int idx)] host-object) #.None (recur (inc idx) output) @@ -56,13 +56,13 @@ (def: (variant lux-object host-object) (-> (-> Object (Error Any)) RubyHash (Error Any)) - (case [(RubyHash::get [(:! Object //.variant-tag-field)] host-object) - (RubyHash::get [(:! Object //.variant-flag-field)] host-object) - (RubyHash::get [(:! Object //.variant-value-field)] host-object)] + (case [(RubyHash::get [(:coerce Object //.variant-tag-field)] host-object) + (RubyHash::get [(:coerce Object //.variant-flag-field)] host-object) + (RubyHash::get [(:coerce Object //.variant-value-field)] host-object)] (^multi [(#.Some tag) ?flag (#.Some value)] [(lux-object value) (#.Some value)]) - (#e.Success [(Long::intValue [] (:! Long tag)) + (#e.Success [(Long::intValue [] (:coerce Long tag)) (: Any (case ?flag (#.Some _) "" #.None (host.null))) value]) @@ -81,28 +81,28 @@ (ex.return host-object) (host.instance? org/jruby/RubyArray host-object) - (tuple lux-object (:! RubyArray host-object)) + (tuple lux-object (:coerce RubyArray host-object)) (host.instance? org/jruby/RubyHash host-object) - (case (variant lux-object (:! RubyHash host-object)) + (case (variant lux-object (:coerce RubyHash host-object)) (#e.Success value) (#e.Success value) _ - (let [object-class (:! Text (Object::toString [] (Object::getClass [] (:! Object host-object)))) - text-representation (:! Text (Object::toString [] (:! Object host-object)))] + (let [object-class (:coerce Text (Object::toString [] (Object::getClass [] (:coerce Object host-object)))) + text-representation (:coerce Text (Object::toString [] (:coerce Object host-object)))] (ex.throw Unknown-Kind-Of-Host-Object (format object-class " --- " text-representation)))) ## else - (let [object-class (:! Text (Object::toString [] (Object::getClass [] (:! Object host-object)))) - text-representation (:! Text (Object::toString [] (:! Object host-object)))] + (let [object-class (:coerce Text (Object::toString [] (Object::getClass [] (:coerce Object host-object)))) + text-representation (:coerce Text (Object::toString [] (:coerce Object host-object)))] (ex.throw Unknown-Kind-Of-Host-Object (format object-class " --- " text-representation))) ))) (def: #export (eval code) (-> Expression (Meta Any)) (function (_ compiler) - (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] + (let [interpreter (|> compiler (get@ #.host) (:coerce //.Host) (get@ #//.interpreter))] (case (interpreter code) (#e.Error error) (exec (log! (format "eval #e.Error\n" @@ -111,7 +111,7 @@ ((lang.throw Cannot-Evaluate error) compiler)) (#e.Success output) - (case (lux-object (:! Object output)) + (case (lux-object (:coerce Object output)) (#e.Success parsed-output) (exec ## (log! (format "eval #e.Success\n" ## "<< " code)) diff --git a/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux index 1e76ef9e4..1f05cf2fd 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux @@ -16,11 +16,11 @@ (def: #export translate-nat (-> Nat (Meta Expression)) - (|>> (:! Int) %i meta/wrap)) + (|>> (:coerce Int) %i meta/wrap)) (def: #export translate-deg (-> Deg (Meta Expression)) - (|>> (:! Int) %i meta/wrap)) + (|>> (:coerce Int) %i meta/wrap)) (def: #export translate-frac (-> Frac (Meta Expression)) diff --git a/new-luxc/source/luxc/lang/translation/ruby/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/statement.jvm.lux index 135a09039..83792921d 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/statement.jvm.lux @@ -34,7 +34,7 @@ (wrap []) tags - (moduleL.declare-tags tags (macro.export? metaV) (:! Type expressionV))) + (moduleL.declare-tags tags (macro.export? metaV) (:coerce Type expressionV))) (wrap [])) #let [_ (log! (format "DEF " (%ident def-ident)))]] (wrap [])) diff --git a/new-luxc/source/luxc/lang/translation/scheme.lux b/new-luxc/source/luxc/lang/translation/scheme.lux index a117899fa..af3208414 100644 --- a/new-luxc/source/luxc/lang/translation/scheme.lux +++ b/new-luxc/source/luxc/lang/translation/scheme.lux @@ -72,7 +72,7 @@ #interpreter (function (_ code) (do e.Monad [output (Language::eval [(scheme.expression code)] interpreter)] - (wrap (maybe.default (:! Object []) + (wrap (maybe.default (:coerce Object []) output)))) #module-buffer #.None #program-buffer (StringBuilder::new [])}))) @@ -85,26 +85,26 @@ (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Nothing)) + (:coerce Nothing)) compiler) []]))) (def: #export (with-sub-context expr) (All [a] (-> (Meta a) (Meta [Text a]))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler)) + (let [old (:coerce Host (get@ #.host compiler)) [old-name old-sub] (get@ #context old) new-name (format old-name "f___" (%i (.int old-sub)))] (case (expr (set@ #.host - (:! Nothing (set@ #context [new-name +0] old)) + (:coerce Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #context [old-name (inc old-sub)]) - (:! Nothing)) + (:coerce Nothing)) compiler') [new-name output]]) @@ -116,7 +116,7 @@ (function (_ compiler) (#e.Success [compiler (|> (get@ #.host compiler) - (:! Host) + (:coerce Host) (get@ #context) (let> [name sub] name))]))) @@ -124,15 +124,15 @@ (def: #export (with-anchor anchor expr) (All [a] (-> Anchor (Meta a) (Meta a))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler))] + (let [old (:coerce Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Nothing (set@ #anchor (#.Some anchor) old)) + (:coerce Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #anchor (get@ #anchor old)) - (:! Nothing)) + (:coerce Nothing)) compiler') output]) @@ -142,7 +142,7 @@ (def: #export anchor (Meta Anchor) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #anchor)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #anchor)) (#.Some anchor) (#e.Success [compiler anchor]) @@ -152,7 +152,7 @@ (def: #export module-buffer (Meta StringBuilder) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #module-buffer)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #module-buffer)) #.None ((lang.throw No-Active-Module-Buffer "") compiler) @@ -162,13 +162,13 @@ (def: #export program-buffer (Meta StringBuilder) (function (_ compiler) - (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))]))) + (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) (do-template [ ] [(def: ( code) (-> Expression (Meta )) (function (_ compiler) - (let [runner (|> compiler (get@ #.host) (:! Host) (get@ ))] + (let [runner (|> compiler (get@ #.host) (:coerce Host) (get@ ))] (case (runner code) (#e.Error error) ((lang.throw Cannot-Execute error) compiler) @@ -192,7 +192,7 @@ (-> Expression (Meta Any)) (do macro.Monad [module-buffer module-buffer - #let [_ (Appendable::append [(:! CharSequence (scheme.expression code))] + #let [_ (Appendable::append [(:coerce CharSequence (scheme.expression code))] module-buffer)]] (load! code))) @@ -205,7 +205,7 @@ module-buffer module-buffer program-buffer program-buffer #let [module-code (StringBuilder::toString [] module-buffer) - _ (Appendable::append [(:! CharSequence (format module-code "\n"))] + _ (Appendable::append [(:coerce CharSequence (format module-code "\n"))] program-buffer)]] (wrap (ioC.write target (format (lang.normalize-name module) "/" r-module-name) diff --git a/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux index 362deee4a..72c58587c 100644 --- a/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux @@ -60,21 +60,21 @@ (def: (parse-tuple lux-object host-object) (-> (-> Object (Error Any)) (FVector Object) (Error Any)) - (let [size (:! Nat (FVector::getBufferLength [] host-object))] + (let [size (:coerce Nat (FVector::getBufferLength [] host-object))] (loop [idx +0 - output (:! (Array Any) (array.new size))] + output (:coerce (Array Any) (array.new size))] (if (n/< size idx) - (case (lux-object (FVector::get [(:! Int idx)] host-object)) + (case (lux-object (FVector::get [(:coerce Int idx)] host-object)) (#e.Error error) (#e.Error error) (#e.Success lux-value) - (recur (inc idx) (array.write idx (:! Any lux-value) output))) + (recur (inc idx) (array.write idx (:coerce Any lux-value) output))) (#e.Success output))))) (def: (variant tag flag value) (-> Nat Bool Any Any) - [(Long::intValue [] (:! Long tag)) + [(Long::intValue [] (:coerce Long tag)) (: Any (if flag //.unit @@ -83,24 +83,24 @@ (def: (to-text value) (-> Any Text) - (let [value-text (:! Text (Object::toString [] (:! Object value))) - class-text (:! Text (Object::toString [] (Object::getClass [] (:! Object value))))] + (let [value-text (:coerce Text (Object::toString [] (:coerce Object value))) + class-text (:coerce Text (Object::toString [] (Object::getClass [] (:coerce Object value))))] (format value-text " : " class-text))) (def: (parse-variant lux-object host-object) (-> (-> Object (Error Any)) Pair (Error Any)) (let [variant-tag (Pair::getCar [] host-object)] (if (and (host.instance? gnu/mapping/SimpleSymbol variant-tag) - (text/= //.variant-tag (Symbol::getName [] (:! Symbol variant-tag)))) + (text/= //.variant-tag (Symbol::getName [] (:coerce Symbol variant-tag)))) (do e.Monad - [#let [host-object (:! Pair (Pair::getCdr [] host-object))] + [#let [host-object (:coerce Pair (Pair::getCdr [] host-object))] tag (lux-object (Pair::getCar [] host-object)) - #let [host-object (:! Pair (Pair::getCdr [] host-object))] + #let [host-object (:coerce Pair (Pair::getCdr [] host-object))] #let [flag (host.instance? java/lang/String (Pair::getCar [] host-object))] value (lux-object (Pair::getCdr [] host-object))] - (wrap (..variant (:! Nat tag) flag value))) - (ex.throw invalid-variant (:! Text (Object::toString [] (:! Object host-object))))))) + (wrap (..variant (:coerce Nat tag) flag value))) + (ex.throw invalid-variant (:coerce Text (Object::toString [] (:coerce Object host-object))))))) (def: (lux-object host-object) (-> Object (Error Any)) @@ -109,32 +109,32 @@ (#e.Success host-object) (host.instance? gnu/math/IntNum host-object) - (#e.Success (IntNum::longValue [] (:! IntNum host-object))) + (#e.Success (IntNum::longValue [] (:coerce IntNum host-object))) (host.instance? gnu/math/DFloNum host-object) - (#e.Success (DFloNum::doubleValue [] (:! DFloNum host-object))) + (#e.Success (DFloNum::doubleValue [] (:coerce DFloNum host-object))) (host.instance? gnu/lists/FString host-object) - (#e.Success (FString::toString [] (:! FString host-object))) + (#e.Success (FString::toString [] (:coerce FString host-object))) (host.instance? gnu/lists/FVector host-object) - (parse-tuple lux-object (:! (FVector Object) host-object)) + (parse-tuple lux-object (:coerce (FVector Object) host-object)) (host.instance? gnu/lists/EmptyList host-object) (#e.Success //.unit) (host.instance? gnu/lists/Pair host-object) - (parse-variant lux-object (:! Pair host-object)) + (parse-variant lux-object (:coerce Pair host-object)) ## else - (let [object-class (:! Text (Object::toString [] (Object::getClass [] (:! Object host-object)))) - text-representation (:! Text (Object::toString [] (:! Object host-object)))] + (let [object-class (:coerce Text (Object::toString [] (Object::getClass [] (:coerce Object host-object)))) + text-representation (:coerce Text (Object::toString [] (:coerce Object host-object)))] (ex.throw Unknown-Kind-Of-Host-Object (format object-class " --- " text-representation))))) (def: #export (eval code) (-> Expression (Meta Any)) (function (_ compiler) - (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] + (let [interpreter (|> compiler (get@ #.host) (:coerce //.Host) (get@ #//.interpreter))] (case (interpreter code) (#e.Error error) (exec (log! (format "eval #e.Error\n" diff --git a/new-luxc/source/luxc/lang/translation/scheme/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/scheme/statement.jvm.lux index 43e18cb85..aa1411c18 100644 --- a/new-luxc/source/luxc/lang/translation/scheme/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/scheme/statement.jvm.lux @@ -34,7 +34,7 @@ (wrap []) tags - (moduleL.declare-tags tags (macro.export? metaV) (:! Type expressionV))) + (moduleL.declare-tags tags (macro.export? metaV) (:coerce Type expressionV))) (wrap [])) #let [_ (log! (format "DEF " (%ident def-ident)))]] (wrap [])) diff --git a/new-luxc/source/luxc/repl.lux b/new-luxc/source/luxc/repl.lux index 987cc2472..a6579e939 100644 --- a/new-luxc/source/luxc/repl.lux +++ b/new-luxc/source/luxc/repl.lux @@ -22,23 +22,23 @@ [poly #+ Poly]) (lang [syntax #+ Aliases] [type] - (type [check])) + (type [check]) + [".L" init] + [".L" module] + [".L" scope] + [".L" extension] + (extension [".E" analysis])) (concurrency [promise] [task #+ Task]) [io] (world [file #+ File] [console #+ Console])) (luxc [lang] - (lang [".L" module] - [".L" scope] - [".L" host] + (lang [".L" host] [".L" translation] [".L" eval] - [".L" init] (translation (jvm [".T" runtime])) - [".L" extension] - (extension [".E" analysis] - [".E" synthesis] + (extension [".E" synthesis] [".E" translation] [".E" statement])))) @@ -67,11 +67,11 @@ (|> compiler (set@ [#.info #.mode] #.REPL) (set@ #.extensions - (:! Nothing - {#extensionL.analysis analysisE.defaults - #extensionL.synthesis synthesisE.defaults - #extensionL.translation translationE.defaults - #extensionL.statement statementE.defaults})) + (:coerce Nothing + {#extensionL.analysis analysisE.defaults + #extensionL.synthesis synthesisE.defaults + #extensionL.translation translationE.defaults + #extensionL.statement statementE.defaults})) (translationL.translate-module source-dirs target-dir translationL.prelude)) (#e.Error error) @@ -108,7 +108,7 @@ (~~ (do-template [ ] [(do p.Monad [_ (poly.like )] - (wrap (|>> (:! ) )))] + (wrap (|>> (:coerce ) )))] [Bool %b] [Nat %n] @@ -123,7 +123,7 @@ (~~ (do-template [ ] [(do p.Monad [_ (poly.like )] - (wrap (|>> (:! ) )))] + (wrap (|>> (:coerce ) )))] [Type %type] [Code %code] @@ -137,12 +137,12 @@ (do p.Monad [[_ elemT] (poly.apply (p.seq (poly.this List) poly.any)) elemR (poly.local (list elemT) representation)] - (wrap (|>> (:! (List Any)) (%list elemR)))) + (wrap (|>> (:coerce (List Any)) (%list elemR)))) (do p.Monad [[_ elemT] (poly.apply (p.seq (poly.this Maybe) poly.any)) elemR (poly.local (list elemT) representation)] - (wrap (|>> (:! (Maybe Any)) + (wrap (|>> (:coerce (Maybe Any)) (case> #.None "#.None" @@ -166,7 +166,7 @@ (format (%code (code.tag tag)) " " (repr recordV)) (#.Cons [tag repr] tail) - (let [[leftV rightV] (:! [Any Any] recordV)] + (let [[leftV rightV] (:coerce [Any Any] recordV)] (format (%code (code.tag tag)) " " (repr leftV) " " (recur tail rightV)))))] (format "{" record-body "}")))))) @@ -188,13 +188,13 @@ "" (#.Cons [tag-name tag-idx repr] #.Nil) - (let [[_tag _last? _value] (:! [Nat Text Any] variantV)] + (let [[_tag _last? _value] (:coerce [Nat Text Any] variantV)] (if (n/= tag-idx _tag) (format "(" (%code (code.tag tag-name)) " " (repr _value) ")") (undefined))) (#.Cons [tag-name tag-idx repr] tail) - (let [[_tag _last? _value] (:! [Nat Text Any] variantV)] + (let [[_tag _last? _value] (:coerce [Nat Text Any] variantV)] (if (n/= tag-idx _tag) (format "(" (%code (code.tag tag-name)) " " (repr _value) ")") (recur tail variantV))))))))) @@ -232,7 +232,7 @@ (lastR tupleV) (#.Cons headR tailR) - (let [[leftV rightV] (:! [Any Any] tupleV)] + (let [[leftV rightV] (:coerce [Any Any] tupleV)] (format (headR leftV) " " (recur tailR rightV)))))] (format "[" tuple-body "]")))))) diff --git a/new-luxc/test/test/luxc/lang/translation/case.lux b/new-luxc/test/test/luxc/lang/translation/case.lux index f7df17c42..a16715729 100644 --- a/new-luxc/test/test/luxc/lang/translation/case.lux +++ b/new-luxc/test/test/luxc/lang/translation/case.lux @@ -74,7 +74,7 @@ ("lux case seq" ("lux case bind" +0) ("lux case exec" false)))))) (case> (#e.Success valueT) - (:! Bool valueT) + (:coerce Bool valueT) (#e.Error error) (exec (log! error) @@ -84,7 +84,7 @@ ("lux case seq" ("lux case bind" +0) ("lux case exec" (0)))))) (case> (#e.Success valueT) - (n/= to-bind (:! Nat valueT)) + (n/= to-bind (:coerce Nat valueT)) (#e.Error error) (exec (log! error) diff --git a/new-luxc/test/test/luxc/lang/translation/common.lux b/new-luxc/test/test/luxc/lang/translation/common.lux index 05a1d069f..793abd4d5 100644 --- a/new-luxc/test/test/luxc/lang/translation/common.lux +++ b/new-luxc/test/test/luxc/lang/translation/common.lux @@ -30,7 +30,7 @@ (|> (run (` ( (~ (code.nat subject)) (~ (code.nat param))))) (case> (#e.Success valueT) - (n/= ( param subject) (:! Nat valueT)) + (n/= ( param subject) (:coerce Nat valueT)) (#e.Error error) (exec (log! error) @@ -51,7 +51,7 @@ (~ (code.nat param))))) (case> (#e.Success valueT) (i/= (bit.arithmetic-right-shift param (nat-to-int subject)) - (:! Int valueT)) + (:coerce Int valueT)) (#e.Error error) (exec (log! error) @@ -71,7 +71,7 @@ [(test (|> (run (` ())) (case> (#e.Success valueT) - (i/= (:! Int valueT)) + (i/= (:coerce Int valueT)) (#e.Error error) (exec (log! error) @@ -84,7 +84,7 @@ [(test (|> (run (` ( (~ (code.int subject))))) (case> (#e.Success valueT) - ( ( subject) (:! valueT)) + ( ( subject) (:coerce valueT)) (#e.Error error) (exec (log! error) @@ -92,17 +92,17 @@ (let [subject ])))] ["lux int to-frac" Frac int-to-frac f/= subject] - ["lux int char" Text (|>> (:! Nat) text.from-code) text/= (|> subject - (:! Nat) - (n/% (bit.left-shift +8 +1)) - (:! Int))] + ["lux int char" Text (|>> (:coerce Nat) text.from-code) text/= (|> subject + (:coerce Nat) + (n/% (bit.left-shift +8 +1)) + (:coerce Int))] )) (~~ (do-template [ ] [(test (exec (log! ) (|> (run (` ( (~ (code.int subject)) (~ (code.int param))))) (case> (#e.Success valueT) - ( ( param subject) (:! valueT)) + ( ( param subject) (:coerce valueT)) (#e.Error error) (exec (log! error) @@ -127,7 +127,7 @@ [(test (|> (run (` ( (~ (code.frac subject)) (~ (code.frac param))))) (case> (#e.Success valueT) - ( ( param subject) (:! valueT)) + ( ( param subject) (:coerce valueT)) _ false)))] @@ -153,7 +153,7 @@ [(test (|> (run (` ())) (case> (#e.Success valueT) - ( (:! Frac valueT)) + ( (:coerce Frac valueT)) _ false)))] @@ -169,7 +169,7 @@ [(test (|> (run (` ( ( (~ (code.frac subject)))))) (case> (#e.Success valueT) - (|> valueT (:! Frac) (f/- subject) frac/abs ) + (|> valueT (:coerce Frac) (f/- subject) frac/abs ) (#e.Error error) (exec (log! error) @@ -218,48 +218,48 @@ (test "Can compare texts for equality." (and (|> (run (` ("lux text =" (~ sample0S) (~ sample0S)))) (case> (#e.Success valueV) - (:! Bool valueV) + (:coerce Bool valueV) _ false)) (|> (run (` ("lux text =" (~ sample0S) (~ sample1S)))) (case> (#e.Success valueV) - (not (:! Bool valueV)) + (not (:coerce Bool valueV)) _ false)))) (test "Can compare texts for order." (|> (run (` ("lux text <" (~ sample1S) (~ sample0S)))) (case> (#e.Success valueV) - (:! Bool valueV) + (:coerce Bool valueV) _ false))) (test "Can get length of text." (|> (run (` ("lux text size" (~ sample0S)))) (case> (#e.Success valueV) - (n/= sample-size (:! Nat valueV)) + (n/= sample-size (:coerce Nat valueV)) _ false))) (test "Can concatenate text." (|> (run (` ("lux text size" (~ concatenatedS)))) (case> (#e.Success valueV) - (n/= (n/* +2 sample-size) (:! Nat valueV)) + (n/= (n/* +2 sample-size) (:coerce Nat valueV)) _ false))) (test "Can find index of sub-text." (and (|> (run (` ("lux text index" (~ concatenatedS) (~ sample0S) +0))) (case> (^multi (#e.Success valueV) - [(:! (Maybe Nat) valueV) (#.Some valueV)]) + [(:coerce (Maybe Nat) valueV) (#.Some valueV)]) (n/= +0 valueV) _ false)) (|> (run (` ("lux text index" (~ concatenatedS) (~ sample1S) +0))) (case> (^multi (#e.Success valueV) - [(:! (Maybe Nat) valueV) (#.Some valueV)]) + [(:coerce (Maybe Nat) valueV) (#.Some valueV)]) (n/= sample-size valueV) _ @@ -269,7 +269,7 @@ ("lux text hash" (~ sample0S)) ("lux text hash" (~ sample0S))))) (case> (#e.Success valueV) - (:! Bool valueV) + (:coerce Bool valueV) (#e.Error error) (exec (log! error) @@ -282,7 +282,7 @@ (~ sample1S) (~ sample2S))))) (case> (#e.Success valueV) - (:! Bool valueV) + (:coerce Bool valueV) (#e.Error error) (exec (log! error) @@ -295,7 +295,7 @@ (~ sample1S) (~ sample2S))))) (case> (#e.Success valueV) - (:! Bool valueV) + (:coerce Bool valueV) (#e.Error error) (exec (log! error) @@ -306,7 +306,7 @@ (~ (code.nat from)) (~ (code.nat to))))) (case> (^multi (#e.Success valueV) - [(:! (Maybe Text) valueV) (#.Some valueV)]) + [(:coerce (Maybe Text) valueV) (#.Some valueV)]) (text/= expected valueV) _ @@ -319,7 +319,7 @@ (~ sample0S) (~ (code.nat char-idx))))) (case> (^multi (#e.Success valueV) - [(:! (Maybe Int) valueV) (#.Some valueV)]) + [(:coerce (Maybe Int) valueV) (#.Some valueV)]) (text.contains? ("lux int char" valueV) sample0) @@ -339,7 +339,7 @@ (test "Can get size of array." (|> (run (` ("lux array size" (~ array0S)))) (case> (#e.Success valueV) - (n/= size (:! Nat valueV)) + (n/= size (:coerce Nat valueV)) (#e.Error error) (exec (log! error) @@ -347,14 +347,14 @@ (test "Can get element from array (if it exists)." (and (|> (run (` ("lux array get" (~ array0S) (~ (code.nat idx))))) (case> (^multi (#e.Success valueV) - [(:! (Maybe Nat) valueV) #.None]) + [(:coerce (Maybe Nat) valueV) #.None]) true _ false)) (|> (run (` ("lux array get" (~ array1S) (~ (code.nat idx))))) (case> (^multi (#e.Success valueV) - [(:! (Maybe Nat) valueV) (#.Some valueV)]) + [(:coerce (Maybe Nat) valueV) (#.Some valueV)]) (n/= value valueV) _ @@ -365,7 +365,7 @@ (~ (code.nat idx))) (~ (code.nat idx))))) (case> (^multi (#e.Success valueV) - [(:! (Maybe Nat) valueV) #.None]) + [(:coerce (Maybe Nat) valueV) #.None]) true _ @@ -428,7 +428,7 @@ (and (|> (run (` ("lux try" ("lux function" +1 [] ("lux io error" (~ (code.text message))))))) (case> (^multi (#e.Success valueV) - [(:! (e.Error Text) valueV) (#e.Error error)]) + [(:coerce (e.Error Text) valueV) (#e.Error error)]) (text.contains? message error) _ @@ -436,7 +436,7 @@ (|> (run (` ("lux try" ("lux function" +1 [] (~ (code.text message)))))) (case> (^multi (#e.Success valueV) - [(:! (e.Error Text) valueV) (#e.Success valueV)]) + [(:coerce (e.Error Text) valueV) (#e.Success valueV)]) (text/= message valueV) _ @@ -444,7 +444,7 @@ (test "Can obtain current time in milli-seconds." (|> (run (` [("lux io current-time") ("lux io current-time")])) (case> (#e.Success valueV) - (let [[pre post] (:! [Nat Nat] valueV)] + (let [[pre post] (:coerce [Nat Nat] valueV)] (n/>= pre post)) (#e.Error error) @@ -464,7 +464,7 @@ (test "Can read atoms." (|> (run (` ("lux atom read" (~ atomS)))) (case> (#e.Success valueV) - (n/= pre (:! Nat valueV)) + (n/= pre (:coerce Nat valueV)) (#e.Error error) (exec (log! error) @@ -475,7 +475,7 @@ [("lux atom compare-and-swap" (1) (0) (~ postS)) ("lux atom read" (1))])))) (case> (#e.Success valueV) - (let [[swapped? current-value] (:! [Bool Nat] valueV)] + (let [[swapped? current-value] (:coerce [Bool Nat] valueV)] (and swapped? (n/= post current-value))) @@ -487,7 +487,7 @@ [("lux atom compare-and-swap" (1) (~ postS) (~ postS)) ("lux atom read" (1))])))) (case> (#e.Success valueV) - (let [[swapped? current-value] (:! [Bool Nat] valueV)] + (let [[swapped? current-value] (:coerce [Bool Nat] valueV)] (and (not swapped?) (n/= pre current-value))) @@ -508,7 +508,7 @@ (test "Can read boxes." (|> (run (` ("lux box read" (~ boxS)))) (case> (#e.Success valueV) - (n/= pre (:! Nat valueV)) + (n/= pre (:coerce Nat valueV)) (#e.Error error) (exec (log! error) @@ -518,7 +518,7 @@ ("lux let" +1 ("lux box write" (~ postS) (0)) ("lux box read" (0)))))) (case> (#e.Success valueV) - (n/= post (:! Nat valueV)) + (n/= post (:coerce Nat valueV)) (#e.Error error) (exec (log! error) @@ -531,7 +531,7 @@ (test "Can query the concurrency level of the machine." (|> (run (` ("lux process parallelism-level"))) (case> (#e.Success valueV) - (n/>= +1 (:! Nat valueV)) + (n/>= +1 (:coerce Nat valueV)) (#e.Error error) (exec (log! error) @@ -571,34 +571,34 @@ (<| (times +100) (all-specs run-jvm))) -(context: "[JS] Common procedures." - (<| (times +100) - (all-specs run-js))) +## (context: "[JS] Common procedures." +## (<| (times +100) +## (all-specs run-js))) -(context: "[Lua] Common procedures." - (<| (times +100) - (all-specs run-lua))) +## (context: "[Lua] Common procedures." +## (<| (times +100) +## (all-specs run-lua))) -(context: "[Ruby] Common procedures." - (<| (times +100) - (all-specs run-ruby))) +## (context: "[Ruby] Common procedures." +## (<| (times +100) +## (all-specs run-ruby))) -(context: "[Python] Common procedures." - (<| (times +100) - (all-specs run-python))) +## (context: "[Python] Common procedures." +## (<| (times +100) +## (all-specs run-python))) -(context: "[R] Common procedures." - (<| (times +100) - (all-specs run-r))) +## (context: "[R] Common procedures." +## (<| (times +100) +## (all-specs run-r))) -(context: "[Scheme] Common procedures." - (<| (times +100) - (all-specs run-scheme))) +## (context: "[Scheme] Common procedures." +## (<| (times +100) +## (all-specs run-scheme))) -(context: "[Common Lisp] Common procedures." - (<| (times +100) - (all-specs run-common-lisp))) +## (context: "[Common Lisp] Common procedures." +## (<| (times +100) +## (all-specs run-common-lisp))) -(context: "[PHP] Common procedures." - (<| (times +100) - (all-specs run-php))) +## (context: "[PHP] Common procedures." +## (<| (times +100) +## (all-specs run-php))) diff --git a/new-luxc/test/test/luxc/lang/translation/function.lux b/new-luxc/test/test/luxc/lang/translation/function.lux index 69cd174dd..fd96aeeb9 100644 --- a/new-luxc/test/test/luxc/lang/translation/function.lux +++ b/new-luxc/test/test/luxc/lang/translation/function.lux @@ -51,7 +51,7 @@ (test "Can read arguments." (|> (run (` ("lux call" (~ functionS) (~+ argsS)))) (case> (#e.Success valueT) - (f/= arg-value (:! Frac valueT)) + (f/= arg-value (:coerce Frac valueT)) (#e.Error error) (exec (log! error) @@ -65,7 +65,7 @@ ("lux call" (~ functionS) (~+ preS)) (~+ postS)))) (case> (#e.Success valueT) - (f/= arg-value (:! Frac valueT)) + (f/= arg-value (:coerce Frac valueT)) (#e.Error error) (exec (log! error) @@ -84,7 +84,7 @@ ((~ (code.int arg-var))))))] (|> (run (` ("lux call" (~ functionS) (~+ argsS)))) (case> (#e.Success valueT) - (f/= arg-value (:! Frac valueT)) + (f/= arg-value (:coerce Frac valueT)) (#e.Error error) (exec (log! error) @@ -95,34 +95,34 @@ (<| (times +100) (function-spec run-jvm))) -(context: "[JS] Function." - (<| (times +100) - (function-spec run-js))) +## (context: "[JS] Function." +## (<| (times +100) +## (function-spec run-js))) -(context: "[Lua] Function." - (<| (times +100) - (function-spec run-lua))) +## (context: "[Lua] Function." +## (<| (times +100) +## (function-spec run-lua))) -(context: "[Ruby] Function." - (<| (times +100) - (function-spec run-ruby))) +## (context: "[Ruby] Function." +## (<| (times +100) +## (function-spec run-ruby))) -(context: "[Python] Function." - (<| (times +100) - (function-spec run-python))) +## (context: "[Python] Function." +## (<| (times +100) +## (function-spec run-python))) -(context: "[R] Function." - (<| (times +100) - (function-spec run-r))) +## (context: "[R] Function." +## (<| (times +100) +## (function-spec run-r))) -(context: "[Scheme] Function." - (<| (times +100) - (function-spec run-scheme))) +## (context: "[Scheme] Function." +## (<| (times +100) +## (function-spec run-scheme))) -(context: "[Common Lisp] Function." - (<| (times +100) - (function-spec run-common-lisp))) +## (context: "[Common Lisp] Function." +## (<| (times +100) +## (function-spec run-common-lisp))) -(context: "[PHP] Function." - (<| (times +100) - (function-spec run-php))) +## (context: "[PHP] Function." +## (<| (times +100) +## (function-spec run-php))) diff --git a/new-luxc/test/test/luxc/lang/translation/js.lux b/new-luxc/test/test/luxc/lang/translation/js.lux index e6443cce8..6f4fb572d 100644 --- a/new-luxc/test/test/luxc/lang/translation/js.lux +++ b/new-luxc/test/test/luxc/lang/translation/js.lux @@ -23,7 +23,7 @@ (-> Synthesis Bool) (|> (run-js (` ("lux is" (~ synthesis) (~ synthesis)))) (case> (#e.Success valueV) - (:! Bool valueV) + (:coerce Bool valueV) _ false))) @@ -34,7 +34,7 @@ [(def: ( angle) (-> Check) (|>> (case> (#e.Success valueV) - (<=> (
 angle) (:!  valueV))
+                 (<=> (
 angle) (:coerce  valueV))
                  
                  (#e.Error error)
                  false)))]
@@ -74,7 +74,7 @@
             (test "Cannot get non-existing fields from objects."
                   (|> (run-js (` ("js object get" (~ field) (~ empty-object))))
                       (case> (^multi (#e.Success valueV)
-                                     [(:! (Maybe Int) valueV) #.None])
+                                     [(:coerce (Maybe Int) valueV) #.None])
                              true
 
                              _
@@ -82,8 +82,8 @@
             (test "Can get fields from objects."
                   (|> (run-js (` ("js object get" (~ field) (~ object))))
                       (case> (^multi (#e.Success valueV)
-                                     [(:! (Maybe Int) valueV) (#.Some valueV)])
-                             (i/= value (:! Int valueV))
+                                     [(:coerce (Maybe Int) valueV) (#.Some valueV)])
+                             (i/= value (:coerce Int valueV))
 
                              _
                              false)))
@@ -91,7 +91,7 @@
                   (|> (run-js (let [post-delete (` ("js object delete" (~ field) (~ object)))]
                                 (` ("js object get" (~ field) (~ post-delete)))))
                       (case> (^multi (#e.Success valueV)
-                                     [(:! (Maybe Int) valueV) #.None])
+                                     [(:coerce (Maybe Int) valueV) #.None])
                              true
 
                              _
@@ -100,7 +100,7 @@
                   (let [base (` ("js object new" ("js global" "Number") (~ (code.text (%f frac-value)))))]
                     (|> (run-js (` ("lux frac +" (~ base) 0.0)))
                         (case> (#e.Success valueV)
-                               (f/= frac-value (:! Frac valueV))
+                               (f/= frac-value (:coerce Frac valueV))
 
                                (#e.Error error)
                                false))))
@@ -125,7 +125,7 @@
             (test "Can get an element from an array."
                   (|> (run-js (` ("js array read" (~ (code.nat idx)) (~ arrayS))))
                       (case> (^multi (#e.Success elemV)
-                                     [[(list.nth idx elems) (:! (Maybe Nat) elemV)]
+                                     [[(list.nth idx elems) (:coerce (Maybe Nat) elemV)]
                                       [(#.Some reference) (#.Some sample)]])
                              (n/= reference sample)
 
@@ -137,7 +137,7 @@
                     (|> (run-js (` ("js array read" (~ idxS)
                                     ("js array write" (~ idxS) (~ overwriteS) (~ arrayS)))))
                         (case> (^multi (#e.Success elemV)
-                                       [(:! (Maybe Nat) elemV)
+                                       [(:coerce (Maybe Nat) elemV)
                                         (#.Some sample)])
                                (n/= overwrite sample)
 
@@ -150,7 +150,7 @@
                              (length-check length))
                          (|> (run-js (` ("js array read" (~ idxS) (~ deleteS))))
                              (case> (^multi (#e.Success elemV)
-                                            [(:! (Maybe Nat) elemV)
+                                            [(:coerce (Maybe Nat) elemV)
                                              #.None])
                                     true
 
diff --git a/new-luxc/test/test/luxc/lang/translation/jvm.lux b/new-luxc/test/test/luxc/lang/translation/jvm.lux
index a835ce9d4..23877a51e 100644
--- a/new-luxc/test/test/luxc/lang/translation/jvm.lux
+++ b/new-luxc/test/test/luxc/lang/translation/jvm.lux
@@ -37,7 +37,7 @@
                                                (lang.with-current-module "")
                                                (macro.run (io.run init-jvm))
                                                (case> (#e.Success valueT)
-                                                      (  (:!  valueT))
+                                                      (  (:coerce  valueT))
 
                                                       (#e.Error error)
                                                       false)))]
@@ -69,7 +69,7 @@
                                  (lang.with-current-module "")
                                  (macro.run (io.run init-jvm))
                                  (case> (#e.Success valueT)
-                                        (  (:!  valueT))
+                                        (  (:coerce  valueT))
 
                                         (#e.Error error)
                                         false)))]
@@ -96,7 +96,7 @@
                                  (lang.with-current-module "")
                                  (macro.run (io.run init-jvm))
                                  (case> (#e.Success valueT)
-                                        (  (:!  valueT))
+                                        (  (:coerce  valueT))
 
                                         (#e.Error error)
                                         false)))]
@@ -138,7 +138,7 @@
                                                   (macro.run (io.run init-jvm))
                                                   (case> (#e.Success valueT)
                                                          ( ( param subject)
-                                                                 (:!  valueT))
+                                                                 (:coerce  valueT))
 
                                                          (#e.Error error)
                                                          false)))]
@@ -177,7 +177,7 @@
                                     (macro.run (io.run init-jvm))
                                     (case> (#e.Success valueT)
                                            (n/= ( param subject)
-                                                (:! Nat valueT))
+                                                (:coerce Nat valueT))
 
                                            (#e.Error error)
                                            false)))]
@@ -211,7 +211,7 @@
                                     (macro.run (io.run init-jvm))
                                     (case> (#e.Success valueT)
                                            ( ( shift ( subject))
-                                                   (:!  valueT))
+                                                   (:coerce  valueT))
 
                                            (#e.Error error)
                                            false)))]
@@ -243,7 +243,7 @@
                                                   (macro.run (io.run init-jvm))
                                                   (case> (#e.Success valueT)
                                                          (bool/= ( param subject)
-                                                                 (:! Bool valueT))
+                                                                 (:coerce Bool valueT))
 
                                                          (#e.Error error)
                                                          false)))]
@@ -300,7 +300,7 @@
                                                (lang.with-current-module "")
                                                (macro.run (io.run init-jvm))
                                                (case> (#e.Success outputZ)
-                                                      (  (:!  outputZ))
+                                                      (  (:coerce  outputZ))
 
                                                       (#e.Error error)
                                                       false)))]
@@ -350,7 +350,7 @@
                                                (lang.with-current-module "")
                                                (macro.run (io.run init-jvm))
                                                (case> (#e.Success outputT)
-                                                      (  (:!  outputT))
+                                                      (  (:coerce  outputT))
 
                                                       (#e.Error error)
                                                       false)))]
@@ -378,7 +378,7 @@
                         (lang.with-current-module "")
                         (macro.run (io.run init-jvm))
                         (case> (#e.Success outputT)
-                               (f/= valueD (:! Frac outputT))
+                               (f/= valueD (:coerce Frac outputT))
 
                                (#e.Error error)
                                false)))
@@ -389,7 +389,7 @@
                         (lang.with-current-module "")
                         (macro.run (io.run init-jvm))
                         (case> (#e.Success outputT)
-                               (n/= size (:! Nat outputT))
+                               (n/= size (:coerce Nat outputT))
 
                                (#e.Error error)
                                false)))
@@ -440,7 +440,7 @@
                       (lang.with-current-module "")
                       (macro.run (io.run init-jvm))
                       (case> (#e.Success outputT)
-                             (:! Bool outputT)
+                             (:coerce Bool outputT)
 
                              (#e.Error error)
                              false)))
@@ -451,7 +451,7 @@
                       (lang.with-current-module "")
                       (macro.run (io.run init-jvm))
                       (case> (#e.Success outputT)
-                             (not (:! Bool outputT))
+                             (not (:coerce Bool outputT))
 
                              (#e.Error error)
                              false)))
@@ -462,7 +462,7 @@
                       (lang.with-current-module "")
                       (macro.run (io.run init-jvm))
                       (case> (#e.Success outputT)
-                             (i/= sample (:! Int outputT))
+                             (i/= sample (:coerce Int outputT))
 
                              (#e.Error error)
                              false)))
@@ -477,7 +477,7 @@
                       (lang.with-current-module "")
                       (macro.run (io.run init-jvm))
                       (case> (#e.Success outputT)
-                             (case (:! (e.Error Any) outputT)
+                             (case (:coerce (e.Error Any) outputT)
                                (#e.Error error)
                                (text.contains? exception-message error)
 
@@ -493,7 +493,7 @@
                       (lang.with-current-module "")
                       (macro.run (io.run init-jvm))
                       (case> (#e.Success outputT)
-                             (|> outputT (:! Class) (Class::getName []) (text/= class))
+                             (|> outputT (:coerce Class) (Class::getName []) (text/= class))
 
                              (#e.Error error)
                              false)))
@@ -504,7 +504,7 @@
                       (lang.with-current-module "")
                       (macro.run (io.run init-jvm))
                       (case> (#e.Success outputT)
-                             (:! Bool outputT)
+                             (:coerce Bool outputT)
 
                              (#e.Error error)
                              false)))
@@ -536,7 +536,7 @@
                       (lang.with-current-module "")
                       (macro.run (io.run init-jvm))
                       (case> (#e.Success outputT)
-                             (i/= GregorianCalendar::AD (:! Int outputT))
+                             (i/= GregorianCalendar::AD (:coerce Int outputT))
 
                              (#e.Error error)
                              false)))
@@ -548,7 +548,7 @@
                       (lang.with-current-module "")
                       (macro.run (io.run init-jvm))
                       (case> (#e.Success outputT)
-                             (is? hostL.unit (:! Text outputT))
+                             (is? hostL.unit (:coerce Text outputT))
 
                              (#e.Error error)
                              false)))
@@ -559,7 +559,7 @@
                       (lang.with-current-module "")
                       (macro.run (io.run init-jvm))
                       (case> (#e.Success outputT)
-                             (text/= sample-string (:! Text outputT))
+                             (text/= sample-string (:coerce Text outputT))
 
                              (#e.Error error)
                              false)))
@@ -572,7 +572,7 @@
                       (lang.with-current-module "")
                       (macro.run (io.run init-jvm))
                       (case> (#e.Success outputT)
-                             (text/= other-sample-string (:! Text outputT))
+                             (text/= other-sample-string (:coerce Text outputT))
 
                              (#e.Error error)
                              false)))
@@ -601,7 +601,7 @@
                       (lang.with-current-module "")
                       (macro.run (io.run init-jvm))
                       (case> (#e.Success outputT)
-                             (i/= sample (:! Int outputT))
+                             (i/= sample (:coerce Int outputT))
 
                              (#e.Error error)
                              false)))
@@ -614,7 +614,7 @@
                       (lang.with-current-module "")
                       (macro.run (io.run init-jvm))
                       (case> (#e.Success outputT)
-                             (:! Bool outputT)
+                             (:coerce Bool outputT)
 
                              (#e.Error error)
                              false)))
@@ -627,7 +627,7 @@
                       (lang.with-current-module "")
                       (macro.run (io.run init-jvm))
                       (case> (#e.Success outputT)
-                             (:! Bool outputT)
+                             (:coerce Bool outputT)
 
                              (#e.Error error)
                              false)))
@@ -638,7 +638,7 @@
                       (lang.with-current-module "")
                       (macro.run (io.run init-jvm))
                       (case> (#e.Success outputT)
-                             (host.instance? ArrayList (:! Object outputT))
+                             (host.instance? ArrayList (:coerce Object outputT))
 
                              (#e.Error error)
                              false)))
diff --git a/new-luxc/test/test/luxc/lang/translation/primitive.lux b/new-luxc/test/test/luxc/lang/translation/primitive.lux
index 42d78f646..5d368cc60 100644
--- a/new-luxc/test/test/luxc/lang/translation/primitive.lux
+++ b/new-luxc/test/test/luxc/lang/translation/primitive.lux
@@ -27,7 +27,7 @@
                   [(test (format "Can translate "  ".")
                          (|> (run ( ))
                              (case> (#e.Success valueT)
-                                    (  (:!  valueT))
+                                    (  (:coerce  valueT))
 
                                     (#e.Error error)
                                     (exec (log! error)
diff --git a/new-luxc/test/test/luxc/lang/translation/reference.lux b/new-luxc/test/test/luxc/lang/translation/reference.lux
index 41032f0c7..17cd78d54 100644
--- a/new-luxc/test/test/luxc/lang/translation/reference.lux
+++ b/new-luxc/test/test/luxc/lang/translation/reference.lux
@@ -35,7 +35,7 @@
     (test "Can refer to definitions."
           (|> (define def-name (//synthesis.i64 def-value))
               (case> (#e.Success valueT)
-                     (i/= def-value (:! Int valueT))
+                     (i/= def-value (:coerce Int valueT))
 
                      (#e.Error error)
                      (exec (log! error)
@@ -51,7 +51,7 @@
                                             register
                                             (//synthesis.variable/local register)]))
               (case> (#e.Success outputT)
-                     (i/= value (:! Int outputT))
+                     (i/= value (:coerce Int outputT))
 
                      (#e.Error error)
                      (exec (log! error)
diff --git a/new-luxc/test/test/luxc/lang/translation/structure.lux b/new-luxc/test/test/luxc/lang/translation/structure.lux
index 6e512f3ec..2a757d3a6 100644
--- a/new-luxc/test/test/luxc/lang/translation/structure.lux
+++ b/new-luxc/test/test/luxc/lang/translation/structure.lux
@@ -30,10 +30,10 @@
     (test "Can translate tuple."
           (|> (run (code.tuple (list/map code.int tuple-in)))
               (case> (#e.Success tuple-out)
-                     (let [tuple-out (:! (Array Any) tuple-out)]
+                     (let [tuple-out (:coerce (Array Any) tuple-out)]
                        (and (n/= size (array.size tuple-out))
                             (list.every? (function (_ [left right])
-                                           (i/= left (:! Int right)))
+                                           (i/= left (:coerce Int right)))
                                          (list.zip2 tuple-in (array.to-list tuple-out)))))
 
                      (#e.Error error)
@@ -50,19 +50,19 @@
     (test "Can translate variant."
           (|> (run (` ((~ (code.nat tag-in)) (~ (code.bool last?-in)) (~ (code.int value-in)))))
               (case> (#e.Success valueT)
-                     (let [valueT (:! (Array Any) valueT)]
+                     (let [valueT (:coerce (Array Any) valueT)]
                        (and (n/= +3 (array.size valueT))
-                            (let [tag-out (:! Integer (maybe.assume (array.read +0 valueT)))
+                            (let [tag-out (:coerce Integer (maybe.assume (array.read +0 valueT)))
                                   last?-out (array.read +1 valueT)
-                                  value-out (:! Any (maybe.assume (array.read +2 valueT)))
-                                  same-tag? (n/= tag-in (|> tag-out host.int-to-long (:! Nat)))
+                                  value-out (:coerce Any (maybe.assume (array.read +2 valueT)))
+                                  same-tag? (n/= tag-in (|> tag-out host.int-to-long (:coerce Nat)))
                                   same-flag? (case last?-out
                                                (#.Some last?-out')
-                                               (and last?-in (text/= "" (:! Text last?-out')))
+                                               (and last?-in (text/= "" (:coerce Text last?-out')))
 
                                                #.None
                                                (not last?-in))
-                                  same-value? (i/= value-in (:! Int value-out))]
+                                  same-value? (i/= value-in (:coerce Int value-out))]
                               (and same-tag?
                                    same-flag?
                                    same-value?))))
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux
index 72e22a485..55499d6cc 100644
--- a/stdlib/source/lux.lux
+++ b/stdlib/source/lux.lux
@@ -2859,16 +2859,16 @@
            _
            (fail "Wrong syntax for :")}))
 
-(macro:' #export (:! tokens)
+(macro:' #export (:coerce tokens)
          (list [(tag$ ["lux" "doc"])
                 (text$ "## The type-coercion macro.
-                        (:! Dinosaur (list 1 2 3))")])
+                        (:coerce Dinosaur (list 1 2 3))")])
          ("lux case" tokens
           {(#Cons type (#Cons value #Nil))
            (return (list (` ("lux coerce" (type (~ type)) (~ value)))))
 
            _
-           (fail "Wrong syntax for :!")}))
+           (fail "Wrong syntax for :coerce")}))
 
 (def:''' (empty? xs)
          #Nil
@@ -5329,7 +5329,7 @@
 (do-template [ ]
   [(def: #export 
      (-> (I64 Any) )
-     (|>> (:! )))]
+     (|>> (:coerce )))]
 
   [i64 I64]
   [nat Nat]
@@ -5700,7 +5700,7 @@
     (case (flatten-alias type)
       (^template [  ]
         (#Named ["lux" ] _)
-        (wrap ( (:!  value))))
+        (wrap ( (:coerce  value))))
       (["Bool" Bool bool$]
        ["Nat"  Nat  nat$]
        ["Int"  Int  int$]
diff --git a/stdlib/source/lux/concurrency/stm.lux b/stdlib/source/lux/concurrency/stm.lux
index 791419444..5c9e2d68c 100644
--- a/stdlib/source/lux/concurrency/stm.lux
+++ b/stdlib/source/lux/concurrency/stm.lux
@@ -76,8 +76,8 @@
   (All [a] (-> (Var a) Tx (Maybe a)))
   (|> tx
       (list.find (function (_ [_var _original _current])
-                   (is? (:! (Var Any) var)
-                        (:! (Var Any) _var))))
+                   (is? (:coerce (Var Any) var)
+                        (:coerce (Var Any) _var))))
       (:: maybe.Monad map (function (_ [_var _original _current])
                                    _current))
       (:assume)
@@ -102,11 +102,11 @@
     #.Nil
     
     (#.Cons [_var _original _current] tx')
-    (if (is? (:! (Var Any) var)
-             (:! (Var Any) _var))
-      (#.Cons {#var (:! (Var Any) _var)
-               #original (:! Any _original)
-               #current (:! Any value)}
+    (if (is? (:coerce (Var Any) var)
+             (:coerce (Var Any) _var))
+      (#.Cons {#var (:coerce (Var Any) _var)
+               #original (:coerce Any _original)
+               #current (:coerce Any value)}
               tx')
       (#.Cons {#var _var
                #original _original
@@ -220,7 +220,7 @@
         (if was-first?
           (exec (|> (io.run (atom.read pending-commits))
                     (promise.await (function (recur [head tail])
-                                     (io (exec (process-commit (:! [(STM Any) (Promise Any)] head))
+                                     (io (exec (process-commit (:coerce [(STM Any) (Promise Any)] head))
                                            (promise.await recur tail))))))
             (wrap []))
           (wrap [])))
diff --git a/stdlib/source/lux/data/bit.lux b/stdlib/source/lux/data/bit.lux
index a0f8e18a7..22ac6522a 100644
--- a/stdlib/source/lux/data/bit.lux
+++ b/stdlib/source/lux/data/bit.lux
@@ -47,11 +47,11 @@
 (def: #export not
   {#.doc "Bitwise negation."}
   (All [s] (-> (I64 s) (I64 s)))
-  (xor (:! I64 -1)))
+  (xor (:coerce I64 -1)))
 
 (def: (flag idx)
   (-> Nat I64)
-  (|> +1 (:! I64) (left-shift idx)))
+  (|> +1 (:coerce I64) (left-shift idx)))
 
 (def: #export (clear idx input)
   {#.doc "Clear bit at given index."}
@@ -70,7 +70,7 @@
 
 (def: #export (set? idx input)
   (-> Nat (I64 Any) Bool)
-  (|> input (:! I64) (..and (flag idx)) (n/= +0) .not))
+  (|> input (:coerce I64) (..and (flag idx)) (n/= +0) .not))
 
 (do-template [ 
] [(def: #export ( distance input) @@ -86,4 +86,4 @@ (def: #export (region size offset) (-> Nat Nat I64) - (|> +1 (:! I64) (left-shift size) dec (left-shift offset))) + (|> +1 (:coerce I64) (left-shift size) dec (left-shift offset))) diff --git a/stdlib/source/lux/data/number.lux b/stdlib/source/lux/data/number.lux index 640bff8a2..df685c150 100644 --- a/stdlib/source/lux/data/number.lux +++ b/stdlib/source/lux/data/number.lux @@ -80,10 +80,10 @@ (def: * d/*) (def: / d//) (def: % d/%) - (def: (negate x) (d/- x (:! Deg -1))) + (def: (negate x) (d/- x (:coerce Deg -1))) (def: abs id) (def: (signum x) - (:! Deg -1))) + (:coerce Deg -1))) (do-template [ ] [(struct: #export _ (Enum ) @@ -103,10 +103,10 @@ (def: top ) (def: bottom ))] - [ Nat Enum (:! Nat -1) +0] + [ Nat Enum (:coerce Nat -1) +0] [ Int Enum 9_223_372_036_854_775_807 -9_223_372_036_854_775_808] [Frac Enum ("lux frac max") ("lux frac min")] - [ Deg Enum (:! Deg -1) (:! Deg +0)] + [ Deg Enum (:coerce Deg -1) (:coerce Deg +0)] ) (do-template [ ] @@ -364,7 +364,7 @@ (#.Some digit-value) (recur (inc idx) - (|> output (i/* ) (i/+ (:! Int digit-value)))))) + (|> output (i/* ) (i/+ (:coerce Int digit-value)))))) (#e.Success (i/* sign output))))) (#e.Error )))))] @@ -381,7 +381,7 @@ (do-template [ ] [(struct: #export (Codec Text Deg) (def: (encode value) - (let [raw-output (de-prefix (:: encode (:! Nat value))) + (let [raw-output (de-prefix (:: encode (:coerce Nat value))) max-num-chars (n// +64) raw-size ("lux text size" raw-output) zero-padding (loop [zeroes-left (n/- raw-size max-num-chars) @@ -400,7 +400,7 @@ (^multi (^ (#.Some (char "."))) [(:: decode ("lux text concat" "+" (de-prefix repr))) (#e.Success output)]) - (#e.Success (:! Deg output)) + (#e.Success (:coerce Deg output)) _ (#e.Error ("lux text concat" repr))) @@ -751,7 +751,7 @@ (loop [idx idx carry +0 output output] - (if (i/>= 0 (:! Int idx)) + (if (i/>= 0 (:coerce Int idx)) (let [raw (|> (digits-get idx output) (n/* +5) (n/+ carry))] @@ -765,7 +765,7 @@ (loop [times power output (|> (make-digits []) (digits-put power +1))] - (if (i/>= 0 (:! Int times)) + (if (i/>= 0 (:coerce Int times)) (recur (dec times) (digits-times-5! power output)) output))) @@ -775,7 +775,7 @@ (loop [idx (dec bit.width) all-zeroes? true output ""] - (if (i/>= 0 (:! Int idx)) + (if (i/>= 0 (:coerce Int idx)) (let [digit (digits-get idx digits)] (if (and (n/= +0 digit) all-zeroes?) @@ -783,7 +783,7 @@ (recur (dec idx) false ("lux text concat" - (:: Codec encode (:! Int digit)) + (:: Codec encode (:coerce Int digit)) output)))) (if all-zeroes? "0" @@ -794,7 +794,7 @@ (loop [idx (dec bit.width) carry +0 output (make-digits [])] - (if (i/>= 0 (:! Int idx)) + (if (i/>= 0 (:coerce Int idx)) (let [raw ($_ n/+ carry (digits-get idx param) @@ -855,13 +855,13 @@ (struct: #export _ (Codec Text Deg) (def: (encode input) - (let [input (:! Nat input) + (let [input (:coerce Nat input) last-idx (dec bit.width)] (if (n/= +0 input) ".0" (loop [idx last-idx digits (make-digits [])] - (if (i/>= 0 (:! Int idx)) + (if (i/>= 0 (:coerce Int idx)) (if (bit.set? idx input) (let [digits' (digits-add (digits-power (n/- idx last-idx)) digits)] @@ -897,7 +897,7 @@ (recur (digits-sub! power digits) (inc idx) (bit.set (n/- idx (dec bit.width)) output)))) - (#e.Success (:! Deg output)))) + (#e.Success (:coerce Deg output)))) #.None (#e.Error ("lux text concat" "Wrong syntax for Deg: " input))) @@ -1009,4 +1009,4 @@ (struct: #export _ (Hash Deg) (def: eq Eq) - (def: hash (|>> (:! Nat)))) + (def: hash (|>> (:coerce Nat)))) diff --git a/stdlib/source/lux/data/text.lux b/stdlib/source/lux/data/text.lux index 6d11bb9b0..58826e2c9 100644 --- a/stdlib/source/lux/data/text.lux +++ b/stdlib/source/lux/data/text.lux @@ -209,7 +209,7 @@ (def: #export from-code (-> Nat Text) - (|>> (:! Int) "lux int char")) + (|>> (:coerce Int) "lux int char")) (def: #export (space? char) {#.doc "Checks whether the character is white-space."} diff --git a/stdlib/source/lux/host.js.lux b/stdlib/source/lux/host.js.lux index 7ad985f1a..876ab0c38 100644 --- a/stdlib/source/lux/host.js.lux +++ b/stdlib/source/lux/host.js.lux @@ -40,8 +40,8 @@ {#.doc (doc "A way to get fields from objects." (get "ceil" (ref "Math")) (get "ceil" (-> Frac Frac) (ref "Math")))} - (wrap (list (` (:! (~ type) - ("js get-field" (~ object) (~ field-name))))))) + (wrap (list (` (:coerce (~ type) + ("js get-field" (~ object) (~ field-name))))))) (syntax: #export (object {kvs (p.some (p.seq s.any s.any))}) {#.doc (doc "A way to create JavaScript objects." @@ -57,8 +57,8 @@ {#.doc (doc "A way to refer to JavaScript variables." (ref "document") (ref "Math.ceil" (-> Frac Frac)))} - (wrap (list (` (:! (~ (default (' ..Object) type)) - ("js ref" (~ (code.text name)))))))) + (wrap (list (` (:coerce (~ (default (' ..Object) type)) + ("js ref" (~ (code.text name)))))))) (do-template [ ] [(syntax: #export () @@ -77,9 +77,9 @@ (call! (ref "Math") "ceil" [123.45]))} (case shape (#.Left [function args ?type]) - (wrap (list (` (:! (~ (default (' ..Object) ?type)) - ("js call" (~ function) (~+ args)))))) + (wrap (list (` (:coerce (~ (default (' ..Object) ?type)) + ("js call" (~ function) (~+ args)))))) (#.Right [object field args ?type]) - (wrap (list (` (:! (~ (default (' ..Object) ?type)) - ("js object-call" (~ object) (~ (code.text field)) (~+ args)))))))) + (wrap (list (` (:coerce (~ (default (' ..Object) ?type)) + ("js object-call" (~ object) (~ (code.text field)) (~+ args)))))))) diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index 5fbeae68d..ae4b78aac 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -1561,8 +1561,8 @@ [return-type (let [g!temp (code.symbol ["" " Ω "])] (` (let [(~ g!temp) (~ return-term)] - (if (not (null? (:! (primitive "java.lang.Object") - (~ g!temp)))) + (if (not (null? (:coerce (primitive "java.lang.Object") + (~ g!temp)))) (~ g!temp) (error! "Cannot produce null references from method calls.")))))]) diff --git a/stdlib/source/lux/io.lux b/stdlib/source/lux/io.lux index 21d70de61..a50c501d1 100644 --- a/stdlib/source/lux/io.lux +++ b/stdlib/source/lux/io.lux @@ -27,13 +27,13 @@ (struct: #export _ (Functor IO) (def: (map f ma) - (io (f (ma (:! Nothing [])))))) + (io (f (ma (:coerce Nothing [])))))) (struct: #export _ (Apply IO) (def: functor Functor) (def: (apply ff fa) - (io ((ff (:! Nothing [])) (fa (:! Nothing [])))))) + (io ((ff (:coerce Nothing [])) (fa (:coerce Nothing [])))))) (struct: #export _ (Monad IO) (def: functor Functor) @@ -42,12 +42,12 @@ (io x)) (def: (join mma) - (io ((mma (:! Nothing [])) (:! Nothing []))))) + (io ((mma (:coerce Nothing [])) (:coerce Nothing []))))) (def: #export (run action) {#.doc "A way to execute IO computations and perform their side-effects."} (All [a] (-> (IO a) a)) - (action (:! Nothing []))) + (action (:coerce Nothing []))) (def: #export (exit code) (-> Int (IO Nothing)) diff --git a/stdlib/source/lux/lang/compiler/analysis/case.lux b/stdlib/source/lux/lang/compiler/analysis/case.lux index 9e67a24f9..84eb23af5 100644 --- a/stdlib/source/lux/lang/compiler/analysis/case.lux +++ b/stdlib/source/lux/lang/compiler/analysis/case.lux @@ -194,8 +194,8 @@ (Operation [(List Pattern) a]))) (function (_ [memberT memberC] then) (do @ - [[memberP [memberP+ thenA]] ((:! (All [a] (-> (Maybe Nat) Type Code (Operation a) (Operation [Pattern a]))) - analyse-pattern) + [[memberP [memberP+ thenA]] ((:coerce (All [a] (-> (Maybe Nat) Type Code (Operation a) (Operation [Pattern a]))) + analyse-pattern) #.None memberT memberC then)] (wrap [(list& memberP memberP+) thenA])))) (do @ diff --git a/stdlib/source/lux/lang/compiler/extension/analysis/common.lux b/stdlib/source/lux/lang/compiler/extension/analysis/common.lux index 6bd1a93bf..ca1c51df9 100644 --- a/stdlib/source/lux/lang/compiler/extension/analysis/common.lux +++ b/stdlib/source/lux/lang/compiler/extension/analysis/common.lux @@ -102,14 +102,14 @@ ## (^ (list typeC valueC)) ## (do compiler.Monad ## [actualT (eval Type typeC) -## _ (typeA.infer (:! Type actualT))] +## _ (typeA.infer (:coerce Type actualT))] ## (typeA.with-type ## (analyse valueC))) ## _ ## (lang.throw ///bundle.incorrect-arity [extension +2 (list.size args)]))))] -## [lux//check (:! Type actualT)] +## [lux//check (:coerce Type actualT)] ## [lux//coerce Any] ## ) diff --git a/stdlib/source/lux/lang/compiler/extension/analysis/host.jvm.lux b/stdlib/source/lux/lang/compiler/extension/analysis/host.jvm.lux index 56da166c5..1fb9d8d90 100644 --- a/stdlib/source/lux/lang/compiler/extension/analysis/host.jvm.lux +++ b/stdlib/source/lux/lang/compiler/extension/analysis/host.jvm.lux @@ -545,10 +545,10 @@ (def: (java-type-to-class type) (-> java/lang/reflect/Type (Meta Text)) (cond (host.instance? Class type) - (macro/wrap (Class::getName [] (:! Class type))) + (macro/wrap (Class::getName [] (:coerce Class type))) (host.instance? ParameterizedType type) - (java-type-to-class (ParameterizedType::getRawType [] (:! ParameterizedType type))) + (java-type-to-class (ParameterizedType::getRawType [] (:coerce ParameterizedType type))) ## else (lang.throw Cannot-Convert-To-Class (jvm-type-name type)))) @@ -561,7 +561,7 @@ (def: (java-type-to-lux-type mappings java-type) (-> Mappings java/lang/reflect/Type (Meta Type)) (cond (host.instance? TypeVariable java-type) - (let [var-name (TypeVariable::getName [] (:! TypeVariable java-type))] + (let [var-name (TypeVariable::getName [] (:coerce TypeVariable java-type))] (case (dict.get var-name mappings) (#.Some var-type) (macro/wrap var-type) @@ -570,7 +570,7 @@ (lang.throw Unknown-Type-Var var-name))) (host.instance? WildcardType java-type) - (let [java-type (:! WildcardType java-type)] + (let [java-type (:coerce WildcardType java-type)] (case [(array.read +0 (WildcardType::getUpperBounds [] java-type)) (array.read +0 (WildcardType::getLowerBounds [] java-type))] (^or [(#.Some bound) _] [_ (#.Some bound)]) @@ -580,7 +580,7 @@ (macro/wrap Any))) (host.instance? Class java-type) - (let [java-type (:! (Class Object) java-type) + (let [java-type (:coerce (Class Object) java-type) class-name (Class::getName [] java-type)] (macro/wrap (case (array.size (Class::getTypeParameters [] java-type)) +0 @@ -594,7 +594,7 @@ (type.univ-q arity))))) (host.instance? ParameterizedType java-type) - (let [java-type (:! ParameterizedType java-type) + (let [java-type (:coerce ParameterizedType java-type) raw (ParameterizedType::getRawType [] java-type)] (if (host.instance? Class raw) (do macro.Monad @@ -602,13 +602,13 @@ (ParameterizedType::getActualTypeArguments []) array.to-list (monad.map @ (java-type-to-lux-type mappings)))] - (macro/wrap (#.Primitive (Class::getName [] (:! (Class Object) raw)) + (macro/wrap (#.Primitive (Class::getName [] (:coerce (Class Object) raw)) paramsT))) (lang.throw jvm-type-is-not-a-class raw))) (host.instance? GenericArrayType java-type) (do macro.Monad - [innerT (|> (:! GenericArrayType java-type) + [innerT (|> (:coerce GenericArrayType java-type) (GenericArrayType::getGenericComponentType []) (java-type-to-lux-type mappings))] (wrap (#.Primitive "#Array" (list innerT)))) @@ -884,10 +884,10 @@ (def: (java-type-to-parameter type) (-> java/lang/reflect/Type (Meta Text)) (cond (host.instance? Class type) - (macro/wrap (Class::getName [] (:! Class type))) + (macro/wrap (Class::getName [] (:coerce Class type))) (host.instance? ParameterizedType type) - (java-type-to-parameter (ParameterizedType::getRawType [] (:! ParameterizedType type))) + (java-type-to-parameter (ParameterizedType::getRawType [] (:coerce ParameterizedType type))) (or (host.instance? TypeVariable type) (host.instance? WildcardType type)) @@ -895,7 +895,7 @@ (host.instance? GenericArrayType type) (do macro.Monad - [componentP (java-type-to-parameter (GenericArrayType::getGenericComponentType [] (:! GenericArrayType type)))] + [componentP (java-type-to-parameter (GenericArrayType::getGenericComponentType [] (:coerce GenericArrayType type)))] (wrap (format componentP "[]"))) ## else diff --git a/stdlib/source/lux/lang/compiler/synthesis/case.lux b/stdlib/source/lux/lang/compiler/synthesis/case.lux index b7f224168..c12930963 100644 --- a/stdlib/source/lux/lang/compiler/synthesis/case.lux +++ b/stdlib/source/lux/lang/compiler/synthesis/case.lux @@ -99,7 +99,7 @@ rightP )) ([#//.Bool bool/=] - [#//.I64 (:! (Eq I64) i/=)] + [#//.I64 (:coerce (Eq I64) i/=)] [#//.F64 frac/=] [#//.Text text/=]) diff --git a/stdlib/source/lux/lang/compiler/translation/scheme/case.jvm.lux b/stdlib/source/lux/lang/compiler/translation/scheme/case.jvm.lux index e5d12a005..40d2625fb 100644 --- a/stdlib/source/lux/lang/compiler/translation/scheme/case.jvm.lux +++ b/stdlib/source/lux/lang/compiler/translation/scheme/case.jvm.lux @@ -32,7 +32,7 @@ (.let [method (.if tail? //runtime.product//right //runtime.product//left)] - (method source (_.int (:! Int idx))))) + (method source (_.int (:coerce Int idx))))) valueO pathP)))) diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux index 91a83864c..982dec71b 100644 --- a/stdlib/source/lux/macro.lux +++ b/stdlib/source/lux/macro.lux @@ -251,7 +251,7 @@ [def-type def-anns def-value] (: (Maybe Definition) (|> (: Module $module) (get@ #.definitions) (get name)))] (if (and (macro? def-anns) (or (export? def-anns) (text/= module this-module))) - (#.Some (:! Macro def-value)) + (#.Some (:coerce Macro def-value)) (case (get-symbol-ann (ident-for #.alias) def-anns) (#.Some [r-module r-name]) (find-macro' modules this-module r-module r-name) @@ -539,7 +539,7 @@ (-> Ident (Meta Type)) (do Monad [[def-type def-data def-value] (find-def name)] - (wrap (:! Type def-value)))) + (wrap (:coerce Type def-value)))) (def: #export (definitions module-name) {#.doc "The entire list of definitions in a module (including the unexported/private ones)."} diff --git a/stdlib/source/lux/world/blob.jvm.lux b/stdlib/source/lux/world/blob.jvm.lux index df9fcf8d2..4565e5499 100644 --- a/stdlib/source/lux/world/blob.jvm.lux +++ b/stdlib/source/lux/world/blob.jvm.lux @@ -27,7 +27,7 @@ (def: i64 (-> (primitive "java.lang.Byte") I64) - (|>> host.byte-to-long (:! I64) (bit.and byte-mask))) + (|>> host.byte-to-long (:coerce I64) (bit.and byte-mask))) (def: byte (-> (I64 Any) (primitive "java.lang.Byte")) @@ -134,7 +134,7 @@ (ex.throw index-out-of-bounds ) ## else - (#e.Success (Arrays::copyOfRange [blob (:! Int from) (:! Int (inc to))])))))) + (#e.Success (Arrays::copyOfRange [blob (:coerce Int from) (:coerce Int (inc to))])))))) (def: #export (slice' from blob) (-> Nat Blob (e.Error Blob)) diff --git a/stdlib/source/lux/world/console.lux b/stdlib/source/lux/world/console.lux index b66dce4da..49432f777 100644 --- a/stdlib/source/lux/world/console.lux +++ b/stdlib/source/lux/world/console.lux @@ -82,7 +82,7 @@ (wrap (StringBuffer::toString [] buffer)))) _ - (exec (Appendable::append [(:! String char)] buffer) + (exec (Appendable::append [(:coerce String char)] buffer) (recur [])))))))) (def: (write message) diff --git a/stdlib/test/test/lux.lux b/stdlib/test/test/lux.lux index 3c731ebc4..6061f4829 100644 --- a/stdlib/test/test/lux.lux +++ b/stdlib/test/test/lux.lux @@ -145,7 +145,7 @@ (def: frac-deg (r.Random Deg) (|> r.deg - (:: r.Functor map (|>> (:! Nat) (bit.left-shift +11) (bit.right-shift +11) (:! Deg))))) + (:: r.Functor map (|>> (bit.left-shift +11) (bit.right-shift +11))))) (do-template [category rand-gen -> <- = ] [(context: (format "[" category "] " "Numeric conversions") diff --git a/stdlib/test/test/lux/lang/compiler/analysis/function.lux b/stdlib/test/test/lux/lang/compiler/analysis/function.lux index 147cbcc9e..33bae5c9b 100644 --- a/stdlib/test/test/lux/lang/compiler/analysis/function.lux +++ b/stdlib/test/test/lux/lang/compiler/analysis/function.lux @@ -24,7 +24,7 @@ (// ["_." primitive] ["_." structure])) -(def: analyse (expressionA.analyser (:! lang.Eval []))) +(def: analyse (expressionA.analyser (:coerce lang.Eval []))) (def: (check-apply expectedT num-args analysis) (-> Type Nat (Meta Analysis) Bool) diff --git a/stdlib/test/test/lux/lang/compiler/analysis/primitive.lux b/stdlib/test/test/lux/lang/compiler/analysis/primitive.lux index 18b8f6c46..0d4bffb39 100644 --- a/stdlib/test/test/lux/lang/compiler/analysis/primitive.lux +++ b/stdlib/test/test/lux/lang/compiler/analysis/primitive.lux @@ -17,7 +17,7 @@ [".A" expression]))) test)) -(def: #export analyse (expressionA.analyser (:! lang.Eval []))) +(def: #export analyse (expressionA.analyser (:coerce lang.Eval []))) (def: unit (r.Random Code) diff --git a/stdlib/test/test/lux/lang/compiler/analysis/reference.lux b/stdlib/test/test/lux/lang/compiler/analysis/reference.lux index ff7ce3412..98db0a006 100644 --- a/stdlib/test/test/lux/lang/compiler/analysis/reference.lux +++ b/stdlib/test/test/lux/lang/compiler/analysis/reference.lux @@ -20,7 +20,7 @@ test) (// ["_." primitive])) -(def: analyse (expressionA.analyser (:! lang.Eval []))) +(def: analyse (expressionA.analyser (:coerce lang.Eval []))) (context: "References" (<| (times +100) diff --git a/stdlib/test/test/lux/lang/compiler/analysis/structure.lux b/stdlib/test/test/lux/lang/compiler/analysis/structure.lux index 2f3e369d6..1ad28e16b 100644 --- a/stdlib/test/test/lux/lang/compiler/analysis/structure.lux +++ b/stdlib/test/test/lux/lang/compiler/analysis/structure.lux @@ -26,7 +26,7 @@ test) (// ["_." primitive])) -(def: analyse (expressionA.analyser (:! lang.Eval []))) +(def: analyse (expressionA.analyser (:coerce lang.Eval []))) (do-template [ ] [(def: #export diff --git a/stdlib/test/test/lux/lang/compiler/synthesis/primitive.lux b/stdlib/test/test/lux/lang/compiler/synthesis/primitive.lux index 1c8368204..aa0da89ea 100644 --- a/stdlib/test/test/lux/lang/compiler/synthesis/primitive.lux +++ b/stdlib/test/test/lux/lang/compiler/synthesis/primitive.lux @@ -33,7 +33,7 @@ (case [synthesis analysis] [(#//.Primitive (#//.Text valueS)) (#analysisL.Primitive (#analysisL.Unit valueA))] - (is? valueS (:! Text valueA)) + (is? valueS (:coerce Text valueA)) [(#//.Primitive (#//.Bool valueS)) (#analysisL.Primitive (#analysisL.Bool valueA))] -- cgit v1.2.3