diff options
author | Eduardo Julian | 2022-11-21 16:40:51 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-11-21 16:40:51 -0400 |
commit | 224797231a8144f6ead1baab3b4b01a74cab629c (patch) | |
tree | 294aaadc4cc8dce8e40041aa318fa84de080002e | |
parent | df0e015145981602b3f97113bcfa586b4f6d0757 (diff) |
Added index section to documentation + re-named Primitive -> Nominal
Diffstat (limited to '')
164 files changed, 1266 insertions, 1002 deletions
diff --git a/lux-bootstrapper/src/lux/analyser/base.clj b/lux-bootstrapper/src/lux/analyser/base.clj index 1a61bcfa5..0b11a238d 100644 --- a/lux-bootstrapper/src/lux/analyser/base.clj +++ b/lux-bootstrapper/src/lux/analyser/base.clj @@ -75,7 +75,7 @@ (return ?module))] (return (&/T [module* ?name])))) -(let [tag-names #{"Primitive" "Sum" "Product" "Function" "Parameter" "Var" "Ex" "UnivQ" "ExQ" "Apply" "Named"}] +(let [tag-names #{"Nominal" "Sum" "Product" "Function" "Parameter" "Var" "Ex" "UnivQ" "ExQ" "Apply" "Named"}] (defn type-tag? [module name] (and (= &/prelude module) (contains? tag-names name)))) diff --git a/lux-bootstrapper/src/lux/analyser/case.clj b/lux-bootstrapper/src/lux/analyser/case.clj index 42ab446ca..bf5f17f38 100644 --- a/lux-bootstrapper/src/lux/analyser/case.clj +++ b/lux-bootstrapper/src/lux/analyser/case.clj @@ -72,9 +72,9 @@ (&/$Parameter (+ (* 2 level) parameter-idx)) type) - (&/$Primitive ?name ?params) - (&/$Primitive ?name (&/|map (partial clean! level ?tid parameter-idx) - ?params)) + (&/$Nominal ?name ?params) + (&/$Nominal ?name (&/|map (partial clean! level ?tid parameter-idx) + ?params)) (&/$Function ?arg ?return) (&/$Function (clean! level ?tid parameter-idx ?arg) @@ -106,8 +106,8 @@ (defn beta-reduce! [level env type] (|case type - (&/$Primitive ?name ?params) - (&/$Primitive ?name (&/|map (partial beta-reduce! level env) ?params)) + (&/$Nominal ?name ?params) + (&/$Nominal ?name (&/|map (partial beta-reduce! level env) ?params)) (&/$Sum ?left ?right) (&/$Sum (beta-reduce! level env ?left) diff --git a/lux-bootstrapper/src/lux/analyser/proc/jvm.clj b/lux-bootstrapper/src/lux/analyser/proc/jvm.clj index 9dba428d5..5f2e1afc3 100644 --- a/lux-bootstrapper/src/lux/analyser/proc/jvm.clj +++ b/lux-bootstrapper/src/lux/analyser/proc/jvm.clj @@ -22,7 +22,7 @@ "(-> Type (Lux (, Text (List Type))))" [type] (|case type - (&/$Primitive payload) + (&/$Nominal payload) (return payload) (&/$Var id) @@ -51,8 +51,8 @@ "(-> Type Type)" [type] (|case type - (&/$Primitive class params) - (&/$Primitive (&host-type/as-obj class) params) + (&/$Nominal class params) + (&/$Nominal (&host-type/as-obj class) params) _ type)) @@ -75,8 +75,8 @@ "(-> Type Type)" [type] (|case type - (&/$Primitive name params) - (&/$Primitive (as-otype name) params) + (&/$Nominal name params) + (&/$Nominal (as-otype name) params) _ type)) @@ -108,7 +108,7 @@ _ base-type)) - (&/$Primitive class-name type-args) + (&/$Nominal class-name type-args) type-args)) ;; [Resources] @@ -116,7 +116,7 @@ "(-> Type (List (^ java.lang.reflect.Type)) (^ java.lang.reflect.Type) (Lux Type))" [obj-type gvars gtype] (|case obj-type - (&/$Primitive class targs) + (&/$Nominal class targs) (if (= (&/|length targs) (&/|length gvars)) (|let [gtype-env (&/fold2 (fn [m ^TypeVariable g t] (&/$Item (&/T [(.getName g) t]) m)) (&/|table) @@ -191,18 +191,18 @@ (&/$GenericClass name params) (case name - "boolean" (return (&/$Primitive "java.lang.Boolean" &/$End)) - "byte" (return (&/$Primitive "java.lang.Byte" &/$End)) - "short" (return (&/$Primitive "java.lang.Short" &/$End)) - "int" (return (&/$Primitive "java.lang.Integer" &/$End)) - "long" (return (&/$Primitive "java.lang.Long" &/$End)) - "float" (return (&/$Primitive "java.lang.Float" &/$End)) - "double" (return (&/$Primitive "java.lang.Double" &/$End)) - "char" (return (&/$Primitive "java.lang.Character" &/$End)) + "boolean" (return (&/$Nominal "java.lang.Boolean" &/$End)) + "byte" (return (&/$Nominal "java.lang.Byte" &/$End)) + "short" (return (&/$Nominal "java.lang.Short" &/$End)) + "int" (return (&/$Nominal "java.lang.Integer" &/$End)) + "long" (return (&/$Nominal "java.lang.Long" &/$End)) + "float" (return (&/$Nominal "java.lang.Float" &/$End)) + "double" (return (&/$Nominal "java.lang.Double" &/$End)) + "char" (return (&/$Nominal "java.lang.Character" &/$End)) "void" (return &type/Any) ;; else (|do [=params (&/map% (partial generic-class->type env) params)] - (return (&/$Primitive name =params)))) + (return (&/$Nominal name =params)))) (&/$GenericArray param) (|do [=param (generic-class->type env param)] @@ -268,7 +268,7 @@ "(-> Analyser ClassDecl (List (, TypeVar Type)) (List SuperClassDecl) MethodSyntax (Lux MethodAnalysis))" [analyse class-decl class-env all-supers method] (|let [[?cname ?cparams] class-decl - class-type (&/$Primitive ?cname (&/|map &/|second class-env))] + class-type (&/$Nominal ?cname (&/|map &/|second class-env))] (|case method (&/$ConstructorMethodSyntax =privacy-modifier ?strict ?anns ?gvars ?exceptions ?inputs ?ctor-args ?body) (|do [method-env (make-type-env ?gvars) @@ -393,10 +393,10 @@ )) (do-template [<name> <proc> <from-class> <to-class>] - (let [output-type (&/$Primitive <to-class> &/$End)] + (let [output-type (&/$Nominal <to-class> &/$End)] (defn- <name> [analyse exo-type _?value] (|do [:let [(&/$Item ?value (&/$End)) _?value] - =value (&&/analyse-1 analyse (&/$Primitive <from-class> &/$End) ?value) + =value (&&/analyse-1 analyse (&/$Nominal <from-class> &/$End) ?value) _ (&type/check exo-type output-type) _location &/location] (return (&/|list (&&/|meta output-type _location (&&/$proc (&/T ["jvm" <proc>]) (&/|list =value) (&/|list)))))))) @@ -433,11 +433,11 @@ ) (do-template [<name> <proc> <v1-class> <v2-class> <to-class>] - (let [output-type (&/$Primitive <to-class> &/$End)] + (let [output-type (&/$Nominal <to-class> &/$End)] (defn- <name> [analyse exo-type ?values] (|do [:let [(&/$Item ?value1 (&/$Item ?value2 (&/$End))) ?values] - =value1 (&&/analyse-1 analyse (&/$Primitive <v1-class> &/$End) ?value1) - =value2 (&&/analyse-1 analyse (&/$Primitive <v2-class> &/$End) ?value2) + =value1 (&&/analyse-1 analyse (&/$Nominal <v1-class> &/$End) ?value1) + =value2 (&&/analyse-1 analyse (&/$Nominal <v2-class> &/$End) ?value2) _ (&type/check exo-type output-type) _location &/location] (return (&/|list (&&/|meta output-type _location (&&/$proc (&/T ["jvm" <proc>]) (&/|list =value1 =value2) (&/|list)))))))) @@ -458,8 +458,8 @@ ) (do-template [<name> <proc> <input-class> <output-class>] - (let [input-type (&/$Primitive <input-class> &/$End) - output-type (&/$Primitive <output-class> &/$End)] + (let [input-type (&/$Nominal <input-class> &/$End) + output-type (&/$Nominal <output-class> &/$End)] (defn- <name> [analyse exo-type ?values] (|do [:let [(&/$Item x (&/$Item y (&/$End))) ?values] =x (&&/analyse-1 analyse input-type x) @@ -513,8 +513,8 @@ (let [length-type &type/Nat idx-type &type/Nat] (do-template [<elem-class> <array-class> <new-name> <new-tag> <load-name> <load-tag> <store-name> <store-tag>] - (let [elem-type (&/$Primitive <elem-class> &/$End) - array-type (&/$Primitive <array-class> &/$End)] + (let [elem-type (&/$Nominal <elem-class> &/$End) + array-type (&/$Nominal <array-class> &/$End)] (defn- <new-name> [analyse exo-type ?values] (|do [:let [(&/$Item length (&/$End)) ?values] =length (&&/analyse-1 analyse length-type length) @@ -582,7 +582,7 @@ [arr-class arr-params] (ensure-object array-type) _ (&/assert! (= &host-type/array-data-tag arr-class) (str "[Analyser Error] Expected array. Instead got: " arr-class)) :let [(&/$Item mutable_type (&/$End)) arr-params - (&/$Primitive "#Mutable" (&/$Item type_variance (&/$End))) mutable_type + (&/$Nominal "#Mutable" (&/$Item type_variance (&/$End))) mutable_type (&/$Function write_type read_type) type_variance] =idx (&&/analyse-1 analyse idx-type idx) _ (&type/check exo-type read_type) @@ -597,7 +597,7 @@ [arr-class arr-params] (ensure-object array-type) _ (&/assert! (= &host-type/array-data-tag arr-class) (str "[Analyser Error] Expected array. Instead got: " arr-class)) :let [(&/$Item mutable_type (&/$End)) arr-params - (&/$Primitive "#Mutable" (&/$Item type_variance (&/$End))) mutable_type + (&/$Nominal "#Mutable" (&/$Item type_variance (&/$End))) mutable_type (&/$Function write_type read_type) type_variance] =idx (&&/analyse-1 analyse idx-type idx) =elem (&&/analyse-1 analyse write_type elem) @@ -629,7 +629,7 @@ (defn- analyse-jvm-object-null [analyse exo-type ?values] (|do [:let [(&/$End) ?values] - :let [output-type (&/$Primitive &host-type/null-data-tag &/$End)] + :let [output-type (&/$Nominal &host-type/null-data-tag &/$End)] _ (&type/check exo-type output-type) _location &/location] (return (&/|list (&&/|meta exo-type _location @@ -647,7 +647,7 @@ (defn- analyse-jvm-throw [analyse exo-type ?values] (|do [:let [(&/$Item ?ex (&/$End)) ?values] =ex (&&/analyse-1+ analyse ?ex) - _ (&type/check (&/$Primitive "java.lang.Throwable" &/$End) (&&/expr-type* =ex)) + _ (&type/check (&/$Nominal "java.lang.Throwable" &/$End) (&&/expr-type* =ex)) [throw-class throw-params] (ensure-object (&&/expr-type* =ex)) _location &/location _ (&type/check exo-type &type/Nothing)] @@ -734,10 +734,10 @@ (defn- up-cast [class parent-gvars class-loader !class! object-type] (|do [[sub-class sub-params] (ensure-object object-type) - (&/$Primitive super-class* super-params*) (&host-type/->super-type &type/existential class-loader !class! (if (= sub-class class) - !class! - sub-class) - sub-params)] + (&/$Nominal super-class* super-params*) (&host-type/->super-type &type/existential class-loader !class! (if (= sub-class class) + !class! + sub-class) + sub-params)] (return (&/fold2 (fn [m ^TypeVariable g t] (&/$Item (&/T [(.getName g) t]) m)) (&/|table) parent-gvars @@ -756,7 +756,7 @@ (&/fail-with-loc (str "[Analyser Error] Unknown class: " !class!))))] (return (&/T [!class! class-loader])))) -(let [dummy-type-param (&/$Primitive "java.lang.Object" &/$End)] +(let [dummy-type-param (&/$Nominal "java.lang.Object" &/$End)] (do-template [<name> <tag> <only-interface?>] (defn- <name> [analyse exo-type class method classes ?values] (|do [:let [(&/$Item object args) ?values] @@ -834,7 +834,7 @@ (return nil)) (catch Exception e (&/fail-with-loc (str "[Analyser Error] Unknown class: " _class-name)))) - :let [output-type (&/$Primitive "java.lang.Class" (&/|list (&/$Primitive _class-name (&/|list))))] + :let [output-type (&/$Nominal "java.lang.Class" (&/|list (&/$Nominal _class-name (&/|list))))] _ (&type/check exo-type output-type) _location &/location] (return (&/|list (&&/|meta output-type _location @@ -904,7 +904,7 @@ class-decl (&/T [name &/$End]) anon-class (str (string/replace module "/" ".") "." name) class-type-decl (&/T [anon-class &/$End]) - anon-class-type (&/$Primitive anon-class &/$End)] + anon-class-type (&/$Nominal anon-class &/$End)] =ctor-args (&/map% (fn [ctor-arg] (|let [[arg-type arg-term] ctor-arg] (|do [=arg-term (&&/analyse-1+ analyse arg-term)] diff --git a/lux-bootstrapper/src/lux/base.clj b/lux-bootstrapper/src/lux/base.clj index 2265c49af..ef7838e77 100644 --- a/lux-bootstrapper/src/lux/base.clj +++ b/lux-bootstrapper/src/lux/base.clj @@ -88,7 +88,7 @@ ;; Type (defvariant - ("Primitive" 2) + ("Nominal" 2) ("Sum" 2) ("Product" 2) ("Function" 2) diff --git a/lux-bootstrapper/src/lux/compiler/cache/type.clj b/lux-bootstrapper/src/lux/compiler/cache/type.clj index 50e943b73..6a6374b9a 100644 --- a/lux-bootstrapper/src/lux/compiler/cache/type.clj +++ b/lux-bootstrapper/src/lux/compiler/cache/type.clj @@ -23,7 +23,7 @@ (if (&type/type= &type/Type type) "T" (|case type - (&/$Primitive name params) + (&/$Nominal name params) (str "^" name stop (serialize-list serialize-type params)) (&/$Product left right) @@ -123,7 +123,7 @@ (when (.startsWith input "^") (let [[name ^String input*] (.split (.substring input 1) stop 2)] (when-let [[params ^String input*] (deserialize-list input*)] - [(&/$Primitive name params) input*])))) + [(&/$Nominal name params) input*])))) (defn deserialize-type "(-> Text Type)" diff --git a/lux-bootstrapper/src/lux/compiler/jvm/proc/host.clj b/lux-bootstrapper/src/lux/compiler/jvm/proc/host.clj index 22f889aeb..66070351d 100644 --- a/lux-bootstrapper/src/lux/compiler/jvm/proc/host.clj +++ b/lux-bootstrapper/src/lux/compiler/jvm/proc/host.clj @@ -50,31 +50,31 @@ (if (&type/type= &type/Any *type*) (.visitLdcInsn *writer* &/unit-tag) (|case *type* - (&/$Primitive "boolean" (&/$End)) + (&/$Nominal "boolean" (&/$End)) (.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name boolean-class) "valueOf" (str "(Z)" (&host-generics/->type-signature boolean-class))) - (&/$Primitive "byte" (&/$End)) + (&/$Nominal "byte" (&/$End)) (.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name byte-class) "valueOf" (str "(B)" (&host-generics/->type-signature byte-class))) - (&/$Primitive "short" (&/$End)) + (&/$Nominal "short" (&/$End)) (.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name short-class) "valueOf" (str "(S)" (&host-generics/->type-signature short-class))) - (&/$Primitive "int" (&/$End)) + (&/$Nominal "int" (&/$End)) (.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name int-class) "valueOf" (str "(I)" (&host-generics/->type-signature int-class))) - (&/$Primitive "long" (&/$End)) + (&/$Nominal "long" (&/$End)) (.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name long-class) "valueOf" (str "(J)" (&host-generics/->type-signature long-class))) - (&/$Primitive "float" (&/$End)) + (&/$Nominal "float" (&/$End)) (.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name float-class) "valueOf" (str "(F)" (&host-generics/->type-signature float-class))) - (&/$Primitive "double" (&/$End)) + (&/$Nominal "double" (&/$End)) (.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name double-class) "valueOf" (str "(D)" (&host-generics/->type-signature double-class))) - (&/$Primitive "char" (&/$End)) + (&/$Nominal "char" (&/$End)) (.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name char-class) "valueOf" (str "(C)" (&host-generics/->type-signature char-class))) - (&/$Primitive _ _) + (&/$Nominal _ _) nil (&/$Named ?name ?type) @@ -782,10 +782,10 @@ ] ^MethodVisitor *writer* &/get-writer normal_array_type (&type/normal (&a/expr-type* ?array)) - :let [(&/$Primitive "#Array" (&/$Item mutable_type (&/$End))) normal_array_type - (&/$Primitive "#Mutable" (&/$Item type_variance (&/$End))) mutable_type + :let [(&/$Nominal "#Array" (&/$Item mutable_type (&/$End))) normal_array_type + (&/$Nominal "#Mutable" (&/$Item type_variance (&/$End))) mutable_type (&/$Function write_type read_type) type_variance] - array-type (&host/->java-sig (&/$Primitive "#Array" (&/|list read_type))) + array-type (&host/->java-sig (&/$Nominal "#Array" (&/|list read_type))) _ (compile ?array) :let [_ (.visitTypeInsn *writer* Opcodes/CHECKCAST array-type)] _ (compile ?idx) @@ -801,10 +801,10 @@ ] ^MethodVisitor *writer* &/get-writer normal_array_type (&type/normal (&a/expr-type* ?array)) - :let [(&/$Primitive "#Array" (&/$Item mutable_type (&/$End))) normal_array_type - (&/$Primitive "#Mutable" (&/$Item type_variance (&/$End))) mutable_type + :let [(&/$Nominal "#Array" (&/$Item mutable_type (&/$End))) normal_array_type + (&/$Nominal "#Mutable" (&/$Item type_variance (&/$End))) mutable_type (&/$Function write_type read_type) type_variance] - array-type (&host/->java-sig (&/$Primitive "#Array" (&/|list write_type))) + array-type (&host/->java-sig (&/$Nominal "#Array" (&/|list write_type))) _ (compile ?array) :let [_ (.visitTypeInsn *writer* Opcodes/CHECKCAST array-type)] :let [_ (.visitInsn *writer* Opcodes/DUP)] @@ -823,13 +823,13 @@ ^MethodVisitor *writer* &/get-writer normal_array_type (&type/normal (&a/expr-type* ?array)) array-type (|case normal_array_type - (&/$Primitive ?name (&/$End)) + (&/$Nominal ?name (&/$End)) (&host/->java-sig normal_array_type) - (&/$Primitive "#Array" (&/$Item mutable_type (&/$End))) - (|let [(&/$Primitive "#Mutable" (&/$Item type_variance (&/$End))) mutable_type + (&/$Nominal "#Array" (&/$Item mutable_type (&/$End))) + (|let [(&/$Nominal "#Mutable" (&/$Item type_variance (&/$End))) mutable_type (&/$Function write_type read_type) type_variance] - (&host/->java-sig (&/$Primitive "#Array" (&/|list read_type))))) + (&host/->java-sig (&/$Nominal "#Array" (&/|list read_type))))) _ (compile ?array) :let [_ (.visitTypeInsn *writer* Opcodes/CHECKCAST array-type)] :let [_ (doto *writer* diff --git a/lux-bootstrapper/src/lux/host.clj b/lux-bootstrapper/src/lux/host.clj index 0abba888a..14ac6565c 100644 --- a/lux-bootstrapper/src/lux/host.clj +++ b/lux-bootstrapper/src/lux/host.clj @@ -45,13 +45,13 @@ "(-> Type [Nat Type])" [type] (|case type - (&/$Primitive "#Array" (&/$Item (&/$Primitive "#Mutable" (&/$Item (&/$Function _ param) - (&/$End))) - (&/$End))) + (&/$Nominal "#Array" (&/$Item (&/$Nominal "#Mutable" (&/$Item (&/$Function _ param) + (&/$End))) + (&/$End))) (|let [[count inner] (unfold-array param)] (&/T [(inc count) inner])) - (&/$Primitive "#Array" (&/$Item param (&/$End))) + (&/$Nominal "#Array" (&/$Item param (&/$End))) (|let [[count inner] (unfold-array param)] (&/T [(inc count) inner])) @@ -64,11 +64,11 @@ "(-> Type (Lux Text))" [^objects type] (|case type - (&/$Primitive ?name params) + (&/$Nominal ?name params) (cond (= &host-type/array-data-tag ?name) (|do [normal_type (&type/normal type) :let [[level base] (unfold-array normal_type)] base-sig (|case base - (&/$Primitive base-class _) + (&/$Nominal base-class _) (return (&host-generics/->type-signature base-class)) _ diff --git a/lux-bootstrapper/src/lux/type.clj b/lux-bootstrapper/src/lux/type.clj index 35a9a4b8e..479065170 100644 --- a/lux-bootstrapper/src/lux/type.clj +++ b/lux-bootstrapper/src/lux/type.clj @@ -27,13 +27,13 @@ (def I64 (&/$Named (&/T [&/prelude "I64"]) (&/$UnivQ empty-env - (&/$Primitive "#I64" (&/|list (&/$Parameter 1)))))) -(def Bit (&/$Named (&/T [&/prelude "Bit"]) (&/$Primitive "#Bit" &/$End))) -(def Nat (&/$Named (&/T [&/prelude "Nat"]) (&/$Primitive "#I64" (&/|list (&/$Primitive &&host/nat-data-tag &/$End))))) -(def Int (&/$Named (&/T [&/prelude "Int"]) (&/$Primitive "#I64" (&/|list (&/$Primitive &&host/int-data-tag &/$End))))) -(def Rev (&/$Named (&/T [&/prelude "Rev"]) (&/$Primitive "#I64" (&/|list (&/$Primitive &&host/rev-data-tag &/$End))))) -(def Frac (&/$Named (&/T [&/prelude "Frac"]) (&/$Primitive "#Frac" &/$End))) -(def Text (&/$Named (&/T [&/prelude "Text"]) (&/$Primitive "#Text" &/$End))) + (&/$Nominal "#I64" (&/|list (&/$Parameter 1)))))) +(def Bit (&/$Named (&/T [&/prelude "Bit"]) (&/$Nominal "#Bit" &/$End))) +(def Nat (&/$Named (&/T [&/prelude "Nat"]) (&/$Nominal "#I64" (&/|list (&/$Nominal &&host/nat-data-tag &/$End))))) +(def Int (&/$Named (&/T [&/prelude "Int"]) (&/$Nominal "#I64" (&/|list (&/$Nominal &&host/int-data-tag &/$End))))) +(def Rev (&/$Named (&/T [&/prelude "Rev"]) (&/$Nominal "#I64" (&/|list (&/$Nominal &&host/rev-data-tag &/$End))))) +(def Frac (&/$Named (&/T [&/prelude "Frac"]) (&/$Nominal "#Frac" &/$End))) +(def Text (&/$Named (&/T [&/prelude "Text"]) (&/$Nominal "#Text" &/$End))) (def Symbol (&/$Named (&/T [&/prelude "Symbol"]) (&/$Product Text Text))) (def Array &&host/Array) @@ -51,8 +51,8 @@ (def IO (&/$Named (&/T [(str &/prelude "/control/io") "IO"]) (&/$UnivQ empty-env - (&/$Primitive (str &/prelude "/control/io.IO") - (&/|list (&/$Parameter 1)))))) + (&/$Nominal (str &/prelude "/control/io.IO") + (&/|list (&/$Parameter 1)))))) (def List (&/$Named (&/T [&/prelude "List"]) @@ -77,13 +77,13 @@ (def Type (&/$Named (&/T [&/prelude "Type"]) - (let [Type (&/$Apply (&/$Primitive "" &/$End) (&/$Parameter 0)) + (let [Type (&/$Apply (&/$Nominal "" &/$End) (&/$Parameter 0)) TypeList (&/$Apply Type List) TypePair (&/$Product Type Type)] - (&/$Apply (&/$Primitive "" &/$End) + (&/$Apply (&/$Nominal "" &/$End) (&/$UnivQ empty-env (&/$Sum - ;; Primitive + ;; Nominal (&/$Product Text TypeList) (&/$Sum ;; Sum @@ -118,15 +118,15 @@ (def Macro (&/$Named (&/T [&/prelude "Macro"]) - (&/$Primitive "#Macro" &/$End))) + (&/$Nominal "#Macro" &/$End))) (def Tag (&/$Named (&/T [&/prelude "Tag"]) - (&/$Primitive "#Tag" &/$End))) + (&/$Nominal "#Tag" &/$End))) (def Slot (&/$Named (&/T [&/prelude "Slot"]) - (&/$Primitive "#Slot" &/$End))) + (&/$Nominal "#Slot" &/$End))) (defn bound? [id] (fn [state] @@ -261,9 +261,9 @@ (return type))) ) - (&/$Primitive ?name ?params) + (&/$Nominal ?name ?params) (|do [=params (&/map% (partial clean* ?tid) ?params)] - (return (&/$Primitive ?name =params))) + (return (&/$Nominal ?name =params))) (&/$Function ?arg ?return) (|do [=arg (clean* ?tid ?arg) @@ -377,13 +377,13 @@ (defn show-type [^objects type] (|case type - (&/$Primitive name params) + (&/$Nominal name params) (|case params (&/$End) - (str "(Primitive " (pr-str name) ")") + (str "(Nominal " (pr-str name) ")") _ - (str "(Primitive " (pr-str name) " " (->> params (&/|map show-type) (&/|interpose " ") (&/fold str "")) ")")) + (str "(Nominal " (pr-str name) " " (->> params (&/|map show-type) (&/|interpose " ") (&/fold str "")) ")")) (&/$Product _) (str "[" (->> (flatten-prod type) (&/|map show-type) (&/|interpose " ") (&/fold str "")) "]") @@ -429,7 +429,7 @@ (and (= ?xmodule ?ymodule) (= ?xname ?yname)) - [(&/$Primitive xname xparams) (&/$Primitive yname yparams)] + [(&/$Nominal xname xparams) (&/$Nominal yname yparams)] (and (.equals ^Object xname yname) (= (&/|length xparams) (&/|length yparams)) (&/fold2 #(and %1 (type= %2 %3)) true xparams yparams)) @@ -513,8 +513,8 @@ (defn beta-reduce [env type] (|case type - (&/$Primitive ?name ?params) - (&/$Primitive ?name (&/|map (partial beta-reduce env) ?params)) + (&/$Nominal ?name ?params) + (&/$Nominal ?name (&/|map (partial beta-reduce env) ?params)) (&/$Sum ?left ?right) (&/$Sum (beta-reduce env ?left) (beta-reduce env ?right)) @@ -750,7 +750,7 @@ actual* (apply-type actual $arg)] (check* fixpoints invariant?? expected actual*)) - [(&/$Primitive e!data) (&/$Primitive a!data)] + [(&/$Nominal e!data) (&/$Nominal a!data)] (|do [? &/jvm?] (if ? (|do [class-loader &/loader] @@ -935,9 +935,9 @@ (&/$Named _ ?it) (normal ?it) - (&/$Primitive ?name ?parameters) + (&/$Nominal ?name ?parameters) (|do [=parameters (&/map% normal ?parameters)] - (return (&/$Primitive ?name =parameters))) + (return (&/$Nominal ?name =parameters))) (&/$Apply ?parameter ?abstraction) (|do [reification (apply-type ?abstraction ?parameter)] diff --git a/lux-bootstrapper/src/lux/type/host.clj b/lux-bootstrapper/src/lux/type/host.clj index 0ea72c98f..96337d19e 100644 --- a/lux-bootstrapper/src/lux/type/host.clj +++ b/lux-bootstrapper/src/lux/type/host.clj @@ -15,7 +15,7 @@ (and (= ?xmodule ?ymodule) (= ?xname ?yname)) - [(&/$Primitive xname xparams) (&/$Primitive yname yparams)] + [(&/$Nominal xname xparams) (&/$Nominal yname yparams)] (and (.equals ^Object xname yname) (= (&/|length xparams) (&/|length yparams)) (&/fold2 #(and %1 (type= %2 %3)) true xparams yparams)) @@ -67,7 +67,7 @@ (def mutable-data-tag "#Mutable") (def array-data-tag "#Array") (defn Array [item] - (&/$Primitive array-data-tag (&/|list (&/$Primitive mutable-data-tag (&/|list (&/$Function item item)))))) + (&/$Nominal array-data-tag (&/|list (&/$Nominal mutable-data-tag (&/|list (&/$Function item item)))))) (def null-data-tag "#Null") (def i64-data-tag "#I64") @@ -133,18 +133,18 @@ (let [gclass-name (.getName class)] (case gclass-name ("[Z" "[B" "[S" "[I" "[J" "[F" "[D" "[C") - (&/$Primitive gclass-name (&/|list)) + (&/$Nominal gclass-name (&/|list)) ;; else (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) Any (reduce (fn [inner _] (Array inner)) - (&/$Primitive base (try (-> (Class/forName base) .getTypeParameters - seq count (repeat (&/$Primitive "java.lang.Object" &/$End)) - &/->list) - (catch Exception e - (&/|list)))) + (&/$Nominal base (try (-> (Class/forName base) .getTypeParameters + seq count (repeat (&/$Nominal "java.lang.Object" &/$End)) + &/->list) + (catch Exception e + (&/|list)))) (range (count (or arr-obrackets arr-pbrackets ""))))) )))))) @@ -164,8 +164,8 @@ .getActualTypeArguments seq &/->list (&/map% (partial instance-param existential matchings)))] - (return (&/$Primitive (->> refl-type* ^Class (.getRawType) .getName) - params*))) + (return (&/$Nominal (->> refl-type* ^Class (.getRawType) .getName) + params*))) (instance? TypeVariable refl-type) (let [gvar (.getName ^TypeVariable refl-type)] @@ -187,14 +187,14 @@ (if (type= Any class-type) "V" (|case class-type - (&/$Primitive "#Array" - (&/$Item (&/$Primitive "#Mutable" - (&/$Item (&/$Function _ (&/$Primitive class-name _)) - (&/$End))) - (&/$End))) + (&/$Nominal "#Array" + (&/$Item (&/$Nominal "#Mutable" + (&/$Item (&/$Function _ (&/$Nominal class-name _)) + (&/$End))) + (&/$End))) (str "[" (&host-generics/->type-signature class-name)) - (&/$Primitive class-name _) + (&/$Nominal class-name _) (&host-generics/->type-signature class-name)))) (instance? GenericArrayType refl-type) @@ -233,7 +233,7 @@ (return m-type) (|do [params* (&/map% (partial instance-gtype existential matchings) type-params)] - (return (&/$Primitive type-name params*)))) + (return (&/$Nominal type-name params*)))) (&/$GenericTypeVar var-name) (if-let [m-type (&/|get var-name matchings)] @@ -303,7 +303,7 @@ (if (.isAssignableFrom super-class+ sub-class+) (let [lineage (trace-lineage sub-class+ super-class+)] (|do [[^Class sub-class* sub-params*] (raise existential lineage sub-class+ sub-params)] - (return (&/$Primitive (.getName sub-class*) sub-params*)))) + (return (&/$Nominal (.getName sub-class*) sub-params*)))) (&/fail-with-loc (str "[Host Error] Classes do not have a subtyping relationship: " sub-class " </= " super-class))))) (defn as-obj [class] @@ -341,7 +341,7 @@ (if (= (&/|length e!params) (&/|length a!params)) (|do [_ (&/map2% check e!params a!params)] (return fixpoints)) - (check-error "" (&/$Primitive e!name e!params) (&/$Primitive a!name a!params))) + (check-error "" (&/$Nominal e!name e!params) (&/$Nominal a!name a!params))) (or (lux-type? e!name) (lux-type? a!name)) @@ -350,14 +350,14 @@ (and (not (primitive-type? e!name)) (= null-data-tag a!name))) (return fixpoints) - (check-error "" (&/$Primitive e!name e!params) (&/$Primitive a!name a!params))) + (check-error "" (&/$Nominal e!name e!params) (&/$Nominal a!name a!params))) (not invariant??) (|do [actual* (->super-type existential class-loader e!name a!name a!params)] - (check (&/$Primitive e!name e!params) actual*)) + (check (&/$Nominal e!name e!params) actual*)) :else - (check-error "" (&/$Primitive e!name e!params) (&/$Primitive a!name a!params)))) + (check-error "" (&/$Nominal e!name e!params) (&/$Nominal a!name a!params)))) (catch Exception e (throw e))))) diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el index 5418fa683..81e2146de 100644 --- a/lux-mode/lux-mode.el +++ b/lux-mode/lux-mode.el @@ -370,7 +370,7 @@ Called by `imenu--generic-function'." (type//syntax (altRE "Union" "Or" "Variant" "Tuple" "And" "Record" "Rec" - "Primitive" "->" + "Nominal" "->" "All" "Ex" "Interface" "type_literal")) @@ -587,7 +587,6 @@ This function also returns nil meaning don't specify the indentation." ("type" 'defun) ("inlined" 'defun) ("context" 'defun) - ("primitive" 'defun) ("method" 'defun) ("analysis" 'defun) diff --git a/lux-python/source/program.lux b/lux-python/source/program.lux index 82f82733b..0d6d82c63 100644 --- a/lux-python/source/program.lux +++ b/lux-python/source/program.lux @@ -223,7 +223,7 @@ [org/python/core/PyInteger [(ffi.is org/python/core/PyObject) (.jvm_member_invoke_virtual# [] "org.python.core.PyObject" "asInt" []) .jvm_object_cast# - (is (Primitive "java.lang.Integer"))]] + (is (Nominal "java.lang.Integer"))]] [org/python/core/PyLong [org/python/core/PyObject::asLong]] [org/python/core/PyFloat [org/python/core/PyObject::asDouble]] [org/python/core/PyString [org/python/core/PyObject::asString]] diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index 84fb5c9d7..07e6a2dc2 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -225,10 +225,10 @@ ($.comment "=>") ($.example "Aw hell naw!")) - ($.definition /.Primitive - "Macro to treat define new primitive types." - ($.example (Primitive "java.lang.Object")) - ($.example (Primitive "java.util.List" [(Primitive "java.lang.Long")]))) + ($.definition /.Nominal + "Macro to treat define new nominal types." + ($.example (Nominal "java.lang.Object")) + ($.example (Nominal "java.util.List" [(Nominal "java.lang.Long")]))) ($.definition /.` (format "Hygienic quasi-quotation as a macro." @@ -324,7 +324,7 @@ ($.example (type Type (Rec @ (Variant - {#Primitive Text (List @)} + {#Nominal Text (List @)} {#Sum @ @} {#Product @ @} {#Function @ @} @@ -642,8 +642,8 @@ ... ($.example (def (reduced env type) ... (-> (List Type) Type Type) ... (when type - ... {.#Primitive name params} - ... {.#Primitive name (list#each (reduced env) params)} + ... {.#Nominal name params} + ... {.#Nominal name (list#each (reduced env) params)} ... (^with_template [<tag>] ... [{<tag> left right} diff --git a/stdlib/source/documentation/lux/data/collection/array.lux b/stdlib/source/documentation/lux/data/collection/array.lux index 0f2c5094f..b806af2a4 100644 --- a/stdlib/source/documentation/lux/data/collection/array.lux +++ b/stdlib/source/documentation/lux/data/collection/array.lux @@ -15,7 +15,7 @@ (list ($.module /._ "") - ($.definition /.primitive) + ($.definition /.nominal) ($.definition /.equivalence) ($.definition /.monoid) ($.definition /.functor) diff --git a/stdlib/source/documentation/lux/data/color.lux b/stdlib/source/documentation/lux/data/color.lux index 77162cec2..768fb1ffb 100644 --- a/stdlib/source/documentation/lux/data/color.lux +++ b/stdlib/source/documentation/lux/data/color.lux @@ -24,10 +24,7 @@ (`` (def .public documentation (List $.Documentation) - (let [encoding (list ($.definition /.RGB - "Red-Green-Blue color format.") - - ($.definition /.of_rgb) + (let [encoding (list ($.definition /.of_rgb) ($.definition /.rgb) ($.definition /.HSL @@ -36,17 +33,11 @@ ($.definition /.hsl) ($.definition /.of_hsl) - ($.definition /.CMYK - "Cyan-Magenta-Yellow-Key color format.") - ($.definition /.hsb) ($.definition /.of_hsb) ($.definition /.HSB - "Hue-Saturation-Brightness color format.") - - ($.definition /.cmyk) - ($.definition /.of_cmyk)) + "Hue-Saturation-Brightness color format.")) transformation (list ($.definition /.gray_scale) ($.definition /.darker) ($.definition /.brighter) diff --git a/stdlib/source/documentation/lux/data/color/named.lux b/stdlib/source/documentation/lux/data/color/named.lux index cd4e683e0..49eb0847d 100644 --- a/stdlib/source/documentation/lux/data/color/named.lux +++ b/stdlib/source/documentation/lux/data/color/named.lux @@ -12,16 +12,17 @@ ["[0]" nat (.use "hex#[0]" hex)]]]]] [\\library ["[0]" / (.only) - ["/[1]" //]]]) + ["/[1]" // (.only) + ["[0]" rgb]]]]) (def description (template (_ <name>) [($.definition <name> (let [[red green blue] (//.rgb <name>) [_ name] (symbol <name>)] - (format "R:" (hex#encoded red) - " G:" (hex#encoded green) - " B:" (hex#encoded blue) + (format "R:" (hex#encoded (rgb.number red)) + " G:" (hex#encoded (rgb.number green)) + " B:" (hex#encoded (rgb.number blue)) " | " (text.replaced "_" " " name))))])) (`` (def .public documentation diff --git a/stdlib/source/documentation/lux/meta/type.lux b/stdlib/source/documentation/lux/meta/type.lux index 292b084f2..b61ba2afd 100644 --- a/stdlib/source/documentation/lux/meta/type.lux +++ b/stdlib/source/documentation/lux/meta/type.lux @@ -14,14 +14,14 @@ [\\library ["[0]" /]] ["[0]" / - ["[1][0]" primitive] + ["[1][0]" nominal] ["[1][0]" check] ["[1][0]" dynamic] ["[1][0]" implicit] ["[1][0]" poly] ["[1][0]" quotient] ["[1][0]" refinement] - ["[1][0]" resource] + ["[1][0]" linear] ["[1][0]" unit] ["[1][0]" variance]]) @@ -269,14 +269,14 @@ (all list#composite ..\\parser - /primitive.documentation + /nominal.documentation /check.documentation /dynamic.documentation /implicit.documentation /poly.documentation /quotient.documentation /refinement.documentation - /resource.documentation + /linear.documentation /unit.documentation /variance.documentation ) diff --git a/stdlib/source/documentation/lux/meta/type/resource.lux b/stdlib/source/documentation/lux/meta/type/linear.lux index c8e34ab6e..c8e34ab6e 100644 --- a/stdlib/source/documentation/lux/meta/type/resource.lux +++ b/stdlib/source/documentation/lux/meta/type/linear.lux diff --git a/stdlib/source/documentation/lux/meta/type/primitive.lux b/stdlib/source/documentation/lux/meta/type/nominal.lux index 036489d22..036489d22 100644 --- a/stdlib/source/documentation/lux/meta/type/primitive.lux +++ b/stdlib/source/documentation/lux/meta/type/nominal.lux diff --git a/stdlib/source/format/lux/data/binary.lux b/stdlib/source/format/lux/data/binary.lux index 2eede5dfb..c04c5116b 100644 --- a/stdlib/source/format/lux/data/binary.lux +++ b/stdlib/source/format/lux/data/binary.lux @@ -251,16 +251,16 @@ (\\unsafe.has_8! offset <number>) [(.++ offset)] caseT))])]) - ([0 .#Primitive (..and ..text (..list again))] - [1 .#Sum pair] - [2 .#Product pair] - [3 .#Function pair] - [4 .#Parameter indexed] - [5 .#Var indexed] - [6 .#Ex indexed] - [7 .#UnivQ quantified] - [8 .#ExQ quantified] - [9 .#Apply pair] + ([00 .#Nominal (..and ..text (..list again))] + [01 .#Sum pair] + [02 .#Product pair] + [03 .#Function pair] + [04 .#Parameter indexed] + [05 .#Var indexed] + [06 .#Ex indexed] + [07 .#UnivQ quantified] + [08 .#ExQ quantified] + [09 .#Apply pair] [10 .#Named (..and ..symbol again)]) )))))) diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 54daff3b3..535b103c8 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -116,7 +116,7 @@ #1) ... (type .public Tag -... (Primitive "#Tag")) +... (Nominal "#Tag")) (.def# Tag (.is_type# {9 #1 [..prelude "Tag"] @@ -124,7 +124,7 @@ #1) ... (type .public Slot -... (Primitive "#Slot")) +... (Nominal "#Slot")) (.def# Slot (.is_type# {9 #1 [..prelude "Slot"] @@ -172,7 +172,7 @@ ... (type .public Type ... (Rec Type ... (Variant -... {#Primitive Text (List Type)} +... {#Nominal Text (List Type)} ... {#Sum Type Type} ... {#Product Type Type} ... {#Function Type Type} @@ -194,7 +194,7 @@ {7 #0 {#End} {1 #0 - ... Primitive + ... Nominal {2 #0 Text Type_List} {1 #0 ... Sum @@ -232,7 +232,7 @@ (.def# type_tags (.is# {9 #0 Symbol List} - {0 #1 [[..prelude "#Primitive"] + {0 #1 [[..prelude "#Nominal"] {0 #1 [[..prelude "#Sum"] {0 #1 [[..prelude "#Product"] {0 #1 [[..prelude "#Function"] @@ -245,7 +245,7 @@ {0 #1 [[..prelude "#Named"] {0 #0}]}]}]}]}]}]}]}]}]}]}]}) #0) -(.def# #Primitive (.as# Tag [(.is# Label' {#Some [0 #0 ..type_tags]}) Type]) #1) +(.def# #Nominal (.as# Tag [(.is# Label' {#Some [0 #0 ..type_tags]}) Type]) #1) (.def# #Sum (.as# Tag [(.is# Label' {#Some [1 #0 ..type_tags]}) Type]) #1) (.def# #Product (.as# Tag [(.is# Label' {#Some [2 #0 ..type_tags]}) Type]) #1) (.def# #Function (.as# Tag [(.is# Label' {#Some [3 #0 ..type_tags]}) Type]) #1) @@ -939,11 +939,11 @@ .public) ... (type .public Macro -... (Primitive "#Macro")) +... (Nominal "#Macro")) (.def# Macro (.is# Type {#Named [..prelude "Macro"] - {#Primitive "#Macro" {#End}}}) + {#Nominal "#Macro" {#End}}}) .public) ... Base functions & macros @@ -1300,9 +1300,9 @@ (.i64_-# (.i64_-# depth id) 0)) ... Recur - {#Primitive name parameters} - {#Primitive name (list#each (__adjusted_quantified_type__ permission depth) - parameters)} + {#Nominal name parameters} + {#Nominal name (list#each (__adjusted_quantified_type__ permission depth) + parameters)} {#Sum left right} {#Sum (__adjusted_quantified_type__ permission depth left) @@ -1875,7 +1875,7 @@ (def' .public UnQuote Type {#Named [..prelude "UnQuote"] - {#Primitive "#Macro/UnQuote" {#End}}}) + {#Nominal "#Macro/UnQuote" {#End}}}) (def' .public (unquote it) (-> Macro UnQuote) @@ -1888,7 +1888,7 @@ (def' .public Spliced_UnQuote Type {#Named [..prelude "Spliced_UnQuote"] - {#Primitive "#Macro/Spliced_UnQuote" {#End}}}) + {#Nominal "#Macro/Spliced_UnQuote" {#End}}}) (def' .public (spliced_unquote it) (-> Macro Spliced_UnQuote) @@ -2042,7 +2042,7 @@ (def' .private (type#= left right) (-> Type Type Bit) - ({[{#Primitive nameL parametersL} {#Primitive nameR parametersR}] + ({[{#Nominal nameL parametersL} {#Nominal nameR parametersR}] (all and' (text#= nameL nameR) (.i64_=# (list#size parametersL) (list#size parametersR)) @@ -2263,17 +2263,17 @@ (untemplated_tuple @composite untemplated replace? subst elements)} [replace? token])) -(def' .public Primitive +(def' .public Nominal Macro (macro (_ tokens) ({{#Item [_ {#Text class_name}] {#End}} - (meta#in (list (variant$ (list (symbol$ [..prelude "#Primitive"]) (text$ class_name) |#End|)))) + (meta#in (list (variant$ (list (symbol$ [..prelude "#Nominal"]) (text$ class_name) |#End|)))) {#Item [_ {#Text class_name}] {#Item [_ {#Tuple params}] {#End}}} - (meta#in (list (variant$ (list (symbol$ [..prelude "#Primitive"]) (text$ class_name) (untemplated_list params))))) + (meta#in (list (variant$ (list (symbol$ [..prelude "#Nominal"]) (text$ class_name) (untemplated_list params))))) _ - (failure (wrong_syntax_error [..prelude "Primitive"]))} + (failure (wrong_syntax_error [..prelude "Nominal"]))} tokens))) (def' .public ` @@ -2624,7 +2624,7 @@ (def' .private (macro_type? type) (-> Type Bit) - ({{#Named ["library/lux" "Macro"] {#Primitive "#Macro" {#End}}} + ({{#Named ["library/lux" "Macro"] {#Nominal "#Macro" {#End}}} #1 _ @@ -3106,9 +3106,9 @@ (def' .private (type#encoded type) (-> Type Text) - ({{#Primitive name params} + ({{#Nominal name params} (all text#composite - "(Primitive " (text#encoded name) + "(Nominal " (text#encoded name) (|> params (list#each (function' [it] (|> it type#encoded (text#composite " ")))) list#reversed @@ -3179,28 +3179,28 @@ (in (symbol$ name)) {#Right [type value]} - ({{#Primitive "#Bit" {#End}} + ({{#Nominal "#Bit" {#End}} (in (bit$ (as Bit value))) - {#Primitive "#Frac" {#End}} + {#Nominal "#Frac" {#End}} (in (frac$ (as Frac value))) - {#Primitive "#Text" {#End}} + {#Nominal "#Text" {#End}} (in (text$ (as Text value))) - {#Primitive "#I64" {#Item {#Primitive "#Nat" {#End}} {#End}}} + {#Nominal "#I64" {#Item {#Nominal "#Nat" {#End}} {#End}}} (in (nat$ (as Nat value))) - {#Primitive "#I64" {#Item {#Primitive "#Int" {#End}} {#End}}} + {#Nominal "#I64" {#Item {#Nominal "#Int" {#End}} {#End}}} (in (int$ (as Int value))) - {#Primitive "#I64" {#Item {#Primitive "#Rev" {#End}} {#End}}} + {#Nominal "#I64" {#Item {#Nominal "#Rev" {#End}} {#End}}} (in (rev$ (as Rev value))) - {#Primitive "#Tag" {#End}} + {#Nominal "#Tag" {#End}} (in (symbol$ name)) - {#Primitive "#Slot" {#End}} + {#Nominal "#Slot" {#End}} (in (symbol$ name)) _ @@ -3255,7 +3255,7 @@ (def' .public Pattern Type {#Named [..prelude "Pattern"] - {#Primitive "#Macro/Pattern" {#End}}}) + {#Nominal "#Macro/Pattern" {#End}}}) (def' .public (pattern it) (-> Macro Pattern) @@ -4638,8 +4638,8 @@ (def (clean_type variables it) (-> (List [Nat (Maybe Type)]) Type Type) (when it - {#Primitive name parameters} - {#Primitive name (list#each (clean_type variables) parameters)} + {#Nominal name parameters} + {#Nominal name (list#each (clean_type variables) parameters)} {#Sum left right} {#Sum (clean_type variables left) @@ -5309,8 +5309,8 @@ (def (type_code type) (-> Type Code) (when type - {#Primitive name params} - (` {.#Primitive (, (text$ name)) (, (untemplated_list (list#each type_code params)))}) + {#Nominal name params} + (` {.#Nominal (, (text$ name)) (, (untemplated_list (list#each type_code params)))}) (with_template#pattern [<tag>] [{<tag> left right} @@ -5570,7 +5570,7 @@ type+value (..definition_value symbol) .let [[type value] type+value]] (when (anonymous_type type) - {#Primitive "#Text" {#End}} + {#Nominal "#Text" {#End}} (in (as ..Text value)) _ @@ -5664,7 +5664,7 @@ (in {#Item =module =refers}))))) (type .public Immediate_UnQuote - (Primitive "#Macro/Immediate_UnQuote")) + (Nominal "#Macro/Immediate_UnQuote")) (def .public immediate_unquote (-> Macro Immediate_UnQuote) @@ -5791,9 +5791,9 @@ (def .public Rec (let [recursive_type (is (-> Code Code Text Code Code) (function (recursive_type g!self g!dummy name body) - (` {.#Apply (..Primitive "") + (` {.#Apply (..Nominal "") (.All ((, g!self) (, g!dummy)) - (, (let$ (local$ name) (` {.#Apply (..Primitive "") (, g!self)}) + (, (let$ (local$ name) (` {.#Apply (..Nominal "") (, g!self)}) body)))})))] (macro (_ tokens) (when tokens @@ -5821,7 +5821,7 @@ Type (let [[_ short] (symbol <type>)] {#Named [..prelude short] - {.#Primitive (text#composite "#Extension/" short) (list)}}))] + {.#Nominal (text#composite "#Extension/" short) (list)}}))] [Analysis] [Synthesis] diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux index 3693401df..47a31df8d 100644 --- a/stdlib/source/library/lux/control/concurrency/actor.lux +++ b/stdlib/source/library/lux/control/concurrency/actor.lux @@ -17,7 +17,7 @@ [macro ["[0]" local]] [type (.only sharing) - ["[0]" primitive (.only representation abstraction)]]]]] + ["[0]" nominal (.only representation abstraction)]]]]] [// ["[0]" atom (.only Atom atom)] ["[0]" async (.only Async Resolver) (.use "[1]#[0]" monad)] @@ -50,7 +50,7 @@ {.#None} (in {.#End})))) - (primitive.def .public (Actor s) + (nominal.def .public (Actor s) (Record [#obituary [(Async (<Obituary> Actor s)) (Resolver (<Obituary> Actor s))] diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux index 6385844ba..31c56c477 100644 --- a/stdlib/source/library/lux/control/concurrency/async.lux +++ b/stdlib/source/library/lux/control/concurrency/async.lux @@ -16,7 +16,7 @@ [macro ["^" pattern]] [type (.only sharing) - ["[0]" primitive (.except def)] + ["[0]" nominal (.except def)] ["[0]" variance (.only Mutable)]]]]] [// ["[0]" thread (.only Delay)] @@ -30,7 +30,7 @@ (template (_ a) [(-> a (IO Any))])) -(primitive.def (Async'' a) +(nominal.def (Async'' a) (Atom [(Value a) (List (Handler a))]) (type .public (Async' r w) diff --git a/stdlib/source/library/lux/control/concurrency/atom.lux b/stdlib/source/library/lux/control/concurrency/atom.lux index 79f902288..962149143 100644 --- a/stdlib/source/library/lux/control/concurrency/atom.lux +++ b/stdlib/source/library/lux/control/concurrency/atom.lux @@ -15,7 +15,7 @@ [meta ["@" target] [type - ["[0]" primitive (.except def)] + ["[0]" nominal (.except def)] ["[0]" variance (.only Mutable)]]]]]) (with_expansions [<jvm> (these (ffi.import (java/util/concurrent/atomic/AtomicReference a) @@ -27,7 +27,7 @@ @.jvm <jvm> (these))) -(primitive.def (Atom'' a) +(nominal.def (Atom'' a) (with_expansions [<jvm> (java/util/concurrent/atomic/AtomicReference a)] (for @.old <jvm> @.jvm <jvm> diff --git a/stdlib/source/library/lux/control/concurrency/incremental.lux b/stdlib/source/library/lux/control/concurrency/incremental.lux index 95af6f6c7..383624097 100644 --- a/stdlib/source/library/lux/control/concurrency/incremental.lux +++ b/stdlib/source/library/lux/control/concurrency/incremental.lux @@ -13,14 +13,14 @@ ["[0]" list]]] [meta [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] [// ["[0]" atom (.only Atom)]]) (type (Dependency a) (-> a (IO Any))) -(primitive.def .public (Computation a) +(nominal.def .public (Computation a) (Atom [a (List (Dependency a))]) (def .public value @@ -117,7 +117,7 @@ _ (watch! update! right)] (in output)))) - (primitive.def .public (Var a) + (nominal.def .public (Var a) (Computation a) (def .public (var value) diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux index 2de5b8b31..04d4333ff 100644 --- a/stdlib/source/library/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux @@ -19,7 +19,7 @@ ["i" int]]] [meta [type - ["[0]" primitive (.except def)] + ["[0]" nominal (.except def)] ["[0]" refinement]]]]] [// ["[0]" atom (.only Atom)] @@ -31,7 +31,7 @@ #open_positions Int #waiting_list (Queue (Resolver Any))])) -(primitive.def .public Semaphore +(nominal.def .public Semaphore (Atom State) (def most_positions_possible @@ -96,7 +96,7 @@ (in {try.#Success (the #open_positions post)}))))))) ) -(primitive.def .public Mutex +(nominal.def .public Mutex Semaphore (def .public (mutex _) @@ -126,7 +126,7 @@ (type .public Limit (, (refinement.type limit))) -(primitive.def .public Barrier +(nominal.def .public Barrier (Record [#limit Limit #count (Atom Nat) diff --git a/stdlib/source/library/lux/control/concurrency/stm.lux b/stdlib/source/library/lux/control/concurrency/stm.lux index c653b051b..ad1e8d459 100644 --- a/stdlib/source/library/lux/control/concurrency/stm.lux +++ b/stdlib/source/library/lux/control/concurrency/stm.lux @@ -17,7 +17,7 @@ [macro ["^" pattern]] [type (.only sharing) - ["[0]" primitive (.except def)] + ["[0]" nominal (.except def)] ["[0]" variance (.only Mutable)]]]]] [// ["[0]" atom (.only Atom atom)] @@ -27,7 +27,7 @@ (type (Observer a) (-> a (IO Any))) -(primitive.def (Var'' a) +(nominal.def (Var'' a) (Atom [a (List (Sink a))]) (type .public (Var' r w) diff --git a/stdlib/source/library/lux/control/concurrency/structured.lux b/stdlib/source/library/lux/control/concurrency/structured.lux index cd7295f4e..7e4b60571 100644 --- a/stdlib/source/library/lux/control/concurrency/structured.lux +++ b/stdlib/source/library/lux/control/concurrency/structured.lux @@ -15,13 +15,13 @@ ["[0]" nat]]] [meta [type (.only sharing) - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] ["[0]" // ["[1]" async (.use "[1]#[0]" monad)] ["[0]" thread (.only Delay)] ["[0]" atom (.only Atom)]]) -(primitive.def .public (Async value) +(nominal.def .public (Async value) (Record [#cancel! (IO Bit) #async (//.Async (Maybe value))]) @@ -205,7 +205,7 @@ (type Pending (Dictionary ID (Ex (_ value) (Async value)))) - (primitive.def .public (Scope value) + (nominal.def .public (Scope value) (Record [#pending (Atom [ID Pending]) #itself (Async value)]) diff --git a/stdlib/source/library/lux/control/function/polymorphism/context.lux b/stdlib/source/library/lux/control/function/polymorphism/context.lux index be28c494e..576d44cf1 100644 --- a/stdlib/source/library/lux/control/function/polymorphism/context.lux +++ b/stdlib/source/library/lux/control/function/polymorphism/context.lux @@ -25,7 +25,7 @@ [syntax (.only syntax) ["[0]" export]]] [type - ["[0]" primitive (.except def #name)]]]]] + ["[0]" nominal (.except def #name)]]]]] [/// ["//" mixin]]) @@ -37,7 +37,7 @@ (scope (alteration context)))) (with_expansions [<representation> Symbol] - (primitive.def .public Layer + (nominal.def .public Layer <representation> (.def .public layer diff --git a/stdlib/source/library/lux/control/io.lux b/stdlib/source/library/lux/control/io.lux index 9da4eda3c..71267a7a1 100644 --- a/stdlib/source/library/lux/control/io.lux +++ b/stdlib/source/library/lux/control/io.lux @@ -12,9 +12,9 @@ [syntax (.only syntax)] ["[0]" template]] [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) -(primitive.def .public (IO a) +(nominal.def .public (IO a) (-> Any a) (def .public io' diff --git a/stdlib/source/library/lux/control/lazy.lux b/stdlib/source/library/lux/control/lazy.lux index 4a71170a8..ef4c8b816 100644 --- a/stdlib/source/library/lux/control/lazy.lux +++ b/stdlib/source/library/lux/control/lazy.lux @@ -16,9 +16,9 @@ [macro (.only with_symbols) [syntax (.only syntax)]] [type (.only sharing) - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) -(primitive.def .public (Lazy a) +(nominal.def .public (Lazy a) (-> [] a) (def .public (lazy' generator) diff --git a/stdlib/source/library/lux/control/security/capability.lux b/stdlib/source/library/lux/control/security/capability.lux index bdcc86586..112de0720 100644 --- a/stdlib/source/library/lux/control/security/capability.lux +++ b/stdlib/source/library/lux/control/security/capability.lux @@ -21,9 +21,9 @@ ["[0]" export] ["|[0]|" declaration]]] [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) -(primitive.def .public (Capability brand input output) +(nominal.def .public (Capability brand input output) (-> input output) (def .public (use it input) @@ -45,7 +45,7 @@ .let [[name vars] declaration] g!brand (at ! each (|>> %.code code.text) (macro.symbol (format (%.symbol [this_module name])))) - .let [type (` (..Capability (.Primitive (, g!brand)) (, input) (, output)))]] + .let [type (` (..Capability (.Nominal (, g!brand)) (, input) (, output)))]] (in (list (` (type (, export_policy) (, (|declaration|.format declaration)) (, type))) diff --git a/stdlib/source/library/lux/control/security/policy.lux b/stdlib/source/library/lux/control/security/policy.lux index 8bd2e9a45..517d60638 100644 --- a/stdlib/source/library/lux/control/security/policy.lux +++ b/stdlib/source/library/lux/control/security/policy.lux @@ -7,9 +7,9 @@ [monad (.only Monad)]] [meta [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) -(primitive.def .public (Policy brand value label) +(nominal.def .public (Policy brand value label) value (type .public (Can_Upgrade brand label value) @@ -78,7 +78,7 @@ ) (with_template [<brand> <value> <upgrade> <downgrade>] - [(primitive.def .public <brand> + [(nominal.def .public <brand> Any (type .public <value> diff --git a/stdlib/source/library/lux/control/thread.lux b/stdlib/source/library/lux/control/thread.lux index 952eabac4..222ea8b2c 100644 --- a/stdlib/source/library/lux/control/thread.lux +++ b/stdlib/source/library/lux/control/thread.lux @@ -14,13 +14,13 @@ [meta ["@" target] [type - ["[0]" primitive (.except def)] + ["[0]" nominal (.except def)] ["[0]" variance (.only Mutable)]]]]]) (type .public (Thread ! a) (-> ! a)) -(primitive.def (Box'' t a) +(nominal.def (Box'' t a) (Array a) (type .public (Box' t r w) diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux index 3158b04d6..3e522b255 100644 --- a/stdlib/source/library/lux/data/collection/array.lux +++ b/stdlib/source/library/lux/data/collection/array.lux @@ -17,9 +17,9 @@ [variance (.only)]]]]] ["!" \\unsafe]) -(def .public primitive +(def .public nominal Text - !.primitive) + !.nominal) (type .public Array' !.Array') diff --git a/stdlib/source/library/lux/data/collection/queue/priority.lux b/stdlib/source/library/lux/data/collection/queue/priority.lux index 49f6cc0a4..17cf5ee16 100644 --- a/stdlib/source/library/lux/data/collection/queue/priority.lux +++ b/stdlib/source/library/lux/data/collection/queue/priority.lux @@ -15,7 +15,7 @@ ["n" nat (.use "[1]#[0]" interval)]]] [meta [type (.only by_example) - ["[0]" primitive (.only abstraction representation)]]]]]) + ["[0]" nominal (.only abstraction representation)]]]]]) (type .public Priority Nat) @@ -37,7 +37,7 @@ ..builder) @)) -(primitive.def .public (Queue a) +(nominal.def .public (Queue a) (Maybe (Tree :@: Priority a)) (def .public empty diff --git a/stdlib/source/library/lux/data/collection/set/multi.lux b/stdlib/source/library/lux/data/collection/set/multi.lux index d7087830b..46c225ab4 100644 --- a/stdlib/source/library/lux/data/collection/set/multi.lux +++ b/stdlib/source/library/lux/data/collection/set/multi.lux @@ -15,13 +15,13 @@ [macro ["^" pattern]] [type - ["[0]" primitive (.only abstraction representation)]]]]] + ["[0]" nominal (.only abstraction representation)]]]]] ["[0]" // (.only) [// ["[0]" list (.use "[1]#[0]" mix monoid)] ["[0]" dictionary (.only Dictionary)]]]) -(primitive.def .public (Set a) +(nominal.def .public (Set a) (Dictionary a Nat) (def .public empty diff --git a/stdlib/source/library/lux/data/collection/set/ordered.lux b/stdlib/source/library/lux/data/collection/set/ordered.lux index 3ff035d4b..fcaa369c7 100644 --- a/stdlib/source/library/lux/data/collection/set/ordered.lux +++ b/stdlib/source/library/lux/data/collection/set/ordered.lux @@ -11,9 +11,9 @@ ["/" ordered]]]] [meta [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) -(primitive.def .public (Set a) +(nominal.def .public (Set a) (/.Dictionary a a) (def .public empty diff --git a/stdlib/source/library/lux/data/collection/stack.lux b/stdlib/source/library/lux/data/collection/stack.lux index b910f3e21..4d1d6e0cb 100644 --- a/stdlib/source/library/lux/data/collection/stack.lux +++ b/stdlib/source/library/lux/data/collection/stack.lux @@ -9,9 +9,9 @@ ["//" list]]] [meta [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) -(primitive.def .public (Stack a) +(nominal.def .public (Stack a) (List a) (def .public empty diff --git a/stdlib/source/library/lux/data/collection/tree/finger.lux b/stdlib/source/library/lux/data/collection/tree/finger.lux index 4e0ed56de..b54a30582 100644 --- a/stdlib/source/library/lux/data/collection/tree/finger.lux +++ b/stdlib/source/library/lux/data/collection/tree/finger.lux @@ -11,10 +11,10 @@ ["[0]" list (.use "[1]#[0]" monoid)]]] [meta [type - ["[0]" primitive (.only abstraction representation)]]]]]) + ["[0]" nominal (.only abstraction representation)]]]]]) ... https://en.wikipedia.org/wiki/Finger_tree -(primitive.def .public (Tree @ t v) +(nominal.def .public (Tree @ t v) (Record [#monoid (Monoid t) #tag t diff --git a/stdlib/source/library/lux/data/color.lux b/stdlib/source/library/lux/data/color.lux index d61e01b02..23388a61c 100644 --- a/stdlib/source/library/lux/data/color.lux +++ b/stdlib/source/library/lux/data/color.lux @@ -19,9 +19,10 @@ ["[0]" i64]]] [meta [type - ["[0]" primitive]]]]] + ["[0]" nominal]]]]] [/ - ["[0]" rgb (.only RGB)]]) + ["[0]" rgb (.only RGB)] + ["[0]" hsl]]) (def top (-- rgb.limit)) @@ -37,22 +38,19 @@ (-> Frac Nat) (|>> (f.* rgb_factor) f.int .nat)) -(type .public HSL - [Frac Frac Frac]) - (type .public HSB [Frac Frac Frac]) -(primitive.def .public Color +(nominal.def .public Color RGB (def .public of_rgb (-> RGB Color) - (|>> primitive.abstraction)) + (|>> nominal.abstraction)) (def .public rgb (-> Color RGB) - (|>> primitive.representation)) + (|>> nominal.representation)) (def .public equivalence (Equivalence Color) @@ -65,7 +63,7 @@ (with_template [<color> <rgb>] [(def .public <color> Color - (primitive.abstraction <rgb>))] + (nominal.abstraction <rgb>))] [black rgb.black] [white rgb.white] @@ -76,14 +74,14 @@ (Monoid Color) (implementation (def identity - (primitive.abstraction + (nominal.abstraction (at <rgb> identity))) (def (composite left right) - (primitive.abstraction + (nominal.abstraction (at <rgb> composite - (primitive.representation left) - (primitive.representation right))))))] + (nominal.representation left) + (nominal.representation right))))))] [addition rgb.addition] [subtraction rgb.subtraction] @@ -91,83 +89,11 @@ (def .public complement (-> Color Color) - (|>> primitive.representation + (|>> nominal.representation rgb.complement - primitive.abstraction)) + nominal.abstraction)) ) -(def .public (hsl color) - (-> Color HSL) - (let [[red green blue] (rgb color) - red (..down (rgb.number red)) - green (..down (rgb.number green)) - blue (..down (rgb.number blue)) - max (all f.max red green blue) - min (all f.min red green blue) - luminance (|> (f.+ max min) (f./ +2.0))] - (if (f.= max min) - ... Achromatic - [+0.0 - +0.0 - luminance] - ... Chromatic - (let [diff (|> max (f.- min)) - saturation (|> diff - (f./ (if (f.> +0.5 luminance) - (|> +2.0 (f.- max) (f.- min)) - (|> max (f.+ min))))) - hue' (cond (f.= red max) - (|> green (f.- blue) (f./ diff) - (f.+ (if (f.< blue green) +6.0 +0.0))) - - (f.= green max) - (|> blue (f.- red) (f./ diff) - (f.+ +2.0)) - - ... (f.= blue max) - (|> red (f.- green) (f./ diff) - (f.+ +4.0)))] - [(|> hue' (f./ +6.0)) - saturation - luminance])))) - -(def (hue_rgb p q t) - (-> Frac Frac Frac Nat) - (let [t (cond (f.< +0.0 t) (f.+ +1.0 t) - (f.> +1.0 t) (f.- +1.0 t) - ... else - t) - f2/3 (f./ +3.0 +2.0)] - (..up (cond (f.< (f./ +6.0 +1.0) t) - (|> q (f.- p) (f.* +6.0) (f.* t) (f.+ p)) - - (f.< (f./ +2.0 +1.0) t) - q - - (f.< f2/3 t) - (|> q (f.- p) (f.* (|> f2/3 (f.- t))) (f.* +6.0) (f.+ p)) - - ... else - p)))) - -(def .public (of_hsl [hue saturation luminance]) - (-> HSL Color) - (|> (if (f.= +0.0 saturation) - ... Achromatic - (let [intensity (..up luminance)] - (rgb.rgb intensity intensity intensity)) - ... Chromatic - (let [q (if (f.< +0.5 luminance) - (|> saturation (f.+ +1.0) (f.* luminance)) - (|> luminance (f.+ saturation) (f.- (f.* saturation luminance)))) - p (|> luminance (f.* +2.0) (f.- q)) - third (|> +1.0 (f./ +3.0))] - (rgb.rgb (|> hue (f.+ third) (hue_rgb p q)) - (|> hue (hue_rgb p q)) - (|> hue (f.- third) (hue_rgb p q))))) - try.trusted - of_rgb)) - (def .public (hsb color) (-> Color HSB) (let [[red green blue] (rgb color) @@ -260,12 +186,16 @@ (with_template [<op> <name>] [(def .public (<name> ratio color) (-> Frac Color Color) - (let [[hue saturation luminance] (hsl color)] - (of_hsl [hue - (|> saturation - (f.* (|> +1.0 (<op> (..normal ratio)))) - (f.min +1.0)) - luminance])))] + (let [color (hsl.of_rgb (rgb color))] + (|> (hsl.hsl (hsl.hue color) + (|> color + hsl.saturation + (f.* (|> +1.0 (<op> (..normal ratio)))) + (f.min +1.0)) + (hsl.luminance color)) + try.trusted + hsl.rgb + of_rgb)))] [f.+ saturated] [f.- un_saturated] @@ -273,22 +203,34 @@ (def .public (gray_scale color) (-> Color Color) - (let [[_ _ luminance] (hsl color)] - (of_hsl [+0.0 - +0.0 - luminance]))) + (let [color (hsl.of_rgb (rgb color))] + (|> (hsl.hsl +0.0 + +0.0 + (hsl.luminance color)) + try.trusted + hsl.rgb + of_rgb))) (with_template [<name> <1> <2>] [(`` (def .public (<name> color) (-> Color [Color Color Color]) - (let [[hue saturation luminance] (hsl color)] + (let [hsl (hsl.of_rgb (rgb color)) + hue (hsl.hue hsl) + saturation (hsl.saturation hsl) + luminance (hsl.luminance hsl)] [color - (of_hsl [(|> hue (f.+ <1>) ..normal) - saturation - luminance]) - (of_hsl [(|> hue (f.+ <2>) ..normal) - saturation - luminance])])))] + (|> (hsl.hsl (|> hue (f.+ <1>) ..normal) + saturation + luminance) + try.trusted + hsl.rgb + of_rgb) + (|> (hsl.hsl (|> hue (f.+ <2>) ..normal) + saturation + luminance) + try.trusted + hsl.rgb + of_rgb)])))] [triad (|> +1.0 (f./ +3.0)) (|> +2.0 (f./ +3.0))] [clash (|> +1.0 (f./ +4.0)) (|> +3.0 (f./ +4.0))] @@ -320,27 +262,27 @@ (type .public Palette (-> Spread Nat Color (List Color))) -(`` (def .public (analogous spread variations color) - Palette - (let [[hue saturation brightness] (hsb color) - spread (..normal spread)] - (list#each (function (_ idx) - (of_hsb [(|> idx ++ .int int.frac (f.* spread) (f.+ hue) ..normal) - saturation - brightness])) - (list.indices variations))))) - -(`` (def .public (monochromatic spread variations color) - Palette - (let [[hue saturation brightness] (hsb color) - spread (..normal spread)] - (|> (list.indices variations) - (list#each (|>> ++ .int int.frac - (f.* spread) - (f.+ brightness) - ..normal - [hue saturation] - of_hsb)))))) +(def .public (analogous spread variations color) + Palette + (let [[hue saturation brightness] (hsb color) + spread (..normal spread)] + (list#each (function (_ idx) + (of_hsb [(|> idx ++ .int int.frac (f.* spread) (f.+ hue) ..normal) + saturation + brightness])) + (list.indices variations)))) + +(def .public (monochromatic spread variations color) + Palette + (let [[hue saturation brightness] (hsb color) + spread (..normal spread)] + (|> (list.indices variations) + (list#each (|>> ++ .int int.frac + (f.* spread) + (f.+ brightness) + ..normal + [hue saturation] + of_hsb))))) (type .public Alpha Rev) diff --git a/stdlib/source/library/lux/data/color/cmyk.lux b/stdlib/source/library/lux/data/color/cmyk.lux index 3e22ab333..d519d2cea 100644 --- a/stdlib/source/library/lux/data/color/cmyk.lux +++ b/stdlib/source/library/lux/data/color/cmyk.lux @@ -15,19 +15,19 @@ ["[0]" int]]] [meta [type - ["[0]" primitive]]]]] + ["[0]" nominal]]]]] [// ["[0]" rgb (.only RGB)]]) (with_expansions [<min> +0.0 <max> +1.0] - (primitive.def .public Value + (nominal.def .public Value Frac (with_template [<number> <name>] [(def .public <name> Value - (primitive.abstraction <number>))] + (nominal.abstraction <number>))] [<min> least] [<max> most] @@ -36,24 +36,24 @@ (exception.def .public (invalid it) (Exception Frac) (exception.report - (list ["Minimum" (%.frac (primitive.representation ..least))] - ["Maximum" (%.frac (primitive.representation ..most))] + (list ["Minimum" (%.frac (nominal.representation ..least))] + ["Maximum" (%.frac (nominal.representation ..most))] ["Value" (%.frac it)]))) (def .public (value it) (-> Frac (Try Value)) - (if (or (f.> (primitive.representation ..most) + (if (or (f.> (nominal.representation ..most) it) - (f.< (primitive.representation ..least) + (f.< (nominal.representation ..least) it)) (exception.except ..invalid [it]) - {try.#Success (primitive.abstraction it)})) + {try.#Success (nominal.abstraction it)})) (def .public number (-> Value Frac) - (|>> primitive.representation)) + (|>> nominal.representation)) (type .public CMYK (Record @@ -66,10 +66,10 @@ (Equivalence CMYK) (implementation (def (= [cR mR yR kR] [cS mS yS kS]) - (and (f.= (primitive.representation cR) (primitive.representation cS)) - (f.= (primitive.representation mR) (primitive.representation mS)) - (f.= (primitive.representation yR) (primitive.representation yS)) - (f.= (primitive.representation kR) (primitive.representation kS)))))) + (and (f.= (nominal.representation cR) (nominal.representation cS)) + (f.= (nominal.representation mR) (nominal.representation mS)) + (f.= (nominal.representation yR) (nominal.representation yS)) + (f.= (nominal.representation kR) (nominal.representation kS)))))) (def top (-- rgb.limit)) @@ -106,26 +106,26 @@ cyan (|> <max> (f.- red) (f.- key) (f.* f)) magenta (|> <max> (f.- green) (f.- key) (f.* f)) yellow (|> <max> (f.- blue) (f.- key) (f.* f))] - [#cyan (primitive.abstraction cyan) - #magenta (primitive.abstraction magenta) - #yellow (primitive.abstraction yellow) - #key (primitive.abstraction key)])) + [#cyan (nominal.abstraction cyan) + #magenta (nominal.abstraction magenta) + #yellow (nominal.abstraction yellow) + #key (nominal.abstraction key)])) (def .public (rgb it) (-> CMYK RGB) - (when (primitive.representation (the #key it)) + (when (nominal.representation (the #key it)) <max> rgb.black key (let [~key (opposite key) red (f.* ~key - (opposite (primitive.representation (the #cyan it)))) + (opposite (nominal.representation (the #cyan it)))) green (f.* ~key - (opposite (primitive.representation (the #magenta it)))) + (opposite (nominal.representation (the #magenta it)))) blue (f.* ~key - (opposite (primitive.representation (the #yellow it))))] + (opposite (nominal.representation (the #yellow it))))] (|> (rgb.rgb (..up red) (..up green) (..up blue)) diff --git a/stdlib/source/library/lux/data/color/hsl.lux b/stdlib/source/library/lux/data/color/hsl.lux new file mode 100644 index 000000000..dd2155f2f --- /dev/null +++ b/stdlib/source/library/lux/data/color/hsl.lux @@ -0,0 +1,184 @@ +(.require + [library + [lux (.except) + [abstract + [equivalence (.only Equivalence)] + [monad (.only do)]] + [control + ["[0]" try (.only Try)] + ["[0]" exception (.only Exception)]] + [data + [text + ["%" \\format]]] + [math + [number + ["i" int] + ["f" frac]]] + [meta + [type + ["[0]" nominal]]]]] + [// + ["[0]" rgb (.only RGB)]]) + +(def top + (-- rgb.limit)) + +(def rgb_factor + (|> top .int i.frac)) + +(def down + (-> Nat + Frac) + (|>> .int i.frac (f./ rgb_factor))) + +(def up + (-> Frac + Nat) + (|>> (f.* rgb_factor) f.int .nat)) + +(type .public Value + Frac) + +(with_template [<value> <name>] + [(def .public <name> + Value + <value>)] + + [+0.0 least] + [+1.0 most] + ) + +(exception.def .public (invalid value) + (Exception Frac) + (exception.report + (list ["Value" (%.frac value)] + ["Minimum" (%.frac ..least)] + ["Maximum" (%.frac ..most)]))) + +(def .public (value it) + (-> Frac + (Try Value)) + (if (or (f.< ..least it) + (f.> ..most it)) + (exception.except ..invalid [it]) + {try.#Success it})) + +(nominal.def .public HSL + (Record + [#hue Value + #saturation Value + #luminance Value]) + + (def .public equivalence + (Equivalence HSL) + (implementation + (def (= left right) + (`` (and (,, (with_template [<slot>] + [(f.= (the <slot> (nominal.representation left)) + (the <slot> (nominal.representation right)))] + + [#hue] + [#saturation] + [#luminance] + ))))))) + + (with_template [<name> <slot>] + [(def .public <name> + (-> HSL + Value) + (|>> nominal.representation + (the <slot>)))] + + [hue #hue] + [saturation #saturation] + [luminance #luminance] + ) + + (def .public (hsl hue saturation luminance) + (-> Frac Frac Frac + (Try HSL)) + (do try.monad + [hue (..value hue) + saturation (..value saturation) + luminance (..value luminance)] + (in (nominal.abstraction + [#hue hue + #saturation saturation + #luminance luminance])))) + + (def .public (of_rgb it) + (-> RGB + HSL) + (let [red (..down (rgb.number (the rgb.#red it))) + green (..down (rgb.number (the rgb.#green it))) + blue (..down (rgb.number (the rgb.#blue it))) + + max (all f.max red green blue) + min (all f.min red green blue) + luminance (|> (f.+ max min) (f./ +2.0))] + (nominal.abstraction + (if (f.= max min) + ... Achromatic + [#hue ..least + #saturation ..least + #luminance luminance] + ... Chromatic + (let [diff (|> max (f.- min)) + saturation (|> diff + (f./ (if (f.> +0.5 luminance) + (|> +2.0 (f.- max) (f.- min)) + (|> max (f.+ min))))) + hue' (cond (f.= red max) + (|> green (f.- blue) (f./ diff) + (f.+ (if (f.< blue green) +6.0 +0.0))) + + (f.= green max) + (|> blue (f.- red) (f./ diff) + (f.+ +2.0)) + + ... (f.= blue max) + (|> red (f.- green) (f./ diff) + (f.+ +4.0)))] + [#hue (|> hue' (f./ +6.0)) + #saturation saturation + #luminance luminance]))))) + + (def (hue_rgb p q t) + (-> Frac Frac Frac + Nat) + (let [t (cond (f.< +0.0 t) (f.+ +1.0 t) + (f.> +1.0 t) (f.- +1.0 t) + ... else + t) + f2/3 (f./ +3.0 +2.0)] + (..up (cond (f.< (f./ +6.0 +1.0) t) + (|> q (f.- p) (f.* +6.0) (f.* t) (f.+ p)) + + (f.< (f./ +2.0 +1.0) t) + q + + (f.< f2/3 t) + (|> q (f.- p) (f.* (|> f2/3 (f.- t))) (f.* +6.0) (f.+ p)) + + ... else + p)))) + + (def .public (rgb it) + (-> HSL + RGB) + (let [[hue saturation luminance] (nominal.representation it)] + (try.trusted + (if (f.= ..least saturation) + ... Achromatic + (let [intensity (..up luminance)] + (rgb.rgb intensity intensity intensity)) + ... Chromatic + (let [q (if (f.< +0.5 luminance) + (|> saturation (f.+ +1.0) (f.* luminance)) + (|> luminance (f.+ saturation) (f.- (f.* saturation luminance)))) + p (|> luminance (f.* +2.0) (f.- q)) + third (|> +1.0 (f./ +3.0))] + (rgb.rgb (|> hue (f.+ third) (hue_rgb p q)) + (|> hue (hue_rgb p q)) + (|> hue (f.- third) (hue_rgb p q)))))))) + ) diff --git a/stdlib/source/library/lux/data/color/rgb.lux b/stdlib/source/library/lux/data/color/rgb.lux index 23ac52a30..8c14e7903 100644 --- a/stdlib/source/library/lux/data/color/rgb.lux +++ b/stdlib/source/library/lux/data/color/rgb.lux @@ -18,22 +18,22 @@ ["[0]" i64]]] [meta [type - ["[0]" primitive]]]]]) + ["[0]" nominal]]]]]) (def .public limit Nat 256) -(primitive.def .public Value +(nominal.def .public Value Nat (def .public least Value - (primitive.abstraction 0)) + (nominal.abstraction 0)) (def .public most Value - (primitive.abstraction (-- ..limit))) + (nominal.abstraction (-- ..limit))) (exception.def .public (invalid it) (Exception Nat) @@ -45,12 +45,12 @@ (-> Nat (Try Value)) (if (n.< ..limit it) - {try.#Success (primitive.abstraction it)} + {try.#Success (nominal.abstraction it)} (exception.except ..invalid [it]))) (def .public number (-> Value Nat) - (|>> primitive.representation)) + (|>> nominal.representation)) (type .public RGB (Record @@ -73,9 +73,9 @@ (Equivalence RGB) (implementation (def (= [rR gR bR] [rS gS bS]) - (and (n.= (primitive.representation rR) (primitive.representation rS)) - (n.= (primitive.representation gR) (primitive.representation gS)) - (n.= (primitive.representation bR) (primitive.representation bS)))))) + (and (n.= (nominal.representation rR) (nominal.representation rS)) + (n.= (nominal.representation gR) (nominal.representation gS)) + (n.= (nominal.representation bR) (nominal.representation bS)))))) (def .public hash (Hash RGB) @@ -85,13 +85,13 @@ (def (hash [r g b]) (all i64.or - (i64.left_shifted 16 (primitive.representation r)) - (i64.left_shifted 08 (primitive.representation g)) - (primitive.representation b))))) + (i64.left_shifted 16 (nominal.representation r)) + (i64.left_shifted 08 (nominal.representation g)) + (nominal.representation b))))) (def (opposite_intensity value) (-> Nat Nat) - (|> (primitive.representation ..most) + (|> (nominal.representation ..most) (n.- value))) (def .public (complement it) @@ -99,9 +99,9 @@ (`` [(,, (with_template [<slot>] [<slot> (|> it (the <slot>) - primitive.representation + nominal.representation opposite_intensity - primitive.abstraction)] + nominal.abstraction)] [#red] [#green] @@ -131,9 +131,9 @@ (let [left (<left> left) right (<right> right)] (`` [(,, (with_template [<slot>] - [<slot> (primitive.abstraction - (<composite> (primitive.representation (the <slot> left)) - (primitive.representation (the <slot> right))))] + [<slot> (nominal.abstraction + (<composite> (nominal.representation (the <slot> left)) + (nominal.representation (the <slot> right))))] [#red] [#green] diff --git a/stdlib/source/library/lux/data/color/terminal.lux b/stdlib/source/library/lux/data/color/terminal.lux index 1f368de0b..d59f2986b 100644 --- a/stdlib/source/library/lux/data/color/terminal.lux +++ b/stdlib/source/library/lux/data/color/terminal.lux @@ -15,19 +15,19 @@ [macro ["[0]" template]] [type - ["[0]" primitive]]]]] + ["[0]" nominal]]]]] ["[0]" // (.only Color) ["[0]" rgb]]) -(primitive.def .public Command +(nominal.def .public Command [Text Text] (def .public equivalence (Equivalence Command) (implementation (def (= reference it) - (let [[beforeR afterR] (primitive.representation Command reference) - [beforeI afterI] (primitive.representation Command it)] + (let [[beforeR afterR] (nominal.representation Command reference) + [beforeI afterI] (nominal.representation Command it)] (and (text#= beforeR beforeI) (text#= afterR afterI)))))) @@ -38,7 +38,7 @@ (def .public (with command text) (-> Command Text Text) - (let [[before after] (primitive.representation Command command)] + (let [[before after] (nominal.representation Command command)] (%.format before text after))) @@ -57,13 +57,13 @@ Command (|> [(%.format ..command (%.nat <fg>) "m") ..default_foreground_color] - (primitive.abstraction Command)))) + (nominal.abstraction Command)))) (`` (def .public (,, (template.symbol [<color> "_background"])) Command (|> [(%.format ..command (%.nat <bg>) "m") ..default_background_color] - (primitive.abstraction Command))))] + (nominal.abstraction Command))))] [030 040 black] [031 041 red] @@ -95,7 +95,7 @@ ";" (%.nat (rgb.number (the rgb.#blue it))) "m") <reset>] - (primitive.abstraction Command))))] + (nominal.abstraction Command))))] ["38;2" foreground ..default_foreground_color] ["48;2" background ..default_background_color] diff --git a/stdlib/source/library/lux/data/format/css.lux b/stdlib/source/library/lux/data/format/css.lux index 53b9238ec..256e70010 100644 --- a/stdlib/source/library/lux/data/format/css.lux +++ b/stdlib/source/library/lux/data/format/css.lux @@ -14,7 +14,7 @@ ["[0]" nat]]] [meta [type - ["[0]" primitive (.except Frame def)]]] + ["[0]" nominal (.except Frame def)]]] [world [net (.only URL)]]]] ["[0]" / @@ -25,10 +25,10 @@ ["[1][0]" style] ["[1][0]" query (.only Query)]]) -(primitive.def .public Common Any) -(primitive.def .public Special Any) +(nominal.def .public Common Any) +(nominal.def .public Special Any) -(primitive.def .public (CSS brand) +(nominal.def .public (CSS brand) Text (def .public css diff --git a/stdlib/source/library/lux/data/format/css/class.lux b/stdlib/source/library/lux/data/format/css/class.lux index a3def1196..46e980a47 100644 --- a/stdlib/source/library/lux/data/format/css/class.lux +++ b/stdlib/source/library/lux/data/format/css/class.lux @@ -11,9 +11,9 @@ [macro [syntax (.only syntax)]] [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) -(primitive.def .public Class +(nominal.def .public Class Text (def .public class diff --git a/stdlib/source/library/lux/data/format/css/id.lux b/stdlib/source/library/lux/data/format/css/id.lux index cd6c1c4cf..fc93ec1bb 100644 --- a/stdlib/source/library/lux/data/format/css/id.lux +++ b/stdlib/source/library/lux/data/format/css/id.lux @@ -11,9 +11,9 @@ [macro [syntax (.only syntax)]] [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) -(primitive.def .public ID +(nominal.def .public ID Text (def .public id diff --git a/stdlib/source/library/lux/data/format/css/property.lux b/stdlib/source/library/lux/data/format/css/property.lux index e34b27b1d..192f0395a 100644 --- a/stdlib/source/library/lux/data/format/css/property.lux +++ b/stdlib/source/library/lux/data/format/css/property.lux @@ -10,7 +10,7 @@ [syntax (.only syntax)] ["[0]" template]] [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] [// [value (.only All Number @@ -57,7 +57,7 @@ (syntax (_ [symbol s.text]) (in (list (code.local (text.replaced "-" "_" symbol)))))) -(primitive.def .public (Property brand) +(nominal.def .public (Property brand) Text (def .public name diff --git a/stdlib/source/library/lux/data/format/css/query.lux b/stdlib/source/library/lux/data/format/css/query.lux index 095d12b40..de3defe3b 100644 --- a/stdlib/source/library/lux/data/format/css/query.lux +++ b/stdlib/source/library/lux/data/format/css/query.lux @@ -11,7 +11,7 @@ [syntax (.only syntax)] ["[0]" template]] [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] ["[0]" // ["[1][0]" value (.only Value Length Count Resolution Ratio Orientation Scan Boolean Update @@ -24,7 +24,7 @@ (syntax (_ [symbol s.text]) (in (list (code.local (text.replaced "-" "_" symbol)))))) -(primitive.def .public Media +(nominal.def .public Media Text (def .public media @@ -42,7 +42,7 @@ ["speech"] )) -(primitive.def .public Feature +(nominal.def .public Feature Text (def .public feature @@ -102,7 +102,7 @@ ) ) -(primitive.def .public Query +(nominal.def .public Query Text (def .public query diff --git a/stdlib/source/library/lux/data/format/css/selector.lux b/stdlib/source/library/lux/data/format/css/selector.lux index a76428c86..757ca8df8 100644 --- a/stdlib/source/library/lux/data/format/css/selector.lux +++ b/stdlib/source/library/lux/data/format/css/selector.lux @@ -11,7 +11,7 @@ [macro ["[0]" template]] [type - ["[0]" primitive (.except def)]]] + ["[0]" nominal (.except def)]]] [world ["[0]" locale (.only Locale)]]]] ["[0]" // @@ -23,21 +23,21 @@ (type .public Tag Label) (type .public Attribute Label) -(primitive.def .public (Generic brand) Any) +(nominal.def .public (Generic brand) Any) (with_template [<generic> <brand>] - [(primitive.def <brand> Any) + [(nominal.def <brand> Any) (type .public <generic> (Generic <brand>))] [Can_Chain Can_Chain'] [Cannot_Chain Cannot_Chain'] ) -(primitive.def .public Unique Any) -(primitive.def .public Specific Any) -(primitive.def .public Composite Any) +(nominal.def .public Unique Any) +(nominal.def .public Specific Any) +(nominal.def .public Composite Any) -(primitive.def .public (Selector kind) +(nominal.def .public (Selector kind) Text (def .public selector @@ -169,7 +169,7 @@ (format ":not") abstraction)) - (primitive.def .public Index + (nominal.def .public Index Text (def .public index diff --git a/stdlib/source/library/lux/data/format/css/style.lux b/stdlib/source/library/lux/data/format/css/style.lux index ddcbbc291..d1bd1899d 100644 --- a/stdlib/source/library/lux/data/format/css/style.lux +++ b/stdlib/source/library/lux/data/format/css/style.lux @@ -8,12 +8,12 @@ ["[0]" list (.use "[1]#[0]" mix)]]] [meta [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] ["[0]" // ["[1][0]" value (.only Value)] ["[1][0]" property (.only Property)]]) -(primitive.def .public Style +(nominal.def .public Style Text (def .public empty diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux index 0a46fddbe..6886dad69 100644 --- a/stdlib/source/library/lux/data/format/css/value.lux +++ b/stdlib/source/library/lux/data/format/css/value.lux @@ -24,7 +24,7 @@ [syntax (.only syntax)] ["[0]" template]] [type - ["[0]" primitive (.except def)]]] + ["[0]" nominal (.except def)]]] [world [net (.only URL)]]]] [// @@ -36,7 +36,7 @@ (def enumeration (template (_ <abstraction> <representation> <out> <sample>+ <definition>+) - [(primitive.def .public <abstraction> + [(nominal.def .public <abstraction> <representation> (def .public <out> @@ -58,7 +58,7 @@ raw (|> raw (text.split_at 1) maybe.trusted product.right)))) -(primitive.def .public (Value brand) +(nominal.def .public (Value brand) Text (def .public value @@ -76,11 +76,11 @@ [unset "unset"] ) - (primitive.def .public (Numeric kind) Any) + (nominal.def .public (Numeric kind) Any) (with_template [<name>] [(with_expansions [<name>' (template.symbol [<name> "'"])] - (primitive.def .public <name>' Any) + (nominal.def .public <name>' Any) (type .public <name> (Numeric <name>')))] @@ -91,7 +91,7 @@ ) (with_template [<brand> <alias>+ <value>+] - [(primitive.def .public <brand> Any) + [(nominal.def .public <brand> Any) (`` (with_template [<name> <value>] [(def .public <name> @@ -905,7 +905,7 @@ (abstraction (format (%.nat horizontal) ..slice_separator (%.nat vertical)))) - (primitive.def .public Stop + (nominal.def .public Stop Text (def .public stop @@ -929,7 +929,7 @@ (representation Value start) ..stop_separator (representation Value end)))) - (primitive.def .public Hint + (nominal.def .public Hint Text (def .public hint @@ -950,7 +950,7 @@ (type .public (List/1 a) [a (List a)]) - (primitive.def .public Angle + (nominal.def .public Angle Text (def .public angle diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux index 0dc8a42b5..77beb4f7f 100644 --- a/stdlib/source/library/lux/data/format/html.lux +++ b/stdlib/source/library/lux/data/format/html.lux @@ -16,7 +16,7 @@ [target ["[0]" js]] [type - ["[0]" primitive (.except def)]]] + ["[0]" nominal (.except def)]]] [world [net (.only URL)]]]] [// @@ -86,11 +86,11 @@ (-> Tag Text) (text.enclosed ["</" ">"])) -(primitive.def .public (HTML brand) +(nominal.def .public (HTML brand) Text (.with_template [<name> <brand>] - [(primitive.def <brand> Any) + [(nominal.def <brand> Any) (type .public <name> (HTML <brand>))] [Meta Meta'] @@ -108,11 +108,11 @@ ) (.with_template [<super> <super_raw> <sub>+] - [(primitive.def (<super_raw> brand) Any) + [(nominal.def (<super_raw> brand) Any) (type .public <super> (HTML (<super_raw> Any))) (`` (.with_template [<sub> <sub_raw>] - [(primitive.def <sub_raw> Any) + [(nominal.def <sub_raw> Any) (type .public <sub> (HTML (<super_raw> <sub_raw>)))] (,, (template.spliced <sub>+))))] diff --git a/stdlib/source/library/lux/data/format/markdown.lux b/stdlib/source/library/lux/data/format/markdown.lux index 11c9f6e9f..e533b908b 100644 --- a/stdlib/source/library/lux/data/format/markdown.lux +++ b/stdlib/source/library/lux/data/format/markdown.lux @@ -8,14 +8,15 @@ ["[0]" list (.use "[1]#[0]" functor)]]] [meta [type - ["[0]" primitive (.except def)]]] + ["[0]" nominal]]] [world [net (.only URL)]]]]) ... https://www.markdownguide.org/basic-syntax/ (def safe - (-> Text Text) + (-> Text + Text) (|>> (text.replaced "\" "\\") (text.replaced "`" "\`") (text.replaced "*" "\*") @@ -32,27 +33,29 @@ (text.replaced "." "\.") (text.replaced "!" "\!"))) -(primitive.def .public Span Any) -(primitive.def .public Block Any) +(nominal.def .public Span Any) +(nominal.def .public Block Any) -(primitive.def .public (Markdown brand) +(nominal.def .public (Markdown brand) Text (def .public empty Markdown - (abstraction "")) + (nominal.abstraction "")) (def .public text - (-> Text (Markdown Span)) - (|>> ..safe abstraction)) + (-> Text + (Markdown Span)) + (|>> ..safe nominal.abstraction)) (def blank_line (format text.new_line text.new_line)) (with_template [<name> <prefix>] [(def .public (<name> content) - (-> Text (Markdown Block)) - (abstraction (format <prefix> " " (..safe content) ..blank_line)))] + (-> (Markdown Span) + (Markdown Block)) + (nominal.abstraction (format <prefix> " " (nominal.representation content) ..blank_line)))] [heading/1 "#"] [heading/2 "##"] @@ -63,30 +66,35 @@ ) (def (block content) - (-> Text (Markdown Block)) - (abstraction (format content ..blank_line))) + (-> Text + (Markdown Block)) + (nominal.abstraction (format content ..blank_line))) (def .public paragraph - (-> (Markdown Span) (Markdown Block)) - (|>> representation ..block)) + (-> (Markdown Span) + (Markdown Block)) + (|>> nominal.representation ..block)) (def .public break (Markdown Span) - (abstraction (format " " text.new_line))) + (nominal.abstraction (format " " text.new_line))) (with_template [<name> <wrapper>] [(def .public <name> - (-> (Markdown Span) (Markdown Span)) - (|>> representation + (-> (Markdown Span) + (Markdown Span)) + (|>> nominal.representation (text.enclosed [<wrapper> <wrapper>]) - abstraction))] + nominal.abstraction))] [bold "**"] [italic "_"] ) (def (prefix with) - (-> Text (-> Text Text)) + (-> Text + (-> Text + Text)) (|>> (text.all_split_by text.new_line) (list#each (function (_ line) (if (text.empty? line) @@ -95,25 +103,27 @@ (text.interposed text.new_line))) (def indent - (-> Text Text) + (-> Text + Text) (..prefix text.tab)) (def .public quote - (-> (Markdown Block) (Markdown Block)) - (|>> representation + (-> (Markdown Block) + (Markdown Block)) + (|>> nominal.representation (..prefix "> ") - abstraction)) + nominal.abstraction)) (def .public numbered_list (-> (List [(Markdown Span) (Maybe (Markdown Block))]) (Markdown Block)) (|>> list.enumeration (list#each (function (_ [idx [summary detail]]) - (format "1. " (representation summary) + (format "1. " (nominal.representation summary) (when detail {.#Some detail} (|> detail - representation + nominal.representation ..indent (text.enclosed [text.new_line text.new_line]) (format text.new_line)) @@ -127,11 +137,11 @@ (-> (List [(Markdown Span) (Maybe (Markdown Block))]) (Markdown Block)) (|>> (list#each (function (_ [summary detail]) - (format "* " (representation summary) + (format "* " (nominal.representation summary) (when detail {.#Some detail} (|> detail - representation + nominal.representation ..indent (text.enclosed [text.new_line text.new_line]) (format text.new_line)) @@ -143,19 +153,22 @@ ... A snippet of code. (def .public snippet - (-> Text (Markdown Span)) - (|>> (text.enclosed ["`` " " ``"]) abstraction)) + (-> Text + (Markdown Span)) + (|>> (text.enclosed ["`` " " ``"]) nominal.abstraction)) ... A (generic) block of code. (def .public generic_code - (-> Text (Markdown Block)) + (-> Text + (Markdown Block)) (let [open (format "```" text.new_line) close (format text.new_line "```")] (|>> (text.enclosed [open close]) ..block))) ... A block of code of a specific language. (def .public (code language block) - (-> Text Text (Markdown Block)) + (-> Text Text + (Markdown Block)) (let [open (format "```" language text.new_line) close (format text.new_line "```")] (|> block @@ -163,24 +176,32 @@ ..block))) (def .public (image description url) - (-> Text URL (Markdown Span)) - (abstraction (format "![" (..safe description) "](" url ")"))) + (-> Text URL + (Markdown Span)) + (nominal.abstraction (format "![" (..safe description) "](" url ")"))) (def .public horizontal_rule (Markdown Block) (..block "___")) + (def .public (anchor name) + (-> Text + (Markdown Span)) + (nominal.abstraction (format "<a name=" name "></a>"))) + (def .public (link description url) - (-> (Markdown Span) URL (Markdown Span)) - (abstraction (format "[" (representation description) "](" url ")"))) + (-> (Markdown Span) URL + (Markdown Span)) + (nominal.abstraction (format "[" (nominal.representation description) "](" url ")"))) (type .public Email Text) (with_template [<name> <type>] [(def .public <name> - (-> <type> (Markdown Span)) - (|>> (text.enclosed ["<" ">"]) abstraction))] + (-> <type> + (Markdown Span)) + (|>> (text.enclosed ["<" ">"]) nominal.abstraction))] [url URL] [email Email] @@ -188,14 +209,17 @@ (with_template [<name> <brand> <infix>] [(def .public (<name> pre post) - (-> (Markdown <brand>) (Markdown <brand>) (Markdown <brand>)) - (abstraction (format (representation pre) <infix> (representation post))))] + (-> (Markdown <brand>) (Markdown <brand>) + (Markdown <brand>)) + (nominal.abstraction (format (nominal.representation pre) <infix> (nominal.representation post))))] [and Span " "] [then Block ""] ) (def .public markdown - (All (_ a) (-> (Markdown a) Text)) - (|>> representation)) + (All (_ a) + (-> (Markdown a) + Text)) + (|>> nominal.representation)) ) diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux index 8daa5be57..c98ef6ee5 100644 --- a/stdlib/source/library/lux/data/format/tar.lux +++ b/stdlib/source/library/lux/data/format/tar.lux @@ -34,7 +34,7 @@ [macro ["^" pattern]] [type - ["[0]" primitive (.except def #name)]]] + ["[0]" nominal (.except def #name)]]] [world ["[0]" file] [time @@ -79,7 +79,7 @@ (list ["Value" (%.nat value)] ["Maximum" (%.nat (-- <limit>))]))) - (primitive.def .public <type> + (nominal.def .public <type> Nat (def .public (<in> value) @@ -164,7 +164,7 @@ [value (at n.octal decoded digits)] (..big value))))) -(primitive.def Checksum +(nominal.def Checksum Text (def from_checksum @@ -257,7 +257,7 @@ (binary!.slice 0 (++ end) string)))))))) (with_template [<type> <representation> <size> <exception> <in> <out> <format> <parser> <none>] - [(primitive.def .public <type> + [(nominal.def .public <type> <representation> (exception.def .public (<exception> value) @@ -315,7 +315,7 @@ (def magic_size Size 7) -(primitive.def Magic +(nominal.def Magic Text (def ustar @@ -402,7 +402,7 @@ ... devminor (..small_number ..device_size))) -(primitive.def Link_Flag +(nominal.def Link_Flag Char (def link_flag @@ -451,7 +451,7 @@ (exception.except ..invalid_link_flag [(.nat it)])))))) ) -(primitive.def .public Mode +(nominal.def .public Mode Nat (def .public mode @@ -540,7 +540,7 @@ (list.repeated ..content_size) (list#mix n.* 1))) -(primitive.def .public Content +(nominal.def .public Content [Big Binary] (def .public (content it) diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux index cc8bf71b8..6222ada19 100644 --- a/stdlib/source/library/lux/data/text.lux +++ b/stdlib/source/library/lux/data/text.lux @@ -224,15 +224,15 @@ (for @.old (as Text ("jvm invokevirtual:java.lang.String:replace:java.lang.CharSequence,java.lang.CharSequence" - (as (Primitive "java.lang.String") template) - (as (Primitive "java.lang.CharSequence") pattern) - (as (Primitive "java.lang.CharSequence") replacement))) + (as (Nominal "java.lang.String") template) + (as (Nominal "java.lang.CharSequence") pattern) + (as (Nominal "java.lang.CharSequence") replacement))) @.jvm (as Text (.jvm_member_invoke_virtual# [] "java.lang.String" "replace" [] - (as (Primitive "java.lang.String") template) - ["Ljava/lang/CharSequence;" (as (Primitive "java.lang.CharSequence") pattern)] - ["Ljava/lang/CharSequence;" (as (Primitive "java.lang.CharSequence") replacement)])) + (as (Nominal "java.lang.String") template) + ["Ljava/lang/CharSequence;" (as (Nominal "java.lang.CharSequence") pattern)] + ["Ljava/lang/CharSequence;" (as (Nominal "java.lang.CharSequence") replacement)])) @.js ... TODO: Remove this when Nashorn is no longer being used. (..if_nashorn @@ -287,18 +287,18 @@ (def (hash input) (for @.old (|> input - (is (Primitive "java.lang.Object")) + (is (Nominal "java.lang.Object")) "jvm invokevirtual:java.lang.Object:hashCode:" "jvm convert int-to-long" (as Nat)) @.jvm (|> input - (as (Primitive "java.lang.Object")) + (as (Nominal "java.lang.Object")) (.jvm_member_invoke_virtual# [] "java.lang.Object" "hashCode" []) .jvm_conversion_int_to_long# .jvm_object_cast# - (is (Primitive "java.lang.Long")) + (is (Nominal "java.lang.Long")) (as Nat)) ... Platform-independent default. (let [length (.text_size# input)] @@ -358,11 +358,11 @@ (for @.old (as Text ("jvm invokevirtual:java.lang.String:toLowerCase:" - (as (Primitive "java.lang.String") value))) + (as (Nominal "java.lang.String") value))) @.jvm (as Text (.jvm_member_invoke_virtual# [] "java.lang.String" "toLowerCase" [] - (as (Primitive "java.lang.String") value))) + (as (Nominal "java.lang.String") value))) @.js (as Text ("js object do" "toLowerCase" value [])) @@ -381,11 +381,11 @@ (for @.old (as Text ("jvm invokevirtual:java.lang.String:toUpperCase:" - (as (Primitive "java.lang.String") value))) + (as (Nominal "java.lang.String") value))) @.jvm (as Text (.jvm_member_invoke_virtual# [] "java.lang.String" "toUpperCase" [] - (as (Primitive "java.lang.String") value))) + (as (Nominal "java.lang.String") value))) @.js (as Text ("js object do" "toUpperCase" value [])) diff --git a/stdlib/source/library/lux/data/text/buffer.lux b/stdlib/source/library/lux/data/text/buffer.lux index 17b603e3b..5b1bf4a6f 100644 --- a/stdlib/source/library/lux/data/text/buffer.lux +++ b/stdlib/source/library/lux/data/text/buffer.lux @@ -17,7 +17,7 @@ [meta ["@" target] [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] ["[0]" //]) (with_expansions [<jvm> (these (import java/lang/CharSequence @@ -49,7 +49,7 @@ ) (these)))) -(`` (primitive.def .public Buffer +(`` (nominal.def .public Buffer (for @.old [Nat (-> java/lang/StringBuilder java/lang/StringBuilder)] @.jvm [Nat (-> java/lang/StringBuilder java/lang/StringBuilder)] @.js [Nat (-> (JS_Array Text) (JS_Array Text))] diff --git a/stdlib/source/library/lux/data/text/encoding.lux b/stdlib/source/library/lux/data/text/encoding.lux index c4247a851..6ff9aeec0 100644 --- a/stdlib/source/library/lux/data/text/encoding.lux +++ b/stdlib/source/library/lux/data/text/encoding.lux @@ -5,10 +5,10 @@ [macro ["[0]" template]] [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) ... https://en.wikipedia.org/wiki/Character_encoding#Common_character_encodings -(primitive.def .public Encoding +(nominal.def .public Encoding Text (with_template [<name> <encoding>] diff --git a/stdlib/source/library/lux/data/text/unicode/block.lux b/stdlib/source/library/lux/data/text/unicode/block.lux index ea4fe8889..2ad6484b8 100644 --- a/stdlib/source/library/lux/data/text/unicode/block.lux +++ b/stdlib/source/library/lux/data/text/unicode/block.lux @@ -12,11 +12,11 @@ ["[0]" i64]]] [meta [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] [/// [char (.only Char)]]) -(primitive.def .public Block +(nominal.def .public Block (Interval Char) (def .public monoid diff --git a/stdlib/source/library/lux/data/text/unicode/set.lux b/stdlib/source/library/lux/data/text/unicode/set.lux index 19ab0a416..67704b82e 100644 --- a/stdlib/source/library/lux/data/text/unicode/set.lux +++ b/stdlib/source/library/lux/data/text/unicode/set.lux @@ -11,7 +11,7 @@ ["[1]" finger (.only Tree)]]]] [meta [type (.only by_example) - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] [// ["[0]" block (.only Block)] [// @@ -27,7 +27,7 @@ @)) -(primitive.def .public Set +(nominal.def .public Set (Tree :@: Block []) (def .public (composite left right) diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux index d132e6256..8be252760 100644 --- a/stdlib/source/library/lux/debug.lux +++ b/stdlib/source/library/lux/debug.lux @@ -82,7 +82,7 @@ @.python (these (.type PyType - (Primitive "python_type")) + (Nominal "python_type")) (import (type [.Any] PyType)) (import (str [.Any] ffi.String))) diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux index e5f23e1ef..882726779 100644 --- a/stdlib/source/library/lux/documentation.lux +++ b/stdlib/source/library/lux/documentation.lux @@ -45,7 +45,7 @@ (def |recursion_dummy| (template (_) - [{.#Primitive "" {.#End}}])) + [{.#Nominal "" {.#End}}])) (.type Fragment (Variant @@ -233,13 +233,13 @@ (-> Nat Text Bit Text Type Text) (when type - {.#Primitive name params} + {.#Nominal name params} (|> params (list#each (|>> (%type' level type_function_name false module) (format " "))) {.#Item (%.text name)} text.together - (text.enclosed ["(Primitive " ")"])) + (text.enclosed ["(Nominal " ")"])) {.#Sum _} (|> type @@ -339,13 +339,13 @@ _ (when type - {.#Primitive name params} + {.#Nominal name params} (when params {.#End} - (format "(Primitive " (%.text name) ")") + (format "(Nominal " (%.text name) ")") _ - (format "(Primitive " (%.text name) " " (|> params (list#each (type_definition' false level arity type_function_info {.#None} module)) (text.interposed " ")) ")")) + (format "(Nominal " (%.text name) " " (|> params (list#each (type_definition' false level arity type_function_info {.#None} module)) (text.interposed " ")) ")")) {.#Sum _} (let [members (type.flat_variant type)] @@ -503,7 +503,10 @@ (macro.with_symbols [g!type] (in (list (` (all md.then ... Name - (<| (md.heading/3) + (<| md.heading/4 + (md.and (md.anchor (, (let [[module short] name] + (code.text (format module ":" short)))))) + md.text (, (code.text (%.code (let [g!name (|> name product.right code.local)] (when parameters {.#End} @@ -603,12 +606,16 @@ ..#documentation (,* documentation)]}))] ((, g!_) [])))))))))) +(def (definition#< left right) + (-> Definition Definition + Bit) + (text#< (symbol.short (the #global right)) + (symbol.short (the #global left)))) + (def definitions_documentation (-> (List Definition) (Markdown Block)) - (|>> (list.sorted (function (_ left right) - (text#< (symbol.short (the #global right)) - (symbol.short (the #global left))))) + (|>> (list.sorted ..definition#<) (list#each (the #documentation)) (list#mix md.then md.empty))) @@ -657,12 +664,13 @@ (if (set.empty? it) md.empty (all md.then - (md.heading/2 heading) + (md.heading/3 (md.text heading)) (|> (set.list it) (list.only (|>> (text#= descriptor.runtime) not)) (list.sorted text#<) (list#each (function (_ it) - [(md.text it) {.#None}])) + [(md.link (md.text it) (%.format "#" it)) + {.#None}])) md.bullet_list) ))) @@ -673,7 +681,8 @@ (let [(open "_[0]") module] (all md.then ... Name - (md.heading/1 (the #module module)) + (md.heading/2 (md.and (md.anchor (the #module module)) + (md.text (the #module module)))) ... Description (when (the #description module) @@ -686,7 +695,7 @@ (dependencies "Dependers" (|> (dictionary.value (the #module module) dependers) (maybe.else (set.empty text.hash)))) - (md.heading/2 "Definitions") + (md.heading/3 (md.text "Definitions")) (|> definitions (list.only (|>> (the #global) symbol.short @@ -704,7 +713,7 @@ missing (all md.then - (md.heading/2 "Missing documentation") + (md.heading/3 (md.text "Missing documentation")) (..listing missing))) ... Un-expected documentation @@ -720,7 +729,7 @@ un_expected (all md.then - (md.heading/2 "Un-expected documentation") + (md.heading/3 (md.text "Un-expected documentation")) (..listing un_expected))) ))) @@ -735,6 +744,25 @@ (set.list (the #dependees module)))) (dictionary.empty text.hash))) +(def index + (-> (List [Module (List Definition)]) + (Markdown Block)) + (|>> (list#each (function (_ [module defs]) + (all md.then + (md.heading/5 (let [it (the #module module)] + (md.link (md.text it) (%.format "#" it)))) + (|> defs + (list.sorted ..definition#<) + (list#each (function (_ it) + (let [[module short] (the #global it)] + [(md.link (md.text short) (%.format "#" module ":" short)) + {.#None}]))) + md.bullet_list) + ))) + (list#mix (function (_ right left) + (md.then left right)) + (md.heading/1 (md.text "Index"))))) + (def .public (markdown it) (-> (List Documentation) Text) @@ -759,13 +787,18 @@ dictionary.entries (list#each (function (_ [name [module definitons]]) [name module])) - ..dependers)] - (|> with_definitions - dictionary.values - (list.sorted (function (_ left right) - (text#< (the #module (product.left right)) - (the #module (product.left left))))) - (list#each (..module_documentation dependers)) - (list.interposed md.horizontal_rule) - (list#mix md.then (is (Markdown Block) md.empty)) - md.markdown))) + ..dependers) + it (|> with_definitions + dictionary.values + (list.sorted (function (_ left right) + (text#< (the #module (product.left right)) + (the #module (product.left left))))))] + (md.markdown + (all md.then + (index it) + (md.heading/1 (md.text "Documentation")) + (|> it + (list#each (..module_documentation dependers)) + (list.interposed md.horizontal_rule) + (list#mix md.then (is (Markdown Block) md.empty))) + )))) diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux index 551afd5c0..5684fb32a 100644 --- a/stdlib/source/library/lux/ffi.jvm.lux +++ b/stdlib/source/library/lux/ffi.jvm.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Primitive Type Declaration Double int char is as type) + [lux (.except Type Declaration Double int char is as type) [abstract ["[0]" monad (.only do)]] [control @@ -61,7 +61,7 @@ (with_template [<name> <class>] [(`` (def .public <name> .Type - {.#Primitive <class> {.#End}}))] + {.#Nominal <class> {.#End}}))] [Boolean box.boolean] [Byte box.byte] @@ -77,7 +77,7 @@ (with_template [<name> <class>] [(`` (def .public <name> .Type - {.#Primitive (reflection.reflection <class>) {.#End}}))] + {.#Nominal (reflection.reflection <class>) {.#End}}))] ... Primitives [boolean reflection.boolean] @@ -118,9 +118,9 @@ (-> (Type Value) Text Code Code) (let [unboxed (..reflection unboxed)] (` (|> (, raw) - (.is (.Primitive (, (code.text <pre>)))) + (.is (.Nominal (, (code.text <pre>)))) .jvm_object_cast# - (.is (.Primitive (, (code.text <post>))))))))] + (.is (.Nominal (, (code.text <post>))))))))] [unbox boxed unboxed] [box unboxed boxed] @@ -212,7 +212,7 @@ {#Interface})) (.type StackFrame - (.Primitive "java/lang/StackTraceElement")) + (.Nominal "java/lang/StackTraceElement")) (.type StackTrace (array.Array StackFrame)) @@ -379,12 +379,12 @@ [parser.lower? _ (` .Any)] [parser.upper? limit (parameter_type value_type limit)] [parser.class? [name parameters] - (` (.Primitive (, (code.text name)) - [(,* (list#each (parameter_type value_type) parameters))]))] + (` (.Nominal (, (code.text name)) + [(,* (list#each (parameter_type value_type) parameters))]))] [parser.array? elementT (when (parser.primitive? elementT) {.#Some elementT} - (` {.#Primitive (, (code.text (..reflection (jvm.array elementT)))) {.#End}}) + (` {.#Nominal (, (code.text (..reflection (jvm.array elementT)))) {.#End}}) {.#None} (` (array.Array (, (value_type elementT)))))])) @@ -1411,7 +1411,7 @@ (in (list (` (.jvm_object_null#)))))) (def .public (null? obj) - (-> (.Primitive "java.lang.Object") Bit) + (-> (.Nominal "java.lang.Object") Bit) (.jvm_object_null?# obj)) (def .public ??? @@ -1437,7 +1437,7 @@ unchecked (<>.maybe <code>.any)]) (with_symbols [g!_ g!unchecked] (let [class_name (..reflection class) - class_type (` (.Primitive (, (code.text class_name)))) + class_type (` (.Nominal (, (code.text class_name)))) check_type (` (.Maybe (, class_type))) check_code (` (if (.jvm_object_instance?# (, (code.text class_name)) (, g!unchecked)) {.#Some (.as (, class_type) @@ -1450,7 +1450,7 @@ (, check_code)))))) {.#None} - (in (list (` (.is (-> (.Primitive "java.lang.Object") (, check_type)) + (in (list (` (.is (-> (.Nominal "java.lang.Object") (, check_type)) (function ((, g!_) (, g!unchecked)) (, check_code)))))) ))))) @@ -1477,8 +1477,8 @@ (` (def (, (code.symbol ["" def_name])) .Type (All ((, (' g!_)) (,* params')) - (.Primitive (, (code.text full_name)) - [(,* params')]))))))) + (.Nominal (, (code.text full_name)) + [(,* params')]))))))) (def (member_type_vars class_tvars member) (-> (List (Type Var)) Import_Member_Declaration (List (Type Var))) @@ -1536,7 +1536,7 @@ ... else (let [g!temp (` ((,' ,') (, (code.symbol ["" " Ω "]))))] (` (let [(, g!temp) (, return_term)] - (if (not (..null? (.as (.Primitive "java.lang.Object") + (if (not (..null? (.as (.Nominal "java.lang.Object") (, g!temp)))) (, g!temp) (panic! "Cannot produce null references from method calls.")))))) @@ -1599,23 +1599,23 @@ (` (.|> (, unboxed/boxed) (,* post))))))] [#1 with_automatic_input_conversion ..unbox - [[jvm.boolean (list (` (.as (.Primitive (, (code.text box.boolean)))))) []] - [jvm.byte (list (` (.as (.Primitive (, (code.text box.byte)))))) []] - [jvm.short (list (` (.as (.Primitive (, (code.text box.short)))))) []] - [jvm.int (list (` (.is (.Primitive (, (code.text box.int)))))) []] - [jvm.long (list (` (.as (.Primitive (, (code.text box.long)))))) []] - [jvm.char (list (` (.as (.Primitive (, (code.text box.char)))))) []] - [jvm.float (list (` (.as (.Primitive (, (code.text box.float)))))) []] - [jvm.double (list (` (.as (.Primitive (, (code.text box.double)))))) []]]] + [[jvm.boolean (list (` (.as (.Nominal (, (code.text box.boolean)))))) []] + [jvm.byte (list (` (.as (.Nominal (, (code.text box.byte)))))) []] + [jvm.short (list (` (.as (.Nominal (, (code.text box.short)))))) []] + [jvm.int (list (` (.is (.Nominal (, (code.text box.int)))))) []] + [jvm.long (list (` (.as (.Nominal (, (code.text box.long)))))) []] + [jvm.char (list (` (.as (.Nominal (, (code.text box.char)))))) []] + [jvm.float (list (` (.as (.Nominal (, (code.text box.float)))))) []] + [jvm.double (list (` (.as (.Nominal (, (code.text box.double)))))) []]]] [#0 with_automatic_output_conversion ..box - [[jvm.boolean (list) [(` (.is (.Primitive (, (code.text box.boolean)))))]] - [jvm.byte (list) [(` (.is (.Primitive (, (code.text box.byte)))))]] - [jvm.short (list) [(` (.is (.Primitive (, (code.text box.short)))))]] - [jvm.int (list) [(` (.is (.Primitive (, (code.text box.int)))))]] - [jvm.long (list) [(` (.is (.Primitive (, (code.text box.long)))))]] - [jvm.char (list) [(` (.is (.Primitive (, (code.text box.char)))))]] - [jvm.float (list) [(` (.is (.Primitive (, (code.text box.float)))))]] - [jvm.double (list) [(` (.is (.Primitive (, (code.text box.double)))))]]]] + [[jvm.boolean (list) [(` (.is (.Nominal (, (code.text box.boolean)))))]] + [jvm.byte (list) [(` (.is (.Nominal (, (code.text box.byte)))))]] + [jvm.short (list) [(` (.is (.Nominal (, (code.text box.short)))))]] + [jvm.int (list) [(` (.is (.Nominal (, (code.text box.int)))))]] + [jvm.long (list) [(` (.is (.Nominal (, (code.text box.long)))))]] + [jvm.char (list) [(` (.is (.Nominal (, (code.text box.char)))))]] + [jvm.float (list) [(` (.is (.Nominal (, (code.text box.float)))))]] + [jvm.double (list) [(` (.is (.Nominal (, (code.text box.double)))))]]]] ) (def (un_quoted quoted) @@ -1628,7 +1628,7 @@ (list.zipped_2 classes) (list#each (function (_ [class [maybe? input]]) (|> (if maybe? - (` (.is (.Primitive (, (code.text (..reflection class)))) + (` (.is (.Nominal (, (code.text (..reflection class)))) (!!! (, (..un_quoted input))))) (..un_quoted input)) [class] @@ -1662,12 +1662,12 @@ [.let [enum_type (.is Code (when class_tvars {.#End} - (` (.Primitive (, (code.text full_name)))) + (` (.Nominal (, (code.text full_name)))) _ (let [=class_tvars (list#each ..var$' class_tvars)] (` (All ((, g!_) (,* =class_tvars)) - (.Primitive (, (code.text full_name)) [(,* =class_tvars)])))))) + (.Nominal (, (code.text full_name)) [(,* =class_tvars)])))))) getter_interop (.is (-> Text Code) (function (_ name) (let [getter_name (code.symbol ["" (..import_name import_format method_prefix name)])] @@ -1817,15 +1817,15 @@ (member_def_interop vars kind class =args member method_prefix import_format)))) (def interface? - (All (_ a) (-> (.Primitive "java.lang.Class" [a]) Bit)) + (All (_ a) (-> (.Nominal "java.lang.Class" [a]) Bit)) (|>> (.jvm_member_invoke_virtual# [] "java.lang.Class" "isInterface" []) .jvm_object_cast# (.is ..Boolean) (.as Bit))) (def load_class - (-> External (Try (.Primitive "java.lang.Class" [Any]))) - (|>> (.as (.Primitive "java.lang.String")) + (-> External (Try (.Nominal "java.lang.Class" [Any]))) + (|>> (.as (.Nominal "java.lang.String")) ["Ljava/lang/String;"] (.jvm_member_invoke_static# [] "java.lang.Class" "forName" []) try)) @@ -1859,7 +1859,7 @@ size <code>.any]) (let [g!size (` (|> (, size) (.is .Nat) - (.as (.Primitive (, (code.text box.long)))) + (.as (.Nominal (, (code.text box.long)))) .jvm_object_cast# .jvm_conversion_long_to_int#))] (`` (cond (,, (with_template [<primitive> <array_op>] @@ -1890,7 +1890,7 @@ (if (type#= .Any type) (at meta.monad in $Object) (when type - {.#Primitive name params} + {.#Nominal name params} (`` (cond (,, (with_template [<type>] [(text#= (..reflection <type>) name) (when params @@ -1927,7 +1927,7 @@ [jvm.double] [jvm.char])) - (text#= array.primitive name) + (text#= array.nominal name) (when params {.#Item {.#Apply writeLT {.#Apply readLT _Mutable}} {.#End}} (at meta.monad each jvm.array @@ -1941,7 +1941,7 @@ {.#End} (let [[_ unprefixed] (maybe.trusted (text.split_by descriptor.array_prefix name))] (at meta.monad each jvm.array - (lux_type->jvm_type context {.#Primitive unprefixed (list)}))) + (lux_type->jvm_type context {.#Nominal unprefixed (list)}))) _ <failure>) @@ -2011,7 +2011,7 @@ (in (list (` (.|> ((, g!extension) (, array)) .jvm_conversion_int_to_long# .jvm_object_cast# - (.is (.Primitive (, (code.text box.long)))) + (.is (.Nominal (, (code.text box.long)))) (.as .Nat)))))) _ @@ -2030,7 +2030,7 @@ array_jvm_type (lux_type->jvm_type context array_type) .let [g!idx (` (.|> (, idx) (.is .Nat) - (.as (.Primitive (, (code.text box.long)))) + (.as (.Nominal (, (code.text box.long)))) .jvm_object_cast# .jvm_conversion_long_to_int#))]] (`` (cond (,, (with_template [<primitive> <extension> <box>] @@ -2039,7 +2039,7 @@ array_jvm_type) (in (list (` (.|> (<extension> (, g!idx) (, array)) .jvm_object_cast# - (.is (.Primitive (, (code.text <box>))))))))] + (.is (.Nominal (, (code.text <box>))))))))] [jvm.boolean .jvm_array_read_boolean# box.boolean] [jvm.byte .jvm_array_read_byte# box.byte] @@ -2070,7 +2070,7 @@ array_jvm_type (lux_type->jvm_type context array_type) .let [g!idx (` (.|> (, idx) (.is .Nat) - (.as (.Primitive (, (code.text box.long)))) + (.as (.Nominal (, (code.text box.long)))) .jvm_object_cast# .jvm_conversion_long_to_int#))]] (`` (cond (,, (with_template [<primitive> <extension> <box>] @@ -2078,7 +2078,7 @@ (jvm.array <primitive>) array_jvm_type) (let [g!value (` (.|> (, value) - (.as (.Primitive (, (code.text <box>)))) + (.as (.Nominal (, (code.text <box>)))) .jvm_object_cast#))] (in (list (` (<extension> (, g!idx) (, g!value) (, array))))))] diff --git a/stdlib/source/library/lux/ffi.lux b/stdlib/source/library/lux/ffi.lux index e4d0878a5..fee15e46d 100644 --- a/stdlib/source/library/lux/ffi.lux +++ b/stdlib/source/library/lux/ffi.lux @@ -21,7 +21,7 @@ [syntax (.only syntax)] ["[0]" template]] [type - ["[0]" primitive (.except #name def)]] + ["[0]" nominal (.except #name def)]] ["@" target (.only) ["[0]" js]]]]]) @@ -217,7 +217,7 @@ @.python .python_function# @.lua "lua function" (these))] - (primitive.def .public (Object brand) Any) + (nominal.def .public (Object brand) Any) (with_expansions [<un_common> (for @.js (these [Symbol] [Null] @@ -230,7 +230,7 @@ <un_common> <un_common>] (with_template [<name>] [(with_expansions [<brand> (template.symbol [<name> "'"])] - (primitive.def <brand> + (nominal.def <brand> Any (type .public <name> @@ -792,8 +792,8 @@ declaration (` ((, (code.local (maybe.else class_name alias))) (,* g!class_variables)))] (in (list.partial (` (.type (, declaration) - (..Object (.Primitive (, (code.text (..host_path class_name))) - [(,* g!class_variables)])))) + (..Object (.Nominal (, (code.text (..host_path class_name))) + [(,* g!class_variables)])))) (list#each (.function (_ member) (`` (`` (when member (,, (for @.lua (,, (these)) diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux index d1922147b..ad7072f9c 100644 --- a/stdlib/source/library/lux/ffi.old.lux +++ b/stdlib/source/library/lux/ffi.old.lux @@ -29,7 +29,7 @@ (with_template [<name> <op> <from> <to>] [(def .public (<name> value) - (-> (Primitive <from>) (Primitive <to>)) + (-> (Nominal <from>) (Nominal <to>)) (<op> value))] [byte_to_long "jvm convert byte-to-long" "java.lang.Byte" "java.lang.Long"] @@ -66,11 +66,11 @@ (with_template [<forward> <from> <to> <backward>] [(def .public <forward> (template (<forward> it) - [(|> it (.is <from>) (.as (Primitive <to>)))])) + [(|> it (.is <from>) (.as (Nominal <to>)))])) (def .public <backward> (template (<backward> it) - [(|> it (.is (Primitive <to>)) (.as <from>))]))] + [(|> it (.is (Nominal <to>)) (.as <from>))]))] [as_boolean .Bit "java.lang.Boolean" of_boolean] [as_long .Int "java.lang.Long" of_long] @@ -81,11 +81,11 @@ (with_template [<forward> <from> <$> <mid> <$'> <to> <backward>] [(def .public <forward> (template (<forward> it) - [(|> it (.is <from>) (.as (Primitive <mid>)) <$> (.is (Primitive <to>)))])) + [(|> it (.is <from>) (.as (Nominal <mid>)) <$> (.is (Nominal <to>)))])) (def .public <backward> (template (<backward> it) - [(|> it (.is (Primitive <to>)) <$'> (.is (Primitive <mid>)) (.as <from>))]))] + [(|> it (.is (Nominal <to>)) <$'> (.is (Nominal <mid>)) (.as <from>))]))] [as_byte .Int ..long_to_byte "java.lang.Long" ..byte_to_long "java.lang.Byte" of_byte] [as_short .Int ..long_to_short "java.lang.Long" ..short_to_long "java.lang.Short" of_short] @@ -152,7 +152,7 @@ #class_params (List Type_Parameter)])) (.type StackFrame - (Primitive "java/lang/StackTraceElement")) + (Nominal "java/lang/StackTraceElement")) (.type StackTrace (Array StackFrame)) @@ -288,14 +288,14 @@ (^.with_template [<prim> <type>] [<prim> {.#Some (' <type>)}]) - (["boolean" (Primitive "java.lang.Boolean")] - ["byte" (Primitive "java.lang.Byte")] - ["short" (Primitive "java.lang.Short")] - ["int" (Primitive "java.lang.Integer")] - ["long" (Primitive "java.lang.Long")] - ["float" (Primitive "java.lang.Float")] - ["double" (Primitive "java.lang.Double")] - ["char" (Primitive "java.lang.Character")] + (["boolean" (Nominal "java.lang.Boolean")] + ["byte" (Nominal "java.lang.Byte")] + ["short" (Nominal "java.lang.Short")] + ["int" (Nominal "java.lang.Integer")] + ["long" (Nominal "java.lang.Long")] + ["float" (Nominal "java.lang.Float")] + ["double" (Nominal "java.lang.Double")] + ["char" (Nominal "java.lang.Character")] ["void" .Any]) _ @@ -342,7 +342,7 @@ [[name params] _ _] (let [name (safe name) =params (list#each (class_type' mode type_params in_array?) params)] - (` (Primitive (, (code.text name)) [(,* =params)]))))) + (` (Nominal (, (code.text name)) [(,* =params)]))))) (def (class_type' mode type_params in_array? class) (-> Primitive_Mode (List Type_Parameter) Bit GenericType Code) @@ -393,8 +393,8 @@ {.#Item bound1 _} (class_type {#ManualPrM} #class_params bound1)))) #class_params)] - (` (Primitive (, (code.text (safe #class_name))) - [(,* =params)])))) + (` (Nominal (, (code.text (safe #class_name))) + [(,* =params)])))) (def type_var_class Text "java.lang.Object") @@ -1025,7 +1025,7 @@ (format "(" (safe name) " " (spaced (list#each generic_type$ params)) ")") {#GenericArray param} - (format "(" array.primitive " " (generic_type$ param) ")") + (format "(" array.nominal " " (generic_type$ param) ")") {#GenericWildcard {.#None}} "?" @@ -1266,7 +1266,7 @@ (in (list (` ("jvm object null")))))) (def .public (null? obj) - (-> (Primitive "java.lang.Object") Bit) + (-> (Nominal "java.lang.Object") Bit) ("jvm object null?" obj)) (def .public ??? @@ -1292,7 +1292,7 @@ unchecked (<>.maybe <code>.any)]) (with_symbols [g!_ g!unchecked] (let [class_name (simple_class$ (list) class) - class_type (` (.Primitive (, (code.text class_name)))) + class_type (` (.Nominal (, (code.text class_name)))) check_type (` (.Maybe (, class_type))) check_code (` (if ((, (code.text (format "jvm instanceof" ":" class_name))) (, g!unchecked)) {.#Some (.as (, class_type) @@ -1305,7 +1305,7 @@ (, check_code)))))) {.#None} - (in (list (` (.is (-> (Primitive "java.lang.Object") (, check_type)) + (in (list (` (.is (-> (Nominal "java.lang.Object") (, check_type)) (function ((, g!_) (, g!unchecked)) (, check_code)))))) ))))) @@ -1330,8 +1330,8 @@ (` (def (, (code.symbol ["" full_name])) Type (All ((, (' g!_)) (,* params')) - (Primitive (, (code.text (safe full_name))) - [(,* params')]))))))) + (Nominal (, (code.text (safe full_name))) + [(,* params')]))))))) (def (member_type_vars class_tvars member) (-> (List Type_Parameter) Import_Member_Declaration (List Type_Parameter)) @@ -1385,7 +1385,7 @@ (` (??? (, return_term))) (let [g!temp (` ((,' ,') (, (code.symbol ["" " Ω "]))))] (` (let [(, g!temp) (, return_term)] - (if (not (..null? (.as (Primitive "java.lang.Object") + (if (not (..null? (.as (Nominal "java.lang.Object") (, g!temp)))) (, g!temp) (panic! (, (code.text (format "Cannot produce null references from method calls @ " @@ -1478,13 +1478,13 @@ [.let [enum_type (.is Code (when class_tvars {.#End} - (` (Primitive (, (code.text full_name)))) + (` (Nominal (, (code.text full_name)))) _ (let [=class_tvars (|> class_tvars (list.only free_type_param?) (list#each lux_type_parameter))] - (` (All ((, g!_) (,* =class_tvars)) (Primitive (, (code.text full_name)) [(,* =class_tvars)])))))) + (` (All ((, g!_) (,* =class_tvars)) (Nominal (, (code.text full_name)) [(,* =class_tvars)])))))) getter_interop (.is (-> Text Code) (function (_ name) (let [getter_name (code.symbol ["" (..import_name import_format method_prefix name)])] @@ -1608,7 +1608,7 @@ (member_def_interop type_params kind class =args member method_prefix import_format)))) (.type (java/lang/Class a) - (Primitive "java.lang.Class" [a])) + (Nominal "java.lang.Class" [a])) (def interface? (All (_ a) (-> (java/lang/Class a) Bit)) @@ -1670,7 +1670,7 @@ (if (type#= Any type) (at meta.monad in "java.lang.Object") (when type - {.#Primitive name params} + {.#Nominal name params} (at meta.monad in name) {.#Apply A F} diff --git a/stdlib/source/library/lux/ffi.php.lux b/stdlib/source/library/lux/ffi.php.lux index 4f31625f0..857633539 100644 --- a/stdlib/source/library/lux/ffi.php.lux +++ b/stdlib/source/library/lux/ffi.php.lux @@ -16,18 +16,18 @@ ["[0]" meta (.only) ["@" target] [type - ["[0]" primitive (.except def)]] + ["[0]" nominal (.except def)]] ["[0]" code (.only) ["<[1]>" \\parser (.only Parser)]] [macro (.only with_symbols) [syntax (.only syntax)] ["[0]" template]]]]]) -(primitive.def .public (Object brand) Any) +(nominal.def .public (Object brand) Any) (with_template [<name>] [(with_expansions [<brand> (template.symbol [<name> "'"])] - (primitive.def .public <brand> Any) + (nominal.def .public <brand> Any) (type .public <name> (..Object <brand>)))] @@ -242,7 +242,7 @@ g!type (code.local (maybe.else class alias)) class_import (` ("php constant" (, (code.text class))))] (in (list.partial (` (type (, g!type) - (..Object (Primitive (, (code.text class)))))) + (..Object (Nominal (, (code.text class)))))) (list#each (function (_ member) (when member {#Field [static? field alias fieldT]} diff --git a/stdlib/source/library/lux/ffi.scm.lux b/stdlib/source/library/lux/ffi.scm.lux index b7169f1e4..92184bb5a 100644 --- a/stdlib/source/library/lux/ffi.scm.lux +++ b/stdlib/source/library/lux/ffi.scm.lux @@ -16,18 +16,18 @@ ["[0]" meta (.only) ["@" target] [type - ["[0]" primitive (.except def)]] + ["[0]" nominal (.except def)]] ["[0]" code (.only) ["<[1]>" \\parser (.only Parser)]] [macro (.only with_symbols) [syntax (.only syntax)] ["[0]" template]]]]]) -(primitive.def .public (Object brand) Any) +(nominal.def .public (Object brand) Any) (with_template [<name>] [(with_expansions [<brand> (template.symbol [<name> "'"])] - (primitive.def .public <brand> Any) + (nominal.def .public <brand> Any) (type .public <name> (..Object <brand>)))] diff --git a/stdlib/source/library/lux/math/modular.lux b/stdlib/source/library/lux/math/modular.lux index 6f66a7e79..e037e5c8c 100644 --- a/stdlib/source/library/lux/math/modular.lux +++ b/stdlib/source/library/lux/math/modular.lux @@ -22,11 +22,11 @@ ["[0]" code (.only) ["<[1]>" \\parser]] [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] ["[0]" // ["[1]" modulus (.only Modulus)]]) -(primitive.def .public (Mod m) +(nominal.def .public (Mod m) (Record [#modulus (Modulus m) #value Int]) diff --git a/stdlib/source/library/lux/math/modulus.lux b/stdlib/source/library/lux/math/modulus.lux index ed7e5eb59..ec9254d5c 100644 --- a/stdlib/source/library/lux/math/modulus.lux +++ b/stdlib/source/library/lux/math/modulus.lux @@ -15,11 +15,11 @@ [macro [syntax (.only syntax)]] [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) (exception.def .public zero_cannot_be_a_modulus) -(primitive.def .public (Modulus %) +(nominal.def .public (Modulus %) Int (def .public (modulus value) diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux index 916fa95f7..afa38b160 100644 --- a/stdlib/source/library/lux/math/number/frac.lux +++ b/stdlib/source/library/lux/math/number/frac.lux @@ -65,14 +65,14 @@ (these (def !double (template (_ value) [(|> value - (as (Primitive "java.lang.Double")) + (as (Nominal "java.lang.Double")) .jvm_object_cast#)])) (def !frac (template (_ value) [(|> value .jvm_object_cast# - (is (Primitive "java.lang.Double")) + (is (Nominal "java.lang.Double")) (as Frac))])) (with_template [<name> <method>] diff --git a/stdlib/source/library/lux/math/number/i32.lux b/stdlib/source/library/lux/math/number/i32.lux index 3d7acc842..af4d6d592 100644 --- a/stdlib/source/library/lux/math/number/i32.lux +++ b/stdlib/source/library/lux/math/number/i32.lux @@ -12,7 +12,7 @@ (def sub ... TODO: Stop needing this coercion. - (as (Sub (I64 (Primitive "#I32"))) + (as (Sub (I64 (Nominal "#I32"))) (maybe.trusted (i64.sub 32)))) (def .public I32 diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux index fc31b8659..8c51327ee 100644 --- a/stdlib/source/library/lux/meta.lux +++ b/stdlib/source/library/lux/meta.lux @@ -142,7 +142,7 @@ (-> Type Bit) (when type {.#Named [.prelude "Macro"] - {.#Primitive "#Macro" {.#End}}} + {.#Nominal "#Macro" {.#End}}} true _ diff --git a/stdlib/source/library/lux/meta/compiler/default/platform.lux b/stdlib/source/library/lux/meta/compiler/default/platform.lux index 0f95c121a..4dad1b450 100644 --- a/stdlib/source/library/lux/meta/compiler/default/platform.lux +++ b/stdlib/source/library/lux/meta/compiler/default/platform.lux @@ -719,11 +719,11 @@ (for @.old (these (def Fake_State Type - {.#Primitive (%.nat (static.random_nat)) (list)}) + {.#Nominal (%.nat (static.random_nat)) (list)}) (def Fake_Document Type - {.#Primitive (%.nat (static.random_nat)) (list)})) + {.#Nominal (%.nat (static.random_nat)) (list)})) (these)) (def (serial_compiler import context platform compilation_sources configuration compiler) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/inference.lux b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/inference.lux index cd36aa83f..db6182d7e 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/inference.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/inference.lux @@ -58,8 +58,8 @@ (def .public (quantified @var @parameter :it:) (-> check.Var Nat Type Type) (when :it: - {.#Primitive name co_variant} - {.#Primitive name (list#each (quantified @var @parameter) co_variant)} + {.#Nominal name co_variant} + {.#Nominal name (list#each (quantified @var @parameter) co_variant)} (^.with_template [<tag>] [{<tag> left right} @@ -194,7 +194,7 @@ (function (again it) (when it (^.or {.#Parameter index} - {.#Apply {.#Primitive "" {.#End}} + {.#Apply {.#Nominal "" {.#End}} {.#Parameter index}}) (if (n.= @self index) recursion @@ -211,8 +211,8 @@ (with_recursion (n.+ 2 @self) recursion quantified)}]) ([.#UnivQ] [.#ExQ]) - {.#Primitive name parameters} - {.#Primitive name (list#each again parameters)} + {.#Nominal name parameters} + {.#Nominal name (list#each again parameters)} _ it))) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/type.lux b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/type.lux index ddb530480..f14a75e91 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/type.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/type.lux @@ -40,7 +40,7 @@ (def .public (existential? type) (-> Type Bit) (when type - {.#Primitive actual {.#End}} + {.#Nominal actual {.#End}} (text.starts_with? ..prefix actual) _ @@ -48,7 +48,7 @@ (def (existential' module id) (-> Text Nat Type) - {.#Primitive (format ..prefix module "#" (%.nat id)) (list)}) + {.#Nominal (format ..prefix module "#" (%.nat id)) (list)}) (def .public existential (Operation Type) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux index 86f8c8a90..a9f5b9726 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Type Module Primitive Analysis Declaration Double #Default char int type) + [lux (.except Type Module Analysis Declaration Double #Default char int type) ["[0]" ffi (.only import)] [abstract ["[0]" monad (.only do)]] @@ -203,7 +203,7 @@ (with_template [<name> <class>] [(def .public <name> .Type - {.#Primitive <class> {.#End}})] + {.#Nominal <class> {.#End}})] ... Boxes [Boolean box.boolean] @@ -385,7 +385,7 @@ (def lux_array_type (template (_ :read: :write:) - [{.#Primitive array.primitive (list {.#Apply :write: {.#Apply :read: _Mutable}})}])) + [{.#Nominal array.nominal (list {.#Apply :write: {.#Apply :read: _Mutable}})}])) (def (jvm_type luxT) (-> .Type (Operation (Type Value))) @@ -404,7 +404,7 @@ (lux_array_type elemT _) (phase#each jvm.array (jvm_type elemT)) - {.#Primitive class parametersT} + {.#Nominal class parametersT} (when (dictionary.value class ..boxes) {.#Some [_ primitive_type]} (when parametersT @@ -455,9 +455,9 @@ (function (_ extension_name analyse archive [arrayC]) (do phase.monad [_ (typeA.inference ..int) - arrayA (<| (typeA.expecting {.#Primitive (|> (jvm.array primitive_type) - ..reflection) - (list)}) + arrayA (<| (typeA.expecting {.#Nominal (|> (jvm.array primitive_type) + ..reflection) + (list)}) (analyse archive arrayC)) @ meta.location] (in [@ {/////analysis.#Extension [.prelude (%.format extension_name "|translation")] @@ -492,8 +492,8 @@ (do phase.monad [lengthA (<| (typeA.expecting ..int) (analyse archive lengthC)) - _ (typeA.inference {.#Primitive (|> (jvm.array primitive_type) ..reflection) - (list)}) + _ (typeA.inference {.#Nominal (|> (jvm.array primitive_type) ..reflection) + (list)}) @ meta.location] (in [@ {/////analysis.#Extension [.prelude (%.format extension_name "|translation")] (list lengthA)}])))])) @@ -525,7 +525,7 @@ (lux_array_type elementT _) (/////analysis.except ..non_parameter objectT) - {.#Primitive name parameters} + {.#Nominal name parameters} (`` (cond (or (,, (with_template [<type>] [(text#= (..reflection <type>) name)] @@ -583,7 +583,7 @@ (def (check_jvm objectT) (-> .Type (Operation (Type Value))) (when objectT - {.#Primitive name {.#End}} + {.#Nominal name {.#End}} (`` (cond (,, (with_template [<type>] [(text#= (..reflection <type>) name) (phase#in <type>)] @@ -613,7 +613,7 @@ (text.starts_with? descriptor.array_prefix name) (let [[_ unprefixed] (maybe.trusted (text.split_by descriptor.array_prefix name))] (at phase.monad each jvm.array - (check_jvm {.#Primitive unprefixed (list)}))) + (check_jvm {.#Nominal unprefixed (list)}))) ... else (phase#in (jvm.class name (list))))) @@ -623,7 +623,7 @@ check_jvm (phase#each jvm.array)) - {.#Primitive name parameters} + {.#Nominal name parameters} (do [! phase.monad] [parameters (monad.each ! check_parameter parameters)] (phase#in (jvm.class name parameters))) @@ -690,8 +690,8 @@ [_ (typeA.inference lux_type) idxA (<| (typeA.expecting ..int) (analyse archive idxC)) - arrayA (<| (typeA.expecting {.#Primitive (|> (jvm.array jvm_type) ..reflection) - (list)}) + arrayA (<| (typeA.expecting {.#Nominal (|> (jvm.array jvm_type) ..reflection) + (list)}) (analyse archive arrayC)) @ meta.location] (in [@ {/////analysis.#Extension [.prelude (%.format extension_name "|translation")] @@ -723,8 +723,8 @@ (def (write_primitive_array_handler lux_type jvm_type) (-> .Type (Type Primitive) (-> Text Handler)) - (let [array_type {.#Primitive (|> (jvm.array jvm_type) ..reflection) - (list)}] + (let [array_type {.#Nominal (|> (jvm.array jvm_type) ..reflection) + (list)}] (..custom [(all <>.and <code>.any <code>.any <code>.any) (function (_ extension_name analyse archive [idxC valueC arrayC]) @@ -879,7 +879,7 @@ (function (_ extension_name analyse archive [class]) (do phase.monad [_ (..ensure_fresh_class! class_loader class) - _ (typeA.inference {.#Primitive "java.lang.Class" (list {.#Primitive class (list)})}) + _ (typeA.inference {.#Nominal "java.lang.Class" (list {.#Nominal class (list)})}) _ (phase.of_try (reflection!.load class_loader class)) @ meta.location] (in [@ {/////analysis.#Extension [.prelude (%.format extension_name "|translation")] @@ -1276,7 +1276,7 @@ inputsT _ - (list.partial {.#Primitive (java/lang/Class::getName owner) owner_tvarsT} + (list.partial {.#Nominal (java/lang/Class::getName owner) owner_tvarsT} inputsT))) outputT)]] (in [methodT @@ -1308,7 +1308,7 @@ (monad.each ! (|>> reflection!.type phase.of_try)) (phase#each (monad.each ! (reflection_type mapping))) phase#conjoint) - .let [objectT {.#Primitive (java/lang/Class::getName owner) owner_tvarsT} + .let [objectT {.#Nominal (java/lang/Class::getName owner) owner_tvarsT} constructorT (<| (type.univ_q (dictionary.size mapping)) (type.function inputsT) objectT)]] @@ -2672,7 +2672,7 @@ [where meta.current_module_name id meta.seed] (in (..anonymous_class_name where id))) - .let [selfT {.#Primitive self_name (list)}] + .let [selfT {.#Nominal self_name (list)}] mock (<| phase.of_try (..mock [self_name parameters] super_class diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux index bd02f425d..edb4a9d3d 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Type Definition Primitive Analysis Synthesis Declaration) + [lux (.except Type Definition Analysis Synthesis Declaration) ["[0]" ffi (.only import)] [abstract ["[0]" monad (.only do)]] @@ -893,7 +893,7 @@ (dictionary.has (parser.name parameterJ) parameterT mapping)) luxT.fresh parameters) - selfT {.#Primitive name (list#each product.right parameters)}] + selfT {.#Nominal name (list#each product.right parameters)}] state phase.state methods (monad.each ! (let [analysis_state (the [declaration.#analysis declaration.#state] state)] (..method_definition archive super interfaces [mapping selfT] diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux index c024f832a..99a99baa6 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux @@ -315,7 +315,7 @@ {.#Named (symbol <original>) <anonymous>})))] - [Binary|Python (Primitive "bytearray")] + [Binary|Python (Nominal "bytearray")] [Binary|DEFAULT (type_literal (array.Array (I64 Any)))] ) @@ -325,8 +325,8 @@ (if (type#= original type) replacement (when type - {.#Primitive name parameters} - {.#Primitive name (list#each again parameters)} + {.#Nominal name parameters} + {.#Nominal name (list#each again parameters)} (^.with_template [<tag>] [{<tag> left right} diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/jvm/common.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/jvm/common.lux index b7ddc07e9..b82acba31 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/jvm/common.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/jvm/common.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Type Label Primitive Synthesis) + [lux (.except Type Label Synthesis) [abstract ["[0]" monad (.only do)]] [control diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/jvm/host.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/jvm/host.lux index 57d0c3bbc..1f019a985 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/jvm/host.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/jvm/host.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Type Primitive Synthesis) + [lux (.except Type Synthesis) [abstract ["[0]" monad (.only do)]] [control diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/value.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/value.lux index 3d914a0e7..70adbaaf3 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/value.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/value.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Type Primitive) + [lux (.except Type) [meta [target [jvm diff --git a/stdlib/source/library/lux/meta/compiler/meta/archive.lux b/stdlib/source/library/lux/meta/compiler/meta/archive.lux index ca3dd65b4..04187cdb3 100644 --- a/stdlib/source/library/lux/meta/compiler/meta/archive.lux +++ b/stdlib/source/library/lux/meta/compiler/meta/archive.lux @@ -28,7 +28,7 @@ [meta ["[0]" configuration (.only Configuration)] [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] [/ ["[0]" artifact] ["[0]" registry (.only Registry)] @@ -73,7 +73,7 @@ #output Output #registry Registry])) -(primitive.def .public Archive +(nominal.def .public Archive (Record [#next module.ID #resolver (Dictionary descriptor.Module [module.ID (Maybe (Entry Any))])]) diff --git a/stdlib/source/library/lux/meta/compiler/meta/archive/key.lux b/stdlib/source/library/lux/meta/compiler/meta/archive/key.lux index 09a246977..f23c094b4 100644 --- a/stdlib/source/library/lux/meta/compiler/meta/archive/key.lux +++ b/stdlib/source/library/lux/meta/compiler/meta/archive/key.lux @@ -3,11 +3,11 @@ [lux (.except) [meta [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] [// [signature (.only Signature)]]) -(primitive.def .public (Key k) +(nominal.def .public (Key k) Signature (def .public signature diff --git a/stdlib/source/library/lux/meta/compiler/meta/archive/module/document.lux b/stdlib/source/library/lux/meta/compiler/meta/archive/module/document.lux index 8778ecd01..31e1ea00d 100644 --- a/stdlib/source/library/lux/meta/compiler/meta/archive/module/document.lux +++ b/stdlib/source/library/lux/meta/compiler/meta/archive/module/document.lux @@ -15,7 +15,7 @@ ["[1]" \\format (.only Format)]]] [meta [type (.only sharing) - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] [/// ["[0]" signature (.only Signature) (.use "[1]#[0]" equivalence)] ["[0]" key (.only Key)]]) @@ -26,7 +26,7 @@ (list ["Expected" (signature.description expected)] ["Actual" (signature.description actual)]))) -(primitive.def .public (Document d) +(nominal.def .public (Document d) (Record [#signature Signature #content d]) diff --git a/stdlib/source/library/lux/meta/compiler/meta/archive/registry.lux b/stdlib/source/library/lux/meta/compiler/meta/archive/registry.lux index ff6424658..3ca43494f 100644 --- a/stdlib/source/library/lux/meta/compiler/meta/archive/registry.lux +++ b/stdlib/source/library/lux/meta/compiler/meta/archive/registry.lux @@ -24,13 +24,13 @@ [macro ["^" pattern]] [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] ["[0]" // ["[0]" unit] ["[1]" artifact (.only Artifact ID) ["[2][0]" category (.only Category)]]]) -(primitive.def .public Registry +(nominal.def .public Registry (Record [#artifacts (Sequence [Artifact (Set unit.ID)]) #resolver (Dictionary Text [ID (Maybe //category.Definition)])]) diff --git a/stdlib/source/library/lux/meta/macro/vocabulary.lux b/stdlib/source/library/lux/meta/macro/vocabulary.lux index 71327712d..0b2216617 100644 --- a/stdlib/source/library/lux/meta/macro/vocabulary.lux +++ b/stdlib/source/library/lux/meta/macro/vocabulary.lux @@ -15,7 +15,7 @@ ["[0]" code (.only) ["?[1]" \\parser (.only Parser)]] ["[0]" type (.only) - ["[0]" primitive (.except def)]]]]) + ["[0]" nominal (.except def)]]]]) (exception.def .public (invalid_type [expected actual]) (Exception [Type Type]) @@ -33,7 +33,7 @@ [public|private@macro macro] ..local [public|private@by_name by_name] ..local]) (//.with_symbols [g!_ g!type g!value] - (in (list (` (primitive.def (, public|private@type) (, type) + (in (list (` (nominal.def (, public|private@type) (, type) Macro (.def (, public|private@micro) (, micro) diff --git a/stdlib/source/library/lux/meta/target/common_lisp.lux b/stdlib/source/library/lux/meta/target/common_lisp.lux index 64af1340f..60f46f514 100644 --- a/stdlib/source/library/lux/meta/target/common_lisp.lux +++ b/stdlib/source/library/lux/meta/target/common_lisp.lux @@ -15,13 +15,13 @@ [macro ["[0]" template]] [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) (def as_form (-> Text Text) (text.enclosed ["(" ")"])) -(primitive.def .public (Code brand) +(nominal.def .public (Code brand) Text (def .public manual @@ -34,7 +34,7 @@ (with_template [<type> <super>] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (`` (primitive.def .public (<brand> brand) Any)) + (`` (nominal.def .public (<brand> brand) Any)) (`` (type .public (<type> brand) (<super> (<brand> brand)))))] @@ -48,7 +48,7 @@ (with_template [<type> <super>] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (`` (primitive.def .public <brand> Any)) + (`` (nominal.def .public <brand> Any)) (`` (type .public <type> (<super> <brand>))))] [Label Code] diff --git a/stdlib/source/library/lux/meta/target/js.lux b/stdlib/source/library/lux/meta/target/js.lux index 4460eb45b..b2e34c32b 100644 --- a/stdlib/source/library/lux/meta/target/js.lux +++ b/stdlib/source/library/lux/meta/target/js.lux @@ -16,7 +16,7 @@ [macro ["[0]" template]] [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) (def expression (text.enclosed ["(" ")"])) @@ -34,7 +34,7 @@ (|>> (format \n+) (text.replaced text.new_line (format text.new_line text.tab)))) -(primitive.def .public (Code brand) +(nominal.def .public (Code brand) Text (def .public code @@ -43,7 +43,7 @@ (with_template [<type> <super>+] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (primitive.def (<brand> brand) Any) + (nominal.def (<brand> brand) Any) (`` (type .public <type> (|> Any <brand> (,, (template.spliced <super>+))))))] [Expression [Code]] @@ -54,7 +54,7 @@ (with_template [<type> <super>+] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (primitive.def <brand> Any) + (nominal.def <brand> Any) (`` (type .public <type> (|> <brand> (,, (template.spliced <super>+))))))] [Var [Location' Computation' Expression' Code]] diff --git a/stdlib/source/library/lux/meta/target/jvm/bytecode/address.lux b/stdlib/source/library/lux/meta/target/jvm/bytecode/address.lux index 92dac219f..3e6d4f4c2 100644 --- a/stdlib/source/library/lux/meta/target/jvm/bytecode/address.lux +++ b/stdlib/source/library/lux/meta/target/jvm/bytecode/address.lux @@ -16,7 +16,7 @@ ["n" nat]]] [meta [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] ["[0]" // [jump (.only Big_Jump)] ["/[1]" // @@ -24,7 +24,7 @@ ["[1][0]" unsigned (.only U2)] ["[1][0]" signed (.only S4)]]]]) -(primitive.def .public Address +(nominal.def .public Address U2 (def .public value diff --git a/stdlib/source/library/lux/meta/target/jvm/bytecode/environment/limit/registry.lux b/stdlib/source/library/lux/meta/target/jvm/bytecode/environment/limit/registry.lux index a4064ce18..28c09c0d2 100644 --- a/stdlib/source/library/lux/meta/target/jvm/bytecode/environment/limit/registry.lux +++ b/stdlib/source/library/lux/meta/target/jvm/bytecode/environment/limit/registry.lux @@ -15,7 +15,7 @@ ["n" nat]]] [meta [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] ["[0]" ///// [encoding ["[1][0]" unsigned (.only U1 U2)]] @@ -29,7 +29,7 @@ (def normal 1) (def wide 2) -(primitive.def .public Registry +(nominal.def .public Registry U2 (def .public registry diff --git a/stdlib/source/library/lux/meta/target/jvm/bytecode/environment/limit/stack.lux b/stdlib/source/library/lux/meta/target/jvm/bytecode/environment/limit/stack.lux index 5ea838b14..eaf7673f7 100644 --- a/stdlib/source/library/lux/meta/target/jvm/bytecode/environment/limit/stack.lux +++ b/stdlib/source/library/lux/meta/target/jvm/bytecode/environment/limit/stack.lux @@ -13,12 +13,12 @@ [\\format (.only Format)]]] [meta [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] ["[0]" ///// [encoding ["[1][0]" unsigned (.only U2)]]]) -(primitive.def .public Stack +(nominal.def .public Stack U2 (with_template [<frames> <name>] diff --git a/stdlib/source/library/lux/meta/target/jvm/bytecode/instruction.lux b/stdlib/source/library/lux/meta/target/jvm/bytecode/instruction.lux index 16bc84c5e..d6abb8141 100644 --- a/stdlib/source/library/lux/meta/target/jvm/bytecode/instruction.lux +++ b/stdlib/source/library/lux/meta/target/jvm/bytecode/instruction.lux @@ -23,7 +23,7 @@ [macro ["[0]" template]] [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] ["[0]" // ["[1][0]" address (.only Address)] ["[1][0]" jump (.only Jump Big_Jump)] @@ -222,7 +222,7 @@ [(n.+ (///unsigned.value ..size/211) size) (|>> mutation ((trinary/211' opcode input0 input1 input2)))])]) -(primitive.def .public Primitive_Array_Type +(nominal.def .public Primitive_Array_Type U1 (def code diff --git a/stdlib/source/library/lux/meta/target/jvm/constant.lux b/stdlib/source/library/lux/meta/target/jvm/constant.lux index b3fbb5cef..936e73230 100644 --- a/stdlib/source/library/lux/meta/target/jvm/constant.lux +++ b/stdlib/source/library/lux/meta/target/jvm/constant.lux @@ -23,7 +23,7 @@ ["^" pattern] ["[0]" template]] [type - ["[0]" primitive (.except def #name)]]]]] + ["[0]" nominal (.except def #name)]]]]] ["[0]" / ["[1][0]" tag] ["/[1]" // @@ -41,7 +41,7 @@ (Format UTF8) binaryF.utf8_16) -(primitive.def .public Class +(nominal.def .public Class (Index UTF8) (def .public index @@ -82,7 +82,7 @@ "[1]::[0]" ("static" doubleToRawLongBits [double] long)) -(primitive.def .public (Value kind) +(nominal.def .public (Value kind) kind (def .public value diff --git a/stdlib/source/library/lux/meta/target/jvm/constant/tag.lux b/stdlib/source/library/lux/meta/target/jvm/constant/tag.lux index 63d5a88f4..66a66f48a 100644 --- a/stdlib/source/library/lux/meta/target/jvm/constant/tag.lux +++ b/stdlib/source/library/lux/meta/target/jvm/constant/tag.lux @@ -10,12 +10,12 @@ [\\format (.only Format)]]] [meta [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] ["[0]" /// [encoding ["[1][0]" unsigned (.only U1) (.use "u1//[0]" equivalence)]]]) -(primitive.def .public Tag +(nominal.def .public Tag U1 (def .public equivalence diff --git a/stdlib/source/library/lux/meta/target/jvm/encoding/name.lux b/stdlib/source/library/lux/meta/target/jvm/encoding/name.lux index dfbf8f419..108ad8752 100644 --- a/stdlib/source/library/lux/meta/target/jvm/encoding/name.lux +++ b/stdlib/source/library/lux/meta/target/jvm/encoding/name.lux @@ -6,7 +6,7 @@ ["%" \\format (.only format)]]] [meta [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) (def .public internal_separator "/") (def .public external_separator ".") @@ -14,7 +14,7 @@ (type .public External Text) -(primitive.def .public Internal +(nominal.def .public Internal Text (def .public internal diff --git a/stdlib/source/library/lux/meta/target/jvm/encoding/signed.lux b/stdlib/source/library/lux/meta/target/jvm/encoding/signed.lux index 7bb8f86fc..428f5ef8a 100644 --- a/stdlib/source/library/lux/meta/target/jvm/encoding/signed.lux +++ b/stdlib/source/library/lux/meta/target/jvm/encoding/signed.lux @@ -21,9 +21,9 @@ [macro ["[0]" template]] [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) -(primitive.def .public (Signed brand) +(nominal.def .public (Signed brand) Int (def .public value @@ -51,7 +51,7 @@ (with_template [<bytes> <name> <size> <constructor> <maximum> <minimum> <+> <->] [(with_expansions [<raw> (template.symbol [<name> "'"])] - (primitive.def <raw> Any) + (nominal.def <raw> Any) (type .public <name> (Signed <raw>))) (def .public <size> <bytes>) diff --git a/stdlib/source/library/lux/meta/target/jvm/encoding/unsigned.lux b/stdlib/source/library/lux/meta/target/jvm/encoding/unsigned.lux index e34ad104f..afd21a166 100644 --- a/stdlib/source/library/lux/meta/target/jvm/encoding/unsigned.lux +++ b/stdlib/source/library/lux/meta/target/jvm/encoding/unsigned.lux @@ -20,9 +20,9 @@ [macro ["[0]" template]] [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) -(primitive.def .public (Unsigned brand) +(nominal.def .public (Unsigned brand) Nat (def .public value @@ -60,7 +60,7 @@ (with_template [<bytes> <name> <size> <constructor> <maximum> <+> <-> <max>] [(with_expansions [<raw> (template.symbol [<name> "'"])] - (primitive.def .public <raw> Any) + (nominal.def .public <raw> Any) (type .public <name> (Unsigned <raw>))) (def .public <size> <bytes>) diff --git a/stdlib/source/library/lux/meta/target/jvm/index.lux b/stdlib/source/library/lux/meta/target/jvm/index.lux index 2ac48514b..7f93bb0ff 100644 --- a/stdlib/source/library/lux/meta/target/jvm/index.lux +++ b/stdlib/source/library/lux/meta/target/jvm/index.lux @@ -8,7 +8,7 @@ [\\format (.only Format)]]] [meta [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] ["[0]" // [encoding ["[1][0]" unsigned (.only U2)]]]) @@ -16,7 +16,7 @@ (def .public length //unsigned.bytes/2) -(primitive.def .public (Index kind) +(nominal.def .public (Index kind) U2 (def .public index diff --git a/stdlib/source/library/lux/meta/target/jvm/loader.lux b/stdlib/source/library/lux/meta/target/jvm/loader.lux index 5e9b5fa0c..689fab421 100644 --- a/stdlib/source/library/lux/meta/target/jvm/loader.lux +++ b/stdlib/source/library/lux/meta/target/jvm/loader.lux @@ -91,12 +91,12 @@ bytecode) (as java/lang/Object (|> 0 - (as (Primitive "java.lang.Long")) + (as (Nominal "java.lang.Long")) ffi.long_to_int)) (as java/lang/Object (|> bytecode binary.size - (as (Primitive "java.lang.Long")) + (as (Nominal "java.lang.Long")) ffi.long_to_int))))] (java/lang/reflect/Method::invoke loader signature java/lang/ClassLoader::defineClass))) diff --git a/stdlib/source/library/lux/meta/target/jvm/modifier.lux b/stdlib/source/library/lux/meta/target/jvm/modifier.lux index 6cac02f5c..9b1b0843e 100644 --- a/stdlib/source/library/lux/meta/target/jvm/modifier.lux +++ b/stdlib/source/library/lux/meta/target/jvm/modifier.lux @@ -19,12 +19,12 @@ [macro (.only with_symbols) [syntax (.only syntax)]] [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] ["[0]" // [encoding ["[1][0]" unsigned]]]) -(primitive.def .public (Modifier of) +(nominal.def .public (Modifier of) //unsigned.U2 (def .public code diff --git a/stdlib/source/library/lux/meta/target/jvm/modifier/inner.lux b/stdlib/source/library/lux/meta/target/jvm/modifier/inner.lux index 5fc4e07ff..6a2a188fe 100644 --- a/stdlib/source/library/lux/meta/target/jvm/modifier/inner.lux +++ b/stdlib/source/library/lux/meta/target/jvm/modifier/inner.lux @@ -3,10 +3,10 @@ [lux (.except static) [meta [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] [// (.only modifiers)]) -(primitive.def .public Inner Any) +(nominal.def .public Inner Any) (modifiers Inner diff --git a/stdlib/source/library/lux/meta/target/jvm/reflection.lux b/stdlib/source/library/lux/meta/target/jvm/reflection.lux index 2a0ad37a8..2e977d594 100644 --- a/stdlib/source/library/lux/meta/target/jvm/reflection.lux +++ b/stdlib/source/library/lux/meta/target/jvm/reflection.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Primitive parameter type) + [lux (.except parameter type) ["[0]" ffi (.only import)] [abstract ["[0]" monad (.only do)]] @@ -291,13 +291,13 @@ (def .public (correspond class type) (-> (java/lang/Class java/lang/Object) Type (Try Mapping)) (when type - {.#Primitive array.primitive (list :member:)} + {.#Nominal array.nominal (list :member:)} (if (java/lang/Class::isArray class) (correspond (java/lang/Class::getComponentType class) :member:) (exception.except ..cannot_correspond [class type])) - {.#Primitive name params} + {.#Nominal name params} (let [class_name (java/lang/Class::getName class) class_params (array.list {.#None} (java/lang/Class::getTypeParameters class)) num_class_params (list.size class_params) diff --git a/stdlib/source/library/lux/meta/target/jvm/type.lux b/stdlib/source/library/lux/meta/target/jvm/type.lux index f55b66ef9..9253258f5 100644 --- a/stdlib/source/library/lux/meta/target/jvm/type.lux +++ b/stdlib/source/library/lux/meta/target/jvm/type.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Primitive Type Declaration int char) + [lux (.except Type Declaration int char) [abstract [equivalence (.only Equivalence)] [hash (.only Hash)]] @@ -16,7 +16,7 @@ ["n" nat]]] [meta [type - ["[0]" primitive (.except def #name)]]]]] + ["[0]" nominal (.except def #name)]]]]] ["[0]" // [encoding ["[1][0]" name (.only External)]]] @@ -26,7 +26,7 @@ ["[1][0]" descriptor (.only Descriptor)] ["[1][0]" reflection (.only Reflection)]]) -(primitive.def .public (Type category) +(nominal.def .public (Type category) [(Signature category) (Descriptor category) (Reflection category)] diff --git a/stdlib/source/library/lux/meta/target/jvm/type/alias.lux b/stdlib/source/library/lux/meta/target/jvm/type/alias.lux index 8d9ddc7f4..99d623d5e 100644 --- a/stdlib/source/library/lux/meta/target/jvm/type/alias.lux +++ b/stdlib/source/library/lux/meta/target/jvm/type/alias.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Type Primitive int char parameter) + [lux (.except Type int char parameter) [abstract ["[0]" monad (.only do)]] [control diff --git a/stdlib/source/library/lux/meta/target/jvm/type/category.lux b/stdlib/source/library/lux/meta/target/jvm/type/category.lux index 9dfe3344c..5ab489d09 100644 --- a/stdlib/source/library/lux/meta/target/jvm/type/category.lux +++ b/stdlib/source/library/lux/meta/target/jvm/type/category.lux @@ -1,30 +1,30 @@ (.require [library - [lux (.except Primitive Declaration) + [lux (.except Declaration) [meta [macro ["[0]" template]] [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) -(primitive.def Void' Any) -(primitive.def .public (Value' kind) Any) -(primitive.def .public (Return' kind) Any) -(primitive.def .public Method Any) +(nominal.def Void' Any) +(nominal.def .public (Value' kind) Any) +(nominal.def .public (Return' kind) Any) +(nominal.def .public Method Any) (type .public Return (<| Return' Any)) (type .public Value (<| Return' Value' Any)) (type .public Void (<| Return' Void')) -(primitive.def (Object' brand) Any) +(nominal.def (Object' brand) Any) (type .public Object (<| Return' Value' Object' Any)) -(primitive.def (Parameter' brand) Any) +(nominal.def (Parameter' brand) Any) (type .public Parameter (<| Return' Value' Object' Parameter' Any)) (with_template [<parents> <child>] [(with_expansions [<raw> (template.symbol [<child> "'"])] - (primitive.def <raw> Any) + (nominal.def <raw> Any) (type .public <child> (`` (<| Return' Value' (,, (template.spliced <parents>)) <raw>))))] @@ -34,5 +34,5 @@ [[Object' Parameter'] Array] ) -(primitive.def .public Declaration Any) -(primitive.def .public Inheritance Any) +(nominal.def .public Declaration Any) +(nominal.def .public Inheritance Any) diff --git a/stdlib/source/library/lux/meta/target/jvm/type/descriptor.lux b/stdlib/source/library/lux/meta/target/jvm/type/descriptor.lux index c9d50b9da..46e360bae 100644 --- a/stdlib/source/library/lux/meta/target/jvm/type/descriptor.lux +++ b/stdlib/source/library/lux/meta/target/jvm/type/descriptor.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Primitive Declaration int char) + [lux (.except Declaration int char) [abstract [equivalence (.only Equivalence)]] [control @@ -15,14 +15,14 @@ ["n" nat]]] [meta [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] ["[0]" // [category (.only Void Value Return Method Primitive Object Class Array Var Parameter Declaration)] ["/[1]" // [encoding ["[1][0]" name (.only Internal External)]]]]) -(primitive.def .public (Descriptor category) +(nominal.def .public (Descriptor category) Text (def .public descriptor diff --git a/stdlib/source/library/lux/meta/target/jvm/type/lux.lux b/stdlib/source/library/lux/meta/target/jvm/type/lux.lux index 306f88580..5e9b87242 100644 --- a/stdlib/source/library/lux/meta/target/jvm/type/lux.lux +++ b/stdlib/source/library/lux/meta/target/jvm/type/lux.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Primitive int char parameter type) + [lux (.except int char parameter type) [abstract ["[0]" monad (.only do)]] [control @@ -17,7 +17,7 @@ ["[0]" dictionary (.only Dictionary)]]] [meta [type - [":" primitive] + [":" nominal] ["[0]" check (.only Check) (.use "[1]#[0]" monad)]]]]] ["[0]" // (.only) [category (.only Void Value Return Method Primitive Object Class Array Var Parameter)] @@ -58,7 +58,7 @@ [(def <name> (Parser (Check Type)) (<>.after <parser> - (<>#in (check#in {.#Primitive (//reflection.reflection <reflection>) {.#End}}))))] + (<>#in (check#in {.#Nominal (//reflection.reflection <reflection>) {.#End}}))))] [boolean //parser.boolean //reflection.boolean] [byte //parser.byte //reflection.byte] @@ -74,7 +74,7 @@ [(def <name> (Parser (Check Type)) (<>.after <parser> - (<>#in (check#in {.#Primitive <box> {.#End}}))))] + (<>#in (check#in {.#Nominal <box> {.#End}}))))] [boxed_boolean //parser.boolean //box.boolean] [boxed_byte //parser.byte //box.byte] @@ -139,7 +139,7 @@ (<>.else (list)))] (in (do [! check.monad] [parameters (monad.all ! parameters)] - (in {.#Primitive name parameters})))) + (in {.#Nominal name parameters})))) (<>.after (<text>.this //descriptor.class_prefix)) (<>.before (<text>.this //descriptor.class_suffix)))) @@ -176,7 +176,7 @@ (-> (Parser (Check Type)) (Parser (Check Type))) (|>> (<>#each (check#each (function (_ elementT) (when elementT - {.#Primitive name {.#End}} + {.#Nominal name {.#End}} (if (`` (or (,, (with_template [<reflection>] [(text#= (//reflection.reflection <reflection>) name)] @@ -188,7 +188,7 @@ [//reflection.float] [//reflection.double] [//reflection.char])))) - {.#Primitive (|> name //reflection.class //reflection.array //reflection.reflection) {.#End}} + {.#Nominal (|> name //reflection.class //reflection.array //reflection.reflection) {.#End}} (|> elementT array.Array type_literal)) _ diff --git a/stdlib/source/library/lux/meta/target/jvm/type/parser.lux b/stdlib/source/library/lux/meta/target/jvm/type/parser.lux index ad41daeac..61c80017c 100644 --- a/stdlib/source/library/lux/meta/target/jvm/type/parser.lux +++ b/stdlib/source/library/lux/meta/target/jvm/type/parser.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Type Primitive Declaration int char parameter) + [lux (.except Type Declaration int char parameter) [abstract [monad (.only do)]] [control diff --git a/stdlib/source/library/lux/meta/target/jvm/type/reflection.lux b/stdlib/source/library/lux/meta/target/jvm/type/reflection.lux index 0cb424d28..003030a9b 100644 --- a/stdlib/source/library/lux/meta/target/jvm/type/reflection.lux +++ b/stdlib/source/library/lux/meta/target/jvm/type/reflection.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Primitive Declaration int char) + [lux (.except Declaration int char) [abstract [equivalence (.only Equivalence)]] [data @@ -8,7 +8,7 @@ ["%" \\format (.only format)]]] [meta [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] ["[0]" // [category (.only Void Value Return Method Primitive Object Class Array Var Parameter Declaration)] ["[1][0]" descriptor] @@ -16,7 +16,7 @@ [encoding ["[1][0]" name (.only External)]]]]) -(primitive.def .public (Reflection category) +(nominal.def .public (Reflection category) Text (def .public reflection diff --git a/stdlib/source/library/lux/meta/target/jvm/type/signature.lux b/stdlib/source/library/lux/meta/target/jvm/type/signature.lux index 8a0cbc5f5..1f7eb3a53 100644 --- a/stdlib/source/library/lux/meta/target/jvm/type/signature.lux +++ b/stdlib/source/library/lux/meta/target/jvm/type/signature.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Primitive Declaration int char) + [lux (.except Declaration int char) [abstract [equivalence (.only Equivalence)] [hash (.only Hash)]] @@ -13,7 +13,7 @@ ["[0]" list (.use "[1]#[0]" functor)]]] [meta [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] ["[0]" // [category (.only Void Value Return Method Primitive Object Class Array Var Parameter Declaration Inheritance)] ["[1][0]" descriptor] @@ -21,7 +21,7 @@ [encoding ["[1][0]" name (.only External)]]]]) -(primitive.def .public (Signature category) +(nominal.def .public (Signature category) Text (def .public signature diff --git a/stdlib/source/library/lux/meta/target/lua.lux b/stdlib/source/library/lux/meta/target/lua.lux index 063c0fc4d..0bafbd9ca 100644 --- a/stdlib/source/library/lux/meta/target/lua.lux +++ b/stdlib/source/library/lux/meta/target/lua.lux @@ -25,7 +25,7 @@ [syntax (.only syntax)] ["[0]" template]] [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) ... Added the carriage return for better Windows compatibility. (def \n+ @@ -40,7 +40,7 @@ (def input_separator ", ") -(primitive.def .public (Code brand) +(nominal.def .public (Code brand) Text (def .public equivalence @@ -65,7 +65,7 @@ (with_template [<type> <super>+] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (primitive.def (<brand> brand) Any) + (nominal.def (<brand> brand) Any) (`` (type .public <type> (|> Any <brand> (,, (template.spliced <super>+))))))] [Expression [Code]] @@ -76,7 +76,7 @@ (with_template [<type> <super>+] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (primitive.def <brand> Any) + (nominal.def <brand> Any) (`` (type .public <type> (|> <brand> (,, (template.spliced <super>+))))))] [Literal [Computation' Expression' Code]] diff --git a/stdlib/source/library/lux/meta/target/php.lux b/stdlib/source/library/lux/meta/target/php.lux index e68d9cc37..44e663934 100644 --- a/stdlib/source/library/lux/meta/target/php.lux +++ b/stdlib/source/library/lux/meta/target/php.lux @@ -24,7 +24,7 @@ [syntax (.only syntax)] ["[0]" template]] [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) (def input_separator ", ") (def statement_suffix ";") @@ -48,7 +48,7 @@ (-> Text Text) (text.enclosed ["(" ")"])) -(primitive.def .public (Code brand) +(nominal.def .public (Code brand) Text (def .public equivalence @@ -73,7 +73,7 @@ (with_template [<type> <super>+] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (primitive.def (<brand> brand) Any) + (nominal.def (<brand> brand) Any) (`` (type .public <type> (|> Any <brand> (,, (template.spliced <super>+))))))] [Expression [Code]] @@ -84,7 +84,7 @@ (with_template [<type> <super>+] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (primitive.def .public <brand> Any) + (nominal.def .public <brand> Any) (`` (type .public <type> (|> <brand> (,, (template.spliced <super>+))))))] [Literal [Computation' Expression' Code]] diff --git a/stdlib/source/library/lux/meta/target/python.lux b/stdlib/source/library/lux/meta/target/python.lux index 9ff10bbe0..9d426d1ed 100644 --- a/stdlib/source/library/lux/meta/target/python.lux +++ b/stdlib/source/library/lux/meta/target/python.lux @@ -25,7 +25,7 @@ [syntax (.only syntax)] ["[0]" template]] [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) (.def input_separator ", ") @@ -57,7 +57,7 @@ (|>> (format \n+) (text.replaced text.new_line nested_new_line))))) -(primitive.def .public (Code brand) +(nominal.def .public (Code brand) Text (.def .public equivalence @@ -82,7 +82,7 @@ (with_template [<type> <super>] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (`` (primitive.def (<brand> brand) Any)) + (`` (nominal.def (<brand> brand) Any)) (`` (type .public (<type> brand) (<super> (<brand> brand)))))] @@ -95,7 +95,7 @@ (with_template [<type> <super>] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (`` (primitive.def <brand> Any)) + (`` (nominal.def <brand> Any)) (`` (type .public <type> (<super> <brand>))))] [Literal Computation] @@ -104,7 +104,7 @@ ) (with_template [<var> <brand>] - [(primitive.def .public <brand> Any) + [(nominal.def .public <brand> Any) (type .public <var> (Var <brand>))] diff --git a/stdlib/source/library/lux/meta/target/r.lux b/stdlib/source/library/lux/meta/target/r.lux index ae57971a3..e95eff6df 100644 --- a/stdlib/source/library/lux/meta/target/r.lux +++ b/stdlib/source/library/lux/meta/target/r.lux @@ -20,14 +20,14 @@ [syntax (.only syntax)] ["[0]" template]] [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) -(primitive.def .public (Code kind) +(nominal.def .public (Code kind) Text (with_template [<type> <super>+] [(with_expansions [<kind> (template.symbol [<type> "'"])] - (primitive.def .public (<kind> kind) Any) + (nominal.def .public (<kind> kind) Any) (`` (type .public <type> (|> Any <kind> (,, (template.spliced <super>+))))))] [Expression [Code]] @@ -35,14 +35,14 @@ (with_template [<type> <super>+] [(with_expansions [<kind> (template.symbol [<type> "'"])] - (primitive.def .public (<kind> kind) Any) + (nominal.def .public (<kind> kind) Any) (`` (type .public (<type> <brand>) (|> <brand> <kind> (,, (template.spliced <super>+))))))] [Var [Expression' Code]] ) (with_template [<var> <kind>] - [(primitive.def .public <kind> Any) + [(nominal.def .public <kind> Any) (type .public <var> (Var <kind>))] [SVar Single] diff --git a/stdlib/source/library/lux/meta/target/ruby.lux b/stdlib/source/library/lux/meta/target/ruby.lux index 2bef96112..17892b773 100644 --- a/stdlib/source/library/lux/meta/target/ruby.lux +++ b/stdlib/source/library/lux/meta/target/ruby.lux @@ -24,7 +24,7 @@ [syntax (.only syntax)] ["[0]" template]] [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) (def input_separator ", ") (def statement_suffix ";") @@ -40,7 +40,7 @@ (|>> (format \n+) (text.replaced text.new_line nested_new_line)))) -(primitive.def .public (Code brand) +(nominal.def .public (Code brand) Text (def .public equivalence @@ -59,7 +59,7 @@ (with_template [<type> <super>+] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (primitive.def (<brand> brand) Any) + (nominal.def (<brand> brand) Any) (`` (type .public <type> (|> Any <brand> (,, (template.spliced <super>+))))))] [Expression [Code]] @@ -72,7 +72,7 @@ (with_template [<type> <super>+] [(with_expansions [<brand> (template.symbol [<type> "'"])] - (primitive.def <brand> Any) + (nominal.def <brand> Any) (`` (type .public <type> (|> <brand> (,, (template.spliced <super>+))))))] [Literal [Computation' Expression' Code]] diff --git a/stdlib/source/library/lux/meta/target/scheme.lux b/stdlib/source/library/lux/meta/target/scheme.lux index af3fd8b00..f9a3a71df 100644 --- a/stdlib/source/library/lux/meta/target/scheme.lux +++ b/stdlib/source/library/lux/meta/target/scheme.lux @@ -20,7 +20,7 @@ [macro ["[0]" template]] [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) ... Added the carriage return for better Windows compatibility. (def \n+ @@ -32,7 +32,7 @@ (.let [nested_new_line (format text.new_line text.tab)] (text.replaced text.new_line nested_new_line))) -(primitive.def .public (Code k) +(nominal.def .public (Code k) Text (def .public equivalence @@ -48,14 +48,14 @@ (def hash (|>> representation (at text.hash hash))))) (with_template [<type> <brand> <super>+] - [(primitive.def .public (<brand> brand) Any) + [(nominal.def .public (<brand> brand) Any) (`` (type .public <type> (|> Any <brand> (,, (template.spliced <super>+)))))] [Expression Expression' [Code]] ) (with_template [<type> <brand> <super>+] - [(primitive.def .public <brand> Any) + [(nominal.def .public <brand> Any) (`` (type .public <type> (|> <brand> (,, (template.spliced <super>+)))))] [Var Var' [Expression' Code]] diff --git a/stdlib/source/library/lux/meta/type.lux b/stdlib/source/library/lux/meta/type.lux index da2463a52..90ad79d1e 100644 --- a/stdlib/source/library/lux/meta/type.lux +++ b/stdlib/source/library/lux/meta/type.lux @@ -80,9 +80,9 @@ (`` (def .public (format type) (-> Type Text) (when type - {.#Primitive name params} + {.#Nominal name params} (all text#composite - "(Primitive " + "(Nominal " (text.enclosed' text.double_quote name) (|> params (list#each (|>> format (text#composite " "))) @@ -140,8 +140,8 @@ (`` (def (reduced env type) (-> (List Type) Type Type) (when type - {.#Primitive name params} - {.#Primitive name (list#each (reduced env) params)} + {.#Nominal name params} + {.#Nominal name (list#each (reduced env) params)} (,, (with_template [<tag>] [{<tag> left right} @@ -188,7 +188,7 @@ false (same? x y)) (when [x y] - [{.#Primitive xname xparams} {.#Primitive yname yparams}] + [{.#Nominal xname xparams} {.#Nominal yname yparams}] (and (text#= xname yname) (n.= (list.size yparams) (list.size xparams)) (list#mix (.function (_ [x y] prev) (and prev (= x y))) @@ -264,9 +264,9 @@ (`` (def .public (code type) (-> Type Code) (when type - {.#Primitive name params} - (` {.#Primitive (, (code.text name)) - (.list (,* (list#each code params)))}) + {.#Nominal name params} + (` {.#Nominal (, (code.text name)) + (.list (,* (list#each code params)))}) (,, (with_template [<tag>] [{<tag> idx} @@ -390,14 +390,14 @@ _ (|> element_type (array (-- depth)) (list) - {.#Primitive array.primitive}))) + {.#Nominal array.nominal}))) (def .public (flat_array type) (-> Type [Nat Type]) (with_expansions [<default> [0 type]] (when type - {.#Primitive name (list element_type)} - (if (text#= array.primitive name) + {.#Nominal name (list element_type)} + (if (text#= array.nominal name) (.let [[depth element_type] (flat_array element_type)] [(++ depth) element_type]) <default>) @@ -511,8 +511,8 @@ (if (at ..equivalence = before it) after (when it - {.#Primitive name co_variant} - {.#Primitive name (list#each again co_variant)} + {.#Nominal name co_variant} + {.#Nominal name (list#each again co_variant)} (,, (with_template [<tag>] [{<tag> left right} diff --git a/stdlib/source/library/lux/meta/type/check.lux b/stdlib/source/library/lux/meta/type/check.lux index bcd8fcadb..fc4794124 100644 --- a/stdlib/source/library/lux/meta/type/check.lux +++ b/stdlib/source/library/lux/meta/type/check.lux @@ -707,7 +707,7 @@ ([.#UnivQ ..var] [.#ExQ ..existential]) - [{.#Primitive e_name e_params} {.#Primitive a_name a_params}] + [{.#Nominal e_name e_params} {.#Nominal a_name a_params}] (if (!text#= e_name a_name) (loop (again [assumptions assumptions e_params e_params @@ -779,10 +779,10 @@ (def .public (clean aliases inputT) (-> (List Var) Type (Check Type)) (when inputT - {.#Primitive name paramsT+} + {.#Nominal name paramsT+} (|> paramsT+ (monad.each ..monad (clean aliases)) - (check#each (|>> {.#Primitive name}))) + (check#each (|>> {.#Nominal name}))) (^.or {.#Parameter _} {.#Ex _} diff --git a/stdlib/source/library/lux/meta/type/dynamic.lux b/stdlib/source/library/lux/meta/type/dynamic.lux index ef7605ad2..24a08e645 100644 --- a/stdlib/source/library/lux/meta/type/dynamic.lux +++ b/stdlib/source/library/lux/meta/type/dynamic.lux @@ -14,7 +14,7 @@ [macro (.only with_symbols) ["[0]" syntax (.only syntax)]]]]] ["[0]" // (.only) - ["[0]" primitive (.only)]]) + ["[0]" nominal (.only)]]) (exception.def .public (wrong_type [expected actual]) (Exception [Type Type]) @@ -23,7 +23,7 @@ ["Actual" (%.type actual)]))) (with_expansions [<representation> [Type Any]] - (primitive.def .public Dynamic + (nominal.def .public Dynamic <representation> (def .public dynamic @@ -47,6 +47,6 @@ (def .public (format value) (-> Dynamic (Try Text)) - (let [[type value] (primitive.representation value)] + (let [[type value] (nominal.representation value)] (debug.representation type value))) )) diff --git a/stdlib/source/library/lux/meta/type/linear.lux b/stdlib/source/library/lux/meta/type/linear.lux index 25b8a52fe..89080dbb4 100644 --- a/stdlib/source/library/lux/meta/type/linear.lux +++ b/stdlib/source/library/lux/meta/type/linear.lux @@ -24,7 +24,7 @@ ["[0]" macro (.only) [syntax (.only syntax)]]]]] [// - ["[0]" primitive (.except def)]]) + ["[0]" nominal (.except def)]]) (type .public (Procedure ! input output value) (-> input (! [output value]))) @@ -67,10 +67,10 @@ [output procedure] (in [keys output])))) -(primitive.def .public Ordered Any) -(primitive.def .public Commutative Any) +(nominal.def .public Ordered Any) +(nominal.def .public Commutative Any) -(primitive.def .public (Key mode key) +(nominal.def .public (Key mode key) Any (with_template [<name> <mode>] @@ -82,7 +82,7 @@ [commutative_key Commutative] )) -(primitive.def .public (Res key value) +(nominal.def .public (Res key value) value (with_template [<name> <mode> <key>] diff --git a/stdlib/source/library/lux/meta/type/primitive.lux b/stdlib/source/library/lux/meta/type/nominal.lux index 033be6d6e..1d5ce2602 100644 --- a/stdlib/source/library/lux/meta/type/primitive.lux +++ b/stdlib/source/library/lux/meta/type/nominal.lux @@ -80,7 +80,7 @@ ... TODO: Make sure the generated code always gets optimized away. ... (This applies to uses of "abstraction" and "representation") (.def .public def - (syntax (_ [[export_policy [name type_vars] representation_type primitives] + (syntax (_ [[export_policy [name type_vars] representation_type nominals] ..abstract]) (do meta.monad [current_module meta.current_module_name @@ -90,11 +90,11 @@ representation_declaration (` ((, g!Representation) (,* type_varsC)))]] (..declaration [name type_varsC abstraction_declaration representation_declaration] (` (.these (type (, export_policy) (, abstraction_declaration) - (Primitive (, (code.text (symbol#encoded [current_module name]))) - [(,* type_varsC)])) + (Nominal (, (code.text (symbol#encoded [current_module name]))) + [(,* type_varsC)])) (type (, representation_declaration) (, representation_type)) - (,* primitives))))))) + (,* nominals))))))) (.def selection (Parser [(List Code) Code]) diff --git a/stdlib/source/library/lux/meta/type/poly.lux b/stdlib/source/library/lux/meta/type/poly.lux index a98fd211c..54736333f 100644 --- a/stdlib/source/library/lux/meta/type/poly.lux +++ b/stdlib/source/library/lux/meta/type/poly.lux @@ -47,9 +47,9 @@ (def .public (code env type) (-> Env Type Code) (when type - {.#Primitive name params} - (` {.#Primitive (, (code.text name)) - (.list (,* (list#each (code env) params)))}) + {.#Nominal name params} + (` {.#Nominal (, (code.text name)) + (.list (,* (list#each (code env) params)))}) (^.with_template [<tag>] [{<tag> idx} @@ -63,7 +63,7 @@ (|> (dictionary.value idx env) maybe.trusted product.left (code env)) (` (.$ (, (code.nat (-- idx))))))) - {.#Apply {.#Primitive "" {.#End}} + {.#Apply {.#Nominal "" {.#End}} {.#Parameter idx}} (when (<//>.argument env idx) 0 (|> env (dictionary.value 0) maybe.trusted product.left (code env)) diff --git a/stdlib/source/library/lux/meta/type/quotient.lux b/stdlib/source/library/lux/meta/type/quotient.lux index 99a63d400..ab043d3ff 100644 --- a/stdlib/source/library/lux/meta/type/quotient.lux +++ b/stdlib/source/library/lux/meta/type/quotient.lux @@ -9,9 +9,9 @@ [macro (.only with_symbols) [syntax (.only syntax)]]]]] ["[0]" // (.only) - ["[0]" primitive (.except def)]]) + ["[0]" nominal (.except def)]]) -(primitive.def .public (Class t c %) +(nominal.def .public (Class t c %) (-> t c) (def .public class @@ -20,7 +20,7 @@ (-> (-> t c) (Class t c %)))) (|>> abstraction)) - (primitive.def .public (Quotient t c %) + (nominal.def .public (Quotient t c %) (Record [#value t #label c]) diff --git a/stdlib/source/library/lux/meta/type/refinement.lux b/stdlib/source/library/lux/meta/type/refinement.lux index 3ccaf066d..f1778d1b1 100644 --- a/stdlib/source/library/lux/meta/type/refinement.lux +++ b/stdlib/source/library/lux/meta/type/refinement.lux @@ -10,9 +10,9 @@ ["[0]" macro (.only) [syntax (.only syntax)]]]]] ["[0]" // (.only) - ["[0]" primitive (.except def)]]) + ["[0]" nominal (.except def)]]) -(primitive.def .public (Refined t %) +(nominal.def .public (Refined t %) (Record [#value t #predicate (Predicate t)]) diff --git a/stdlib/source/library/lux/meta/type/unit.lux b/stdlib/source/library/lux/meta/type/unit.lux index e4bf7a1e9..e7dfa241b 100644 --- a/stdlib/source/library/lux/meta/type/unit.lux +++ b/stdlib/source/library/lux/meta/type/unit.lux @@ -18,9 +18,9 @@ ["[0]" macro (.only) [syntax (.only syntax)]]]]] ["[0]" // (.only) - ["[0]" primitive (.except def)]]) + ["[0]" nominal (.except def)]]) -(primitive.def .public (Measure scale unit) +(nominal.def .public (Measure scale unit) Int (def .public measure diff --git a/stdlib/source/library/lux/meta/type/variance.lux b/stdlib/source/library/lux/meta/type/variance.lux index 929d6268b..f7828e49a 100644 --- a/stdlib/source/library/lux/meta/type/variance.lux +++ b/stdlib/source/library/lux/meta/type/variance.lux @@ -12,7 +12,7 @@ (-> it it)) (type .public (Mutable r w) - (Primitive "#Mutable" [(-> w r)])) + (Nominal "#Mutable" [(-> w r)])) (with_template [<name> <type>] [(def .public <name> diff --git a/stdlib/source/library/lux/world/db/sql.lux b/stdlib/source/library/lux/world/db/sql.lux index 9a2e04dc8..dee4d034f 100644 --- a/stdlib/source/library/lux/world/db/sql.lux +++ b/stdlib/source/library/lux/world/db/sql.lux @@ -14,7 +14,7 @@ [macro ["[0]" template]]] [type - ["[0]" primitive (.except def)]]]]) + ["[0]" nominal (.except def)]]]]) (def parenthesize (-> Text Text) @@ -22,7 +22,7 @@ ... Kind (with_template [<declaration>] - [(primitive.def .public <declaration> Any)] + [(nominal.def .public <declaration> Any)] [Literal'] [Column'] @@ -63,7 +63,7 @@ (def .public no_alias Alias "") -(primitive.def .public (SQL kind) +(nominal.def .public (SQL kind) Text ... SQL diff --git a/stdlib/source/library/lux/world/environment.lux b/stdlib/source/library/lux/world/environment.lux index f391ea67c..42f8e8805 100644 --- a/stdlib/source/library/lux/world/environment.lux +++ b/stdlib/source/library/lux/world/environment.lux @@ -274,8 +274,8 @@ ... @.scheme ... (these (ffi.import (exit [Int] "io" Nothing)) ... ... https://srfi.schemers.org/srfi-98/srfi-98.html - ... (primitive.def Pair Any) - ... (primitive.def PList Any) + ... (nominal.def Pair Any) + ... (nominal.def PList Any) ... (ffi.import (get-environment-variables [] "io" PList)) ... (ffi.import (car [Pair] Text)) ... (ffi.import (cdr [Pair] Text)) diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux index 554d8c4f6..b27ffa2bc 100644 --- a/stdlib/source/library/lux/world/file.lux +++ b/stdlib/source/library/lux/world/file.lux @@ -512,7 +512,7 @@ @.python (these (type (Tuple/2 left right) - (Primitive "python_tuple[2]" [left right])) + (Nominal "python_tuple[2]" [left right])) (ffi.import PyFile "[1]::[0]" diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux index b8d07c7fc..22e4c7330 100644 --- a/stdlib/source/library/lux/world/file/watch.lux +++ b/stdlib/source/library/lux/world/file/watch.lux @@ -29,13 +29,13 @@ [meta ["@" target] [type - ["[0]" primitive (.only representation abstraction)]]] + ["[0]" nominal (.only representation abstraction)]]] [world [time ["[0]" instant (.only Instant) (.use "[1]#[0]" equivalence)]]]]] ["[0]" //]) -(primitive.def .public Concern +(nominal.def .public Concern (Record [#creation Bit #modification Bit diff --git a/stdlib/source/library/lux/world/locale.lux b/stdlib/source/library/lux/world/locale.lux index f42c19e20..72df452e4 100644 --- a/stdlib/source/library/lux/world/locale.lux +++ b/stdlib/source/library/lux/world/locale.lux @@ -12,12 +12,12 @@ ["[0]" encoding (.only Encoding)]]] [meta [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] [/ ["[0]" language (.only Language)] ["[0]" territory (.only Territory)]]) -(primitive.def .public Locale +(nominal.def .public Locale Text (def territory_separator "_") diff --git a/stdlib/source/library/lux/world/locale/language.lux b/stdlib/source/library/lux/world/locale/language.lux index 31fa44455..ef62ab9a5 100644 --- a/stdlib/source/library/lux/world/locale/language.lux +++ b/stdlib/source/library/lux/world/locale/language.lux @@ -10,10 +10,10 @@ [macro ["[0]" template]] [type - ["[0]" primitive (.except def #name)]]]]]) + ["[0]" nominal (.except def #name)]]]]]) ... https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes -(primitive.def .public Language +(nominal.def .public Language (Record [#name Text #code Text]) diff --git a/stdlib/source/library/lux/world/locale/territory.lux b/stdlib/source/library/lux/world/locale/territory.lux index bf33f64b6..5863a7e52 100644 --- a/stdlib/source/library/lux/world/locale/territory.lux +++ b/stdlib/source/library/lux/world/locale/territory.lux @@ -10,10 +10,10 @@ [macro ["[0]" template]] [type - ["[0]" primitive (.except def #name)]]]]]) + ["[0]" nominal (.except def #name)]]]]]) ... https://en.wikipedia.org/wiki/ISO_3166-1 -(primitive.def .public Territory +(nominal.def .public Territory (Record [#name Text #short Text diff --git a/stdlib/source/library/lux/world/net/http/cookie.lux b/stdlib/source/library/lux/world/net/http/cookie.lux index c8acede49..a07d0e114 100644 --- a/stdlib/source/library/lux/world/net/http/cookie.lux +++ b/stdlib/source/library/lux/world/net/http/cookie.lux @@ -21,7 +21,7 @@ ["i" int]]] [meta [type - ["[0]" primitive (.only)]]] + ["[0]" nominal (.only)]]] [world ["[0]" time (.only) ["[0]" day] @@ -130,13 +130,13 @@ [http_only "HttpOnly"] ) -(primitive.def .public CSRF_Policy +(nominal.def .public CSRF_Policy Text (with_template [<name> <value>] [(def .public <name> CSRF_Policy - (primitive.abstraction <value>))] + (nominal.abstraction <value>))] [strict "Strict"] [lax "Lax"] @@ -145,7 +145,7 @@ (def .public (same_site policy) (-> CSRF_Policy Attribute) - (..attribute (format "SameSite=" (primitive.representation policy)))) + (..attribute (format "SameSite=" (nominal.representation policy)))) ) (type .public Jar diff --git a/stdlib/source/library/lux/world/net/http/version.lux b/stdlib/source/library/lux/world/net/http/version.lux index 51eab0f59..b3a466cb7 100644 --- a/stdlib/source/library/lux/world/net/http/version.lux +++ b/stdlib/source/library/lux/world/net/http/version.lux @@ -8,28 +8,28 @@ ["[0]" text (.use "[1]#[0]" hash)]] [meta [type - ["[0]" primitive (.only)]]]]]) + ["[0]" nominal (.only)]]]]]) -(primitive.def .public Version +(nominal.def .public Version Text (def .public equivalence (Equivalence Version) (implementation (def (= reference it) - (text#= (primitive.representation reference) - (primitive.representation it))))) + (text#= (nominal.representation reference) + (nominal.representation it))))) (def .public hash (Hash Version) (implementation (def equivalence ..equivalence) - (def hash (|>> primitive.representation text#hash)))) + (def hash (|>> nominal.representation text#hash)))) (with_template [<name> <version>] [(def .public <name> Version - (primitive.abstraction <version>))] + (nominal.abstraction <version>))] [v0_9 "0.9"] [v1_0 "1.0"] diff --git a/stdlib/source/library/lux/world/net/mime.lux b/stdlib/source/library/lux/world/net/mime.lux index 409e13080..ab8b54c29 100644 --- a/stdlib/source/library/lux/world/net/mime.lux +++ b/stdlib/source/library/lux/world/net/mime.lux @@ -10,18 +10,18 @@ ["[0]" encoding (.only Encoding)]]] [meta [type - ["[0]" primitive]]]]]) + ["[0]" nominal]]]]]) -(primitive.def .public MIME +(nominal.def .public MIME Text (def .public mime (-> Text MIME) - (|>> primitive.abstraction)) + (|>> nominal.abstraction)) (def .public name (-> MIME Text) - (|>> primitive.representation)) + (|>> nominal.representation)) (def .public equivalence (Equivalence MIME) diff --git a/stdlib/source/library/lux/world/net/uri/scheme.lux b/stdlib/source/library/lux/world/net/uri/scheme.lux index aabe810b1..108254cc2 100644 --- a/stdlib/source/library/lux/world/net/uri/scheme.lux +++ b/stdlib/source/library/lux/world/net/uri/scheme.lux @@ -8,16 +8,16 @@ ["[0]" text]] [meta [type - ["[0]" primitive (.only)]]]]]) + ["[0]" nominal (.only)]]]]]) ... https://en.wikipedia.org/wiki/List_of_URI_schemes -(primitive.def .public Scheme +(nominal.def .public Scheme Text (with_template [<scheme> <name>] [(def .public <name> Scheme - (primitive.abstraction <scheme>))] + (nominal.abstraction <scheme>))] ["about" about] ["acap" acap] @@ -125,11 +125,11 @@ (def .public scheme (-> Text Scheme) - (|>> primitive.abstraction)) + (|>> nominal.abstraction)) (def .public name (-> Scheme Text) - (|>> primitive.representation)) + (|>> nominal.representation)) (def .public equivalence (Equivalence Scheme) diff --git a/stdlib/source/library/lux/world/time.lux b/stdlib/source/library/lux/world/time.lux index a1e2cea24..0848dbbb8 100644 --- a/stdlib/source/library/lux/world/time.lux +++ b/stdlib/source/library/lux/world/time.lux @@ -20,7 +20,7 @@ ["n" nat (.use "[1]#[0]" decimal)]]] [meta [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] [/ ["[0]" duration (.only Duration)]]) @@ -79,7 +79,7 @@ [..seconds second_parser invalid_second ..section_parser] ) -(primitive.def .public Time +(nominal.def .public Time Nat (def .public midnight diff --git a/stdlib/source/library/lux/world/time/date.lux b/stdlib/source/library/lux/world/time/date.lux index cf6906bee..efa497d60 100644 --- a/stdlib/source/library/lux/world/time/date.lux +++ b/stdlib/source/library/lux/world/time/date.lux @@ -24,7 +24,7 @@ ["i" int]]] [meta [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] ["[0]" // ["[1][0]" year (.only Year)] ["[1][0]" month (.only Month)]]) @@ -69,7 +69,7 @@ (def separator "-") -(primitive.def .public Date +(nominal.def .public Date (Record [#year Year #month Month diff --git a/stdlib/source/library/lux/world/time/duration.lux b/stdlib/source/library/lux/world/time/duration.lux index 3aca1d203..627348295 100644 --- a/stdlib/source/library/lux/world/time/duration.lux +++ b/stdlib/source/library/lux/world/time/duration.lux @@ -20,11 +20,11 @@ ["[0]" nat (.use "[1]#[0]" decimal)]]] [meta [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] ["[0]" // ["[1][0]" year]]) -(primitive.def .public Duration +(nominal.def .public Duration Int (def .public of_millis diff --git a/stdlib/source/library/lux/world/time/instant.lux b/stdlib/source/library/lux/world/time/instant.lux index db49c57c6..a7b55a416 100644 --- a/stdlib/source/library/lux/world/time/instant.lux +++ b/stdlib/source/library/lux/world/time/instant.lux @@ -23,7 +23,7 @@ [meta ["@" target] [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] ["[0]" // (.only Time) ["[0]" duration (.only Duration)] ["[0]" year (.only Year)] @@ -31,7 +31,7 @@ ["[0]" day (.only Day)] ["[0]" date (.only Date)]]) -(primitive.def .public Instant +(nominal.def .public Instant Int (def .public of_millis @@ -161,7 +161,7 @@ (io (..of_millis (for @.old ("jvm invokestatic:java.lang.System:currentTimeMillis:") @.jvm (|> (.jvm_member_invoke_static# [] "java.lang.System" "currentTimeMillis" []) .jvm_object_cast# - (is (Primitive "java.lang.Long")) + (is (Nominal "java.lang.Long")) (as Int)) @.js (let [date ("js object new" ("js constant" "Date") [])] (|> ("js object do" "getTime" date []) diff --git a/stdlib/source/library/lux/world/time/solar.lux b/stdlib/source/library/lux/world/time/solar.lux index 8c4ffa315..26163e511 100644 --- a/stdlib/source/library/lux/world/time/solar.lux +++ b/stdlib/source/library/lux/world/time/solar.lux @@ -16,7 +16,7 @@ [meta ["@" target] [type - ["[0]" primitive (.except def)]]]]] + ["[0]" nominal (.except def)]]]]] ["[0]" // ["[1]" instant] ["[0]" duration (.only Duration)]]) @@ -24,7 +24,7 @@ (type .public Zone Text) -(primitive.def .public Instant +(nominal.def .public Instant (Record [#utc //.Instant #zone Zone diff --git a/stdlib/source/library/lux/world/time/year.lux b/stdlib/source/library/lux/world/time/year.lux index 3dd0c9960..e53b84463 100644 --- a/stdlib/source/library/lux/world/time/year.lux +++ b/stdlib/source/library/lux/world/time/year.lux @@ -19,7 +19,7 @@ ["i" int (.use "[1]#[0]" decimal)]]] [meta [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) (def (internal year) (-> Int Int) @@ -36,7 +36,7 @@ (exception.def .public there_is_no_year_0) ... https://en.wikipedia.org/wiki/Gregorian_calendar -(primitive.def .public Year +(nominal.def .public Year Int (def .public (year value) diff --git a/stdlib/source/parser/lux/data/binary.lux b/stdlib/source/parser/lux/data/binary.lux index 7ed8a1fdd..2aad65ba1 100644 --- a/stdlib/source/parser/lux/data/binary.lux +++ b/stdlib/source/parser/lux/data/binary.lux @@ -274,16 +274,16 @@ (let [pair (//.and type type) indexed ..nat quantified (//.and (..list type) type)] - (!variant [[0 [.#Primitive] (//.and ..text (..list type))] - [1 [.#Sum] pair] - [2 [.#Product] pair] - [3 [.#Function] pair] - [4 [.#Parameter] indexed] - [5 [.#Var] indexed] - [6 [.#Ex] indexed] - [7 [.#UnivQ] quantified] - [8 [.#ExQ] quantified] - [9 [.#Apply] pair] + (!variant [[00 [.#Nominal] (//.and ..text (..list type))] + [01 [.#Sum] pair] + [02 [.#Product] pair] + [03 [.#Function] pair] + [04 [.#Parameter] indexed] + [05 [.#Var] indexed] + [06 [.#Ex] indexed] + [07 [.#UnivQ] quantified] + [08 [.#ExQ] quantified] + [09 [.#Apply] pair] [10 [.#Named] (//.and ..symbol type)]]))))) (def .public location diff --git a/stdlib/source/parser/lux/meta/type.lux b/stdlib/source/parser/lux/meta/type.lux index 1dec4fbb1..f84ab2452 100644 --- a/stdlib/source/parser/lux/meta/type.lux +++ b/stdlib/source/parser/lux/meta/type.lux @@ -27,7 +27,7 @@ (def |recursion_dummy| (template (|recursion_dummy|) - [{.#Primitive "" {.#End}}])) + [{.#Nominal "" {.#End}}])) (with_template [<name>] [(exception.def .public (<name> type) diff --git a/stdlib/source/program/aedifex/artifact/time/date.lux b/stdlib/source/program/aedifex/artifact/time/date.lux index 43b5efe6e..ed3cff954 100644 --- a/stdlib/source/program/aedifex/artifact/time/date.lux +++ b/stdlib/source/program/aedifex/artifact/time/date.lux @@ -18,7 +18,7 @@ ["i" int]]] [meta [type - ["[0]" primitive (.except def)]]] + ["[0]" nominal (.except def)]]] [world [time ["[0]" date (.use "[1]#[0]" equivalence)] @@ -41,7 +41,7 @@ ["Maximum" (%.int ..max_year)] ["Year" (%.int (year.value year))]))) -(primitive.def .public Date +(nominal.def .public Date date.Date (def .public epoch diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux index fbbe69825..8b0922916 100644 --- a/stdlib/source/program/aedifex/hash.lux +++ b/stdlib/source/program/aedifex/hash.lux @@ -22,7 +22,7 @@ [macro ["^" pattern]] [type - ["[0]" primitive (.except def)]]]]]) + ["[0]" nominal (.except def)]]]]]) ... TODO: Replace with pure-Lux implementations of these algorithms ... https://en.wikipedia.org/wiki/SHA-1#SHA-1_pseudocode @@ -35,10 +35,10 @@ ("static" getInstance [java/lang/String] java/security/MessageDigest) (digest [[byte]] [byte])) -(primitive.def .public SHA1 Any) -(primitive.def .public MD5 Any) +(nominal.def .public SHA1 Any) +(nominal.def .public MD5 Any) -(primitive.def .public (Hash h) +(nominal.def .public (Hash h) Binary (def .public data diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index 29e2725cf..f009922e8 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -587,9 +587,9 @@ (same? expected))) (_.coverage [/.type_of] (same? /.Nat (/.type_of expected))) - (_.coverage [/.Primitive] - (when (/.Primitive "foo" [expected/0 expected/1]) - {.#Primitive "foo" (list actual/0 actual/1)} + (_.coverage [/.Nominal] + (when (/.Nominal "foo" [expected/0 expected/1]) + {.#Nominal "foo" (list actual/0 actual/1)} (and (same? expected/0 actual/0) (same? expected/1 actual/1)) diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux index bbffbd0a3..a923891aa 100644 --- a/stdlib/source/test/lux/data/collection/array.lux +++ b/stdlib/source/test/lux/data/collection/array.lux @@ -155,11 +155,11 @@ (_.coverage [!.empty !.size] (n.= size (!.size (is (Array Nat) (!.empty size))))) - (_.coverage [!.primitive] + (_.coverage [!.nominal] (when !.Array (<| {.#Named (symbol !.Array)} {.#UnivQ (list)} - {.#Primitive !.primitive (list _)}) + {.#Nominal !.nominal (list _)}) true _ @@ -323,12 +323,12 @@ (_.coverage [/.empty /.size] (n.= size (/.size (is (Array Nat) (/.empty size))))) - (_.coverage [/.primitive] + (_.coverage [/.nominal] (when /.Array (<| {.#Named (symbol /.Array)} {.#Named (symbol !.Array)} {.#UnivQ (list)} - {.#Primitive /.primitive (list _)}) + {.#Nominal /.nominal (list _)}) true _ diff --git a/stdlib/source/test/lux/data/color.lux b/stdlib/source/test/lux/data/color.lux index 7434e8c15..8198800e6 100644 --- a/stdlib/source/test/lux/data/color.lux +++ b/stdlib/source/test/lux/data/color.lux @@ -21,10 +21,12 @@ ["_" property (.only Test)]]]] [\\library ["[0]" / (.only) - ["[0]" rgb]]] + ["[0]" rgb] + ["[0]" hsl]]] ["[0]" / ["[1][0]" rgb] ["[1][0]" cmyk] + ["[1][0]" hsl] ["[1][0]" named] ["[1][0]" terminal]]) @@ -63,14 +65,15 @@ (def rgb_error_margin +1.8) -(with_template [<field>] - [(def (<field> color) +(with_template [<name> <field>] + [(def <name> (-> /.Color Frac) - (let [[hue saturation luminance] (/.hsl color)] - <field>))] + (|>> /.rgb + hsl.of_rgb + <field>))] - [saturation] - [luminance] + [saturation hsl.saturation] + [luminance hsl.luminance] ) (def (encoding expected) @@ -79,10 +82,6 @@ (_.coverage [/.rgb /.of_rgb] (|> expected /.rgb /.of_rgb (at /.equivalence = expected))) - (_.coverage [/.HSL /.hsl /.of_hsl] - (|> expected /.hsl /.of_hsl - (distance/3 expected) - (f.<= ..rgb_error_margin))) (_.coverage [/.HSB /.hsb /.of_hsb] (|> expected /.hsb /.of_hsb (distance/3 expected) @@ -215,6 +214,7 @@ /rgb.test /cmyk.test + /hsl.test /named.test /terminal.test )))) diff --git a/stdlib/source/test/lux/data/color/hsl.lux b/stdlib/source/test/lux/data/color/hsl.lux new file mode 100644 index 000000000..b3221e03b --- /dev/null +++ b/stdlib/source/test/lux/data/color/hsl.lux @@ -0,0 +1,89 @@ +(.require + [library + [lux (.except) + [abstract + [monad (.only do)] + [\\specification + ["[0]S" equivalence]]] + [control + ["[0]" try (.use "[1]#[0]" functor)] + ["[0]" exception]] + [math + ["[0]" random (.only Random)] + [number + ["f" frac]]] + [test + ["_" property (.only Test)]]]] + [\\library + ["[0]" / (.only) + [// + ["[0]" rgb]]]] + [// + ["[0]T" rgb]]) + +(def .public value + (Random /.Value) + (random.one (|>> /.value try.maybe) + random.safe_frac)) + +(def .public random + (Random /.HSL) + (do random.monad + [hue ..value + saturation ..value + luminance ..value] + (random.one (|>> try.maybe) + (in (/.hsl hue saturation luminance))))) + +(def .public test + Test + (<| (_.covering /._) + (do [! random.monad] + [expected_value ..value + expected_rgb rgbT.random + expected_hsl ..random]) + (all _.and + (_.for [/.Value] + (all _.and + (_.coverage [/.value] + (|> expected_value + /.value + (try#each (f.= expected_value)) + (try.else false))) + (_.coverage [/.least] + (when (/.value (f.+ +0.001 /.least)) + {try.#Failure _} false + {try.#Success _} true)) + (_.coverage [/.most] + (when (/.value (f.- +0.001 /.most)) + {try.#Failure _} false + {try.#Success _} true)) + (_.coverage [/.invalid] + (and (when (/.value (f.- +0.001 /.least)) + {try.#Failure it} (exception.match? /.invalid it) + {try.#Success _} false) + (when (/.value (f.+ +0.001 /.most)) + {try.#Failure it} (exception.match? /.invalid it) + {try.#Success _} false))) + )) + (_.for [/.HSL] + (all _.and + (_.for [/.equivalence] + (equivalenceS.spec /.equivalence ..random)) + + (_.coverage [/.hsl + /.hue /.saturation /.luminance] + (|> (/.hsl (/.hue expected_hsl) (/.saturation expected_hsl) (/.luminance expected_hsl)) + (try#each (at /.equivalence = expected_hsl)) + (try.else false))) + (_.coverage [/.of_rgb /.rgb] + (and (|> expected_rgb + /.of_rgb + /.rgb + (at rgb.equivalence = expected_rgb)) + (|> expected_hsl + /.rgb + /.of_rgb + (at /.equivalence = expected_hsl)))) + )) + ))) diff --git a/stdlib/source/test/lux/ffi.old.lux b/stdlib/source/test/lux/ffi.old.lux index 5feb469ec..e3ea06d48 100644 --- a/stdlib/source/test/lux/ffi.old.lux +++ b/stdlib/source/test/lux/ffi.old.lux @@ -235,9 +235,9 @@ test/lux/ffi/TestInterface::current (i.= (i.+ increase counter)))) (_.coverage [/.type] - (and (type#= (Primitive "java.lang.Char") + (and (type#= (Nominal "java.lang.Char") (/.type java/lang/Char)) - (type#= (Primitive "java.util.List" [(Primitive "java.lang.Byte")]) + (type#= (Nominal "java.util.List" [(Nominal "java.lang.Byte")]) (/.type (java/util/List java/lang/Byte))))) ))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/inference.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/inference.lux index 21fb6b1df..0cfac766e 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/inference.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/inference.lux @@ -63,11 +63,11 @@ configuration ($configuration.random 5)] (in (//.state (//.info version host configuration))))) -(def primitive +(def nominal (Random Type) (do random.monad [name (random.lower_cased 1)] - (in {.#Primitive name (list)}))) + (in {.#Nominal name (list)}))) (def analysis //.Phase @@ -103,7 +103,7 @@ [lux ..random_state .let [state [/extension.#bundle (/extension/analysis.bundle ..eval) /extension.#state lux]] - expected ..primitive + expected ..nominal name ($symbol.random 1 1) [type/0 term/0] ..simple_parameter arity (at ! each (n.% 10) random.nat) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/module.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/module.lux index da666f219..26dd79c7b 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/module.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/module.lux @@ -36,11 +36,11 @@ configuration ($configuration.random 5)] (in (//.state (//.info version host configuration))))) -(def primitive +(def nominal (Random Type) (do random.monad [name (random.lower_cased 1)] - (in {.#Primitive name (list)}))) + (in {.#Nominal name (list)}))) (def (new? hash it) (-> Nat .Module Bit) @@ -199,7 +199,7 @@ alias_name (random.lower_cased 3) public? random.bit - def_type ..primitive + def_type ..nominal arity (at ! each (|>> (n.% 10) ++) random.nat) labels|head (random.lower_cased 1) labels|tail (|> (random.lower_cased 1) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/type.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/type.lux index c6b2fcb7c..9699f635d 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/type.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/type.lux @@ -35,11 +35,11 @@ configuration ($configuration.random 5)] (in (//.state (//.info version host configuration))))) -(def primitive +(def nominal (Random Type) (do random.monad [name (random.lower_cased 1)] - (in {.#Primitive name (list)}))) + (in {.#Nominal name (list)}))) (def .public test Test @@ -48,9 +48,9 @@ [lux ..random_state .let [state [/extension.#bundle /extension.empty /extension.#state lux]] - expected ..primitive + expected ..nominal dummy (random.only (|>> (type#= expected) not) - ..primitive) + ..nominal) module (random.lower_cased 1)] (all _.and (_.coverage [/.expecting /.inference] diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/complex.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/complex.lux index 0fb6d9f54..829452717 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/complex.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/analysis/complex.lux @@ -69,11 +69,11 @@ configuration ($configuration.random 5)] (in (//analysis.state (//analysis.info version host configuration))))) -(def primitive +(def nominal (Random Type) (do random.monad [name (random.lower_cased 1)] - (in {.#Primitive name (list)}))) + (in {.#Nominal name (list)}))) (def analysis //analysis.Phase diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux index 8d9aebda6..258333074 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except i64 int primitive) + [lux (.except i64 int) [abstract ["[0]" monad (.only do)]] [data diff --git a/stdlib/source/test/lux/meta/target/jvm.lux b/stdlib/source/test/lux/meta/target/jvm.lux index b5039dcaf..514eecf1f 100644 --- a/stdlib/source/test/lux/meta/target/jvm.lux +++ b/stdlib/source/test/lux/meta/target/jvm.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Type Primitive Label int) + [lux (.except Type Label int) ["[0]" ffi (.only import)] [abstract ["[0]" monad (.only do)]] diff --git a/stdlib/source/test/lux/meta/type.lux b/stdlib/source/test/lux/meta/type.lux index 50cccc419..8c7e6cd9c 100644 --- a/stdlib/source/test/lux/meta/type.lux +++ b/stdlib/source/test/lux/meta/type.lux @@ -33,7 +33,7 @@ [\\library ["[0]" / (.use "[1]#[0]" equivalence)]] ["[0]" / - ["[1][0]" primitive] + ["[1][0]" nominal] ["[1][0]" check] ["[1][0]" dynamic] ["[1][0]" implicit] @@ -54,19 +54,19 @@ _ false)])) -(def primitive +(def nominal (Random Type) (|> (random.alpha_numeric 1) (at random.monad each (function (_ name) - {.#Primitive name (list)})))) + {.#Nominal name (list)})))) (def test|matches Test (<| (_.for [\\parser.types_do_not_match]) (do [! random.monad] - [expected ..primitive + [expected ..nominal dummy (random.only (|>> (/#= expected) not) - ..primitive)]) + ..nominal)]) (all _.and (_.coverage [\\parser.exactly] (and (|> (\\parser.result (\\parser.exactly expected) expected) @@ -99,9 +99,9 @@ (def test|aggregate Test (do [! random.monad] - [expected_left ..primitive - expected_middle ..primitive - expected_right ..primitive] + [expected_left ..nominal + expected_middle ..nominal + expected_right ..nominal] (`` (all _.and (,, (with_template [<parser> <exception> <good_constructor> <bad_constructor>] [(_.coverage [<parser> <exception>] @@ -147,9 +147,9 @@ (def test|parameter Test (do random.monad - [quantification ..primitive - argument ..primitive - not_parameter ..primitive + [quantification ..nominal + argument ..nominal + not_parameter ..nominal parameter random.nat] (all _.and (_.coverage [\\parser.not_parameter] @@ -208,7 +208,7 @@ (def test|polymorphic Test (do [! random.monad] - [not_polymorphic ..primitive + [not_polymorphic ..nominal expected_inputs (at ! each (|>> (n.% 10) ++) random.nat)] (all _.and (_.coverage [\\parser.not_polymorphic] @@ -231,7 +231,7 @@ (def test|recursive Test (do random.monad - [expected ..primitive] + [expected ..nominal] (all _.and (_.coverage [\\parser.recursive] (|> (.type_literal (Rec @ expected)) @@ -264,13 +264,13 @@ (_.for [\\parser.Parser]) (all _.and (do [! random.monad] - [expected ..primitive] + [expected ..nominal] (_.coverage [\\parser.result \\parser.any] (|> (\\parser.result \\parser.any expected) (!expect (^.multi {try.#Success actual} (/#= expected actual)))))) (do [! random.monad] - [expected ..primitive] + [expected ..nominal] (_.coverage [\\parser.next \\parser.unconsumed_input] (and (|> (\\parser.result (do <>.monad [actual \\parser.next @@ -283,7 +283,7 @@ (!expect (^.multi {try.#Failure error} (exception.match? \\parser.unconsumed_input error))))))) (do [! random.monad] - [expected ..primitive] + [expected ..nominal] (_.coverage [\\parser.empty_input] (`` (and (,, (with_template [<parser>] [(|> (\\parser.result (do <>.monad @@ -297,7 +297,7 @@ [\\parser.next] )))))) (do [! random.monad] - [expected ..primitive] + [expected ..nominal] (_.coverage [\\parser.Env \\parser.env \\parser.fresh] (|> (\\parser.result (do <>.monad [env \\parser.env @@ -307,9 +307,9 @@ (!expect (^.multi {try.#Success environment} (same? \\parser.fresh environment)))))) (do [! random.monad] - [expected ..primitive + [expected ..nominal dummy (random.only (|>> (/#= expected) not) - ..primitive)] + ..nominal)] (_.coverage [\\parser.local] (|> (\\parser.result (do <>.monad [_ \\parser.any] @@ -328,7 +328,7 @@ (do [! random.monad] [expected_name (random.and (random.alpha_numeric 1) (random.alpha_numeric 1)) - expected_type ..primitive] + expected_type ..nominal] (_.coverage [\\parser.named \\parser.not_named] (|> (\\parser.result \\parser.named {.#Named expected_name expected_type}) @@ -359,9 +359,9 @@ (let [pairG (random.and again again) un_parameterized (is (Random Type) (all random.either - (random#each (|>> {.#Primitive}) (random.and ..short (random.list 0 again))) - (random#each (|>> {.#Primitive}) (random.and ..short (random.list 1 again))) - (random#each (|>> {.#Primitive}) (random.and ..short (random.list 2 again))) + (random#each (|>> {.#Nominal}) (random.and ..short (random.list 0 again))) + (random#each (|>> {.#Nominal}) (random.and ..short (random.list 1 again))) + (random#each (|>> {.#Nominal}) (random.and ..short (random.list 2 again))) (random#each (|>> {.#Sum}) pairG) (random#each (|>> {.#Product}) pairG) (random#each (|>> {.#Function}) pairG) @@ -491,8 +491,8 @@ element_type (|> (..random 0) (random.only (function (_ type) (when type - {.#Primitive name (list element_type)} - (not (text#= array.primitive name)) + {.#Nominal name (list element_type)} + (not (text#= array.nominal name)) _ true)))) @@ -563,7 +563,7 @@ ..\\parser - /primitive.test + /nominal.test /check.test /dynamic.test /implicit.test diff --git a/stdlib/source/test/lux/meta/type/check.lux b/stdlib/source/test/lux/meta/type/check.lux index 05b6dcba4..5fd953e73 100644 --- a/stdlib/source/test/lux/meta/type/check.lux +++ b/stdlib/source/test/lux/meta/type/check.lux @@ -61,7 +61,7 @@ random_quantified (random.either (random#each (|>> {.#UnivQ}) quantifiedG) (random#each (|>> {.#ExQ}) quantifiedG))] (all random.either - (random#each (|>> {.#Primitive}) (random.and ..short (random#in (list)))) + (random#each (|>> {.#Nominal}) (random.and ..short (random#in (list)))) random_pair random_id random_quantified @@ -75,7 +75,7 @@ (def (valid_type? type) (-> Type Bit) (when type - {.#Primitive name params} + {.#Nominal name params} (list.every? valid_type? params) {.#Ex id} @@ -118,16 +118,16 @@ ($monad.spec ..injection ..comparison /.monad)) )) -(def (primitive_type parameters) +(def (nominal_type parameters) (-> Nat (Random Type)) (do random.monad - [primitive (random.upper_cased 3) - parameters (random.list parameters (primitive_type (-- parameters)))] - (in {.#Primitive primitive parameters}))) + [nominal (random.upper_cased 3) + parameters (random.list parameters (nominal_type (-- parameters)))] + (in {.#Nominal nominal parameters}))) (def clean_type (Random Type) - (primitive_type 2)) + (nominal_type 2)) (exception.def yolo) @@ -214,7 +214,7 @@ (when (/.result /.fresh_context (do /.monad [[var_id var_type] /.var - _ (/.bind {.#Primitive nominal (list)} + _ (/.bind {.#Nominal nominal (list)} var_id)] (in true))) {try.#Success _} true @@ -225,7 +225,7 @@ (and (|> (do /.monad [[var_id var_type] /.var pre (/.bound? var_id) - _ (/.bind {.#Primitive nominal (list)} + _ (/.bind {.#Nominal nominal (list)} var_id) post (/.bound? var_id)] (in (and (not pre) @@ -248,9 +248,9 @@ (when (/.result /.fresh_context (do /.monad [[var_id var_type] /.var - _ (/.bind {.#Primitive nominal (list)} + _ (/.bind {.#Nominal nominal (list)} var_id)] - (/.bind {.#Primitive nominal (list)} + (/.bind {.#Nominal nominal (list)} var_id))) {try.#Success _} false @@ -262,7 +262,7 @@ var_id random.nat] (_.coverage [/.unknown_type_var] (when (/.result /.fresh_context - (/.bind {.#Primitive nominal (list)} + (/.bind {.#Nominal nominal (list)} var_id)) {try.#Success _} false @@ -271,7 +271,7 @@ (exception.match? /.unknown_type_var error)))) (do random.monad [nominal (random.upper_cased 10) - .let [expected {.#Primitive nominal (list)}]] + .let [expected {.#Nominal nominal (list)}]] (_.coverage [/.peek] (and (|> (do /.monad [[var_id var_type] /.var] @@ -299,7 +299,7 @@ false))))) (do random.monad [nominal (random.upper_cased 10) - .let [expected {.#Primitive nominal (list)}]] + .let [expected {.#Nominal nominal (list)}]] (_.coverage [/.read] (when (/.result /.fresh_context (do /.monad @@ -313,7 +313,7 @@ false))) (do random.monad [nominal (random.upper_cased 10) - .let [expected {.#Primitive nominal (list)}]] + .let [expected {.#Nominal nominal (list)}]] (_.coverage [/.unbound_type_var] (when (/.result /.fresh_context (do /.monad @@ -383,7 +383,7 @@ (Random Type) (do random.monad [name (random.upper_cased 10)] - (in {.#Primitive name (list)}))) + (in {.#Nominal name (list)}))) (def (non_twins = random) (All (_ a) (-> (-> a a Bit) (Random a) (Random [a a]))) @@ -401,22 +401,22 @@ (def (handles_nominal_types! name/0 name/1 parameter/0 parameter/1) (-> Text Text Type Type Bit) (let [names_matter! - (and (..succeeds? (/.check {.#Primitive name/0 (list)} - {.#Primitive name/0 (list)})) - (..fails? (/.check {.#Primitive name/0 (list)} - {.#Primitive name/1 (list)}))) + (and (..succeeds? (/.check {.#Nominal name/0 (list)} + {.#Nominal name/0 (list)})) + (..fails? (/.check {.#Nominal name/0 (list)} + {.#Nominal name/1 (list)}))) parameters_matter! - (and (..succeeds? (/.check {.#Primitive name/0 (list parameter/0)} - {.#Primitive name/0 (list parameter/0)})) - (..fails? (/.check {.#Primitive name/0 (list parameter/0)} - {.#Primitive name/0 (list parameter/1)}))) + (and (..succeeds? (/.check {.#Nominal name/0 (list parameter/0)} + {.#Nominal name/0 (list parameter/0)})) + (..fails? (/.check {.#Nominal name/0 (list parameter/0)} + {.#Nominal name/0 (list parameter/1)}))) covariant_parameters! - (and (..succeeds? (/.check {.#Primitive name/0 (list Super)} - {.#Primitive name/0 (list Sub)})) - (..fails? (/.check {.#Primitive name/0 (list Sub)} - {.#Primitive name/0 (list Super)})))] + (and (..succeeds? (/.check {.#Nominal name/0 (list Super)} + {.#Nominal name/0 (list Sub)})) + (..fails? (/.check {.#Nominal name/0 (list Sub)} + {.#Nominal name/0 (list Super)})))] (and names_matter! parameters_matter! covariant_parameters!))) @@ -424,8 +424,8 @@ (with_template [<assertion> <combinator>] [(def (<assertion> name/0 name/1) (-> Text Text Bit) - (let [pair/0 {<combinator> {.#Primitive name/0 (list)} {.#Primitive name/0 (list)}} - pair/1 {<combinator> {.#Primitive name/1 (list)} {.#Primitive name/1 (list)}} + (let [pair/0 {<combinator> {.#Nominal name/0 (list)} {.#Nominal name/0 (list)}} + pair/1 {<combinator> {.#Nominal name/1 (list)} {.#Nominal name/1 (list)}} invariant! (and (..succeeds? (/.check pair/0 pair/0)) @@ -713,7 +713,7 @@ [name (random.upper_cased 10) parameterT dirty_type] (in (function (_ holeT) - {.#Primitive name (list (parameterT holeT))}))) + {.#Nominal name (list (parameterT holeT))}))) (,, (with_template [<tag>] [(do [! random.monad] [funcT dirty_type @@ -765,18 +765,18 @@ (def for_subsumption|nominal (Random Bit) (do random.monad - [primitive (random.upper_cased 10) + [nominal (random.upper_cased 10) example ..clean_type] - (in (and (/.subsumes? {.#Primitive primitive (list)} - {.#Primitive primitive (list)}) - (/.subsumes? {.#Primitive primitive (list .Any)} - {.#Primitive primitive (list example)}) - (not (/.subsumes? {.#Primitive primitive (list example)} - {.#Primitive primitive (list .Any)})) - (/.subsumes? {.#Primitive primitive (list example)} - {.#Primitive primitive (list .Nothing)}) - (not (/.subsumes? {.#Primitive primitive (list .Nothing)} - {.#Primitive primitive (list example)})) + (in (and (/.subsumes? {.#Nominal nominal (list)} + {.#Nominal nominal (list)}) + (/.subsumes? {.#Nominal nominal (list .Any)} + {.#Nominal nominal (list example)}) + (not (/.subsumes? {.#Nominal nominal (list example)} + {.#Nominal nominal (list .Any)})) + (/.subsumes? {.#Nominal nominal (list example)} + {.#Nominal nominal (list .Nothing)}) + (not (/.subsumes? {.#Nominal nominal (list .Nothing)} + {.#Nominal nominal (list example)})) )))) (def for_subsumption|sum diff --git a/stdlib/source/test/lux/meta/type/primitive.lux b/stdlib/source/test/lux/meta/type/nominal.lux index c0bf30297..c0bf30297 100644 --- a/stdlib/source/test/lux/meta/type/primitive.lux +++ b/stdlib/source/test/lux/meta/type/nominal.lux diff --git a/stdlib/source/test/lux/world/net.lux b/stdlib/source/test/lux/world/net.lux index ddcd8dcfd..13fb27295 100644 --- a/stdlib/source/test/lux/world/net.lux +++ b/stdlib/source/test/lux/world/net.lux @@ -24,7 +24,8 @@ true) (_.coverage [/.URL] true) - (_.coverage [/.Address] + (_.coverage [/.Address + /.#host /.#port] true) /mime.test diff --git a/stdlib/source/unsafe/lux/data/binary.lux b/stdlib/source/unsafe/lux/data/binary.lux index 83a6df975..fd68e39e0 100644 --- a/stdlib/source/unsafe/lux/data/binary.lux +++ b/stdlib/source/unsafe/lux/data/binary.lux @@ -43,11 +43,11 @@ @.python (type .public Binary - (Primitive "bytearray")) + (Nominal "bytearray")) @.scheme (these (type .public Binary - (Primitive "bytevector")) + (Nominal "bytevector")) (ffi.import (make-bytevector [Nat] Binary)) (ffi.import (bytevector-u8-ref [Binary Nat] I64)) @@ -201,7 +201,7 @@ (.as .Int <value>) (,, (.static @.jvm)) - (.as (.Primitive "java.lang.Long") <value>) + (.as (.Nominal "java.lang.Long") <value>) <value>)) <jvm_value> <jvm_value> <jvm_value> (ffi.long_to_byte <jvm_value>) diff --git a/stdlib/source/unsafe/lux/data/collection/array.lux b/stdlib/source/unsafe/lux/data/collection/array.lux index 8c1d0ce47..184be69cf 100644 --- a/stdlib/source/unsafe/lux/data/collection/array.lux +++ b/stdlib/source/unsafe/lux/data/collection/array.lux @@ -11,19 +11,19 @@ [type ["[0]" variance]]]]]) -(def .public primitive +(def .public nominal "#Array") (with_template [<item> <array>] [(.type .public <array> - {.#Primitive ..primitive {.#Item <item> {.#End}}})] + {.#Nominal ..nominal {.#Item <item> {.#End}}})] [(variance.Mutable r w) (Array' r w)] [(variance.Mutable a a) (Array a)] ) -(with_expansions [<index_type> (.Primitive "java.lang.Long") - <item_type> (.Primitive "java.lang.Object")] +(with_expansions [<index_type> (.Nominal "java.lang.Long") + <item_type> (.Nominal "java.lang.Object")] (for @.jvm (def jvm_int (template (jvm_int value) [(.|> value |