diff options
Diffstat (limited to '')
132 files changed, 636 insertions, 787 deletions
diff --git a/luxc/src/lux/analyser.clj b/luxc/src/lux/analyser.clj index 29c9e7588..641dfa947 100644 --- a/luxc/src/lux/analyser.clj +++ b/luxc/src/lux/analyser.clj @@ -12,8 +12,7 @@ [module :as &&module] [parser :as &&a-parser]) (lux.analyser.proc [common :as &&common] - [jvm :as &&jvm] - [js :as &&js]))) + [jvm :as &&jvm]))) ;; [Utils] (defn analyse-variant+ [analyse exo-type ident values] @@ -172,10 +171,6 @@ (|do [_ &/jvm-host] (&&jvm/analyse-host analyse exo-type compilers ?procedure parameters)) - (.startsWith ^String ?procedure "js") - (|do [_ &/js-host] - (&&js/analyse-host analyse exo-type ?procedure parameters)) - :else (&&common/analyse-proc analyse exo-type ?procedure parameters)))) @@ -199,7 +194,7 @@ ;; [Resources] (defn analyse [optimize eval! compile-module compilers] (|do [asts &parser/parse] - (&/flat-map% (partial analyse-ast optimize eval! compile-module compilers &type/Bottom) asts))) + (&/flat-map% (partial analyse-ast optimize eval! compile-module compilers &type/Nothing) asts))) (defn clean-output [?var analysis] (|do [:let [[[?output-type ?output-cursor] ?output-term] analysis] diff --git a/luxc/src/lux/analyser/case.clj b/luxc/src/lux/analyser/case.clj index ff00f1aa8..2694c9447 100644 --- a/luxc/src/lux/analyser/case.clj +++ b/luxc/src/lux/analyser/case.clj @@ -38,7 +38,7 @@ (&/T [(&/T ["" -1 -1]) (&/$Tuple &/$Nil)])) (defn ^:private resolve-type [type] - (if (&type/type= &type/Top type) + (if (&type/type= &type/Any type) (return type) (|case type (&/$Var ?id) @@ -301,7 +301,7 @@ (&/$Tuple ?members) (|case ?members (&/$Nil) - (|do [_ (&type/check value-type &type/Top) + (|do [_ (&type/check value-type &type/Any) =kont kont] (return (&/T [($TupleTestAC (&/|list)) =kont]))) @@ -579,7 +579,7 @@ (|case ?structs (&/$Nil) (|do [value-type* (resolve-type value-type)] - (if (&type/type= &type/Top value-type*) + (if (&type/type= &type/Any value-type*) (return true) (&/fail-with-loc "[Pattern-maching Error] Unit is not total."))) diff --git a/luxc/src/lux/analyser/lux.clj b/luxc/src/lux/analyser/lux.clj index 639d71cb6..781f9854b 100644 --- a/luxc/src/lux/analyser/lux.clj +++ b/luxc/src/lux/analyser/lux.clj @@ -45,7 +45,7 @@ ;; [Exports] (defn analyse-unit [analyse ?exo-type] (|do [_cursor &/cursor - _ (&type/check ?exo-type &type/Top)] + _ (&type/check ?exo-type &type/Any)] (return (&/|list (&&/|meta ?exo-type _cursor (&&/$tuple (&/|list))))))) @@ -689,7 +689,7 @@ (return (&/|list (coerce ==type =value))))) (let [program-type (&/$Function (&/$Apply &type/Text &type/List) - (&/$Apply &type/Top &type/IO))] + (&/$Apply &type/Any &type/IO))] (defn analyse-program [analyse optimize compile-program ?program] (|do [_ &/ensure-statement =program (&&/analyse-1 analyse program-type ?program) diff --git a/luxc/src/lux/analyser/module.clj b/luxc/src/lux/analyser/module.clj index fca407c4b..130004701 100644 --- a/luxc/src/lux/analyser/module.clj +++ b/luxc/src/lux/analyser/module.clj @@ -49,7 +49,7 @@ (do-template [<flagger> <asker> <tag>] (do (defn <flagger> - "(-> Text (Lux Top))" + "(-> Text (Lux Any))" [module-name] (fn [state] (let [state* (&/update$ &/$modules @@ -382,7 +382,7 @@ state))))) (defn ensure-can-see-tag - "(-> Text Text (Lux Top))" + "(-> Text Text (Lux Any))" [module tag-name] (|do [current-module &/get-module-name] (fn [state] diff --git a/luxc/src/lux/analyser/proc/common.clj b/luxc/src/lux/analyser/proc/common.clj index 19d833cc2..ac5900634 100644 --- a/luxc/src/lux/analyser/proc/common.clj +++ b/luxc/src/lux/analyser/proc/common.clj @@ -122,7 +122,7 @@ (&/|list))))))) (do-template [<name> <op>] - (let [inputT (&/$Apply &type/Top &type/I64) + (let [inputT (&/$Apply &type/Any &type/I64) outputT &type/I64] (defn <name> [analyse exo-type ?values] (|do [:let [(&/$Cons mask (&/$Cons input (&/$Nil))) ?values] @@ -139,7 +139,7 @@ ) (do-template [<name> <op>] - (let [inputT (&/$Apply &type/Top &type/I64) + (let [inputT (&/$Apply &type/Any &type/I64) outputT &type/I64] (defn <name> [analyse exo-type ?values] (|do [:let [(&/$Cons shift (&/$Cons input (&/$Nil))) ?values] @@ -167,9 +167,9 @@ (return (&/|list (&&/|meta exo-type _cursor (&&/$proc (&/T <proc>) (&/|list subjectA paramA) (&/|list)))))))) - ^:private analyse-i64-eq ["i64" "="] (&/$Apply &type/Top &type/I64) &type/Bool - ^:private analyse-i64-add ["i64" "+"] (&/$Apply &type/Top &type/I64) &type/I64 - ^:private analyse-i64-sub ["i64" "-"] (&/$Apply &type/Top &type/I64) &type/I64 + ^:private analyse-i64-eq ["i64" "="] (&/$Apply &type/Any &type/I64) &type/Bool + ^:private analyse-i64-add ["i64" "+"] (&/$Apply &type/Any &type/I64) &type/I64 + ^:private analyse-i64-sub ["i64" "-"] (&/$Apply &type/Any &type/I64) &type/I64 ) (do-template [<name> <proc> <input-type> <output-type>] @@ -248,9 +248,9 @@ ^:private analyse-int-frac &type/Int &type/Frac ["int" "frac"] ^:private analyse-frac-int &type/Frac &type/Int ["frac" "int"] - ^:private analyse-io-log &type/Text &type/Top ["io" "log"] - ^:private analyse-io-error &type/Text &type/Bottom ["io" "error"] - ^:private analyse-io-exit &type/Int &type/Bottom ["io" "exit"] + ^:private analyse-io-log &type/Text &type/Any ["io" "log"] + ^:private analyse-io-error &type/Text &type/Nothing ["io" "error"] + ^:private analyse-io-exit &type/Int &type/Nothing ["io" "exit"] ) (defn ^:private analyse-io-current-time [analyse exo-type ?values] @@ -410,7 +410,7 @@ (|do [:let [(&/$Cons valueC (&/$Cons boxC (&/$Nil))) ?values] boxA (&&/analyse-1 analyse (&type/Box threadT valueT) boxC) valueA (&&/analyse-1 analyse valueT valueC) - _ (&type/check exo-type &type/Top) + _ (&type/check exo-type &type/Any) _cursor &/cursor] (return (&/|list (&&/|meta exo-type _cursor (&&/$proc (&/T ["box" "write"]) (&/|list valueA boxA) (&/|list))))))))))) @@ -425,8 +425,8 @@ (defn ^:private analyse-process-schedule [analyse exo-type ?values] (|do [:let [(&/$Cons ?milliseconds (&/$Cons ?procedure (&/$Nil))) ?values] =milliseconds (&&/analyse-1 analyse &type/Nat ?milliseconds) - =procedure (&&/analyse-1 analyse (&/$Apply &type/Top &type/IO) ?procedure) - _ (&type/check exo-type &type/Top) + =procedure (&&/analyse-1 analyse (&/$Apply &type/Any &type/IO) ?procedure) + _ (&type/check exo-type &type/Any) _cursor &/cursor] (return (&/|list (&&/|meta exo-type _cursor (&&/$proc (&/T ["process" "schedule"]) (&/|list =milliseconds =procedure) (&/|list))))))) diff --git a/luxc/src/lux/analyser/proc/js.clj b/luxc/src/lux/analyser/proc/js.clj deleted file mode 100644 index 8b218ee43..000000000 --- a/luxc/src/lux/analyser/proc/js.clj +++ /dev/null @@ -1,93 +0,0 @@ -(ns lux.analyser.proc.js - (:require (clojure [template :refer [do-template]] - [string :as string]) - clojure.core.match - clojure.core.match.array - (lux [base :as & :refer [|let |do return* return |case assert!]] - [type :as &type]) - (lux.analyser [base :as &&]))) - -(do-template [<name> <proc>] - (defn <name> [analyse exo-type ?values] - (|do [:let [(&/$Cons ?function ?args) ?values] - =function (&&/analyse-1 analyse (&/$Primitive "function" &/$Nil) ?function) - =args (&/map% (partial &&/analyse-1+ analyse) ?args) - _ (&type/check exo-type (&/$Primitive "object" &/$Nil)) - _cursor &/cursor] - (return (&/|list (&&/|meta exo-type _cursor - (&&/$proc (&/T ["js" <proc>]) (&/$Cons =function =args) (&/|list))))))) - - ^:private analyse-js-new "new" - ^:private analyse-js-call "call" - ) - -(defn ^:private analyse-js-object-call [analyse exo-type ?values] - (|do [:let [(&/$Cons ?object (&/$Cons ?field ?args)) ?values] - =object (&&/analyse-1 analyse (&/$Primitive "object" &/$Nil) ?object) - =field (&&/analyse-1 analyse &type/Text ?field) - =args (&/map% (partial &&/analyse-1+ analyse) ?args) - _ (&type/check exo-type (&/$Primitive "object" &/$Nil)) - _cursor &/cursor] - (return (&/|list (&&/|meta exo-type _cursor - (&&/$proc (&/T ["js" "object-call"]) (&/$Cons =object (&/$Cons =field =args)) (&/|list))))))) - -(defn ^:private analyse-js-ref [analyse exo-type ?values] - (|do [:let [(&/$Cons [_ (&/$Text ?ref-name)] (&/$Nil)) ?values] - _ (&type/check exo-type (&/$Primitive "object" &/$Nil)) - _cursor &/cursor] - (return (&/|list (&&/|meta exo-type _cursor - (&&/$proc (&/T ["js" "ref"]) (&/|list) (&/|list ?ref-name))))))) - -(do-template [<name> <proc>] - (defn <name> [analyse exo-type ?values] - (|do [:let [(&/$Cons ?object (&/$Cons ?field (&/$Nil))) ?values] - =object (&&/analyse-1 analyse (&/$Primitive "object" &/$Nil) ?object) - =field (&&/analyse-1 analyse &type/Text ?field) - _ (&type/check exo-type (&/$Primitive "object" &/$Nil)) - _cursor &/cursor] - (return (&/|list (&&/|meta exo-type _cursor - (&&/$proc (&/T ["js" <proc>]) (&/|list =object =field) (&/|list))))))) - - ^:private analyse-js-get-field "get-field" - ^:private analyse-js-delete-field "delete-field" - ) - -(defn ^:private analyse-js-set-field [analyse exo-type ?values] - (|do [:let [(&/$Cons ?object (&/$Cons ?field (&/$Cons ?value (&/$Nil)))) ?values] - =object (&&/analyse-1 analyse (&/$Primitive "object" &/$Nil) ?object) - =field (&&/analyse-1 analyse &type/Text ?field) - =value (&&/analyse-1+ analyse ?value) - _ (&type/check exo-type (&/$Primitive "object" &/$Nil)) - _cursor &/cursor] - (return (&/|list (&&/|meta exo-type _cursor - (&&/$proc (&/T ["js" "set-field"]) (&/|list =object =field =value) (&/|list))))))) - -(do-template [<name> <proc> <type>] - (defn <name> [analyse exo-type ?values] - (|do [:let [(&/$Nil) ?values] - :let [output-type (&/$Primitive <type> &/$Nil)] - _ (&type/check exo-type output-type) - _cursor &/cursor] - (return (&/|list (&&/|meta exo-type _cursor - (&&/$proc (&/T ["js" <proc>]) (&/|list) (&/|list))))))) - - ^:private analyse-js-object "object" "object" - ^:private analyse-js-null "null" "object" - ^:private analyse-js-undefined "undefined" "undefined" - ) - -(defn analyse-host [analyse exo-type proc ?values] - (case proc - "new" (analyse-js-new analyse exo-type ?values) - "call" (analyse-js-call analyse exo-type ?values) - "object-call" (analyse-js-object-call analyse exo-type ?values) - "ref" (analyse-js-ref analyse exo-type ?values) - "object" (analyse-js-object analyse exo-type ?values) - "get-field" (analyse-js-get-field analyse exo-type ?values) - "set-field" (analyse-js-set-field analyse exo-type ?values) - "delete-field" (analyse-js-delete-field analyse exo-type ?values) - "null" (analyse-js-null analyse exo-type ?values) - "undefined" (analyse-js-undefined analyse exo-type ?values) - ;; else - (&/fail-with-loc (str "[Analyser Error] Unknown host procedure: " ["js" proc]))) - ) diff --git a/luxc/src/lux/analyser/proc/jvm.clj b/luxc/src/lux/analyser/proc/jvm.clj index 2eef1082c..8ad13c74b 100644 --- a/luxc/src/lux/analyser/proc/jvm.clj +++ b/luxc/src/lux/analyser/proc/jvm.clj @@ -194,7 +194,7 @@ "float" (return (&/$Primitive "java.lang.Float" &/$Nil)) "double" (return (&/$Primitive "java.lang.Double" &/$Nil)) "char" (return (&/$Primitive "java.lang.Character" &/$Nil)) - "void" (return &type/Top) + "void" (return &type/Any) ;; else (|do [=params (&/map% (partial generic-class->type env) params)] (return (&/$Primitive name =params)))) @@ -252,7 +252,7 @@ itype (generic-class->type full-env itype*)] (if (double-register-gclass? itype*) (&&env/with-local iname itype - (&&env/with-local "" &type/Bottom + (&&env/with-local "" &type/Nothing body*)) (&&env/with-local iname itype body*))))) @@ -265,7 +265,7 @@ (&/$ConstructorMethodSyntax =privacy-modifier ?strict ?anns ?gvars ?exceptions ?inputs ?ctor-args ?body) (|do [method-env (make-type-env ?gvars) :let [full-env (&/|++ class-env method-env)] - :let [output-type &type/Top] + :let [output-type &type/Any] =ctor-args (&/map% (fn [ctor-arg] (|do [:let [[ca-type ca-term] ctor-arg] =ca-type (generic-class->type full-env ca-type) @@ -635,7 +635,7 @@ _ (&type/check (&/$Primitive "java.lang.Throwable" &/$Nil) (&&/expr-type* =ex)) [throw-class throw-params] (ensure-object (&&/expr-type* =ex)) _cursor &/cursor - _ (&type/check exo-type &type/Bottom)] + _ (&type/check exo-type &type/Nothing)] (return (&/|list (&&/|meta exo-type _cursor (&&/$proc (&/T ["jvm" "throw"]) (&/|list =ex) (&/|list))))))) @@ -673,7 +673,7 @@ :let [gclass (&host-type/gtype->gclass gtype)] =type (&host-type/instance-param &type/existential &/$Nil gtype) =value (&&/analyse-1 analyse =type value) - :let [output-type &type/Top] + :let [output-type &type/Any] _ (&type/check exo-type output-type) _cursor &/cursor] (return (&/|list (&&/|meta exo-type _cursor @@ -690,7 +690,7 @@ :let [gclass (&host-type/gtype->gclass gtype)] =type (analyse-field-access-helper obj-type gvars gtype) =value (&&/analyse-1 analyse =type value) - :let [output-type &type/Top] + :let [output-type &type/Any] _ (&type/check exo-type output-type) _cursor &/cursor] (return (&/|list (&&/|meta exo-type _cursor @@ -829,7 +829,7 @@ _ (compile-interface interface-decl supers =anns =methods) :let [_ (println 'INTERFACE (str module "." (&/|first interface-decl)))] _cursor &/cursor] - (return (&/|list (&&/|meta &type/Top _cursor + (return (&/|list (&&/|meta &type/Any _cursor (&&/$tuple (&/|list))))))) (defn ^:private analyse-jvm-class [analyse compile-class class-decl super-class interfaces =inheritance-modifier =anns ?fields methods] @@ -848,7 +848,7 @@ _ &/pop-dummy-name :let [_ (println 'CLASS full-name)] _cursor &/cursor] - (return (&/|list (&&/|meta &type/Top _cursor + (return (&/|list (&&/|meta &type/Any _cursor (&&/$tuple (&/|list)))))))) (defn ^:private captured-source [env-entry] diff --git a/luxc/src/lux/analyser/record.clj b/luxc/src/lux/analyser/record.clj index 595858873..3d3d8169f 100644 --- a/luxc/src/lux/analyser/record.clj +++ b/luxc/src/lux/analyser/record.clj @@ -11,7 +11,7 @@ "(-> (List (, Syntax Syntax)) (Lux (List Syntax)))" (|do [[tag-group tag-type] (|case pairs (&/$Nil) - (return (&/T [&/$Nil &type/Top])) + (return (&/T [&/$Nil &type/Any])) (&/$Cons [[_ (&/$Tag tag1)] _] _) (|do [[module name] (&&/resolved-ident tag1) diff --git a/luxc/src/lux/base.clj b/luxc/src/lux/base.clj index 8867d0b1e..e1f48d23b 100644 --- a/luxc/src/lux/base.clj +++ b/luxc/src/lux/base.clj @@ -1070,7 +1070,7 @@ _ output)))))) -(def ^{:doc "(Meta Top)"} +(def ^{:doc "(Meta Any)"} ensure-statement (fn [state] (|case (get$ $expected state) @@ -1325,7 +1325,7 @@ (return* state (|keys (get$ $modules state))))) (defn when% - "(-> Bool (Meta Top) (Meta Top))" + "(-> Bool (Meta Any) (Meta Any))" [test body] (if test body diff --git a/luxc/src/lux/compiler/jvm/proc/host.clj b/luxc/src/lux/compiler/jvm/proc/host.clj index da2c5ccde..91c39effb 100644 --- a/luxc/src/lux/compiler/jvm/proc/host.clj +++ b/luxc/src/lux/compiler/jvm/proc/host.clj @@ -47,7 +47,7 @@ double-class "java.lang.Double" char-class "java.lang.Character"] (defn prepare-return! [^MethodVisitor *writer* *type*] - (if (&type/type= &type/Top *type*) + (if (&type/type= &type/Any *type*) (.visitLdcInsn *writer* &/unit-tag) (|case *type* (&/$Primitive "boolean" (&/$Nil)) diff --git a/luxc/src/lux/host.clj b/luxc/src/lux/host.clj index 3f0181c99..5b93f5b49 100644 --- a/luxc/src/lux/host.clj +++ b/luxc/src/lux/host.clj @@ -75,7 +75,7 @@ (return ex-type-class) _ - (if (&type/type= &type/Top type) + (if (&type/type= &type/Any type) (return "V") (assert false (str '->java-sig " " (&type/show-type type)))) ))) diff --git a/luxc/src/lux/type.clj b/luxc/src/lux/type.clj index c2650c5b8..3a7b7cc9b 100644 --- a/luxc/src/lux/type.clj +++ b/luxc/src/lux/type.clj @@ -53,27 +53,27 @@ Box "#Box" ) -(def Bottom - (&/$Named (&/T ["lux" "Bottom"]) +(def Nothing + (&/$Named (&/T ["lux" "Nothing"]) (&/$UnivQ empty-env (&/$Bound 1)))) -(def Top - (&/$Named (&/T ["lux" "Top"]) +(def Any + (&/$Named (&/T ["lux" "Any"]) (&/$ExQ empty-env (&/$Bound 1)))) (def IO (&/$Named (&/T ["lux/codata" "IO"]) (&/$UnivQ empty-env - (&/$Function Bottom (&/$Bound 1))))) + (&/$Function Nothing (&/$Bound 1))))) (def List (&/$Named (&/T ["lux" "List"]) (&/$UnivQ empty-env (&/$Sum ;; lux;Nil - Top + Any ;; lux;Cons (&/$Product (&/$Bound 1) (&/$Apply (&/$Bound 1) @@ -84,7 +84,7 @@ (&/$UnivQ empty-env (&/$Sum ;; lux;None - Top + Any ;; lux;Some (&/$Bound 1)) ))) @@ -94,7 +94,7 @@ (let [Type (&/$Apply (&/$Bound 1) (&/$Bound 0)) TypeList (&/$Apply Type List) TypePair (&/$Product Type Type)] - (&/$Apply Bottom + (&/$Apply Nothing (&/$UnivQ empty-env (&/$Sum ;; Primitive @@ -424,8 +424,8 @@ (&/$Nil) <unit>)) - Variant$ &/$Sum Bottom - Tuple$ &/$Product Top + Variant$ &/$Sum Nothing + Tuple$ &/$Product Any ) (defn show-type [^objects type] @@ -930,8 +930,8 @@ (&/$Cons last prevs) (&/fold (fn [r l] (<plus> l r)) last prevs))) - fold-prod Top &/$Product - fold-sum Bottom &/$Sum + fold-prod Any &/$Product + fold-sum Nothing &/$Sum ) (def create-var+ diff --git a/luxc/src/lux/type/host.clj b/luxc/src/lux/type/host.clj index d56e85fd7..bb7459c48 100644 --- a/luxc/src/lux/type/host.clj +++ b/luxc/src/lux/type/host.clj @@ -58,8 +58,8 @@ )] output))) -(def ^:private Top - (&/$Named (&/T ["lux" "Top"]) +(def ^:private Any + (&/$Named (&/T ["lux" "Any"]) (&/$ExQ (&/|list) (&/$Bound 1)))) @@ -139,7 +139,7 @@ (if-let [[_ _ arr-obrackets arr-obase simple-base arr-pbrackets arr-pbase] (re-find class-name-re gclass-name)] (let [base (or arr-obase simple-base (jprim->lprim arr-pbase))] (if (.equals "void" base) - Top + Any (reduce (fn [inner _] (&/$Primitive array-data-tag (&/|list inner))) (&/$Primitive base (try (-> (Class/forName base) .getTypeParameters seq count (repeat (&/$Primitive "java.lang.Object" &/$Nil)) @@ -184,7 +184,7 @@ (defn principal-class [refl-type] (cond (instance? Class refl-type) (let [class-type (class->type refl-type)] - (if (type= Top class-type) + (if (type= Any class-type) "V" (|case class-type (&/$Primitive "#Array" (&/$Cons (&/$Primitive class-name _) (&/$Nil))) diff --git a/new-luxc/source/luxc/cache/io.lux b/new-luxc/source/luxc/cache/io.lux index 998c658ac..2d1f373d5 100644 --- a/new-luxc/source/luxc/cache/io.lux +++ b/new-luxc/source/luxc/cache/io.lux @@ -65,7 +65,7 @@ (wrap (list.concat root-modules)))) (def: (delete file) - (-> File (Process Top)) + (-> File (Process Any)) (do io.Monad<Process> [deleted? (file.delete file)] (if deleted? @@ -73,7 +73,7 @@ (io.throw Cannot-Delete-Cached-File file)))) (def: (un-install target-dir module-name) - (-> File Text (Process Top)) + (-> File Text (Process Any)) (do io.Monad<Process> [#let [module-dir (///io.file target-dir module-name)] files (file.files module-dir) @@ -127,7 +127,7 @@ _ (un-install target-dir module-name)] (wrap (list)))))) -(type: Loader (-> Ident Blob (Error Top))) +(type: Loader (-> Ident Blob (Error Any))) (def: (install target-dir load-def module-name module) (-> File Loader Text Module (Process Module)) @@ -191,7 +191,7 @@ (:: @ map (dict.from-list text.Hash<Text>))))) (def: (set-cache cache) - (-> //.Cache (Process Top)) + (-> //.Cache (Process Any)) (do io.Monad<IO> [swapped? (atom.compare-and-swap //.empty cache ..cache)] (if swapped? @@ -199,13 +199,13 @@ (io.throw Cannot-Pre-Load-Cache-More-Than-Once "")))) (def: #export (pre-load source-dirs target-dir load-def) - (-> (List File) File Loader (Process Top)) + (-> (List File) File Loader (Process Any)) (do io.Monad<Process> [loaded-cache (pre-load' source-dirs (///io.platform-target target-dir) load-def)] (set-cache loaded-cache))) (def: #export (clean target-dir wanted-modules) - (-> File (Set Text) (Process Top)) + (-> File (Set Text) (Process Any)) (do io.Monad<Process> [cached (cached target-dir) _ (|> cached diff --git a/new-luxc/source/luxc/io.jvm.lux b/new-luxc/source/luxc/io.jvm.lux index 79450a502..16c2f4726 100644 --- a/new-luxc/source/luxc/io.jvm.lux +++ b/new-luxc/source/luxc/io.jvm.lux @@ -82,7 +82,7 @@ (file.make-directory (sanitize (platform-target target-dir))))) (def: #export (prepare-module target-dir module-name) - (-> File Text (Process Top)) + (-> File Text (Process Any)) (do io.Monad<Process> [#let [module-path (|> module-name (format (platform-target target-dir) "/") @@ -98,7 +98,7 @@ "Target: " target-dir "\n")))))) (def: #export (write target name content) - (-> File Text Blob (Process Top)) + (-> File Text Blob (Process Any)) (|> name (format (platform-target target) "/") sanitize diff --git a/new-luxc/source/luxc/lang/analysis/type.lux b/new-luxc/source/luxc/lang/analysis/type.lux index c3296fd21..6d89dd5ef 100644 --- a/new-luxc/source/luxc/lang/analysis/type.lux +++ b/new-luxc/source/luxc/lang/analysis/type.lux @@ -23,5 +23,5 @@ (do macro.Monad<Meta> [actualT (eval Type type) _ (&.infer (:! Type actualT))] - (&.with-type Top + (&.with-type Any (analyse value)))) diff --git a/new-luxc/source/luxc/lang/extension.lux b/new-luxc/source/luxc/lang/extension.lux index ef7a4f864..254dd18ca 100644 --- a/new-luxc/source/luxc/lang/extension.lux +++ b/new-luxc/source/luxc/lang/extension.lux @@ -27,7 +27,7 @@ (type: #export Analysis (-> (-> Code (Meta Code)) - (-> Type Code (Meta Top)) + (-> Type Code (Meta Any)) (List Code) (Meta Code))) (type: #export Synthesis @@ -39,7 +39,7 @@ (-> (List Code) (Meta Code))) (type: #export Statement - (-> (List Code) (Meta Top))) + (-> (List Code) (Meta Any))) (type: #export Extensions {#analysis (Dict Text Analysis) @@ -61,9 +61,9 @@ (|> compiler (get@ #.extensions) (:! Extensions))]))) (def: (set extensions) - (-> Extensions (Meta Top)) + (-> Extensions (Meta Any)) (function (_ compiler) - (#e.Success [(set@ #.extensions (:! Bottom extensions) compiler) + (#e.Success [(set@ #.extensions (:! Nothing extensions) compiler) []]))) (do-template [<name> <type> <category> <exception>] @@ -99,7 +99,7 @@ (do-template [<name> <type> <category> <exception>] [(def: #export (<name> name extension) - (-> Text <type> (Meta Top)) + (-> Text <type> (Meta Any)) (do macro.Monad<Meta> [extensions ..get _ (//.assert <exception> name diff --git a/new-luxc/source/luxc/lang/extension/analysis/common.lux b/new-luxc/source/luxc/lang/extension/analysis/common.lux index 9f2ac5aa8..f22cdcdd1 100644 --- a/new-luxc/source/luxc/lang/extension/analysis/common.lux +++ b/new-luxc/source/luxc/lang/extension/analysis/common.lux @@ -191,9 +191,9 @@ Bundle (<| (prefix "io") (|> (dict.new text.Hash<Text>) - (install "log" (unary Text Top)) - (install "error" (unary Text Bottom)) - (install "exit" (unary Int Bottom)) + (install "log" (unary Text Any)) + (install "error" (unary Text Nothing)) + (install "exit" (unary Int Nothing)) (install "current-time" (nullary Int))))) (def: bit-procs @@ -410,7 +410,7 @@ (do macro.Monad<Meta> [[thread-id threadT] (&.with-type-env tc.var) [var-id varT] (&.with-type-env tc.var)] - ((binary varT (type (Box threadT varT)) Top proc) + ((binary varT (type (Box threadT varT)) Any proc) analyse eval args)))) (def: box-procs @@ -427,7 +427,7 @@ (<| (prefix "process") (|> (dict.new text.Hash<Text>) (install "parallelism-level" (nullary Nat)) - (install "schedule" (binary Nat (type (io.IO Top)) Top)) + (install "schedule" (binary Nat (type (io.IO Any)) Any)) ))) (def: #export procedures diff --git a/new-luxc/source/luxc/lang/extension/analysis/host.jvm.lux b/new-luxc/source/luxc/lang/extension/analysis/host.jvm.lux index 08ad014be..9ef06a4b1 100644 --- a/new-luxc/source/luxc/lang/extension/analysis/host.jvm.lux +++ b/new-luxc/source/luxc/lang/extension/analysis/host.jvm.lux @@ -477,12 +477,12 @@ (case args (^ (list exceptionC)) (do macro.Monad<Meta> - [_ (&.infer Bottom) + [_ (&.infer Nothing) [exceptionT exceptionA] (&common.with-unknown-type (analyse exceptionC)) exception-class (check-object exceptionT) ? (sub-class? "java.lang.Throwable" exception-class) - _ (: (Meta Top) + _ (: (Meta Any) (if ? (wrap []) (&.throw Non-Throwable exception-class)))] @@ -571,7 +571,7 @@ (java-type-to-lux-type mappings bound) _ - (macro/wrap Top))) + (macro/wrap Any))) (host.instance? Class java-type) (let [java-type (:! (Class Object) java-type) @@ -818,7 +818,7 @@ (case [classC fieldC] [[_ (#.Text class)] [_ (#.Text field)]] (do macro.Monad<Meta> - [_ (&.infer Top) + [_ (&.infer Any) [fieldT final?] (static-field class field) _ (&.assert Cannot-Set-Final-Field (format class "#" field) (not final?)) @@ -1130,7 +1130,7 @@ (def: (invoke//special proc) (-> Text ///.Analysis) (function (_ analyse eval args) - (case (: (e.Error [(List Code) [Text Text Code (List [Text Code]) Top]]) + (case (: (e.Error [(List Code) [Text Text Code (List [Text Code]) Any]]) (p.run args ($_ p.seq s.text s.text s.any (p.some (s.tuple (p.seq s.text s.any))) s.end!))) (#e.Success [_ [class method objectC argsTC _]]) (do macro.Monad<Meta> diff --git a/new-luxc/source/luxc/lang/extension/statement.lux b/new-luxc/source/luxc/lang/extension/statement.lux index f607ac154..a92995630 100644 --- a/new-luxc/source/luxc/lang/extension/statement.lux +++ b/new-luxc/source/luxc/lang/extension/statement.lux @@ -52,7 +52,7 @@ (wrap [annsI (:! Code annsV)]))) (def: (ensure-valid-alias def-name annotations value) - (-> Text Code Code (Meta Top)) + (-> Text Code Code (Meta Any)) (case [annotations value] (^multi [[_ (#.Record pairs)] [_ (#.Symbol _)]] (|> pairs list.size (n/= +1))) @@ -76,7 +76,7 @@ (do @ [_ (ensure-valid-alias def-name annotationsV valueC) _ (lang.with-scope - (statementT.translate-def def-name Bottom id annotationsV))] + (statementT.translate-def def-name Nothing id annotationsV))] (wrap [])) #.None @@ -107,7 +107,7 @@ (do macro.Monad<Meta> [[_ programA] (<| lang.with-scope (scopeL.with-local [args (type (List Text))]) - (lang.with-type (type (IO Top))) + (lang.with-type (type (IO Any))) (expressionA.analyser evalL.eval programC)) syntheses //.all-syntheses programI (expressionT.translate (expressionS.synthesize syntheses programA)) diff --git a/new-luxc/source/luxc/lang/host.jvm.lux b/new-luxc/source/luxc/lang/host.jvm.lux index 5819e5126..01afaeccc 100644 --- a/new-luxc/source/luxc/lang/host.jvm.lux +++ b/new-luxc/source/luxc/lang/host.jvm.lux @@ -97,13 +97,13 @@ (.function (_ compiler) (let [old (:! commonT.Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Bottom (set@ #commonT.anchor (#.Some anchor) old)) + (:! Nothing (set@ #commonT.anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host (|>> (:! commonT.Host) (set@ #commonT.anchor (get@ #commonT.anchor old)) - (:! Bottom)) + (:! Nothing)) compiler') output]) @@ -129,13 +129,13 @@ (.function (_ compiler) (let [old (:! commonT.Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Bottom (set@ #commonT.context [(&.normalize-name name) +0] old)) + (:! Nothing (set@ #commonT.context [(&.normalize-name name) +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host (|>> (:! commonT.Host) (set@ #commonT.context (get@ #commonT.context old)) - (:! Bottom)) + (:! Nothing)) compiler') output]) @@ -149,13 +149,13 @@ [old-name old-sub] (get@ #commonT.context old) new-name (format old-name "$" (%i (nat-to-int old-sub)))] (case (expr (set@ #.host - (:! Bottom (set@ #commonT.context [new-name +0] old)) + (:! Nothing (set@ #commonT.context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host (|>> (:! commonT.Host) (set@ #commonT.context [old-name (n/inc old-sub)]) - (:! Bottom)) + (:! Nothing)) compiler') [new-name output]]) diff --git a/new-luxc/source/luxc/lang/host/common-lisp.lux b/new-luxc/source/luxc/lang/host/common-lisp.lux index 7ae024a07..3ba69314d 100644 --- a/new-luxc/source/luxc/lang/host/common-lisp.lux +++ b/new-luxc/source/luxc/lang/host/common-lisp.lux @@ -8,8 +8,8 @@ (coll [list "list/" Functor<List> Fold<List>])) (type abstract))) -(abstract: #export Single {} Top) -(abstract: #export Poly {} Top) +(abstract: #export Single {} Any) +(abstract: #export Poly {} Any) (abstract: #export (Var kind) {} diff --git a/new-luxc/source/luxc/lang/host/jvm.lux b/new-luxc/source/luxc/lang/host/jvm.lux index 3fb55d2f9..20dd4c37b 100644 --- a/new-luxc/source/luxc/lang/host/jvm.lux +++ b/new-luxc/source/luxc/lang/host/jvm.lux @@ -122,7 +122,7 @@ ## Labels (def: #export new-label - (-> Top Label) + (-> Any Label) org/objectweb/asm/Label::new) (def: #export (simple-class name) diff --git a/new-luxc/source/luxc/lang/host/php.lux b/new-luxc/source/luxc/lang/host/php.lux index 982989320..603888d3e 100644 --- a/new-luxc/source/luxc/lang/host/php.lux +++ b/new-luxc/source/luxc/lang/host/php.lux @@ -7,11 +7,11 @@ (coll [list "list/" Functor<List> Fold<List>])) (type abstract))) -(abstract: Global' {} Top) -(abstract: Var' {} Top) -(abstract: Computation' {} Top) -(abstract: (Expression' k) {} Top) -(abstract: Statement' {} Top) +(abstract: Global' {} Any) +(abstract: Var' {} Any) +(abstract: Computation' {} Any) +(abstract: (Expression' k) {} Any) +(abstract: Statement' {} Any) (abstract: (Code' k) {} diff --git a/new-luxc/source/luxc/lang/host/python.lux b/new-luxc/source/luxc/lang/host/python.lux index 128de5811..b2b639cb2 100644 --- a/new-luxc/source/luxc/lang/host/python.lux +++ b/new-luxc/source/luxc/lang/host/python.lux @@ -7,9 +7,9 @@ (coll [list "list/" Functor<List> Fold<List>])) (type abstract))) -(abstract: #export Single {} Top) -(abstract: #export Poly {} Top) -(abstract: #export Keyword {} Top) +(abstract: #export Single {} Any) +(abstract: #export Poly {} Any) +(abstract: #export Keyword {} Any) (abstract: #export (Var kind) {} diff --git a/new-luxc/source/luxc/lang/host/r.lux b/new-luxc/source/luxc/lang/host/r.lux index 76e80d3d9..960063a11 100644 --- a/new-luxc/source/luxc/lang/host/r.lux +++ b/new-luxc/source/luxc/lang/host/r.lux @@ -8,8 +8,8 @@ (coll [list "list/" Functor<List> Fold<List>])) (type abstract))) -(abstract: #export Single {} Top) -(abstract: #export Poly {} Top) +(abstract: #export Single {} Any) +(abstract: #export Poly {} Any) (abstract: #export (Var kind) {} diff --git a/new-luxc/source/luxc/lang/host/scheme.lux b/new-luxc/source/luxc/lang/host/scheme.lux index 218903ca0..7c8c67ab0 100644 --- a/new-luxc/source/luxc/lang/host/scheme.lux +++ b/new-luxc/source/luxc/lang/host/scheme.lux @@ -8,8 +8,8 @@ (coll [list "list/" Functor<List> Fold<List>])) (type abstract))) -(abstract: #export Single {} Top) -(abstract: #export Poly {} Top) +(abstract: #export Single {} Any) +(abstract: #export Poly {} Any) (abstract: #export (Var kind) {} diff --git a/new-luxc/source/luxc/lang/init.lux b/new-luxc/source/luxc/lang/init.lux deleted file mode 100644 index da8fc9c07..000000000 --- a/new-luxc/source/luxc/lang/init.lux +++ /dev/null @@ -1,53 +0,0 @@ -(.module: - lux - [//] - (// [".L" extension] - (extension [".E" analysis] - [".E" synthesis] - [".E" translation] - [".E" statement]) - (translation (jvm [".T" common])))) - -(def: #export (cursor file) - (-> Text Cursor) - [file +1 +0]) - -(def: #export (source file code) - (-> Text Text Source) - [(cursor file) +0 code]) - -(def: dummy-source - Source - [.dummy-cursor +0 ""]) - -(def: #export type-context - Type-Context - {#.ex-counter +0 - #.var-counter +0 - #.var-bindings (list)}) - -(def: #export info - Info - {#.target (for {"JVM" "JVM" - "JS" "JS"}) - #.version //.version - #.mode #.Build}) - -(def: #export (compiler host) - (-> Top Lux) - {#.info ..info - #.source dummy-source - #.cursor .dummy-cursor - #.current-module #.None - #.modules (list) - #.scopes (list) - #.type-context ..type-context - #.expected #.None - #.seed +0 - #.scope-type-vars (list) - #.extensions (:! Bottom - {#extensionL.analysis analysisE.defaults - #extensionL.synthesis synthesisE.defaults - #extensionL.translation translationE.defaults - #extensionL.statement statementE.defaults}) - #.host (:! Bottom host)}) diff --git a/new-luxc/source/luxc/lang/translation.lux b/new-luxc/source/luxc/lang/translation.lux index 0899eccf2..0ed495c31 100644 --- a/new-luxc/source/luxc/lang/translation.lux +++ b/new-luxc/source/luxc/lang/translation.lux @@ -130,7 +130,7 @@ (&.throw Unrecognized-Statement (%code code)))) (def: (forgive-eof action) - (-> (Meta Top) (Meta Top)) + (-> (Meta Any) (Meta Any)) (function (_ compiler) (case (action compiler) (#e.Error error) @@ -172,7 +172,7 @@ e.assume)))}) ## (def: (write-module target-dir file-name module-name module artifacts) -## (-> File Text Text Module Artifacts (Process Top)) +## (-> File Text Text Module Artifacts (Process Any)) ## (do io.Monad<Process> ## [_ (monad.map @ (product.uncurry (&io.write target-dir)) ## (dict.entries artifacts))] @@ -269,7 +269,7 @@ (translate-module sources target prelude compiler))) (def: #export (translate-program sources target program) - (-> (List File) File Text (Process Top)) + (-> (List File) File Text (Process Any)) (do io.Monad<Process> [compiler (initialize sources target) _ (translate-module sources target program compiler) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp.lux b/new-luxc/source/luxc/lang/translation/common-lisp.lux index 704dfe91e..1ae046d33 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp.lux @@ -52,7 +52,7 @@ (type: #export Host {#context [Text Nat] #anchor (Maybe Anchor) - #loader (-> Expression (Error Top)) + #loader (-> Expression (Error Any)) #interpreter (-> Expression (Error LispObject)) #module-buffer (Maybe StringBuilder) #program-buffer StringBuilder}) @@ -80,12 +80,12 @@ (def: #export r-module-name Text (format "module" file-extension)) (def: #export init-module-buffer - (Meta Top) + (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Bottom)) + (:! Nothing)) compiler) []]))) @@ -96,13 +96,13 @@ [old-name old-sub] (get@ #context old) new-name (format old-name "f___" (%i (nat-to-int old-sub)))] (case (expr (set@ #.host - (:! Bottom (set@ #context [new-name +0] old)) + (:! Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #context [old-name (n/inc old-sub)]) - (:! Bottom)) + (:! Nothing)) compiler') [new-name output]]) @@ -124,13 +124,13 @@ (function (_ compiler) (let [old (:! Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Bottom (set@ #anchor (#.Some anchor) old)) + (:! Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #anchor (get@ #anchor old)) - (:! Bottom)) + (:! Nothing)) compiler') output]) @@ -174,7 +174,7 @@ (#e.Success output) (#e.Success [compiler output])))))] - [load! #loader Top] + [load! #loader Any] [interpret #interpreter LispObject] ) @@ -187,7 +187,7 @@ (lang.normalize-name (format module "$" name))) (def: #export (save code) - (-> Expression (Meta Top)) + (-> Expression (Meta Any)) (do macro.Monad<Meta> [module-buffer module-buffer #let [_ (Appendable::append [(:! CharSequence (_.expression code))] @@ -197,7 +197,7 @@ (def: #export run interpret) (def: #export (save-module! target) - (-> File (Meta (Process Top))) + (-> File (Meta (Process Any))) (do macro.Monad<Meta> [module macro.current-module-name module-buffer module-buffer 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 ee2aac932..eef9a985f 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 @@ -24,7 +24,7 @@ (#static forName [String] #try (Class Object))) (def: _0 - Top + Any (case (Class::forName "org.armedbear.lisp.Symbol") (#e.Success _) (log! "LOADED") @@ -71,23 +71,23 @@ (elt [int] LispObject)) (def: (parse-tuple lux-object host-object) - (-> (-> Object (Error Top)) SimpleVector (Error Top)) + (-> (-> Object (Error Any)) SimpleVector (Error Any)) (let [size (:! Nat (SimpleVector::length [] host-object))] (loop [idx +0 - output (:! (Array Top) (array.new size))] + output (:! (Array Any) (array.new size))] (if (n/< size idx) (case (lux-object (SimpleVector::elt [(:! Int idx)] host-object)) (#e.Error error) (#e.Error error) (#e.Success lux-value) - (recur (n/inc idx) (array.write idx (:! Top lux-value) output))) + (recur (n/inc idx) (array.write idx (:! Any lux-value) output))) (#e.Success output))))) (def: (variant tag flag value) - (-> Nat Bool Top Top) + (-> Nat Bool Any Any) [(Long::intValue [] (:! Long tag)) - (: Top + (: Any (if flag //.unit (host.null))) @@ -98,7 +98,7 @@ (cdr LispObject)) (def: (parse-variant lux-object host-object) - (-> (-> Object (Error Top)) Cons (Error Top)) + (-> (-> 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)))) @@ -113,7 +113,7 @@ (ex.throw invalid-variant (:! Text (Object::toString [] (:! Object host-object))))))) (def: (lux-object host-object) - (-> Object (Error Top)) + (-> Object (Error Any)) (cond (host.instance? org/armedbear/lisp/Bignum host-object) (#e.Success (Bignum::longValue [] (:! Bignum host-object))) @@ -144,7 +144,7 @@ (ex.throw Unknown-Kind-Of-Host-Object (:! Object host-object)))) (def: #export (eval code) - (-> Expression (Meta Top)) + (-> Expression (Meta Any)) (function (_ compiler) (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] (case (interpreter code) 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 96393c970..1819a8601 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 @@ -365,7 +365,7 @@ (def: #export artifact Text (format prefix //.file-extension)) (def: #export translate - (Meta (Process Top)) + (Meta (Process Any)) (do macro.Monad<Meta> [_ //.init-module-buffer _ (//.save runtime)] 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 e73d88c96..dab065e62 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 @@ -11,7 +11,7 @@ [".T" eval])) (def: #export (translate-def name expressionT expressionO metaV) - (-> Text Type Expression Code (Meta Top)) + (-> Text Type Expression Code (Meta Any)) (do macro.Monad<Meta> [current-module macro.current-module-name #let [def-ident [current-module name]]] diff --git a/new-luxc/source/luxc/lang/translation/js.lux b/new-luxc/source/luxc/lang/translation/js.lux index 3e9b1b143..edca93d10 100644 --- a/new-luxc/source/luxc/lang/translation/js.lux +++ b/new-luxc/source/luxc/lang/translation/js.lux @@ -90,12 +90,12 @@ (def: #export module-js-name Text "module.js") (def: #export init-module-buffer - (Meta Top) + (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Bottom)) + (:! Nothing)) compiler) []]))) @@ -106,13 +106,13 @@ [old-name old-sub] (get@ #context old) new-name (format old-name "$" (%i (nat-to-int old-sub)))] (case (expr (set@ #.host - (:! Bottom (set@ #context [new-name +0] old)) + (:! Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #context [old-name (n/inc old-sub)]) - (:! Bottom)) + (:! Nothing)) compiler') [new-name output]]) @@ -134,13 +134,13 @@ (function (_ compiler) (let [old (:! Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Bottom (set@ #anchor (#.Some anchor) old)) + (:! Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #anchor (get@ #anchor old)) - (:! Bottom)) + (:! Nothing)) compiler') output]) @@ -173,7 +173,7 @@ (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))]))) (def: (execute code) - (-> Expression (Meta Top)) + (-> Expression (Meta Any)) (function (_ compiler) (case (|> compiler (get@ #.host) @@ -187,7 +187,7 @@ (#e.Success [compiler []])))) (def: (::toString js-object) - (-> Top JSObject) + (-> Any JSObject) (object [] AbstractJSObject [] [] (AbstractJSObject (isFunction) boolean @@ -317,7 +317,7 @@ (format (module-name module) "$" (lang.normalize-name name))) (def: #export (save-js code) - (-> JS (Meta Top)) + (-> JS (Meta Any)) (do macro.Monad<Meta> [module-buffer module-buffer #let [_ (Appendable::append [(:! CharSequence code)] @@ -325,11 +325,11 @@ (execute code))) (def: #export (save-definition name code) - (-> Ident Expression (Meta Top)) + (-> Ident Expression (Meta Any)) (save-js (format "var " (definition-name name) " = " code ";\n"))) (def: #export (save-module! target) - (-> File (Meta (Process Top))) + (-> File (Meta (Process Any))) (do macro.Monad<Meta> [module macro.current-module-name module-buffer module-buffer 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 5b2499eb0..04121b944 100644 --- a/new-luxc/source/luxc/lang/translation/js/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/eval.jvm.lux @@ -73,7 +73,7 @@ #.None)) (def: (variant lux-object js-object) - (-> (-> Object (Error Top)) ScriptObjectMirror (Maybe Top)) + (-> (-> Object (Error Any)) ScriptObjectMirror (Maybe Any)) (case [(JSObject::getMember [//.variant-tag-field] js-object) (JSObject::getMember [//.variant-flag-field] js-object) (JSObject::getMember [//.variant-value-field] js-object)] @@ -88,7 +88,7 @@ #.None)) (def: (array lux-object js-object) - (-> (-> Object (Error Top)) ScriptObjectMirror (Maybe (Array Object))) + (-> (-> Object (Error Any)) ScriptObjectMirror (Maybe (Array Object))) (if (JSObject::isArray [] js-object) (let [init-num-keys (int-to-nat (ScriptObjectMirror::size [] js-object))] (loop [num-keys init-num-keys @@ -112,7 +112,7 @@ #.None)) (def: (lux-object js-object) - (-> Object (Error Top)) + (-> Object (Error Any)) (`` (cond (host.null? js-object) (ex.throw Null-Has-No-Lux-Representation "") @@ -160,7 +160,7 @@ (ex.throw Unknown-Kind-Of-JS-Object (Object::toString [] (:! Object js-object)))))) (def: #export (eval code) - (-> Expression (Meta Top)) + (-> Expression (Meta Any)) (function (_ compiler) (case (|> compiler (get@ #.host) diff --git a/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux index 1839a1a5e..2c7303c31 100644 --- a/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux @@ -727,7 +727,7 @@ (def: #export artifact Text (format prefix ".js")) (def: #export translate - (Meta (Process Top)) + (Meta (Process Any)) (do macro.Monad<Meta> [_ //.init-module-buffer _ (//.save-js runtime)] 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 e15e4379a..849ae76c2 100644 --- a/new-luxc/source/luxc/lang/translation/js/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/statement.jvm.lux @@ -11,7 +11,7 @@ [".T" eval])) (def: #export (translate-def name expressionT expressionJS metaV) - (-> Text Type Expression Code (Meta Top)) + (-> Text Type Expression Code (Meta Any)) (do macro.Monad<Meta> [current-module macro.current-module-name #let [def-ident [current-module name]]] 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 29db94d07..1d8da2893 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/common.jvm.lux @@ -66,13 +66,13 @@ (case (action (update@ #.host (|>> (:! Host) (set@ #artifacts (dict.new text.Hash<Text>)) - (:! Bottom)) + (:! Nothing)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #artifacts (|> (get@ #.host compiler) (:! Host) (get@ #artifacts))) - (:! Bottom)) + (:! Nothing)) compiler') [(|> compiler' (get@ #.host) (:! Host) (get@ #artifacts)) output]]) @@ -81,19 +81,19 @@ (#e.Error error)))) (def: #export (record-artifact name content) - (-> Text Blob (Meta Top)) + (-> Text Blob (Meta Any)) (function (_ compiler) (if (|> compiler (get@ #.host) (:! Host) (get@ #artifacts) (dict.contains? name)) (ex.throw Cannot-Overwrite-Artifact name) (#e.Success [(update@ #.host (|>> (:! Host) (update@ #artifacts (dict.put name content)) - (:! Bottom)) + (:! Nothing)) compiler) []])))) (def: #export (store-class name byte-code) - (-> Text Bytecode (Meta Top)) + (-> Text Bytecode (Meta Any)) (function (_ compiler) (let [store (|> (get@ #.host compiler) (:! Host) @@ -116,7 +116,7 @@ (def: #export $Object $.Type ($t.class "java.lang.Object" (list))) (def: #export (load-definition compiler) - (-> Lux (-> Ident Blob (Error Top))) + (-> Lux (-> Ident Blob (Error Any))) (function (_ (^@ def-ident [def-module def-name]) def-bytecode) (let [normal-name (format (lang.normalize-name def-name) (%n (text/hash def-name))) class-name (format (text.replace-all "/" "." def-module) "." normal-name)] diff --git a/new-luxc/source/luxc/lang/translation/jvm/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/eval.jvm.lux index c326895a2..d8e8ffd5e 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/eval.jvm.lux @@ -21,7 +21,7 @@ (getField [String] Field)) (def: #export (eval valueI) - (-> $.Inst (Meta Top)) + (-> $.Inst (Meta Any)) (do macro.Monad<Meta> [current-module macro.current-module-name class-name (:: @ map %code (macro.gensym (format current-module "/eval"))) 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 4400c1e90..4c52231f3 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/statement.jvm.lux @@ -37,7 +37,7 @@ (getField [String] #try Field)) (def: #export (translate-def def-name valueT valueI metaV) - (-> Text Type $.Inst Code (Meta Top)) + (-> Text Type $.Inst Code (Meta Any)) (do macro.Monad<Meta> [current-module macro.current-module-name #let [def-ident [current-module def-name]]] @@ -65,7 +65,7 @@ $i.RETURN))))] _ (commonT.store-class class-name bytecode) class (commonT.load-class class-name) - valueV (: (Meta Top) + valueV (: (Meta Any) (case (do e.Monad<Error> [field (Class::getField [commonT.value-field] class)] (Field::get [#.None] field)) @@ -93,7 +93,7 @@ (commonT.record-artifact (format bytecode-name ".class") bytecode))))) (def: #export (translate-program programI) - (-> $.Inst (Meta Top)) + (-> $.Inst (Meta Any)) (let [nilI runtimeT.noneI num-inputsI (|>> ($i.ALOAD +0) $i.ARRAYLENGTH) decI (|>> ($i.int 1) $i.ISUB) diff --git a/new-luxc/source/luxc/lang/translation/lua.lux b/new-luxc/source/luxc/lang/translation/lua.lux index 5d25fb864..94a703300 100644 --- a/new-luxc/source/luxc/lang/translation/lua.lux +++ b/new-luxc/source/luxc/lang/translation/lua.lux @@ -78,7 +78,7 @@ (type: #export Host {#context [Text Nat] #anchor (Maybe Anchor) - #interpreter (-> Text (Error Top)) + #interpreter (-> Text (Error Any)) #module-buffer (Maybe StringBuilder) #program-buffer StringBuilder}) @@ -104,12 +104,12 @@ (def: #export lua-module-name Text "module.lua") (def: #export init-module-buffer - (Meta Top) + (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Bottom)) + (:! Nothing)) compiler) []]))) @@ -120,13 +120,13 @@ [old-name old-sub] (get@ #context old) new-name (format old-name "___" (%i (nat-to-int old-sub)))] (case (expr (set@ #.host - (:! Bottom (set@ #context [new-name +0] old)) + (:! Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #context [old-name (n/inc old-sub)]) - (:! Bottom)) + (:! Nothing)) compiler') [new-name output]]) @@ -148,13 +148,13 @@ (function (_ compiler) (let [old (:! Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Bottom (set@ #anchor (#.Some anchor) old)) + (:! Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #anchor (get@ #anchor old)) - (:! Bottom)) + (:! Nothing)) compiler') output]) @@ -187,7 +187,7 @@ (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))]))) (def: (execute code) - (-> Expression (Meta Top)) + (-> Expression (Meta Any)) (function (_ compiler) (let [interpreter (|> compiler (get@ #.host) (:! Host) (get@ #interpreter))] (case (interpreter code) @@ -208,7 +208,7 @@ (lang.normalize-name (format module "$" name))) (def: #export (save code) - (-> Lua (Meta Top)) + (-> Lua (Meta Any)) (do macro.Monad<Meta> [module-buffer module-buffer #let [_ (Appendable::append [(:! CharSequence code)] @@ -216,7 +216,7 @@ (execute code))) (def: #export (save-module! target) - (-> File (Meta (Process Top))) + (-> File (Meta (Process Any))) (do macro.Monad<Meta> [module macro.current-module-name module-buffer module-buffer 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 cc267e7d5..68b41e6d7 100644 --- a/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux @@ -38,7 +38,7 @@ (host.import net/sandius/rembulan/impl/DefaultTable) (def: (variant lux-object host-object) - (-> (-> Object (Error Top)) DefaultTable (Maybe Top)) + (-> (-> Object (Error Any)) DefaultTable (Maybe Any)) (case [(Table::get-key [//.variant-tag-field] host-object) (Table::get-key [//.variant-flag-field] host-object) (Table::get-key [//.variant-value-field] host-object)] @@ -46,14 +46,14 @@ [(lux-object value) (#.Some value)]) (#.Some [(Long::intValue [] (:! Long tag)) - (: Top (case ?flag (#.Some _) "" #.None (host.null))) + (: Any (case ?flag (#.Some _) "" #.None (host.null))) value]) _ #.None)) (def: (array lux-object host-object) - (-> (-> Object (Error Top)) DefaultTable (Maybe (Array Object))) + (-> (-> Object (Error Any)) DefaultTable (Maybe (Array Object))) (let [init-num-keys (:! Nat (Table::rawlen [] host-object))] (loop [num-keys init-num-keys idx +0 @@ -74,7 +74,7 @@ (#.Some output))))) (def: (lux-object host-object) - (-> Object (Error Top)) + (-> Object (Error Any)) (cond (host.null? host-object) (ex.throw Null-Has-No-Lux-Representation "") @@ -106,7 +106,7 @@ )) (def: #export (eval code) - (-> Expression (Meta Top)) + (-> Expression (Meta Any)) (function (_ compiler) (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] (case (interpreter (format "return " code ";")) diff --git a/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux index 70b498dfa..ace528429 100644 --- a/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux @@ -386,7 +386,7 @@ (def: #export artifact Text (format prefix ".lua")) (def: #export translate - (Meta (Process Top)) + (Meta (Process Any)) (do macro.Monad<Meta> [_ //.init-module-buffer _ (//.save runtime)] 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 ee0725014..3a438ae65 100644 --- a/new-luxc/source/luxc/lang/translation/lua/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/statement.jvm.lux @@ -11,7 +11,7 @@ [".T" eval])) (def: #export (translate-def name expressionT expressionO metaV) - (-> Text Type Expression Code (Meta Top)) + (-> Text Type Expression Code (Meta Any)) (do macro.Monad<Meta> [current-module macro.current-module-name #let [def-ident [current-module name]]] diff --git a/new-luxc/source/luxc/lang/translation/php.lux b/new-luxc/source/luxc/lang/translation/php.lux index 8cbcaad3a..50bfd5289 100644 --- a/new-luxc/source/luxc/lang/translation/php.lux +++ b/new-luxc/source/luxc/lang/translation/php.lux @@ -54,7 +54,7 @@ (type: #export Host {#context [Text Nat] #anchor (Maybe Anchor) - #loader (-> Statement (Error Top)) + #loader (-> Statement (Error Any)) #interpreter (-> Expression (Error Object)) #module-buffer (Maybe StringBuilder) #program-buffer StringBuilder}) @@ -77,12 +77,12 @@ (def: #export module-name Text (format "module" extension)) (def: #export init-module-buffer - (Meta Top) + (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Bottom)) + (:! Nothing)) compiler) []]))) @@ -93,13 +93,13 @@ [old-name old-sub] (get@ #context old) new-name (format old-name "___" (%i (nat-to-int old-sub)))] (case (expr (set@ #.host - (:! Bottom (set@ #context [new-name +0] old)) + (:! Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #context [old-name (n/inc old-sub)]) - (:! Bottom)) + (:! Nothing)) compiler') [new-name output]]) @@ -121,13 +121,13 @@ (function (_ compiler) (let [old (:! Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Bottom (set@ #anchor (#.Some anchor) old)) + (:! Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #anchor (get@ #anchor old)) - (:! Bottom)) + (:! Nothing)) compiler') output]) @@ -171,7 +171,7 @@ (#e.Success output) (#e.Success [compiler output])))))] - [load! #loader Statement Top] + [load! #loader Statement Any] [interpret #interpreter Expression Object] ) @@ -186,7 +186,7 @@ (lang.normalize-name (format module "$" name))) (def: #export (save code) - (-> Statement (Meta Top)) + (-> Statement (Meta Any)) (do macro.Monad<Meta> [module-buffer module-buffer #let [_ (Appendable::append [(:! CharSequence (_.code code))] @@ -194,7 +194,7 @@ (load! code))) (def: #export (save-module! target) - (-> File (Meta (Process Top))) + (-> File (Meta (Process Any))) (do macro.Monad<Meta> [module macro.current-module-name module-buffer module-buffer 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 c6ff1a880..48c09c6c0 100644 --- a/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux @@ -60,10 +60,10 @@ (get [Memory] Memory)) (def: (tuple lux-object host-object) - (-> (-> Object (Error Top)) ArrayMemory (Error Top)) + (-> (-> Object (Error Any)) ArrayMemory (Error Any)) (let [size (ArrayMemory::size [] host-object)] (loop [idx 0 - output (: (Array Top) (array.new (:! Nat size)))] + output (: (Array Any) (array.new (:! Nat size)))] (if (i/< size idx) (let [value (|> host-object (ArrayMemory::get [(LongMemory::new [idx])]) @@ -78,13 +78,13 @@ (ex.return output))))) (def: (variant lux-object host-object) - (-> (-> Object (Error Top)) ArrayMemory (Error Top)) + (-> (-> Object (Error Any)) ArrayMemory (Error Any)) (do e.Monad<Error> [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 (: Top + (wrap (: Any [(Long::intValue [] (:! Long variant-tag)) - (: Top + (: Any (if (|> host-object (ArrayMemory::get [(StringMemory::new [//.variant-flag-field])]) (:! ReferenceMemory) @@ -95,7 +95,7 @@ variant-value])))) (def: (lux-object host-object) - (-> Object (Error Top)) + (-> Object (Error Any)) (cond (host.instance? php/runtime/memory/FalseMemory host-object) (ex.return false) @@ -123,7 +123,7 @@ (ex.throw Unknown-Kind-Of-Host-Object host-object))) (def: #export (eval code) - (-> Expression (Meta Top)) + (-> Expression (Meta Any)) (function (_ compiler) (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] (case (interpreter code) diff --git a/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux index c7262a291..5f9745845 100644 --- a/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux @@ -397,7 +397,7 @@ (def: #export artifact Text (format prefix //.extension)) (def: #export translate - (Meta (Process Top)) + (Meta (Process Any)) (do macro.Monad<Meta> [_ //.init-module-buffer _ (//.save runtime)] 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 afbf7e476..a20e164ca 100644 --- a/new-luxc/source/luxc/lang/translation/php/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/statement.jvm.lux @@ -11,7 +11,7 @@ [".T" eval])) (def: #export (translate-def name expressionT expressionO metaV) - (-> Text Type Expression Code (Meta Top)) + (-> Text Type Expression Code (Meta Any)) (do macro.Monad<Meta> [current-module macro.current-module-name #let [def-ident [current-module name]]] diff --git a/new-luxc/source/luxc/lang/translation/python.lux b/new-luxc/source/luxc/lang/translation/python.lux index 8739c278d..604f06019 100644 --- a/new-luxc/source/luxc/lang/translation/python.lux +++ b/new-luxc/source/luxc/lang/translation/python.lux @@ -54,7 +54,7 @@ (type: #export Host {#context [Text Nat] #anchor (Maybe Anchor) - #loader (-> Statement (Error Top)) + #loader (-> Statement (Error Any)) #interpreter (-> Expression (Error PyObject)) #module-buffer (Maybe StringBuilder) #program-buffer StringBuilder}) @@ -74,12 +74,12 @@ (def: #export python-module-name Text "module.py") (def: #export init-module-buffer - (Meta Top) + (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Bottom)) + (:! Nothing)) compiler) []]))) @@ -90,13 +90,13 @@ [old-name old-sub] (get@ #context old) new-name (format old-name "___" (%i (nat-to-int old-sub)))] (case (expr (set@ #.host - (:! Bottom (set@ #context [new-name +0] old)) + (:! Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #context [old-name (n/inc old-sub)]) - (:! Bottom)) + (:! Nothing)) compiler') [new-name output]]) @@ -118,13 +118,13 @@ (function (_ compiler) (let [old (:! Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Bottom (set@ #anchor (#.Some anchor) old)) + (:! Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #anchor (get@ #anchor old)) - (:! Bottom)) + (:! Nothing)) compiler') output]) @@ -168,7 +168,7 @@ (#e.Success output) (#e.Success [compiler output])))))] - [load! #loader Statement Top] + [load! #loader Statement Any] [interpret #interpreter Expression PyObject] ) @@ -191,12 +191,12 @@ module-buffer)]] (<eval> code)))] - [save load! python.statement Statement Top] + [save load! python.statement Statement Any] [run interpret python.expression Expression PyObject] ) (def: #export (save-module! target) - (-> File (Meta (Process Top))) + (-> File (Meta (Process Any))) (do macro.Monad<Meta> [module macro.current-module-name module-buffer module-buffer 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 164d088df..6f4e43f9d 100644 --- a/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux @@ -45,10 +45,10 @@ (getType [] PyType)) (def: (tuple lux-object host-object) - (-> (-> PyObject (Error Top)) PyObject (Error Top)) + (-> (-> PyObject (Error Any)) PyObject (Error Any)) (let [size (:! Nat (PyObject::__len__ [] host-object))] (loop [idx +0 - output (:! (Array Top) (array.new size))] + output (:! (Array Any) (array.new size))] (if (n/< size idx) (case (PyObject::__getitem__ [(:! Int idx)] host-object) (#e.Error error) @@ -72,7 +72,7 @@ (def: value-field (PyString::new [//.variant-value-field])) (def: (variant lux-object host-object) - (-> (-> PyObject (Error Top)) PyObject (Error Top)) + (-> (-> PyObject (Error Any)) PyObject (Error Any)) (case [(PyObject::__getitem__dict [tag-field] host-object) (PyObject::__getitem__dict [flag-field] host-object) (PyObject::__getitem__dict [value-field] host-object)] @@ -85,7 +85,7 @@ [(lux-object value) (#e.Success value)]) (#e.Success [(Long::intValue [] (:! Long tag)) - (: Top + (: Any (case (python-type (:! PyObject flag)) "NoneType" (host.null) @@ -98,7 +98,7 @@ (ex.throw Not-A-Variant (Object::toString [] host-object)))) (def: (lux-object host-object) - (-> PyObject (Error Top)) + (-> PyObject (Error Any)) (case (python-type host-object) "str" (#e.Success (PyObject::asString [] host-object)) @@ -125,7 +125,7 @@ (ex.throw Unknown-Kind-Of-Host-Object (format type " " (Object::toString [] host-object))))) (def: #export (eval code) - (-> Expression (Meta Top)) + (-> Expression (Meta Any)) (function (_ compiler) (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] (case (interpreter code) diff --git a/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux index 8167537f5..282d7536e 100644 --- a/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux @@ -426,7 +426,7 @@ (def: #export artifact Text (format prefix ".py")) (def: #export translate - (Meta (Process Top)) + (Meta (Process Any)) (do macro.Monad<Meta> [_ //.init-module-buffer _ (//.save runtime)] 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 b267f5a64..23b51371c 100644 --- a/new-luxc/source/luxc/lang/translation/python/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/statement.jvm.lux @@ -11,7 +11,7 @@ [".T" eval])) (def: #export (translate-def name expressionT expressionO metaV) - (-> Text Type Expression Code (Meta Top)) + (-> Text Type Expression Code (Meta Any)) (do macro.Monad<Meta> [current-module macro.current-module-name #let [def-ident [current-module name]]] diff --git a/new-luxc/source/luxc/lang/translation/r.lux b/new-luxc/source/luxc/lang/translation/r.lux index 410e167bc..0eba35760 100644 --- a/new-luxc/source/luxc/lang/translation/r.lux +++ b/new-luxc/source/luxc/lang/translation/r.lux @@ -56,7 +56,7 @@ (type: #export Host {#context [Text Nat] #anchor (Maybe Anchor) - #loader (-> Expression (Error Top)) + #loader (-> Expression (Error Any)) #interpreter (-> Expression (Error Object)) #module-buffer (Maybe StringBuilder) #program-buffer StringBuilder}) @@ -82,12 +82,12 @@ (def: #export r-module-name Text "module.r") (def: #export init-module-buffer - (Meta Top) + (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Bottom)) + (:! Nothing)) compiler) []]))) @@ -98,13 +98,13 @@ [old-name old-sub] (get@ #context old) new-name (format old-name "f___" (%i (nat-to-int old-sub)))] (case (expr (set@ #.host - (:! Bottom (set@ #context [new-name +0] old)) + (:! Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #context [old-name (n/inc old-sub)]) - (:! Bottom)) + (:! Nothing)) compiler') [new-name output]]) @@ -126,13 +126,13 @@ (function (_ compiler) (let [old (:! Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Bottom (set@ #anchor (#.Some anchor) old)) + (:! Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #anchor (get@ #anchor old)) - (:! Bottom)) + (:! Nothing)) compiler') output]) @@ -176,7 +176,7 @@ (#e.Success output) (#e.Success [compiler output])))))] - [load! #loader Top] + [load! #loader Any] [interpret #interpreter Object] ) @@ -194,7 +194,7 @@ (lang.normalize-name (format module "$" name))) (def: #export (save code) - (-> Expression (Meta Top)) + (-> Expression (Meta Any)) (do macro.Monad<Meta> [module-buffer module-buffer #let [_ (Appendable::append [(:! CharSequence (r.expression code))] @@ -204,7 +204,7 @@ (def: #export run interpret) (def: #export (save-module! target) - (-> File (Meta (Process Top))) + (-> File (Meta (Process Any))) (do macro.Monad<Meta> [module macro.current-module-name module-buffer module-buffer 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 05d16f871..66e157e40 100644 --- a/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux @@ -50,10 +50,10 @@ (host.import org/renjin/sexp/Null) (def: (parse-tuple lux-object host-object) - (-> (-> Object (Error Top)) ListVector (Error Top)) + (-> (-> Object (Error Any)) ListVector (Error Any)) (let [size (:! Nat (ListVector::length [] host-object))] (loop [idx +0 - output (:! (Array Top) (array.new size))] + output (:! (Array Any) (array.new size))] (if (n/< size idx) (case (ListVector::getElementAsSEXP [(:! Int idx)] host-object) (#e.Error error) @@ -65,11 +65,11 @@ (#e.Error error) (#e.Success lux-value) - (recur (n/inc idx) (array.write idx (:! Top lux-value) output)))) + (recur (n/inc idx) (array.write idx (:! Any lux-value) output)))) (#e.Success output))))) (def: (parse-variant lux-object host-object) - (-> (-> Object (Error Top)) ListVector (Error Top)) + (-> (-> Object (Error Any)) ListVector (Error Any)) (do e.Monad<Error> [tag (ListVector::get-field-sexp [//.variant-tag-field] host-object) flag (ListVector::get-field-sexp [//.variant-flag-field] host-object) @@ -79,7 +79,7 @@ (:! IntArrayVector) (IntArrayVector::getElementAsInt [0]) (Long::intValue [])) - (: Top + (: Any (if (host.instance? Null flag) (host.null) //.unit)) @@ -100,7 +100,7 @@ low)))))) (def: (lux-object host-object) - (-> Object (Error Top)) + (-> Object (Error Any)) (cond (host.instance? StringArrayVector host-object) (#e.Success (StringArrayVector::getElementAsString [0] (:! StringArrayVector host-object))) @@ -132,7 +132,7 @@ (ex.throw Unknown-Kind-Of-Host-Object (format object-class " --- " text-representation))))) (def: #export (eval code) - (-> Expression (Meta Top)) + (-> Expression (Meta Any)) (function (_ compiler) (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] (case (interpreter code) diff --git a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux index f13329e26..7cdc82064 100644 --- a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux @@ -882,7 +882,7 @@ (def: #export artifact Text (format prefix ".r")) (def: #export translate - (Meta (Process Top)) + (Meta (Process Any)) (do macro.Monad<Meta> [_ //.init-module-buffer _ (//.save runtime)] 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 7ff6a23e8..62349abcf 100644 --- a/new-luxc/source/luxc/lang/translation/r/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/statement.jvm.lux @@ -11,7 +11,7 @@ [".T" eval])) (def: #export (translate-def name expressionT expressionO metaV) - (-> Text Type Expression Code (Meta Top)) + (-> Text Type Expression Code (Meta Any)) (do macro.Monad<Meta> [current-module macro.current-module-name #let [def-ident [current-module name]]] diff --git a/new-luxc/source/luxc/lang/translation/ruby.lux b/new-luxc/source/luxc/lang/translation/ruby.lux index 16b0813d5..c8cce4caf 100644 --- a/new-luxc/source/luxc/lang/translation/ruby.lux +++ b/new-luxc/source/luxc/lang/translation/ruby.lux @@ -51,7 +51,7 @@ (type: #export Host {#context [Text Nat] #anchor (Maybe Anchor) - #interpreter (-> Text (Error Top)) + #interpreter (-> Text (Error Any)) #module-buffer (Maybe StringBuilder) #program-buffer StringBuilder}) @@ -61,19 +61,19 @@ #anchor #.None #interpreter (let [interpreter (ScriptingContainer::new [])] (function (_ code) - ("lux try" (io (: Top (maybe.default [] (ScriptingContainer::runScriptlet [code] interpreter))))))) + ("lux try" (io (: Any (maybe.default [] (ScriptingContainer::runScriptlet [code] interpreter))))))) #module-buffer #.None #program-buffer (StringBuilder::new [])})) (def: #export ruby-module-name Text "module.rb") (def: #export init-module-buffer - (Meta Top) + (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Bottom)) + (:! Nothing)) compiler) []]))) @@ -84,13 +84,13 @@ [old-name old-sub] (get@ #context old) new-name (format old-name "___" (%i (nat-to-int old-sub)))] (case (expr (set@ #.host - (:! Bottom (set@ #context [new-name +0] old)) + (:! Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #context [old-name (n/inc old-sub)]) - (:! Bottom)) + (:! Nothing)) compiler') [new-name output]]) @@ -112,13 +112,13 @@ (function (_ compiler) (let [old (:! Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Bottom (set@ #anchor (#.Some anchor) old)) + (:! Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #anchor (get@ #anchor old)) - (:! Bottom)) + (:! Nothing)) compiler') output]) @@ -151,7 +151,7 @@ (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))]))) (def: (execute code) - (-> Expression (Meta Top)) + (-> Expression (Meta Any)) (function (_ compiler) (let [interpreter (|> compiler (get@ #.host) (:! Host) (get@ #interpreter))] (case (interpreter code) @@ -172,7 +172,7 @@ (lang.normalize-name (format module "$" name))) (def: #export (save code) - (-> Ruby (Meta Top)) + (-> Ruby (Meta Any)) (do macro.Monad<Meta> [module-buffer module-buffer #let [_ (Appendable::append [(:! CharSequence code)] @@ -180,7 +180,7 @@ (execute code))) (def: #export (save-module! target) - (-> File (Meta (Process Top))) + (-> File (Meta (Process Any))) (do macro.Monad<Meta> [module macro.current-module-name module-buffer module-buffer 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 348e5bcf9..49bf7f1da 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux @@ -36,10 +36,10 @@ (get [Object] #? Object)) (def: (tuple lux-object host-object) - (-> (-> Object (Error Top)) RubyArray (Error Top)) + (-> (-> Object (Error Any)) RubyArray (Error Any)) (let [size (:! Nat (RubyArray::getLength [] host-object))] (loop [idx +0 - output (:! (Array Top) (array.new size))] + output (:! (Array Any) (array.new size))] (if (n/< size idx) (case (RubyArray::get [(:! Int idx)] host-object) #.None @@ -55,7 +55,7 @@ (#e.Success output))))) (def: (variant lux-object host-object) - (-> (-> Object (Error Top)) RubyHash (Error Top)) + (-> (-> 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)] @@ -63,14 +63,14 @@ [(lux-object value) (#.Some value)]) (#e.Success [(Long::intValue [] (:! Long tag)) - (: Top (case ?flag (#.Some _) "" #.None (host.null))) + (: Any (case ?flag (#.Some _) "" #.None (host.null))) value]) _ (ex.throw Not-A-Variant ""))) (def: (lux-object host-object) - (-> Object (Error Top)) + (-> Object (Error Any)) (`` (cond (host.null? host-object) (ex.throw Null-Has-No-Lux-Representation "") @@ -100,7 +100,7 @@ ))) (def: #export (eval code) - (-> Expression (Meta Top)) + (-> Expression (Meta Any)) (function (_ compiler) (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] (case (interpreter code) diff --git a/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux index e2bf83dfa..bb0549259 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux @@ -271,7 +271,7 @@ (def: #export artifact Text (format prefix ".rb")) (def: #export translate - (Meta (Process Top)) + (Meta (Process Any)) (do macro.Monad<Meta> [_ //.init-module-buffer _ (//.save runtime)] 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 972a6428e..135a09039 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/statement.jvm.lux @@ -11,7 +11,7 @@ [".T" eval])) (def: #export (translate-def name expressionT expressionO metaV) - (-> Text Type Expression Code (Meta Top)) + (-> Text Type Expression Code (Meta Any)) (do macro.Monad<Meta> [current-module macro.current-module-name #let [def-ident [current-module name]]] diff --git a/new-luxc/source/luxc/lang/translation/scheme.lux b/new-luxc/source/luxc/lang/translation/scheme.lux index 451d5f8e2..22cd7151e 100644 --- a/new-luxc/source/luxc/lang/translation/scheme.lux +++ b/new-luxc/source/luxc/lang/translation/scheme.lux @@ -55,7 +55,7 @@ (type: #export Host {#context [Text Nat] #anchor (Maybe Anchor) - #loader (-> Expression (Error Top)) + #loader (-> Expression (Error Any)) #interpreter (-> Expression (Error Object)) #module-buffer (Maybe StringBuilder) #program-buffer StringBuilder}) @@ -82,12 +82,12 @@ (def: #export r-module-name Text (format "module" file-extension)) (def: #export init-module-buffer - (Meta Top) + (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Bottom)) + (:! Nothing)) compiler) []]))) @@ -98,13 +98,13 @@ [old-name old-sub] (get@ #context old) new-name (format old-name "f___" (%i (nat-to-int old-sub)))] (case (expr (set@ #.host - (:! Bottom (set@ #context [new-name +0] old)) + (:! Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #context [old-name (n/inc old-sub)]) - (:! Bottom)) + (:! Nothing)) compiler') [new-name output]]) @@ -126,13 +126,13 @@ (function (_ compiler) (let [old (:! Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Bottom (set@ #anchor (#.Some anchor) old)) + (:! Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host (|>> (:! Host) (set@ #anchor (get@ #anchor old)) - (:! Bottom)) + (:! Nothing)) compiler') output]) @@ -176,7 +176,7 @@ (#e.Success output) (#e.Success [compiler output])))))] - [load! #loader Top] + [load! #loader Any] [interpret #interpreter Object] ) @@ -189,7 +189,7 @@ (lang.normalize-name (format module "$" name))) (def: #export (save code) - (-> Expression (Meta Top)) + (-> Expression (Meta Any)) (do macro.Monad<Meta> [module-buffer module-buffer #let [_ (Appendable::append [(:! CharSequence (scheme.expression code))] @@ -199,7 +199,7 @@ (def: #export run interpret) (def: #export (save-module! target) - (-> File (Meta (Process Top))) + (-> File (Meta (Process Any))) (do macro.Monad<Meta> [module macro.current-module-name module-buffer module-buffer 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 a45af1f00..056bf7599 100644 --- a/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux @@ -59,36 +59,36 @@ (host.import gnu/mapping/SimpleSymbol) (def: (parse-tuple lux-object host-object) - (-> (-> Object (Error Top)) (FVector Object) (Error Top)) + (-> (-> Object (Error Any)) (FVector Object) (Error Any)) (let [size (:! Nat (FVector::getBufferLength [] host-object))] (loop [idx +0 - output (:! (Array Top) (array.new size))] + output (:! (Array Any) (array.new size))] (if (n/< size idx) (case (lux-object (FVector::get [(:! Int idx)] host-object)) (#e.Error error) (#e.Error error) (#e.Success lux-value) - (recur (n/inc idx) (array.write idx (:! Top lux-value) output))) + (recur (n/inc idx) (array.write idx (:! Any lux-value) output))) (#e.Success output))))) (def: (variant tag flag value) - (-> Nat Bool Top Top) + (-> Nat Bool Any Any) [(Long::intValue [] (:! Long tag)) - (: Top + (: Any (if flag //.unit (host.null))) value]) (def: (to-text value) - (-> Top Text) + (-> Any Text) (let [value-text (:! Text (Object::toString [] (:! Object value))) class-text (:! Text (Object::toString [] (Object::getClass [] (:! Object value))))] (format value-text " : " class-text))) (def: (parse-variant lux-object host-object) - (-> (-> Object (Error Top)) Pair (Error Top)) + (-> (-> 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)))) @@ -103,7 +103,7 @@ (ex.throw invalid-variant (:! Text (Object::toString [] (:! Object host-object))))))) (def: (lux-object host-object) - (-> Object (Error Top)) + (-> Object (Error Any)) (cond (or (host.instance? java/lang/Boolean host-object) (host.instance? java/lang/String host-object)) (#e.Success host-object) @@ -132,7 +132,7 @@ (ex.throw Unknown-Kind-Of-Host-Object (format object-class " --- " text-representation))))) (def: #export (eval code) - (-> Expression (Meta Top)) + (-> Expression (Meta Any)) (function (_ compiler) (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] (case (interpreter code) diff --git a/new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux index 3bdfc614f..c3f149eeb 100644 --- a/new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux @@ -368,7 +368,7 @@ (def: #export artifact Text (format prefix //.file-extension)) (def: #export translate - (Meta (Process Top)) + (Meta (Process Any)) (do macro.Monad<Meta> [_ //.init-module-buffer _ (//.save runtime)] 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 6fdb4073a..43e18cb85 100644 --- a/new-luxc/source/luxc/lang/translation/scheme/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/scheme/statement.jvm.lux @@ -11,7 +11,7 @@ [".T" eval])) (def: #export (translate-def name expressionT expressionO metaV) - (-> Text Type Expression Code (Meta Top)) + (-> Text Type Expression Code (Meta Any)) (do macro.Monad<Meta> [current-module macro.current-module-name #let [def-ident [current-module name]]] diff --git a/new-luxc/source/luxc/repl.lux b/new-luxc/source/luxc/repl.lux index 0ce7fb898..b1efa5c20 100644 --- a/new-luxc/source/luxc/repl.lux +++ b/new-luxc/source/luxc/repl.lux @@ -67,7 +67,7 @@ (|> compiler (set@ [#.info #.mode] #.REPL) (set@ #.extensions - (:! Bottom + (:! Nothing {#extensionL.analysis analysisE.defaults #extensionL.synthesis synthesisE.defaults #extensionL.translation translationE.defaults @@ -91,10 +91,10 @@ (-> Text Source Source) [where offset (format input "\n" line)]) -(type: Representation (-> Top Text)) +(type: Representation (-> Any Text)) (def: (represent-together representations values) - (-> (List Representation) (List Top) (List Text)) + (-> (List Representation) (List Any) (List Text)) (|> (list.zip2 representations values) (list/map (function (_ [representation value]) (representation value))))) @@ -102,12 +102,12 @@ (Poly Representation) (`` ($_ p.either (do p.Monad<Parser> - [_ (poly.this Top)] + [_ (poly.this Any)] (wrap (const "[]"))) (~~ (do-template [<type> <formatter>] [(do p.Monad<Parser> - [_ (poly.this <type>)] + [_ (poly.like <type>)] (wrap (|>> (:! <type>) <formatter>)))] [Bool %b] @@ -122,7 +122,7 @@ (`` ($_ p.either (~~ (do-template [<type> <formatter>] [(do p.Monad<Parser> - [_ (poly.this <type>)] + [_ (poly.like <type>)] (wrap (|>> (:! <type>) <formatter>)))] [Type %type] @@ -137,12 +137,12 @@ (do p.Monad<Parser> [[_ elemT] (poly.apply (p.seq (poly.this List) poly.any)) elemR (poly.local (list elemT) representation)] - (wrap (|>> (:! (List Top)) (%list elemR)))) + (wrap (|>> (:! (List Any)) (%list elemR)))) (do p.Monad<Parser> [[_ elemT] (poly.apply (p.seq (poly.this Maybe) poly.any)) elemR (poly.local (list elemT) representation)] - (wrap (|>> (:! (Maybe Top)) + (wrap (|>> (:! (Maybe Any)) (case> #.None "#.None" @@ -166,7 +166,7 @@ (format (%code (code.tag tag)) " " (repr recordV)) (#.Cons [tag repr] tail) - (let [[leftV rightV] (:! [Top Top] recordV)] + (let [[leftV rightV] (:! [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 Top] variantV)] + (let [[_tag _last? _value] (:! [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 Top] variantV)] + (let [[_tag _last? _value] (:! [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] (:! [Top Top] tupleV)] + (let [[leftV rightV] (:! [Any Any] tupleV)] (format (headR leftV) " " (recur tailR rightV)))))] (format "[" tuple-body "]")))))) @@ -263,7 +263,7 @@ )))) (def: (represent compiler type value) - (-> Lux Type Top Text) + (-> Lux Type Any Text) (case (poly.run type (representation compiler)) (#e.Success representation) (representation value) @@ -272,14 +272,14 @@ ". . . cannot represent value . . .")) (def: (repl-translate source-dirs target-dir code) - (-> (List File) File Code (Meta [Type Top])) + (-> (List File) File Code (Meta [Type Any])) (function (_ compiler) (case ((translationL.translate (translationL.translate-module source-dirs target-dir) no-aliases code) compiler) (#e.Success [compiler' aliases']) - (#e.Success [compiler' [Bottom []]]) + (#e.Success [compiler' [Nothing []]]) (#e.Error error) (if (ex.match? translationL.Unrecognized-Statement error) @@ -295,7 +295,7 @@ (def: fresh-source Source [[repl-module +1 +0] +0 ""]) (def: #export (run source-dirs target-dir) - (-> (List File) File (Task Top)) + (-> (List File) File (Task Any)) (do task.Monad<Task> [console (promise.future console.open) compiler (initialize source-dirs target-dir console)] diff --git a/new-luxc/test/test/luxc/common.lux b/new-luxc/test/test/luxc/common.lux index 01e3d1aaa..1fd647ba9 100644 --- a/new-luxc/test/test/luxc/common.lux +++ b/new-luxc/test/test/luxc/common.lux @@ -14,50 +14,50 @@ [".T_jvm" eval] [".T_jvm" runtime] [".T_jvm" statement]) - [js] - (js [".T_js" expression] - [".T_js" eval] - [".T_js" runtime] - [".T_js" statement]) - [lua] - (lua [".T_lua" expression] - [".T_lua" eval] - [".T_lua" runtime] - [".T_lua" statement]) - [ruby] - (ruby [".T_ruby" expression] - [".T_ruby" eval] - [".T_ruby" runtime] - [".T_ruby" statement]) - [python] - (python [".T_python" expression] - [".T_python" eval] - [".T_python" runtime] - [".T_python" statement]) - [r] - (r [".T_r" expression] - [".T_r" eval] - [".T_r" runtime] - [".T_r" statement]) - [scheme] - (scheme [".T_scheme" expression] - [".T_scheme" eval] - [".T_scheme" runtime] - [".T_scheme" statement]) - [common-lisp] - (common-lisp [".T_common-lisp" expression] - [".T_common-lisp" eval] - [".T_common-lisp" runtime] - [".T_common-lisp" statement]) - [php] - (php [".T_php" expression] - [".T_php" eval] - [".T_php" runtime] - [".T_php" statement]) + ## [js] + ## (js [".T_js" expression] + ## [".T_js" eval] + ## [".T_js" runtime] + ## [".T_js" statement]) + ## [lua] + ## (lua [".T_lua" expression] + ## [".T_lua" eval] + ## [".T_lua" runtime] + ## [".T_lua" statement]) + ## [ruby] + ## (ruby [".T_ruby" expression] + ## [".T_ruby" eval] + ## [".T_ruby" runtime] + ## [".T_ruby" statement]) + ## [python] + ## (python [".T_python" expression] + ## [".T_python" eval] + ## [".T_python" runtime] + ## [".T_python" statement]) + ## [r] + ## (r [".T_r" expression] + ## [".T_r" eval] + ## [".T_r" runtime] + ## [".T_r" statement]) + ## [scheme] + ## (scheme [".T_scheme" expression] + ## [".T_scheme" eval] + ## [".T_scheme" runtime] + ## [".T_scheme" statement]) + ## [common-lisp] + ## (common-lisp [".T_common-lisp" expression] + ## [".T_common-lisp" eval] + ## [".T_common-lisp" runtime] + ## [".T_common-lisp" statement]) + ## [php] + ## (php [".T_php" expression] + ## [".T_php" eval] + ## [".T_php" runtime] + ## [".T_php" statement]) )))) -(type: #export Runner (-> Synthesis (e.Error Top))) -(type: #export Definer (-> Ident Synthesis (e.Error Top))) +(type: #export Runner (-> Synthesis (e.Error Any))) +(type: #export Definer (-> Ident Synthesis (e.Error Any))) (do-template [<name> <host>] [(def: #export <name> @@ -67,18 +67,18 @@ (wrap (initL.compiler host))))] [init-jvm &host.init-host] - [init-js js.init] - [init-lua lua.init] - [init-ruby ruby.init] - [init-python python.init] - [init-r r.init] - [init-scheme scheme.init] - [init-common-lisp common-lisp.init] - [init-php php.init] + ## [init-js js.init] + ## [init-lua lua.init] + ## [init-ruby ruby.init] + ## [init-python python.init] + ## [init-r r.init] + ## [init-scheme scheme.init] + ## [init-common-lisp common-lisp.init] + ## [init-php php.init] ) (def: (runner translate-runtime translate-expression eval init) - (All [a] (-> (Meta Top) (-> Synthesis (Meta a)) (-> a (Meta Top)) (IO Lux) + (All [a] (-> (Meta Any) (-> Synthesis (Meta a)) (-> a (Meta Any)) (IO Lux) Runner)) (function (_ synthesis) (|> (do macro.Monad<Meta> @@ -89,15 +89,15 @@ (macro.run (io.run init))))) (def: (definer translate-runtime translate-expression eval init translate-def) - (All [a] (-> (Meta Top) (-> Synthesis (Meta a)) (-> a (Meta Top)) (IO Lux) - (-> Text Type a Code (Meta Top)) + (All [a] (-> (Meta Any) (-> Synthesis (Meta a)) (-> a (Meta Any)) (IO Lux) + (-> Text Type a Code (Meta Any)) Definer)) (function (_ [module-name def-name] synthesis) (|> (do macro.Monad<Meta> [_ translate-runtime valueO (translate-expression synthesis) _ (moduleL.with-module +0 module-name - (translate-def def-name Top valueO (' {}))) + (translate-def def-name Any valueO (' {}))) sampleO (translate-expression (code.symbol [module-name def-name]))] (eval sampleO)) (lang.with-current-module "") @@ -106,26 +106,26 @@ (def: #export run-jvm (runner runtimeT_jvm.translate expressionT_jvm.translate evalT_jvm.eval init-jvm)) (def: #export def-jvm (definer runtimeT_jvm.translate expressionT_jvm.translate evalT_jvm.eval init-jvm statementT_jvm.translate-def)) -(def: #export run-js (runner runtimeT_js.translate expressionT_js.translate evalT_js.eval init-js)) -(def: #export def-js (definer runtimeT_js.translate expressionT_js.translate evalT_js.eval init-js statementT_js.translate-def)) +## (def: #export run-js (runner runtimeT_js.translate expressionT_js.translate evalT_js.eval init-js)) +## (def: #export def-js (definer runtimeT_js.translate expressionT_js.translate evalT_js.eval init-js statementT_js.translate-def)) -(def: #export run-lua (runner runtimeT_lua.translate expressionT_lua.translate evalT_lua.eval init-lua)) -(def: #export def-lua (definer runtimeT_lua.translate expressionT_lua.translate evalT_lua.eval init-lua statementT_lua.translate-def)) +## (def: #export run-lua (runner runtimeT_lua.translate expressionT_lua.translate evalT_lua.eval init-lua)) +## (def: #export def-lua (definer runtimeT_lua.translate expressionT_lua.translate evalT_lua.eval init-lua statementT_lua.translate-def)) -(def: #export run-ruby (runner runtimeT_ruby.translate expressionT_ruby.translate evalT_ruby.eval init-ruby)) -(def: #export def-ruby (definer runtimeT_ruby.translate expressionT_ruby.translate evalT_ruby.eval init-ruby statementT_ruby.translate-def)) +## (def: #export run-ruby (runner runtimeT_ruby.translate expressionT_ruby.translate evalT_ruby.eval init-ruby)) +## (def: #export def-ruby (definer runtimeT_ruby.translate expressionT_ruby.translate evalT_ruby.eval init-ruby statementT_ruby.translate-def)) -(def: #export run-python (runner runtimeT_python.translate expressionT_python.translate evalT_python.eval init-python)) -(def: #export def-python (definer runtimeT_python.translate expressionT_python.translate evalT_python.eval init-python statementT_python.translate-def)) +## (def: #export run-python (runner runtimeT_python.translate expressionT_python.translate evalT_python.eval init-python)) +## (def: #export def-python (definer runtimeT_python.translate expressionT_python.translate evalT_python.eval init-python statementT_python.translate-def)) -(def: #export run-r (runner runtimeT_r.translate expressionT_r.translate evalT_r.eval init-r)) -(def: #export def-r (definer runtimeT_r.translate expressionT_r.translate evalT_r.eval init-r statementT_r.translate-def)) +## (def: #export run-r (runner runtimeT_r.translate expressionT_r.translate evalT_r.eval init-r)) +## (def: #export def-r (definer runtimeT_r.translate expressionT_r.translate evalT_r.eval init-r statementT_r.translate-def)) -(def: #export run-scheme (runner runtimeT_scheme.translate expressionT_scheme.translate evalT_scheme.eval init-scheme)) -(def: #export def-scheme (definer runtimeT_scheme.translate expressionT_scheme.translate evalT_scheme.eval init-scheme statementT_scheme.translate-def)) +## (def: #export run-scheme (runner runtimeT_scheme.translate expressionT_scheme.translate evalT_scheme.eval init-scheme)) +## (def: #export def-scheme (definer runtimeT_scheme.translate expressionT_scheme.translate evalT_scheme.eval init-scheme statementT_scheme.translate-def)) -(def: #export run-common-lisp (runner runtimeT_common-lisp.translate expressionT_common-lisp.translate evalT_common-lisp.eval init-common-lisp)) -(def: #export def-common-lisp (definer runtimeT_common-lisp.translate expressionT_common-lisp.translate evalT_common-lisp.eval init-common-lisp statementT_common-lisp.translate-def)) +## (def: #export run-common-lisp (runner runtimeT_common-lisp.translate expressionT_common-lisp.translate evalT_common-lisp.eval init-common-lisp)) +## (def: #export def-common-lisp (definer runtimeT_common-lisp.translate expressionT_common-lisp.translate evalT_common-lisp.eval init-common-lisp statementT_common-lisp.translate-def)) -(def: #export run-php (runner runtimeT_php.translate expressionT_php.translate evalT_php.eval init-php)) -(def: #export def-php (definer runtimeT_php.translate expressionT_php.translate evalT_php.eval init-php statementT_php.translate-def)) +## (def: #export run-php (runner runtimeT_php.translate expressionT_php.translate evalT_php.eval init-php)) +## (def: #export def-php (definer runtimeT_php.translate expressionT_php.translate evalT_php.eval init-php statementT_php.translate-def)) diff --git a/new-luxc/test/test/luxc/lang/analysis/procedure/common.lux b/new-luxc/test/test/luxc/lang/analysis/procedure/common.lux index 4cee3dce3..fba355a79 100644 --- a/new-luxc/test/test/luxc/lang/analysis/procedure/common.lux +++ b/new-luxc/test/test/luxc/lang/analysis/procedure/common.lux @@ -304,7 +304,7 @@ (check-success+ "lux process schedule" (list timeC (` ("lux function" (~' _) (~' _) (~ primC)))) - Top)) + Any)) )))) (context: "IO procedures" @@ -314,11 +314,11 @@ exitC (|> r.int (:: @ map code.int))] ($_ seq (test "Can log messages to standard output." - (check-success+ "lux io log" (list logC) Top)) + (check-success+ "lux io log" (list logC) Any)) (test "Can throw a run-time error." - (check-success+ "lux io error" (list logC) Bottom)) + (check-success+ "lux io error" (list logC) Nothing)) (test "Can exit the program." - (check-success+ "lux io exit" (list exitC) Bottom)) + (check-success+ "lux io exit" (list exitC) Nothing)) (test "Can query the current time (as milliseconds since epoch)." (check-success+ "lux io current-time" (list) Int)) )))) diff --git a/new-luxc/test/test/luxc/lang/analysis/procedure/host.jvm.lux b/new-luxc/test/test/luxc/lang/analysis/procedure/host.jvm.lux index 0c27d14d1..3d0c76777 100644 --- a/new-luxc/test/test/luxc/lang/analysis/procedure/host.jvm.lux +++ b/new-luxc/test/test/luxc/lang/analysis/procedure/host.jvm.lux @@ -374,7 +374,7 @@ (or (text/= "java.lang.Object" throwable) (success "jvm object throw" (list throwableC) - Bottom))) + Nothing))) (test "jvm object class" (success "jvm object class" (list (code.text boxed)) @@ -415,14 +415,14 @@ (code.text "allHtmlFlavor") (`' ("lux check" (+0 "java.awt.datatransfer.DataFlavor" (+0)) ("jvm object null")))) - Top)) + Any)) (test "jvm member static put (final)" (failure "jvm member static put" (list (code.text "java.lang.System") (code.text "out") (`' ("lux check" (+0 "java.io.PrintStream" (+0)) ("jvm object null")))) - Top)) + Any)) (test "jvm member static put (inheritance in)" (success "jvm member static put" (list (code.text "java.awt.datatransfer.DataFlavor") @@ -430,7 +430,7 @@ (`' ("jvm object cast" ("lux check" (+0 "javax.activation.ActivationDataFlavor" (+0)) ("jvm object null"))))) - Top)) + Any)) )) (context: "Member [Virtual Field]." diff --git a/new-luxc/test/test/luxc/lang/translation/js.lux b/new-luxc/test/test/luxc/lang/translation/js.lux index 68bc227f2..e6443cce8 100644 --- a/new-luxc/test/test/luxc/lang/translation/js.lux +++ b/new-luxc/test/test/luxc/lang/translation/js.lux @@ -28,7 +28,7 @@ _ false))) -(type: Check (-> (e.Error Top) Bool)) +(type: Check (-> (e.Error Any) Bool)) (do-template [<name> <type> <pre> <=>] [(def: (<name> angle) diff --git a/new-luxc/test/test/luxc/lang/translation/jvm.lux b/new-luxc/test/test/luxc/lang/translation/jvm.lux index 54966ae65..a835ce9d4 100644 --- a/new-luxc/test/test/luxc/lang/translation/jvm.lux +++ b/new-luxc/test/test/luxc/lang/translation/jvm.lux @@ -477,7 +477,7 @@ (lang.with-current-module "") (macro.run (io.run init-jvm)) (case> (#e.Success outputT) - (case (:! (e.Error Top) outputT) + (case (:! (e.Error Any) outputT) (#e.Error error) (text.contains? exception-message error) diff --git a/new-luxc/test/test/luxc/lang/translation/structure.lux b/new-luxc/test/test/luxc/lang/translation/structure.lux index 2ca57cbac..6e512f3ec 100644 --- a/new-luxc/test/test/luxc/lang/translation/structure.lux +++ b/new-luxc/test/test/luxc/lang/translation/structure.lux @@ -30,7 +30,7 @@ (test "Can translate tuple." (|> (run (code.tuple (list/map code.int tuple-in))) (case> (#e.Success tuple-out) - (let [tuple-out (:! (Array Top) tuple-out)] + (let [tuple-out (:! (Array Any) tuple-out)] (and (n/= size (array.size tuple-out)) (list.every? (function (_ [left right]) (i/= left (:! Int right))) @@ -50,11 +50,11 @@ (test "Can translate variant." (|> (run (` ((~ (code.nat tag-in)) (~ (code.bool last?-in)) (~ (code.int value-in))))) (case> (#e.Success valueT) - (let [valueT (:! (Array Top) valueT)] + (let [valueT (:! (Array Any) valueT)] (and (n/= +3 (array.size valueT)) (let [tag-out (:! Integer (maybe.assume (array.read +0 valueT))) last?-out (array.read +1 valueT) - value-out (:! Top (maybe.assume (array.read +2 valueT))) + value-out (:! Any (maybe.assume (array.read +2 valueT))) same-tag? (n/= tag-in (|> tag-out host.int-to-long (:! Nat))) same-flag? (case last?-out (#.Some last?-out') @@ -81,34 +81,34 @@ (<| (times +100) (structure-spec run-jvm))) -(context: "[JS] Structures." - (<| (times +100) - (structure-spec run-js))) +## (context: "[JS] Structures." +## (<| (times +100) +## (structure-spec run-js))) -(context: "[Lua] Structures." - (<| (times +100) - (structure-spec run-lua))) +## (context: "[Lua] Structures." +## (<| (times +100) +## (structure-spec run-lua))) -(context: "[Ruby] Structures." - (<| (times +100) - (structure-spec run-ruby))) +## (context: "[Ruby] Structures." +## (<| (times +100) +## (structure-spec run-ruby))) -(context: "[Python] Structures." - (<| (times +100) - (structure-spec run-python))) +## (context: "[Python] Structures." +## (<| (times +100) +## (structure-spec run-python))) -(context: "[R] Structures." - (<| (times +100) - (structure-spec run-r))) +## (context: "[R] Structures." +## (<| (times +100) +## (structure-spec run-r))) -(context: "[Scheme] Structures." - (<| (times +100) - (structure-spec run-scheme))) +## (context: "[Scheme] Structures." +## (<| (times +100) +## (structure-spec run-scheme))) -(context: "[Common Lisp] Structures." - (<| (times +100) - (structure-spec run-common-lisp))) +## (context: "[Common Lisp] Structures." +## (<| (times +100) +## (structure-spec run-common-lisp))) -(context: "[PHP] Structures." - (<| (times +100) - (structure-spec run-php))) +## (context: "[PHP] Structures." +## (<| (times +100) +## (structure-spec run-php))) diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 795133b33..5fbbf44b5 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -9,10 +9,10 @@ [["" +0 +0] (+0 true)]] (+0)))]) -## (type: Top +## (type: Any ## (Ex [a] a)) -("lux def" Top - (+10 ["lux" "Top"] +("lux def" Any + (+10 ["lux" "Any"] (+8 (+0) (+4 +1))) [dummy-cursor (+10 (+1 [[dummy-cursor (+7 ["lux" "type?"])] @@ -25,10 +25,10 @@ It can be used to write functions or data-structures that can take, or return, anything.")]] (+0)))))]) -## (type: Bottom +## (type: Nothing ## (All [a] a)) -("lux def" Bottom - (+10 ["lux" "Bottom"] +("lux def" Nothing + (+10 ["lux" "Nothing"] (+7 (+0) (+4 +1))) [dummy-cursor (+10 (+1 [[dummy-cursor (+7 ["lux" "type?"])] @@ -48,7 +48,7 @@ (+10 ["lux" "List"] (+7 (+0) (+1 ## "lux.Nil" - Top + Any ## "lux.Cons" (+2 (+4 +1) (+9 (+4 +1) (+4 +0)))))) @@ -175,7 +175,7 @@ (+10 ["lux" "Maybe"] (+7 #Nil (+1 ## "lux.None" - Top + Any ## "lux.Some" (+4 +1)))) [dummy-cursor @@ -212,7 +212,7 @@ {Type-List ("lux case" ("lux check type" (+2 Type Type)) {Type-Pair - (+9 Bottom + (+9 Nothing (+7 #Nil (+1 ## "lux.Primitive" (+2 Text Type-List) @@ -468,10 +468,10 @@ (record$ #Nil)) ## (type: Definition -## [Type Code Top]) +## [Type Code Any]) ("lux def" Definition (#Named ["lux" "Definition"] - (#Product Type (#Product Code Top))) + (#Product Type (#Product Code Any))) (record$ (#Cons [(tag$ ["lux" "doc"]) (text$ "Represents all the data associated with a definition: its type, its annotations, and its value.")] default-def-meta-exported))) @@ -565,12 +565,12 @@ (#Named ["lux" "Module-State"] (#Sum ## #Active - Top + Any (#Sum ## #Compiled - Top + Any ## #Cached - Top))) + Any))) (record$ (#Cons [(tag$ ["lux" "tags"]) (tuple$ (#Cons (text$ "Active") (#Cons (text$ "Compiled") (#Cons (text$ "Cached") #Nil))))] default-def-meta-exported))) @@ -652,11 +652,11 @@ ("lux def" Mode (#Named ["lux" "Mode"] (#Sum ## Build - Top + Any (#Sum ## Eval - Top + Any ## REPL - Top))) + Any))) (record$ (#Cons [(tag$ ["lux" "tags"]) (tuple$ (#Cons (text$ "Build") (#Cons (text$ "Eval") @@ -700,8 +700,8 @@ ## #expected (Maybe Type) ## #seed Nat ## #scope-type-vars (List Nat) -## #extensions Bottom -## #host Bottom}) +## #extensions Nothing +## #host Nothing}) ("lux def" Lux (#Named ["lux" "Lux"] (#Product ## "lux.info" @@ -725,9 +725,9 @@ (#Product ## scope-type-vars (#Apply Nat List) (#Product ## extensions - Bottom + Nothing ## "lux.host" - Bottom)))))))))))) + Nothing)))))))))))) (record$ (#Cons [(tag$ ["lux" "tags"]) (tuple$ (#Cons (text$ "info") (#Cons (text$ "source") @@ -1227,7 +1227,7 @@ ## A name can be provided, to specify a recursive type. (All List [a] - (| Top + (| Any [a (List a)]))")] #Nil) (let'' [self-name tokens] ("lux case" tokens @@ -1374,12 +1374,12 @@ (text$ "## Tuple types: (& Text Int Bool) - ## Top. + ## Any. (&)")] #Nil) ("lux case" (list/reverse tokens) {#Nil - (return (list (symbol$ ["lux" "Top"]))) + (return (list (symbol$ ["lux" "Any"]))) (#Cons last prevs) (return (list (list/fold (function'' [left right] (form$ (list (tag$ ["lux" "Product"]) left right))) @@ -1392,12 +1392,12 @@ (text$ "## Variant types: (| Text Int Bool) - ## Bottom. + ## Nothing. (|)")] #Nil) ("lux case" (list/reverse tokens) {#Nil - (return (list (symbol$ ["lux" "Bottom"]))) + (return (list (symbol$ ["lux" "Nothing"]))) (#Cons last prevs) (return (list (list/fold (function'' [left right] (form$ (list (tag$ ["lux" "Sum"]) left right))) @@ -1774,7 +1774,7 @@ (text$ "Logs message to standard output. Useful for debugging.")]) - (-> Text Top) + (-> Text Any) ("lux io log" message)) (def:''' (text/compose x y) @@ -2212,7 +2212,7 @@ (def:''' (high-bits value) (list) - (-> ($' I64 Top) I64) + (-> ($' I64 Any) I64) ("lux i64 logical-right-shift" +32 value)) (def:''' low-mask @@ -2224,7 +2224,7 @@ (def:''' (low-bits value) (list) - (-> ($' I64 Top) I64) + (-> ($' I64 Any) I64) ("lux i64 and" low-mask value)) (def:''' #export (n/< test subject) @@ -2898,7 +2898,7 @@ (#Cons type #Nil) ("lux case" type {[_ (#Tag "" member-name)] - (return [(` .Top) (#Some (list member-name))]) + (return [(` .Any) (#Some (list member-name))]) [_ (#Form (#Cons [_ (#Tag "" member-name)] member-types))] (return [(` (& (~+ member-types))) (#Some (list member-name))]) @@ -2913,7 +2913,7 @@ (function' [case] ("lux case" case {[_ (#Tag "" member-name)] - (return [member-name (` .Top)]) + (return [member-name (` .Any)]) [_ (#Form (#Cons [_ (#Tag "" member-name)] (#Cons member-type #Nil)))] (return [member-name member-type]) @@ -2956,7 +2956,7 @@ {(#Cons [_ (#Symbol "" name)] (#Cons body #Nil)) (let' [body' (replace-syntax (list [name (` (#.Apply (~ (make-bound +1)) (~ (make-bound +0))))]) (update-bounds body))] - (return (list (` (#.Apply .Bottom (#.UnivQ #.Nil (~ body'))))))) + (return (list (` (#.Apply .Nothing (#.UnivQ #.Nil (~ body'))))))) _ (fail "Wrong syntax for Rec")})) @@ -3608,7 +3608,7 @@ (def: #export (error! message) {#.doc "## Causes an error, with the given error message. (error! \"OH NO!\")"} - (-> Text Bottom) + (-> Text Nothing) ("lux io error" message)) (macro: (default tokens state) @@ -4027,9 +4027,9 @@ (if (empty? args) (let [g!param (symbol$ ["" ""]) prime-name (symbol$ ["" name]) - type+ (replace-syntax (list [name (` ((~ prime-name) .Bottom))]) type)] + type+ (replace-syntax (list [name (` ((~ prime-name) .Nothing))]) type)] (#Some (` ((All (~ prime-name) [(~ g!param)] (~ type+)) - .Bottom)))) + .Nothing)))) #None) (case args #Nil @@ -4432,13 +4432,13 @@ #inner _ #locals {#counter _ #mappings locals} #captured {#counter _ #mappings closure}} - (try-both (find (: (-> [Text [Type Top]] (Maybe Type)) + (try-both (find (: (-> [Text [Type Any]] (Maybe Type)) (function (_ [bname [type _]]) (if (text/= name bname) (#Some type) #None)))) - (: (List [Text [Type Top]]) locals) - (: (List [Text [Type Top]]) closure))))) + (: (List [Text [Type Any]]) locals) + (: (List [Text [Type Any]]) closure))))) scopes))) (def: (find-def-type name state) @@ -4461,7 +4461,7 @@ (#Some def-type))))) (def: (find-def-value name state) - (-> Ident (Meta [Type Top])) + (-> Ident (Meta [Type Any])) (let [[v-prefix v-name] name {#info info #source source #current-module _ #modules modules #scopes scopes #type-context types #host host @@ -4824,10 +4824,10 @@ openings+options (parse-openings options) #let [[openings options] openings+options] current-module current-module-name - #let [test-referrals (: (-> Text (List Text) (List Text) (Meta (List Top))) + #let [test-referrals (: (-> Text (List Text) (List Text) (Meta (List Any))) (function (_ module-name all-defs referred-defs) (monad/map Monad<Meta> - (: (-> Text (Meta Top)) + (: (-> Text (Meta Any)) (function (_ _def) (if (is-member? all-defs _def) (return []) @@ -4849,10 +4849,10 @@ (-> Text Refer (Meta (List Code))) (do Monad<Meta> [current-module current-module-name - #let [test-referrals (: (-> Text (List Text) (List Text) (Meta (List Top))) + #let [test-referrals (: (-> Text (List Text) (List Text) (Meta (List Any))) (function (_ module-name all-defs referred-defs) (monad/map Monad<Meta> - (: (-> Text (Meta Top)) + (: (-> Text (Meta Any)) (function (_ _def) (if (is-member? all-defs _def) (return []) @@ -5299,7 +5299,7 @@ (do-template [<name> <to>] [(def: #export <name> - (-> (I64 Top) <to>) + (-> (I64 Any) <to>) (|>> (:! <to>)))] [i64 I64] @@ -6016,7 +6016,7 @@ )) (def: (parse-end tokens) - (-> (List Code) (Meta Top)) + (-> (List Code) (Meta Any)) (case tokens (^ (list)) (return []) @@ -6297,7 +6297,7 @@ ) (def: to-significand - (-> (I64 Top) Frac) + (-> (I64 Any) Frac) (|>> ("lux i64 logical-right-shift" +11) int-to-frac)) diff --git a/stdlib/source/lux/cli.lux b/stdlib/source/lux/cli.lux index 72a22a267..281dfd9d5 100644 --- a/stdlib/source/lux/cli.lux +++ b/stdlib/source/lux/cli.lux @@ -53,7 +53,7 @@ (def: #export (this reference) {#.doc "Checks that a token is in the inputs."} - (-> Text (CLI Top)) + (-> Text (CLI Any)) (function (_ inputs) (do E.Monad<Error> [[remaining raw] (any inputs)] @@ -83,7 +83,7 @@ (def: #export end {#.doc "Ensures there are no more inputs."} - (CLI Top) + (CLI Any) (function (_ inputs) (case inputs #.Nil (#E.Success [inputs []]) @@ -133,7 +133,7 @@ (with-gensyms [g!args g!_ g!output g!message] (wrap (list (` ("lux program" (.function ((~ g!program) (~ g!args)) - (case ((: (~! (..CLI (io.IO .Top))) + (case ((: (~! (..CLI (io.IO .Any))) ((~! do) (~! p.Monad<Parser>) [(~+ (|> args (list/map (function (_ [binding parser]) diff --git a/stdlib/source/lux/concurrency/actor.lux b/stdlib/source/lux/concurrency/actor.lux index 1e512d642..77543ba78 100644 --- a/stdlib/source/lux/concurrency/actor.lux +++ b/stdlib/source/lux/concurrency/actor.lux @@ -61,7 +61,7 @@ (type: #export (Behavior s) {#.doc "An actor's behavior when messages are received."} {#handle (-> (Message s) s (Actor s) (Task s)) - #end (-> Text s (Promise Top))}) + #end (-> Text s (Promise Any))}) (def: #export (spawn behavior init) {#.doc "Given a behavior and initial state, spawns an actor and returns it."} @@ -124,7 +124,7 @@ (message state self)) (def: (default-end cause state) - (All [s] (-> Text s (Promise Top))) + (All [s] (-> Text s (Promise Any))) (promise/wrap [])) (def: #export default-behavior diff --git a/stdlib/source/lux/concurrency/atom.lux b/stdlib/source/lux/concurrency/atom.lux index c60edd01e..10f7005d3 100644 --- a/stdlib/source/lux/concurrency/atom.lux +++ b/stdlib/source/lux/concurrency/atom.lux @@ -37,5 +37,5 @@ (recur [])))))) (def: #export (write value atom) - (All [a] (-> a (Atom a) (IO Top))) + (All [a] (-> a (Atom a) (IO Any))) (update (function.const value) atom)) diff --git a/stdlib/source/lux/concurrency/frp.lux b/stdlib/source/lux/concurrency/frp.lux index caa1173c2..28d7be094 100644 --- a/stdlib/source/lux/concurrency/frp.lux +++ b/stdlib/source/lux/concurrency/frp.lux @@ -12,14 +12,14 @@ ## [Types] (abstract: #export (Channel a) {#.doc "An asynchronous channel to distribute values."} - (Atom (List (-> a (IO Top)))) + (Atom (List (-> a (IO Any)))) (def: #export (channel _) - (All [a] (-> Top (Channel a))) + (All [a] (-> Any (Channel a))) (@abstraction (atom (list)))) (def: #export (listen listener (^@representation channel)) - (All [a] (-> (-> a (IO Top)) (Channel a) (IO Top))) + (All [a] (-> (-> a (IO Any)) (Channel a) (IO Any))) ## TODO: Simplify when possible. (do io.Monad<IO> [_ (atom.update (|>> (#.Cons listener)) channel)] @@ -27,7 +27,7 @@ (def: #export (publish (^@representation channel) value) {#.doc "Publish to a channel."} - (All [a] (-> (Channel a) a (IO Top))) + (All [a] (-> (Channel a) a (IO Any))) (do io.Monad<IO> [listeners (atom.read channel)] (monad.map @ (function (_ listener) (listener value)) listeners))) @@ -46,7 +46,7 @@ (def: #export (pipe output input) {#.doc "Copy/pipe the contents of a channel on to another."} - (All [a] (-> (Channel a) (Channel a) (IO Top))) + (All [a] (-> (Channel a) (Channel a) (IO Any))) (listen (publish output) input)) @@ -76,7 +76,7 @@ output))) (def: #export (periodic time) - (-> Nat (Channel Top)) + (-> Nat (Channel Any)) (let [output (channel [])] (exec (io.run (loop [_ []] diff --git a/stdlib/source/lux/concurrency/promise.lux b/stdlib/source/lux/concurrency/promise.lux index 15bad9910..3ccdc22e9 100644 --- a/stdlib/source/lux/concurrency/promise.lux +++ b/stdlib/source/lux/concurrency/promise.lux @@ -15,7 +15,7 @@ (abstract: #export (Promise a) {#.doc "Represents values produced by asynchronous computations (unlike IO, which is synchronous)."} - (Atom [(Maybe a) (List (-> a (IO Top)))]) + (Atom [(Maybe a) (List (-> a (IO Any)))]) (def: #export (promise ?value) (All [a] (-> (Maybe a) (Promise a))) @@ -49,7 +49,7 @@ (resolve value (@abstraction promise))))))) (def: #export (await f (^@representation promise)) - (All [a] (-> (-> a (IO Top)) (Promise a) Top)) + (All [a] (-> (-> a (IO Any)) (Promise a) Any)) (let [(^@ old [_value _observers]) (io.run (atom.read promise))] (case _value (#.Some value) @@ -160,7 +160,7 @@ (def: #export (wait time-millis) {#.doc "Returns a promise that will be resolved after the specified amount of milliseconds."} - (-> Nat (Promise Top)) + (-> Nat (Promise Any)) (delay time-millis [])) (def: #export (time-out time-millis promise) diff --git a/stdlib/source/lux/concurrency/semaphore.lux b/stdlib/source/lux/concurrency/semaphore.lux index c9ac32fcb..23303a236 100644 --- a/stdlib/source/lux/concurrency/semaphore.lux +++ b/stdlib/source/lux/concurrency/semaphore.lux @@ -9,7 +9,7 @@ (type: State {#open-positions Nat - #waiting-list (List (Promise Top))}) + #waiting-list (List (Promise Any))}) (abstract: #export Semaphore {#.doc "A tool for controlling access to resources by multiple concurrent processes."} @@ -22,10 +22,10 @@ #waiting-list (list)}))) (def: #export (wait semaphore) - (Ex [k] (-> Semaphore (Promise Top))) + (Ex [k] (-> Semaphore (Promise Any))) (let [semaphore (@representation semaphore)] (io.run - (loop [signal (: (Promise Top) + (loop [signal (: (Promise Any) (promise.promise #.None))] (do io.Monad<IO> [state (atom.read semaphore) @@ -44,13 +44,13 @@ (recur signal))))))) (def: #export (signal semaphore) - (Ex [k] (-> Semaphore (Promise Top))) + (Ex [k] (-> Semaphore (Promise Any))) (let [semaphore (@representation semaphore)] (promise.future (loop [_ []] (do io.Monad<IO> [state (atom.read semaphore) - #let [[?signal state'] (: [(Maybe (Promise Top)) State] + #let [[?signal state'] (: [(Maybe (Promise Any)) State] (case (get@ #waiting-list state) #.Nil [#.None (update@ #open-positions inc state)] @@ -76,15 +76,15 @@ Semaphore (def: #export (mutex _) - (-> Top Mutex) + (-> Any Mutex) (@abstraction (semaphore +1))) (def: (acquire mutex) - (-> Mutex (Promise Top)) + (-> Mutex (Promise Any)) (wait (@representation mutex))) (def: (release mutex) - (-> Mutex (Promise Top)) + (-> Mutex (Promise Any)) (signal (@representation mutex))) (def: #export (synchronize mutex procedure) @@ -115,7 +115,7 @@ #end-turnstile (semaphore +0)})) (def: (un-block times turnstile) - (-> Nat Semaphore (Promise Top)) + (-> Nat Semaphore (Promise Any)) (loop [step +0] (if (n/< times step) (do promise.Monad<Promise> @@ -125,7 +125,7 @@ (do-template [<phase> <update> <goal> <turnstile>] [(def: (<phase> (^@representation barrier)) - (-> Barrier (Promise Top)) + (-> Barrier (Promise Any)) (do promise.Monad<Promise> [#let [limit (refinement.un-refine (get@ #limit barrier)) goal <goal> @@ -140,7 +140,7 @@ ) (def: #export (block barrier) - (-> Barrier (Promise Top)) + (-> Barrier (Promise Any)) (do promise.Monad<Promise> [_ (start barrier)] (end barrier))) diff --git a/stdlib/source/lux/concurrency/stm.lux b/stdlib/source/lux/concurrency/stm.lux index fb150d842..a7c8b3cf3 100644 --- a/stdlib/source/lux/concurrency/stm.lux +++ b/stdlib/source/lux/concurrency/stm.lux @@ -15,7 +15,7 @@ (abstract: #export (Var a) {#.doc "A mutable cell containing a value, and observers that will be alerted of any change to it."} - (Atom [a (List (-> a (IO Top)))]) + (Atom [a (List (-> a (IO Any)))]) (def: #export (var value) {#.doc "Creates a new STM var, with a default value."} @@ -34,7 +34,7 @@ (:: io.Functor<IO> map product.left))) (def: (write! new-value (^@representation var)) - (All [a] (-> a (Var a) (IO Top))) + (All [a] (-> a (Var a) (IO Any))) (do io.Monad<IO> [(^@ old [_value _observers]) (atom.read var) succeeded? (atom.compare-and-swap old [new-value _observers] var)] @@ -76,8 +76,8 @@ (All [a] (-> (Var a) Tx (Maybe a))) (|> tx (list.find (function (_ [_var _original _current]) - (is? (:! (Var Top) var) - (:! (Var Top) _var)))) + (is? (:! (Var Any) var) + (:! (Var Any) _var)))) (:: maybe.Monad<Maybe> map (function (_ [_var _original _current]) _current)) (:!!) @@ -102,11 +102,11 @@ #.Nil (#.Cons [_var _original _current] tx') - (if (is? (:! (Var Top) var) - (:! (Var Top) _var)) - (#.Cons {#var (:! (Var Top) _var) - #original (:! Top _original) - #current (:! Top value)} + (if (is? (:! (Var Any) var) + (:! (Var Any) _var)) + (#.Cons {#var (:! (Var Any) _var) + #original (:! Any _original) + #current (:! Any value)} tx') (#.Cons {#var _var #original _original @@ -116,7 +116,7 @@ (def: #export (write value var) {#.doc "Writes value to var."} - (All [a] (-> a (Var a) (STM Top))) + (All [a] (-> a (Var a) (STM Any))) (function (_ tx) (case (find-var-value var tx) (#.Some _) @@ -169,7 +169,7 @@ tx)) (def: (commit-var! [_var _original _current]) - (-> (Ex [a] (Tx-Frame a)) Top) + (-> (Ex [a] (Tx-Frame a)) Any) (if (is? _original _current) [] (io.run (write! _current _var)))) @@ -187,7 +187,7 @@ (atom false)) (def: (issue-commit commit) - (-> Commit (IO Top)) + (-> Commit (IO Any)) (let [entry [commit (promise #.None)]] (loop [|commits| (io.run (atom.read pending-commits))] (case (promise.poll |commits|) @@ -202,7 +202,7 @@ (recur tail))))) (def: (process-commit [stm-proc output]) - (-> [(STM Top) (Promise Top)] Top) + (-> [(STM Any) (Promise Any)] Any) (let [[finished-tx value] (stm-proc fresh-tx)] (io.run (if (can-commit? finished-tx) (exec (list/map commit-var! finished-tx) @@ -210,7 +210,7 @@ (issue-commit [stm-proc output]))))) (def: init-processor! - (IO Top) + (IO Any) (do io.Monad<IO> [flag (atom.read commit-processor-flag)] (if flag @@ -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 Top) (Promise Top)] head)) + (io (exec (process-commit (:! [(STM Any) (Promise Any)] head)) (promise.await recur tail)))))) (wrap [])) (wrap []))) diff --git a/stdlib/source/lux/concurrency/task.lux b/stdlib/source/lux/concurrency/task.lux index 8d95842e9..911fdd2d2 100644 --- a/stdlib/source/lux/concurrency/task.lux +++ b/stdlib/source/lux/concurrency/task.lux @@ -70,8 +70,8 @@ ma)))) (syntax: #export (task {type s.any}) - {#.doc (doc "Makes an uninitialized Task (in this example, of Top)." - (task Top))} + {#.doc (doc "Makes an uninitialized Task (in this example, of Any)." + (task Any))} (wrap (list (` (: (..Task (~ type)) (P.promise #.None)))))) diff --git a/stdlib/source/lux/control/concatenative.lux b/stdlib/source/lux/control/concatenative.lux index 1af41bbdb..2b91cac0e 100644 --- a/stdlib/source/lux/control/concatenative.lux +++ b/stdlib/source/lux/control/concatenative.lux @@ -86,10 +86,10 @@ (-> (~ (de-alias inputC)) (~ (de-alias outputC)))))))))))) -(def: begin! Top []) +(def: begin! Any []) (def: end! - (All [a] (-> [Top a] a)) + (All [a] (-> [Any a] a)) (function (_ [_ top]) top)) diff --git a/stdlib/source/lux/control/parser.lux b/stdlib/source/lux/control/parser.lux index 88f2eb20d..14c6c3313 100644 --- a/stdlib/source/lux/control/parser.lux +++ b/stdlib/source/lux/control/parser.lux @@ -59,7 +59,7 @@ ## [Parsers] (def: #export (assert message test) {#.doc "Fails with the given message if the test is false."} - (All [s] (-> Text Bool (Parser s Top))) + (All [s] (-> Text Bool (Parser s Any))) (function (_ input) (if test (#e.Success [input []]) @@ -192,7 +192,7 @@ ))) (def: #export (not p) - (All [s a] (-> (Parser s a) (Parser s Top))) + (All [s a] (-> (Parser s a) (Parser s Any))) (function (_ input) (case (p input) (#e.Error msg) diff --git a/stdlib/source/lux/control/pipe.lux b/stdlib/source/lux/control/pipe.lux index 19d67ce7d..4cbfe3504 100644 --- a/stdlib/source/lux/control/pipe.lux +++ b/stdlib/source/lux/control/pipe.lux @@ -35,7 +35,7 @@ (~ body)))))) (def: _reverse_ - (Syntax Top) + (Syntax Any) (function (_ tokens) (#e.Success [(list.reverse tokens) []]))) diff --git a/stdlib/source/lux/control/region.lux b/stdlib/source/lux/control/region.lux index e26a23ab9..7397d9781 100644 --- a/stdlib/source/lux/control/region.lux +++ b/stdlib/source/lux/control/region.lux @@ -9,7 +9,7 @@ (coll [list "list/" Fold<List>])))) (type: (Cleaner r m) - (-> r (m (Error Top)))) + (-> r (m (Error Any)))) (type: #export (Region r m a) (-> [r (List (Cleaner r m))] @@ -36,7 +36,7 @@ error|output)))) (def: (combine-outcomes clean-up output) - (All [a] (-> (Error Top) (Error a) (Error a))) + (All [a] (-> (Error Any) (Error a) (Error a))) (case clean-up (#e.Success _) output @@ -55,7 +55,7 @@ (wrap (list/fold combine-outcomes output results)))) (def: #export (acquire Monad<m> cleaner value) - (All [m a] (-> (Monad m) (-> a (m (Error Top))) a + (All [m a] (-> (Monad m) (-> a (m (Error Any))) a (All [r] (Region r m a)))) (function (_ [region cleaners]) (:: Monad<m> wrap [(#.Cons (function (_ region) (cleaner value)) diff --git a/stdlib/source/lux/control/state.lux b/stdlib/source/lux/control/state.lux index ab69ed9fe..296147e6b 100644 --- a/stdlib/source/lux/control/state.lux +++ b/stdlib/source/lux/control/state.lux @@ -52,13 +52,13 @@ (def: #export (put new-state) {#.doc "Set the new state."} - (All [s] (-> s (State s Top))) + (All [s] (-> s (State s Any))) (function (_ state) [new-state []])) (def: #export (update change) {#.doc "Compute the new state."} - (All [s] (-> (-> s s) (State s Top))) + (All [s] (-> (-> s s) (State s Any))) (function (_ state) [(change state) []])) @@ -134,7 +134,7 @@ (wrap [state a])))) (def: #export (while condition body) - (All [s] (-> (State s Bool) (State s Top) (State s Top))) + (All [s] (-> (State s Bool) (State s Any) (State s Any))) (do Monad<State> [execute? condition] (if execute? @@ -144,7 +144,7 @@ (wrap [])))) (def: #export (do-while condition body) - (All [s] (-> (State s Bool) (State s Top) (State s Top))) + (All [s] (-> (State s Bool) (State s Any) (State s Any))) (do Monad<State> [_ body] (while condition body))) diff --git a/stdlib/source/lux/control/thread.lux b/stdlib/source/lux/control/thread.lux index e44869043..7d46f3707 100644 --- a/stdlib/source/lux/control/thread.lux +++ b/stdlib/source/lux/control/thread.lux @@ -23,7 +23,7 @@ ("lux box read" box))) (def: #export (write value box) - (All [a] (-> a (All [!] (-> (Box ! a) (Thread ! Top))))) + (All [a] (-> a (All [!] (-> (Box ! a) (Thread ! Any))))) (function (_ !) ("lux box write" value box))) diff --git a/stdlib/source/lux/control/writer.lux b/stdlib/source/lux/control/writer.lux index 7f23e2750..3dcf64cc3 100644 --- a/stdlib/source/lux/control/writer.lux +++ b/stdlib/source/lux/control/writer.lux @@ -44,7 +44,7 @@ (def: #export (log l) {#.doc "Set the log to a particular value."} - (All [l] (-> l (Writer l Top))) + (All [l] (-> l (Writer l Any))) [l []]) (struct: #export (WriterT Monoid<l> Monad<M>) diff --git a/stdlib/source/lux/data/bit.lux b/stdlib/source/lux/data/bit.lux index e89cf0c9d..a0f8e18a7 100644 --- a/stdlib/source/lux/data/bit.lux +++ b/stdlib/source/lux/data/bit.lux @@ -33,7 +33,7 @@ (def: #export (count subject) {#.doc "Count the number of 1s in a bit-map."} - (-> (I64 Top) Nat) + (-> (I64 Any) Nat) (let [count' (n/- (|> subject (right-shift +1) (and +6148914691236517205) i64) (i64 subject))] (|> count' @@ -69,7 +69,7 @@ ) (def: #export (set? idx input) - (-> Nat (I64 Top) Bool) + (-> Nat (I64 Any) Bool) (|> input (:! I64) (..and (flag idx)) (n/= +0) .not)) (do-template [<name> <main> <comp>] diff --git a/stdlib/source/lux/data/coll/sequence.lux b/stdlib/source/lux/data/coll/sequence.lux index f5ade6bed..4e6226dcd 100644 --- a/stdlib/source/lux/data/coll/sequence.lux +++ b/stdlib/source/lux/data/coll/sequence.lux @@ -59,7 +59,7 @@ (bit.and branch-idx-mask)) (def: (new-hierarchy _) - (All [a] (-> Top (Hierarchy a))) + (All [a] (-> Any (Hierarchy a))) (array.new full-node-size)) (def: (tail-off vec-size) diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux index 03d4de615..9262c3d70 100644 --- a/stdlib/source/lux/data/format/json.lux +++ b/stdlib/source/lux/data/format/json.lux @@ -24,7 +24,7 @@ (do-template [<name> <type>] [(type: #export <name> <type>)] - [Null Top] + [Null Any] [Boolean Bool] [Number Frac] [String Text] @@ -234,7 +234,7 @@ _ (fail ($_ text/compose "JSON value is not " <desc> ".")))))] - [null Top #Null "null"] + [null Any #Null "null"] [boolean Bool #Boolean "boolean"] [number Frac #Number "number"] [string Text #String "string"] @@ -255,7 +255,7 @@ (def: #export (<check> test) {#.doc (code.text ($_ text/compose "Ensures a JSON value is a " <desc> "."))} - (-> <type> (Reader Top)) + (-> <type> (Reader Any)) (do p.Monad<Parser> [head any] (case head @@ -395,7 +395,7 @@ (l.some l.space)) (def: data-sep - (l.Lexer [Text Top Text]) + (l.Lexer [Text Any Text]) ($_ p.seq space~ (l.this ",") space~)) (def: null~ @@ -467,7 +467,7 @@ (wrap chars)))) (def: (kv~ json~) - (-> (-> Top (l.Lexer JSON)) (l.Lexer [String JSON])) + (-> (-> Any (l.Lexer JSON)) (l.Lexer [String JSON])) (do p.Monad<Parser> [key string~ _ space~ @@ -478,7 +478,7 @@ (do-template [<name> <type> <open> <close> <elem-parser> <prep>] [(def: (<name> json~) - (-> (-> Top (l.Lexer JSON)) (l.Lexer <type>)) + (-> (-> Any (l.Lexer JSON)) (l.Lexer <type>)) (do p.Monad<Parser> [_ (l.this <open>) _ space~ @@ -492,7 +492,7 @@ ) (def: (json~' _) - (-> Top (l.Lexer JSON)) + (-> Any (l.Lexer JSON)) ($_ p.alt null~ boolean~ number~ string~ (array~ json~') (object~ json~'))) (struct: #export _ (Codec Text JSON) diff --git a/stdlib/source/lux/data/format/xml.lux b/stdlib/source/lux/data/format/xml.lux index d1a84d675..a725263af 100644 --- a/stdlib/source/lux/data/format/xml.lux +++ b/stdlib/source/lux/data/format/xml.lux @@ -304,7 +304,7 @@ (#E.Error error))) (def: #export (node tag) - (-> Ident (Reader Top)) + (-> Ident (Reader Any)) (function (_ docs) (case docs #.Nil @@ -338,7 +338,7 @@ (wrap [tail output])))))) (def: #export ignore - (Reader Top) + (Reader Any) (function (_ docs) (case docs #.Nil diff --git a/stdlib/source/lux/data/number.lux b/stdlib/source/lux/data/number.lux index 2aba0da7a..72c6dbb86 100644 --- a/stdlib/source/lux/data/number.lux +++ b/stdlib/source/lux/data/number.lux @@ -731,7 +731,7 @@ (type: Digits (Array Nat)) (def: (make-digits _) - (-> Top Digits) + (-> Any Digits) ("lux array new" bit.width)) (def: (digits-get idx digits) @@ -955,7 +955,7 @@ (do-template [<getter> <mask> <size> <offset>] [(def: <mask> (|> +1 (bit.left-shift <size>) dec (bit.left-shift <offset>))) (def: (<getter> input) - (-> (I64 Top) I64) + (-> (I64 Any) I64) (|> input (bit.and <mask>) (bit.logical-right-shift <offset>) i64))] [mantissa mantissa-mask mantissa-size +0] @@ -964,7 +964,7 @@ ) (def: #export (bits-to-frac input) - (-> (I64 Top) Frac) + (-> (I64 Any) Frac) (let [S (sign input) E (exponent input) M (mantissa input)] diff --git a/stdlib/source/lux/data/text/lexer.lux b/stdlib/source/lux/data/text/lexer.lux index d965020e0..84495a6a8 100644 --- a/stdlib/source/lux/data/text/lexer.lux +++ b/stdlib/source/lux/data/text/lexer.lux @@ -63,7 +63,7 @@ (def: #export (this reference) {#.doc "Lex a text if it matches the given sample."} - (-> Text (Lexer Top)) + (-> Text (Lexer Any)) (function (_ [offset tape]) (case (text.index-of' reference offset tape) (#.Some where) @@ -87,7 +87,7 @@ (def: #export end {#.doc "Ensure the lexer's input is empty."} - (Lexer Top) + (Lexer Any) (function (_ (^@ input [offset tape])) (if (n/= offset (text.size tape)) (#e.Success [input []]) diff --git a/stdlib/source/lux/data/text/regex.lux b/stdlib/source/lux/data/text/regex.lux index f644c4669..cf0d69475 100644 --- a/stdlib/source/lux/data/text/regex.lux +++ b/stdlib/source/lux/data/text/regex.lux @@ -309,7 +309,7 @@ )) (def: (unflatten^ lexer) - (-> (l.Lexer Text) (l.Lexer [Text Top])) + (-> (l.Lexer Text) (l.Lexer [Text Any])) (p.seq lexer (:: p.Monad<Parser> wrap []))) (def: (|||^ left right) diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index 1f920c0b1..5fbeae68d 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -246,7 +246,7 @@ ["float" (primitive "java.lang.Float")] ["double" (primitive "java.lang.Double")] ["char" (primitive "java.lang.Character")] - ["void" .Top]) + ["void" .Any]) _ #.None)) @@ -264,7 +264,7 @@ ["long" .Int] ["float" .Frac] ["double" .Frac] - ["void" .Top]) + ["void" .Any]) _ #.None)) @@ -530,7 +530,7 @@ (-> Text Text (Syntax Code)) (do p.Monad<Parser> [#let [dotted-name (format "::" field-name)] - [_ _ value] (: (Syntax [Top Top Code]) + [_ _ value] (: (Syntax [Any Any Code]) (s.form ($_ p.seq (s.this (' :=)) (s.this (code.symbol ["" dotted-name])) s.any)))] (wrap (`' ((~ (code.text (format "jvm putfield" ":" class-name ":" field-name))) _jvm_this (~ value)))))) @@ -657,7 +657,7 @@ (s.this (' >)))) (def: (assert-no-periods name) - (-> Text (Syntax Top)) + (-> Text (Syntax Any)) (p.assert "Names in class declarations cannot contain periods." (not (text.contains? "." name)))) @@ -1809,8 +1809,8 @@ (` ((~ setter-name) (~ g!value))) (` ((~ setter-name) (~ g!value) (~ g!obj)))) setter-type (if import-field-static? - (` (All [(~+ tvar-asts)] (-> (~ typeC) (IO Top)))) - (` (All [(~+ tvar-asts)] (-> (~ typeC) (~ classC) (IO Top))))) + (` (All [(~+ tvar-asts)] (-> (~ typeC) (IO Any)))) + (` (All [(~+ tvar-asts)] (-> (~ typeC) (~ classC) (IO Any))))) setter-value (with-mode-field-set import-field-mode import-field-type g!value) setter-value (if import-field-maybe? (` (!!! (~ setter-value))) @@ -1840,7 +1840,7 @@ ("jvm invokevirtual:java.lang.Class:isInterface:" class)) (def: (load-class class-name) - (-> Text (Either Text (primitive "java.lang.Class" [Top]))) + (-> Text (Either Text (primitive "java.lang.Class" [Any]))) (try ("jvm invokestatic:java.lang.Class:forName:java.lang.String" class-name))) (def: (class-kind [class-name _]) @@ -1942,7 +1942,7 @@ (def: (type->class-name type) (-> Type (Meta Text)) - (if (type/= Top type) + (if (type/= Any type) (:: Monad<Meta> wrap "java.lang.Object") (case type (#.Primitive name params) diff --git a/stdlib/source/lux/io.lux b/stdlib/source/lux/io.lux index d35584fd1..21d70de61 100644 --- a/stdlib/source/lux/io.lux +++ b/stdlib/source/lux/io.lux @@ -9,7 +9,7 @@ (type: #export (IO a) {#.doc "A type that represents synchronous, effectful computations that may interact with the outside world."} - (-> Bottom a)) + (-> Nothing a)) (macro: #export (io tokens state) {#.doc (doc "Delays the evaluation of an expression, by wrapping it in an IO 'thunk'." @@ -27,13 +27,13 @@ (struct: #export _ (Functor IO) (def: (map f ma) - (io (f (ma (:! Bottom [])))))) + (io (f (ma (:! Nothing [])))))) (struct: #export _ (Apply IO) (def: functor Functor<IO>) (def: (apply ff fa) - (io ((ff (:! Bottom [])) (fa (:! Bottom [])))))) + (io ((ff (:! Nothing [])) (fa (:! Nothing [])))))) (struct: #export _ (Monad IO) (def: functor Functor<IO>) @@ -42,15 +42,15 @@ (io x)) (def: (join mma) - (io ((mma (:! Bottom [])) (:! Bottom []))))) + (io ((mma (:! Nothing [])) (:! Nothing []))))) (def: #export (run action) {#.doc "A way to execute IO computations and perform their side-effects."} (All [a] (-> (IO a) a)) - (action (:! Bottom []))) + (action (:! Nothing []))) (def: #export (exit code) - (-> Int (IO Bottom)) + (-> Int (IO Nothing)) (io ("lux io exit" code))) ## Process diff --git a/stdlib/source/lux/lang.lux b/stdlib/source/lux/lang.lux index 9f164b719..4c467c7fb 100644 --- a/stdlib/source/lux/lang.lux +++ b/stdlib/source/lux/lang.lux @@ -10,7 +10,7 @@ (macro ["s" syntax #+ syntax:]))) (type: #export Eval - (-> Type Code (Meta Top))) + (-> Type Code (Meta Any))) (def: #export (fail message) (All [a] (-> Text (Meta a))) diff --git a/stdlib/source/lux/lang/analysis/case.lux b/stdlib/source/lux/lang/analysis/case.lux index 3140a9d7e..744d3cf24 100644 --- a/stdlib/source/lux/lang/analysis/case.lux +++ b/stdlib/source/lux/lang/analysis/case.lux @@ -168,7 +168,7 @@ [Deg (#.Deg pattern-value) (#analysisL.Deg pattern-value)] [Frac (#.Frac pattern-value) (#analysisL.Frac pattern-value)] [Text (#.Text pattern-value) (#analysisL.Text pattern-value)] - [Top (#.Tuple #.Nil) #analysisL.Unit]) + [Any (#.Tuple #.Nil) #analysisL.Unit]) (^ [cursor (#.Tuple (list singleton))]) (analyse-pattern #.None inputT singleton next) diff --git a/stdlib/source/lux/lang/analysis/primitive.lux b/stdlib/source/lux/lang/analysis/primitive.lux index f154932e6..74596fba2 100644 --- a/stdlib/source/lux/lang/analysis/primitive.lux +++ b/stdlib/source/lux/lang/analysis/primitive.lux @@ -24,5 +24,5 @@ (def: #export unit (Meta Analysis) (do macro.Monad<Meta> - [_ (typeA.infer Top)] + [_ (typeA.infer Any)] (wrap (#//.Primitive #//.Unit)))) diff --git a/stdlib/source/lux/lang/analysis/structure.lux b/stdlib/source/lux/lang/analysis/structure.lux index 8e3611e67..4e91baad7 100644 --- a/stdlib/source/lux/lang/analysis/structure.lux +++ b/stdlib/source/lux/lang/analysis/structure.lux @@ -299,7 +299,7 @@ (case record ## empty-record = empty-tuple = unit = [] #.Nil - (:: macro.Monad<Meta> wrap [(list) Top]) + (:: macro.Monad<Meta> wrap [(list) Any]) (#.Cons [head-k head-v] _) (do macro.Monad<Meta> diff --git a/stdlib/source/lux/lang/analysis/type.lux b/stdlib/source/lux/lang/analysis/type.lux index 6d06d5cff..a7f9b3b29 100644 --- a/stdlib/source/lux/lang/analysis/type.lux +++ b/stdlib/source/lux/lang/analysis/type.lux @@ -42,7 +42,7 @@ output)))) (def: #export (infer actualT) - (-> Type (Meta Top)) + (-> Type (Meta Any)) (do macro.Monad<Meta> [expectedT macro.expected-type] (with-env diff --git a/stdlib/source/lux/lang/init.lux b/stdlib/source/lux/lang/init.lux index a1ef4ffb8..80e6d4740 100644 --- a/stdlib/source/lux/lang/init.lux +++ b/stdlib/source/lux/lang/init.lux @@ -35,7 +35,7 @@ #.mode #.Build}) (def: #export (compiler host) - (-> Top Lux) + (-> Any Lux) {#.info ..info #.source dummy-source #.cursor .dummy-cursor @@ -46,11 +46,11 @@ #.expected #.None #.seed +0 #.scope-type-vars (list) - #.extensions (:! Bottom + #.extensions (:! Nothing [] ## {#extensionL.analysis analysisE.defaults ## #extensionL.synthesis synthesisE.defaults ## #extensionL.translation translationE.defaults ## #extensionL.statement statementE.defaults} ) - #.host (:! Bottom host)}) + #.host (:! Nothing host)}) diff --git a/stdlib/source/lux/lang/module.lux b/stdlib/source/lux/lang/module.lux index d5efb1d7e..161fd073a 100644 --- a/stdlib/source/lux/lang/module.lux +++ b/stdlib/source/lux/lang/module.lux @@ -56,7 +56,7 @@ #.module-state #.Active}) (def: #export (set-annotations annotations) - (-> Code (Meta Top)) + (-> Code (Meta Any)) (do macro.Monad<Meta> [self-name macro.current-module-name self macro.current-module] @@ -72,7 +72,7 @@ (//.throw cannot-set-module-annotations-more-than-once [self-name old annotations])))) (def: #export (import module) - (-> Text (Meta Top)) + (-> Text (Meta Any)) (do macro.Monad<Meta> [self-name macro.current-module-name] (function (_ compiler) @@ -82,7 +82,7 @@ []])))) (def: #export (alias alias module) - (-> Text Text (Meta Top)) + (-> Text Text (Meta Any)) (do macro.Monad<Meta> [self-name macro.current-module-name] (function (_ compiler) @@ -141,7 +141,7 @@ (do-template [<setter> <asker> <tag>] [(def: #export (<setter> module-name) - (-> Text (Meta Top)) + (-> Text (Meta Any)) (function (_ compiler) (case (|> compiler (get@ #.modules) (plist.get module-name)) (#.Some module) @@ -194,7 +194,7 @@ ) (def: (ensure-undeclared-tags module-name tags) - (-> Text (List Tag) (Meta Top)) + (-> Text (List Tag) (Meta Any)) (do macro.Monad<Meta> [bindings (..tags module-name) _ (monad.map @ @@ -209,7 +209,7 @@ (wrap []))) (def: #export (declare-tags tags exported? type) - (-> (List Tag) Bool Type (Meta Top)) + (-> (List Tag) Bool Type (Meta Any)) (do macro.Monad<Meta> [self-name macro.current-module-name [type-module type-name] (case type diff --git a/stdlib/source/lux/lang/syntax.lux b/stdlib/source/lux/lang/syntax.lux index bc1543cac..8029b5975 100644 --- a/stdlib/source/lux/lang/syntax.lux +++ b/stdlib/source/lux/lang/syntax.lux @@ -81,7 +81,7 @@ ## This is just a helper parser to find text which doesn't run into ## any special character sequences for multi-line comments. (def: comment-bound^ - (l.Lexer Top) + (l.Lexer Any) ($_ p.either (l.this new-line) (l.this ")#") diff --git a/stdlib/source/lux/lang/type.lux b/stdlib/source/lux/lang/type.lux index 1bfea13d6..36e6a74a8 100644 --- a/stdlib/source/lux/lang/type.lux +++ b/stdlib/source/lux/lang/type.lux @@ -274,8 +274,8 @@ (#.Cons type types') (<ctor> type (<name> types'))))] - [variant Bottom #.Sum] - [tuple Top #.Product] + [variant Nothing #.Sum] + [tuple Any #.Product] ) (def: #export (function inputs output) diff --git a/stdlib/source/lux/lang/type/check.lux b/stdlib/source/lux/lang/type/check.lux index 4537ae38d..61001d8be 100644 --- a/stdlib/source/lux/lang/type/check.lux +++ b/stdlib/source/lux/lang/type/check.lux @@ -203,7 +203,7 @@ (ex.throw unknown-type-var id)))) (def: #export (write type id) - (-> Type Var (Check Top)) + (-> Type Var (Check Any)) (function (_ context) (case (|> context (get@ #.var-bindings) (var::get id)) (#.Some (#.Some bound)) @@ -217,7 +217,7 @@ (ex.throw unknown-type-var id)))) (def: (update type id) - (-> Type Var (Check Top)) + (-> Type Var (Check Any)) (function (_ context) (case (|> context (get@ #.var-bindings) (var::get id)) (#.Some _) @@ -243,7 +243,7 @@ (get@ #.var-bindings context)]))) (def: (set-bindings value) - (-> (List [Var (Maybe Type)]) (Check Top)) + (-> (List [Var (Maybe Type)]) (Check Any)) (function (_ context) (#e.Success [(set@ #.var-bindings value context) []]))) @@ -319,7 +319,7 @@ (#e.Error message))) (def: #export (assert message test) - (-> Text Bool (Check Top)) + (-> Text Bool (Check Any)) (function (_ context) (if test (#e.Success [context []]) @@ -365,13 +365,13 @@ (else (maybe.default (#.Var id) ?bound))))) (def: (link-2 left right) - (-> Var Var (Check Top)) + (-> Var Var (Check Any)) (do Monad<Check> [_ (write (#.Var right) left)] (write (#.Var left) right))) (def: (link-3 interpose to from) - (-> Var Var Var (Check Top)) + (-> Var Var Var (Check Any)) (do Monad<Check> [_ (update (#.Var interpose) from)] (update (#.Var to) interpose))) @@ -449,7 +449,7 @@ (check' etype atype assumptions)))))) (def: (with-error-stack on-error check) - (All [a] (-> (-> Top Text) (Check a) (Check a))) + (All [a] (-> (-> Any Text) (Check a) (Check a))) (function (_ context) (case (check context) (#e.Error error) @@ -625,7 +625,7 @@ (def: #export (check expected actual) {#.doc "Type-check to ensure that the 'expected' type subsumes the 'actual' type."} - (-> Type Type (Check Top)) + (-> Type Type (Check Any)) (do Monad<Check> [assumptions (check' expected actual (list))] (wrap []))) diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux index 8131db902..890ed5273 100644 --- a/stdlib/source/lux/macro.lux +++ b/stdlib/source/lux/macro.lux @@ -97,7 +97,7 @@ (def: #export (assert message test) {#.doc "Fails with the given message if the test is false."} - (-> Text Bool (Meta Top)) + (-> Text Bool (Meta Any)) (function (_ compiler) (if test (#e.Success [compiler []]) @@ -464,19 +464,19 @@ {#.doc "Looks-up the type of a local variable somewhere in the environment."} (-> Text (Meta Type)) (function (_ compiler) - (let [test (: (-> [Text [Type Top]] Bool) + (let [test (: (-> [Text [Type Any]] Bool) (|>> product.left (text/= name)))] (case (do maybe.Monad<Maybe> [scope (list.find (function (_ env) - (or (list.any? test (: (List [Text [Type Top]]) + (or (list.any? test (: (List [Text [Type Any]]) (get@ [#.locals #.mappings] env))) - (list.any? test (: (List [Text [Type Top]]) + (list.any? test (: (List [Text [Type Any]]) (get@ [#.captured #.mappings] env))))) (get@ #.scopes compiler)) [_ [type _]] (try-both (list.find test) - (: (List [Text [Type Top]]) + (: (List [Text [Type Any]]) (get@ [#.locals #.mappings] scope)) - (: (List [Text [Type Top]]) + (: (List [Text [Type Any]]) (get@ [#.captured #.mappings] scope)))] (wrap type)) (#.Some var-type) @@ -535,7 +535,7 @@ (find-def-type name)))) (def: #export (find-type-def name) - {#.doc "Finds the value of a type definition (such as Int, Top or Lux)."} + {#.doc "Finds the value of a type definition (such as Int, Any or Lux)."} (-> Ident (Meta Type)) (do Monad<Meta> [[def-type def-data def-value] (find-def name)] diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux index 63590953b..4c0363df0 100644 --- a/stdlib/source/lux/macro/poly.lux +++ b/stdlib/source/lux/macro/poly.lux @@ -165,7 +165,7 @@ list.reverse))))] (recur (inc current-arg) (|> env' - (dict.put partialI [.Bottom partialC]) + (dict.put partialI [.Nothing partialC]) (dict.put partial-varI [(#.Bound partial-varI) partial-varL])) (#.Cons partial-varL all-varsL)))) [all-varsL env']))]] @@ -196,7 +196,7 @@ (do-template [<name> <test>] [(def: #export (<name> expected) - (-> Type (Poly Top)) + (-> Type (Poly Any)) (do p.Monad<Parser> [actual any] (if (<test> expected actual) @@ -235,7 +235,7 @@ (p.fail ($_ text/compose "Not a bound type: " (type.to-text headT)))))) (def: #export (var id) - (-> Nat (Poly Top)) + (-> Nat (Poly Any)) (do p.Monad<Parser> [env ..env headT any] @@ -280,10 +280,10 @@ (do p.Monad<Parser> [headT any] (case (type.un-name headT) - (#.Apply (#.Named ["lux" "Bottom"] _) (#.UnivQ _ headT')) + (#.Apply (#.Named ["lux" "Nothing"] _) (#.UnivQ _ headT')) (do @ [[recT _ output] (|> poly - (with-extension .Bottom) + (with-extension .Nothing) (with-extension headT) (local (list headT')))] (wrap [recT output])) @@ -297,7 +297,7 @@ [env ..env headT any] (case (type.un-name headT) - (^multi (#.Apply (#.Named ["lux" "Bottom"] _) (#.Bound funcT-idx)) + (^multi (#.Apply (#.Named ["lux" "Nothing"] _) (#.Bound funcT-idx)) (n/= +0 (adjusted-idx env funcT-idx)) [(dict.get +0 env) (#.Some [self-type self-call])]) (wrap self-call) @@ -404,7 +404,7 @@ (|> (dict.get idx env) maybe.assume product.left (to-code env)) (` (.$ (~ (code.nat (dec idx))))))) - (#.Apply (#.Named ["lux" "Bottom"] _) (#.Bound idx)) + (#.Apply (#.Named ["lux" "Nothing"] _) (#.Bound idx)) (let [idx (adjusted-idx env idx)] (if (n/= +0 idx) (|> (dict.get idx env) maybe.assume product.left (to-code env)) diff --git a/stdlib/source/lux/macro/poly/equality.lux b/stdlib/source/lux/macro/poly/equality.lux index 4cf8b2de0..8df347bba 100644 --- a/stdlib/source/lux/macro/poly/equality.lux +++ b/stdlib/source/lux/macro/poly/equality.lux @@ -45,7 +45,7 @@ (wrap (` (: (~ (@Eq inputT)) <eq>))))] - [(poly.this Top) (function ((~ g!_) (~ g!_) (~ g!_)) true)] + [(poly.this Any) (function ((~ g!_) (~ g!_) (~ g!_)) true)] [(poly.like Bool) bool.Eq<Bool>] [(poly.like Nat) number.Eq<Nat>] [(poly.like Int) number.Eq<Int>] diff --git a/stdlib/source/lux/macro/poly/json.lux b/stdlib/source/lux/macro/poly/json.lux index 1bf0cba96..ba20f7627 100644 --- a/stdlib/source/lux/macro/poly/json.lux +++ b/stdlib/source/lux/macro/poly/json.lux @@ -87,7 +87,7 @@ (wrap (` (: (~ (@JSON//encode inputT)) <encoder>))))] - [(poly.this Top) (function ((~ g!_) (~ (code.symbol ["" "0"]))) #//.Null)] + [(poly.this Any) (function ((~ g!_) (~ (code.symbol ["" "0"]))) #//.Null)] [(poly.like Bool) (|>> #//.Boolean)] [(poly.like Nat) (:: (~! ..Codec<JSON,Nat>) (~' encode))] [(poly.like Int) (:: (~! ..Codec<JSON,Int>) (~' encode))] @@ -203,7 +203,7 @@ (wrap (` (: (~ (@JSON//decode inputT)) <decoder>))))] - [(poly.this Top) //.null] + [(poly.this Any) //.null] [(poly.like Bool) //.boolean] [(poly.like Nat) (p.codec (~! ..Codec<JSON,Nat>) //.any)] [(poly.like Int) (p.codec (~! ..Codec<JSON,Int>) //.any)] diff --git a/stdlib/source/lux/macro/syntax.lux b/stdlib/source/lux/macro/syntax.lux index d7621eba4..0268cae29 100644 --- a/stdlib/source/lux/macro/syntax.lux +++ b/stdlib/source/lux/macro/syntax.lux @@ -80,7 +80,7 @@ (def: #export (this ast) {#.doc "Ensures the given Code is the next input."} - (-> Code (Syntax Top)) + (-> Code (Syntax Any)) (function (_ tokens) (case tokens (#.Cons [token tokens']) @@ -143,7 +143,7 @@ (def: #export end! {#.doc "Ensures there are no more inputs."} - (Syntax Top) + (Syntax Any) (function (_ tokens) (case tokens #.Nil (#e.Success [tokens []]) diff --git a/stdlib/source/lux/macro/syntax/common/reader.lux b/stdlib/source/lux/macro/syntax/common/reader.lux index 49ef3851d..c84cc5624 100644 --- a/stdlib/source/lux/macro/syntax/common/reader.lux +++ b/stdlib/source/lux/macro/syntax/common/reader.lux @@ -50,7 +50,7 @@ (s.tuple (p.seq s.text s.text))) (def: (_definition-anns^ _) - (-> Top (Syntax //.Annotations)) + (-> Any (Syntax //.Annotations)) (p.alt (s.this (' #.Nil)) (s.form (do p.Monad<Parser> [_ (s.this (' #.Cons)) @@ -60,7 +60,7 @@ )) (def: (flat-list^ _) - (-> Top (Syntax (List Code))) + (-> Any (Syntax (List Code))) (p.either (do p.Monad<Parser> [_ (s.this (' #.Nil))] (wrap (list))) diff --git a/stdlib/source/lux/math/constructive.lux b/stdlib/source/lux/math/constructive.lux index 25fd6a29f..8d375fad7 100644 --- a/stdlib/source/lux/math/constructive.lux +++ b/stdlib/source/lux/math/constructive.lux @@ -120,7 +120,7 @@ {} - .Top)))) + .Any)))) (#.Some meaning) (wrap (.list (.` (.type: (~+ (scw.export export?)) @@ -185,7 +185,7 @@ (~ meaning))))))) (.type: #export (not p) - (-> p .Bottom)) + (-> p .Nothing)) (.type: #export (Test p) (#True p) @@ -194,6 +194,6 @@ (exception: #export absurd) (.def: #export absurdity - (.All [p] (-> p .Bottom)) + (.All [p] (-> p .Nothing)) (.function (_ proof) (.error! (ex.construct absurd [])))) diff --git a/stdlib/source/lux/math/random.lux b/stdlib/source/lux/math/random.lux index cdb65971c..55c504585 100644 --- a/stdlib/source/lux/math/random.lux +++ b/stdlib/source/lux/math/random.lux @@ -24,7 +24,7 @@ (type: #export #rec PRNG {#.doc "An abstract way to represent any PRNG."} - (-> Top [PRNG I64])) + (-> Any [PRNG I64])) (type: #export (Random a) {#.doc "A producer of random values based on a PRNG."} @@ -248,7 +248,7 @@ {#.doc "An implementation of the PCG32 algorithm. For more information, please see: http://www.pcg-random.org/"} - (-> [(I64 Top) (I64 Top)] PRNG) + (-> [(I64 Any) (I64 Any)] PRNG) (function (_ _) [(|> seed .nat (n/* pcg-32-magic-mult) ("lux i64 +" inc) [inc] pcg-32) (let [rot (|> seed .i64 (bit.logical-right-shift +59))] @@ -263,7 +263,7 @@ {#.doc "An implementation of the Xoroshiro128+ algorithm. For more information, please see: http://xoroshiro.di.unimi.it/"} - (-> [(I64 Top) (I64 Top)] PRNG) + (-> [(I64 Any) (I64 Any)] PRNG) (function (_ _) [(let [s01 (bit.xor s0 s1)] (xoroshiro-128+ [(|> s0 diff --git a/stdlib/source/lux/test.lux b/stdlib/source/lux/test.lux index c78424559..33ac37423 100644 --- a/stdlib/source/lux/test.lux +++ b/stdlib/source/lux/test.lux @@ -22,7 +22,7 @@ (type: #export Seed {#.doc "The seed value used for random testing (if that feature is used)."} - (I64 Top)) + (I64 Any)) (type: #export Test (r.Random (Promise [Counters Text]))) @@ -91,7 +91,7 @@ [prng result]))) (def: (times-failure seed documentation) - (-> (I64 Top) Text Text) + (-> (I64 Any) Text Text) (format "Failed with this seed: " (%n (.nat seed)) "\n" documentation)) @@ -227,7 +227,7 @@ list.reverse (monad.map @ exported-tests) (:: @ map list/join)))] - (wrap (list (` (: (~! (IO Top)) + (wrap (list (` (: (~! (IO Any)) ((~! io) (exec ((~! do) (~! promise.Monad<Promise>) [(~' #let) [(~ g!total-successes) +0 (~ g!total-failures) +0] diff --git a/stdlib/source/lux/type/abstract.lux b/stdlib/source/lux/type/abstract.lux index be53d4d9d..2caaf62bb 100644 --- a/stdlib/source/lux/type/abstract.lux +++ b/stdlib/source/lux/type/abstract.lux @@ -58,7 +58,7 @@ (let [[module kind] (ident-for #..Representation)]))) (def: (install-casts' this-module-name name type-vars) - (-> Text Text (List Text) (Meta Top)) + (-> Text Text (List Text) (Meta Any)) (do macro.Monad<Meta> [this-module (macro.find-module this-module-name) #let [type-varsC (list/map code.local-symbol type-vars) @@ -96,7 +96,7 @@ []])))) (def: (un-install-casts' this-module-name) - (-> Text (Meta Top)) + (-> Text (Meta Any)) (do macro.Monad<Meta> [this-module (macro.find-module this-module-name) #let [this-module (|> this-module diff --git a/stdlib/source/lux/type/resource.lux b/stdlib/source/lux/type/resource.lux index c25db4aab..2c7062c1a 100644 --- a/stdlib/source/lux/type/resource.lux +++ b/stdlib/source/lux/type/resource.lux @@ -137,7 +137,7 @@ (wrap (list& head tail)))))))) (def: (no-op Monad<m>) - (All [m] (-> (Monad m) (Linear m Top))) + (All [m] (-> (Monad m) (Linear m Any))) (function (_ context) (:: Monad<m> wrap [context []]))) (do-template [<name> <m> <monad>] @@ -166,7 +166,7 @@ (Procedure (~! <m>) [(~+ g!inputsT+) (~ g!context)] [(~+ g!outputsT+) (~ g!context)] - .Top)) + .Any)) (function ((~ g!_) [(~+ g!inputs) (~ g!context)]) (:: (~! <monad>) (~' wrap) [[(~+ g!outputs) (~ g!context)] []]))))))))))] @@ -191,7 +191,7 @@ (Procedure (~! <m>) [<from> (~ g!context)] [<to> (~ g!context)] - .Top)) + .Any)) (function ((~ g!_) [<from> (~ g!context)]) (:: (~! <monad>) (~' wrap) [[<to> (~ g!context)] []])))))))))] diff --git a/stdlib/source/lux/world/blob.jvm.lux b/stdlib/source/lux/world/blob.jvm.lux index 88b1913e9..df9fcf8d2 100644 --- a/stdlib/source/lux/world/blob.jvm.lux +++ b/stdlib/source/lux/world/blob.jvm.lux @@ -30,7 +30,7 @@ (|>> host.byte-to-long (:! I64) (bit.and byte-mask))) (def: byte - (-> (I64 Top) (primitive "java.lang.Byte")) + (-> (I64 Any) (primitive "java.lang.Byte")) (|>> .int host.long-to-byte)) (def: #export (create size) @@ -76,7 +76,7 @@ (ex.throw index-out-of-bounds (%n idx)))) (def: #export (write-8 idx value blob) - (-> Nat (I64 Top) Blob (e.Error Blob)) + (-> Nat (I64 Any) Blob (e.Error Blob)) (if (n/< (host.array-length blob) idx) (exec (|> blob (host.array-write idx (..byte value))) @@ -84,7 +84,7 @@ (ex.throw index-out-of-bounds (%n idx)))) (def: #export (write-16 idx value blob) - (-> Nat (I64 Top) Blob (e.Error Blob)) + (-> Nat (I64 Any) Blob (e.Error Blob)) (if (n/< (host.array-length blob) (n/+ +1 idx)) (exec (|> blob (host.array-write idx (..byte (bit.logical-right-shift +8 value))) @@ -93,7 +93,7 @@ (ex.throw index-out-of-bounds (%n idx)))) (def: #export (write-32 idx value blob) - (-> Nat (I64 Top) Blob (e.Error Blob)) + (-> Nat (I64 Any) Blob (e.Error Blob)) (if (n/< (host.array-length blob) (n/+ +3 idx)) (exec (|> blob (host.array-write idx (..byte (bit.logical-right-shift +24 value))) @@ -104,7 +104,7 @@ (ex.throw index-out-of-bounds (%n idx)))) (def: #export (write-64 idx value blob) - (-> Nat (I64 Top) Blob (e.Error Blob)) + (-> Nat (I64 Any) Blob (e.Error Blob)) (if (n/< (host.array-length blob) (n/+ +7 idx)) (exec (|> blob (host.array-write idx (..byte (bit.logical-right-shift +56 value))) diff --git a/stdlib/source/lux/world/console.lux b/stdlib/source/lux/world/console.lux index 7e5d72790..7bd7cfaca 100644 --- a/stdlib/source/lux/world/console.lux +++ b/stdlib/source/lux/world/console.lux @@ -12,8 +12,8 @@ (interface: #export Console (read-char [] (Task Text)) (read-line [] (Task Text)) - (write [Text] (Task Top)) - (close [] (Task Top))) + (write [Text] (Task Any)) + (close [] (Task Any))) (for {"JVM" (as-is (host.import java/io/InputStream diff --git a/stdlib/source/lux/world/file.lux b/stdlib/source/lux/world/file.lux index 92fdd1501..78640ad58 100644 --- a/stdlib/source/lux/world/file.lux +++ b/stdlib/source/lux/world/file.lux @@ -53,7 +53,7 @@ (do-template [<name> <flag>] [(def: #export (<name> data file) - (-> Blob File (Process Top)) + (-> Blob File (Process Any)) (do io.Monad<Process> [stream (FileOutputStream::new [(java/io/File::new file) <flag>]) _ (OutputStream::write [data] stream) diff --git a/stdlib/source/lux/world/net/tcp.jvm.lux b/stdlib/source/lux/world/net/tcp.jvm.lux index a0cfbc4b6..fddd6a94e 100644 --- a/stdlib/source/lux/world/net/tcp.jvm.lux +++ b/stdlib/source/lux/world/net/tcp.jvm.lux @@ -50,7 +50,7 @@ (wrap (.nat bytes-read))))) (def: #export (write data offset length self) - (-> Blob Nat Nat TCP (Task Top)) + (-> Blob Nat Nat TCP (Task Any)) (let [out (get@ #out (@representation self))] (promise.future (do io.Monad<Process> @@ -59,7 +59,7 @@ (Flushable::flush [] out))))) (def: #export (close self) - (-> TCP (Task Top)) + (-> TCP (Task Any)) (let [(^open) (@representation self)] (promise.future (do io.Monad<Process> @@ -85,19 +85,19 @@ (tcp-client socket)))) (def: #export (server port) - (-> //.Port (Task [(Promise Top) + (-> //.Port (Task [(Promise Any) (frp.Channel TCP)])) (promise.future (do (e.ErrorT io.Monad<IO>) [server (ServerSocket::new [(.int port)]) - #let [signal (: (Promise Top) + #let [signal (: (Promise Any) (promise #.None)) _ (promise.await (function (_ _) (AutoCloseable::close [] server)) signal) output (: (frp.Channel TCP) (frp.channel [])) - _ (: (Promise Top) + _ (: (Promise Any) (promise.future (loop [_ []] (do io.Monad<IO> diff --git a/stdlib/source/lux/world/net/udp.jvm.lux b/stdlib/source/lux/world/net/udp.jvm.lux index da4f8f05d..5818020e6 100644 --- a/stdlib/source/lux/world/net/udp.jvm.lux +++ b/stdlib/source/lux/world/net/udp.jvm.lux @@ -72,7 +72,7 @@ (.nat (DatagramPacket::getPort [] packet))]))))) (def: #export (write address port data offset length self) - (-> //.Address //.Port Blob Nat Nat UDP (T.Task Top)) + (-> //.Address //.Port Blob Nat Nat UDP (T.Task Any)) (P.future (do (e.ErrorT io.Monad<IO>) [address (resolve address) @@ -81,13 +81,13 @@ socket)))) (def: #export (close self) - (-> UDP (T.Task Top)) + (-> UDP (T.Task Any)) (let [(^open) (@representation self)] (P.future (AutoCloseable::close [] socket)))) (def: #export (client _) - (-> Top (T.Task UDP)) + (-> Any (T.Task UDP)) (P.future (do (e.ErrorT io.Monad<IO>) [socket (DatagramSocket::new|client [])] diff --git a/stdlib/test/test/lux/concurrency/frp.lux b/stdlib/test/test/lux/concurrency/frp.lux index 527fafb36..6de1634ec 100644 --- a/stdlib/test/test/lux/concurrency/frp.lux +++ b/stdlib/test/test/lux/concurrency/frp.lux @@ -11,7 +11,7 @@ lux/test) (def: (write! values channel) - (All [a] (-> (List a) (Channel a) (IO Top))) + (All [a] (-> (List a) (Channel a) (IO Any))) (do io.Monad<IO> [_ (monad.map @ (frp.publish channel) values)] (wrap []))) diff --git a/stdlib/test/test/lux/concurrency/semaphore.lux b/stdlib/test/test/lux/concurrency/semaphore.lux index af025dbb5..b360426c5 100644 --- a/stdlib/test/test/lux/concurrency/semaphore.lux +++ b/stdlib/test/test/lux/concurrency/semaphore.lux @@ -13,7 +13,7 @@ lux/test) (def: (wait-many-times times semaphore) - (-> Nat /.Semaphore (Promise Top)) + (-> Nat /.Semaphore (Promise Any)) (loop [steps times] (if (n/> +0 steps) (do promise.Monad<Promise> @@ -44,7 +44,7 @@ true))))) (let [semaphore (/.semaphore open-positions)] (wrap (do promise.Monad<Promise> - [_ (: (Promise Top) + [_ (: (Promise Any) (loop [steps (n/* +2 open-positions)] (if (n/> +0 steps) (do @ @@ -110,7 +110,7 @@ )))) (def: (waiter resource barrier id) - (-> (Atom Text) /.Barrier Nat (Promise Top)) + (-> (Atom Text) /.Barrier Nat (Promise Any)) (do promise.Monad<Promise> [_ (/.block barrier) #let [_ (io.run (atom.update (|>> (format (%n id))) resource))]] diff --git a/stdlib/test/test/lux/control/parser.lux b/stdlib/test/test/lux/control/parser.lux index bc26444ce..fd1f67724 100644 --- a/stdlib/test/test/lux/control/parser.lux +++ b/stdlib/test/test/lux/control/parser.lux @@ -25,7 +25,7 @@ _ false)) (def: (enforced? parser input) - (All [s] (-> (&.Parser s Top) s Bool)) + (All [s] (-> (&.Parser s Any) s Bool)) (case (&.run input parser) (#E.Success [_ []]) true diff --git a/stdlib/test/test/lux/control/region.lux b/stdlib/test/test/lux/control/region.lux index a266218f9..48b2b1b7f 100644 --- a/stdlib/test/test/lux/control/region.lux +++ b/stdlib/test/test/lux/control/region.lux @@ -73,7 +73,7 @@ count-clean-up (function (_ value) (do @ [_ (thread.update inc clean-up-counter)] - (wrap (: (Error Top) (ex.throw oops [])))))] + (wrap (: (Error Any) (ex.throw oops [])))))] outcome (/.run @ (do (/.Monad<Region> @) [_ (monad.map @ (/.acquire @@ count-clean-up) diff --git a/stdlib/test/test/lux/lang/analysis/primitive.lux b/stdlib/test/test/lux/lang/analysis/primitive.lux index 8e4ca6dde..6e2a8aae9 100644 --- a/stdlib/test/test/lux/lang/analysis/primitive.lux +++ b/stdlib/test/test/lux/lang/analysis/primitive.lux @@ -29,7 +29,7 @@ (~~ (do-template [<type> <code-wrapper> <value-gen>] [(r.seq (r/wrap <type>) (r/map <code-wrapper> <value-gen>))] - [Top code.tuple (r.list +0 ..unit)] + [Any code.tuple (r.list +0 ..unit)] [Bool code.bool r.bool] [Nat code.nat r.nat] [Int code.int r.int] @@ -58,7 +58,7 @@ (context: "Primitives" ($_ seq (test "Can analyse unit." - (|> (infer-primitive Top (..analyse (' []))) + (|> (infer-primitive Any (..analyse (' []))) (case> (^ (#e.Success (#analysis.Primitive (#analysis.Unit output)))) (is? [] output) diff --git a/stdlib/test/test/lux/lang/type.lux b/stdlib/test/test/lux/lang/type.lux index be888d321..22cd568ee 100644 --- a/stdlib/test/test/lux/lang/type.lux +++ b/stdlib/test/test/lux/lang/type.lux @@ -102,8 +102,8 @@ (and (L/= (list) members) (L/= (list <unit>) flat)))))] - ["variant" &.variant &.flatten-variant Bottom] - ["tuple" &.tuple &.flatten-tuple Top] + ["variant" &.variant &.flatten-variant Nothing] + ["tuple" &.tuple &.flatten-tuple Any] )] ($_ seq <struct-tests> diff --git a/stdlib/test/test/lux/lang/type/check.lux b/stdlib/test/test/lux/lang/type/check.lux index b384ad2ef..57285c91c 100644 --- a/stdlib/test/test/lux/lang/type/check.lux +++ b/stdlib/test/test/lux/lang/type/check.lux @@ -74,23 +74,23 @@ false)) ## [Tests] -(context: "Top and Bottom." +(context: "Any and Nothing." (<| (times +100) (do @ [sample (|> gen-type (r.filter valid-type?))] ($_ seq - (test "Top is the super-type of everything." - (@.checks? Top sample)) + (test "Any is the super-type of everything." + (@.checks? Any sample)) - (test "Bottom is the sub-type of everything." - (@.checks? sample Bottom)) + (test "Nothing is the sub-type of everything." + (@.checks? sample Nothing)) )))) (context: "Simple type-checking." ($_ seq - (test "Top and Bottom match themselves." - (and (@.checks? Bottom Bottom) - (@.checks? Top Top))) + (test "Any and Nothing match themselves." + (and (@.checks? Nothing Nothing) + (@.checks? Any Any))) (test "Existential types only match with themselves." (and (type-checks? (do @.Monad<Check> @@ -116,10 +116,10 @@ (#.Named ["module" "name"] exT)))))) (test "Functions are covariant on inputs and contravariant on outputs." - (and (@.checks? (#.Function Bottom Top) - (#.Function Top Bottom)) - (not (@.checks? (#.Function Top Bottom) - (#.Function Bottom Top))))) + (and (@.checks? (#.Function Nothing Any) + (#.Function Any Nothing)) + (not (@.checks? (#.Function Any Nothing) + (#.Function Nothing Any))))) )) (context: "Type application." @@ -164,10 +164,10 @@ (test "Can bind unbound type-vars by type-checking against them." (and (type-checks? (do @.Monad<Check> [[id var] @.var] - (@.check var .Top))) + (@.check var .Any))) (type-checks? (do @.Monad<Check> [[id var] @.var] - (@.check .Top var))))) + (@.check .Any var))))) (test "Cannot rebind already bound type-vars." (not (type-checks? (do @.Monad<Check> @@ -178,13 +178,13 @@ (test "If the type bound to a var is a super-type to another, then the var is also a super-type." (type-checks? (do @.Monad<Check> [[id var] @.var - _ (@.check var Top)] + _ (@.check var Any)] (@.check var .Bool)))) (test "If the type bound to a var is a sub-type of another, then the var is also a sub-type." (type-checks? (do @.Monad<Check> [[id var] @.var - _ (@.check var Bottom)] + _ (@.check var Nothing)] (@.check .Bool var)))) )) diff --git a/stdlib/test/test/lux/type/object/interface.lux b/stdlib/test/test/lux/type/object/interface.lux index f74d32e2a..7e2bddcdb 100644 --- a/stdlib/test/test/lux/type/object/interface.lux +++ b/stdlib/test/test/lux/type/object/interface.lux @@ -23,7 +23,7 @@ (class: NatRC Resettable-Counter #super NatC - Top + Any (def: reset (set@Counter +0))) @@ -48,7 +48,7 @@ (class: (ListI a) (Iterable a) #super (ListC a) - Top + Any (def: enumerate get@Collection)) diff --git a/stdlib/test/test/lux/type/object/protocol.lux b/stdlib/test/test/lux/type/object/protocol.lux index fcb53d3b1..58e4f6fcd 100644 --- a/stdlib/test/test/lux/type/object/protocol.lux +++ b/stdlib/test/test/lux/type/object/protocol.lux @@ -3,10 +3,10 @@ (lux (data text/format) (type (object protocol)))) -(type: Counter (Object (Method Top Nat))) +(type: Counter (Object (Method Any Nat))) (def: (count [tick return] state) - (Class Nat (Method Top Nat)) + (Class Nat (Method Any Nat)) (let [state' (inc state)] [(return state') state'])) @@ -48,20 +48,20 @@ (read [] a)) (def: (readM [tick return] state) - (All [s] (Class s (Method Top s))) + (All [s] (Class s (Method Any s))) [(return state) state]) (protocol: (Add n) - (+ n Top) - (- n Top)) + (+ n Any) + (- n Any)) (protocol: (Mul n) - (* n Top) - (/ n Top)) + (* n Any) + (/ n Any)) (do-template [<name> <op>] [(def: (<name> [diff return] state) - (Class Nat (Method Nat Top)) + (Class Nat (Method Nat Any)) [(return []) (<op> diff state)])] [+M n/+] @@ -108,11 +108,11 @@ (numberO (+0 (read [])))) (def: _test3 - [Top NatO] + [Any NatO] (numberO (+1 (+0 (+ +123))))) (def: _test4 - [Top NatO] + [Any NatO] (numberO (+1 (+1 (* +123))))) ## TODO: Fix when new-luxc is the official compiler. @@ -121,9 +121,9 @@ ## (numberO (^read (read [])))) ## (def: _test3 -## [Top NatO] +## [Any NatO] ## (numberO (^add (+ +123)))) ## (def: _test4 -## [Top NatO] +## [Any NatO] ## (numberO (^mul (* +123)))) diff --git a/stdlib/test/test/lux/world/blob.lux b/stdlib/test/test/lux/world/blob.lux index e1c77552b..a74fb20e0 100644 --- a/stdlib/test/test/lux/world/blob.lux +++ b/stdlib/test/test/lux/world/blob.lux @@ -33,7 +33,7 @@ (:: r.Monad<Random> wrap output))))) (def: (bits-io bytes read write value) - (-> Nat (-> Nat /.Blob (e.Error Nat)) (-> Nat Nat /.Blob (e.Error Top)) Nat Bool) + (-> Nat (-> Nat /.Blob (e.Error Nat)) (-> Nat Nat /.Blob (e.Error Any)) Nat Bool) (let [blob (/.create +8) bits (n/* +8 bytes) capped-value (|> +1 (bit.left-shift bits) dec (bit.and value))] |