From 224797231a8144f6ead1baab3b4b01a74cab629c Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 21 Nov 2022 16:40:51 -0400 Subject: Added index section to documentation + re-named Primitive -> Nominal --- stdlib/source/library/lux.lux | 78 ++++----- .../library/lux/control/concurrency/actor.lux | 4 +- .../library/lux/control/concurrency/async.lux | 4 +- .../library/lux/control/concurrency/atom.lux | 4 +- .../lux/control/concurrency/incremental.lux | 6 +- .../library/lux/control/concurrency/semaphore.lux | 8 +- .../source/library/lux/control/concurrency/stm.lux | 4 +- .../library/lux/control/concurrency/structured.lux | 6 +- .../lux/control/function/polymorphism/context.lux | 4 +- stdlib/source/library/lux/control/io.lux | 4 +- stdlib/source/library/lux/control/lazy.lux | 4 +- .../library/lux/control/security/capability.lux | 6 +- .../source/library/lux/control/security/policy.lux | 6 +- stdlib/source/library/lux/control/thread.lux | 4 +- .../source/library/lux/data/collection/array.lux | 4 +- .../library/lux/data/collection/queue/priority.lux | 4 +- .../library/lux/data/collection/set/multi.lux | 4 +- .../library/lux/data/collection/set/ordered.lux | 4 +- .../source/library/lux/data/collection/stack.lux | 4 +- .../library/lux/data/collection/tree/finger.lux | 4 +- stdlib/source/library/lux/data/color.lux | 192 +++++++-------------- stdlib/source/library/lux/data/color/cmyk.lux | 42 ++--- stdlib/source/library/lux/data/color/hsl.lux | 184 ++++++++++++++++++++ stdlib/source/library/lux/data/color/rgb.lux | 36 ++-- stdlib/source/library/lux/data/color/terminal.lux | 16 +- stdlib/source/library/lux/data/format/css.lux | 8 +- .../source/library/lux/data/format/css/class.lux | 4 +- stdlib/source/library/lux/data/format/css/id.lux | 4 +- .../library/lux/data/format/css/property.lux | 4 +- .../source/library/lux/data/format/css/query.lux | 8 +- .../library/lux/data/format/css/selector.lux | 16 +- .../source/library/lux/data/format/css/style.lux | 4 +- .../source/library/lux/data/format/css/value.lux | 18 +- stdlib/source/library/lux/data/format/html.lux | 10 +- stdlib/source/library/lux/data/format/markdown.lux | 106 +++++++----- stdlib/source/library/lux/data/format/tar.lux | 16 +- stdlib/source/library/lux/data/text.lux | 26 +-- stdlib/source/library/lux/data/text/buffer.lux | 4 +- stdlib/source/library/lux/data/text/encoding.lux | 4 +- .../source/library/lux/data/text/unicode/block.lux | 4 +- .../source/library/lux/data/text/unicode/set.lux | 4 +- stdlib/source/library/lux/debug.lux | 2 +- stdlib/source/library/lux/documentation.lux | 85 ++++++--- stdlib/source/library/lux/ffi.jvm.lux | 92 +++++----- stdlib/source/library/lux/ffi.lux | 10 +- stdlib/source/library/lux/ffi.old.lux | 56 +++--- stdlib/source/library/lux/ffi.php.lux | 8 +- stdlib/source/library/lux/ffi.scm.lux | 6 +- stdlib/source/library/lux/math/modular.lux | 4 +- stdlib/source/library/lux/math/modulus.lux | 4 +- stdlib/source/library/lux/math/number/frac.lux | 4 +- stdlib/source/library/lux/math/number/i32.lux | 2 +- stdlib/source/library/lux/meta.lux | 2 +- .../library/lux/meta/compiler/default/platform.lux | 4 +- .../compiler/language/lux/analysis/inference.lux | 10 +- .../meta/compiler/language/lux/analysis/type.lux | 4 +- .../language/lux/phase/extension/analysis/jvm.lux | 42 ++--- .../lux/phase/extension/declaration/jvm.lux | 4 +- .../lux/phase/extension/declaration/lux.lux | 6 +- .../lux/phase/extension/translation/jvm/common.lux | 2 +- .../lux/phase/extension/translation/jvm/host.lux | 2 +- .../language/lux/phase/translation/jvm/value.lux | 2 +- .../library/lux/meta/compiler/meta/archive.lux | 4 +- .../library/lux/meta/compiler/meta/archive/key.lux | 4 +- .../meta/compiler/meta/archive/module/document.lux | 4 +- .../lux/meta/compiler/meta/archive/registry.lux | 4 +- .../source/library/lux/meta/macro/vocabulary.lux | 4 +- .../source/library/lux/meta/target/common_lisp.lux | 8 +- stdlib/source/library/lux/meta/target/js.lux | 8 +- .../lux/meta/target/jvm/bytecode/address.lux | 4 +- .../jvm/bytecode/environment/limit/registry.lux | 4 +- .../jvm/bytecode/environment/limit/stack.lux | 4 +- .../lux/meta/target/jvm/bytecode/instruction.lux | 4 +- .../library/lux/meta/target/jvm/constant.lux | 6 +- .../library/lux/meta/target/jvm/constant/tag.lux | 4 +- .../library/lux/meta/target/jvm/encoding/name.lux | 4 +- .../lux/meta/target/jvm/encoding/signed.lux | 6 +- .../lux/meta/target/jvm/encoding/unsigned.lux | 6 +- .../source/library/lux/meta/target/jvm/index.lux | 4 +- .../source/library/lux/meta/target/jvm/loader.lux | 4 +- .../library/lux/meta/target/jvm/modifier.lux | 4 +- .../library/lux/meta/target/jvm/modifier/inner.lux | 4 +- .../library/lux/meta/target/jvm/reflection.lux | 6 +- stdlib/source/library/lux/meta/target/jvm/type.lux | 6 +- .../library/lux/meta/target/jvm/type/alias.lux | 2 +- .../library/lux/meta/target/jvm/type/category.lux | 22 +-- .../lux/meta/target/jvm/type/descriptor.lux | 6 +- .../library/lux/meta/target/jvm/type/lux.lux | 14 +- .../library/lux/meta/target/jvm/type/parser.lux | 2 +- .../lux/meta/target/jvm/type/reflection.lux | 6 +- .../library/lux/meta/target/jvm/type/signature.lux | 6 +- stdlib/source/library/lux/meta/target/lua.lux | 8 +- stdlib/source/library/lux/meta/target/php.lux | 8 +- stdlib/source/library/lux/meta/target/python.lux | 10 +- stdlib/source/library/lux/meta/target/r.lux | 10 +- stdlib/source/library/lux/meta/target/ruby.lux | 8 +- stdlib/source/library/lux/meta/target/scheme.lux | 8 +- stdlib/source/library/lux/meta/type.lux | 26 +-- stdlib/source/library/lux/meta/type/check.lux | 6 +- stdlib/source/library/lux/meta/type/dynamic.lux | 6 +- stdlib/source/library/lux/meta/type/linear.lux | 10 +- stdlib/source/library/lux/meta/type/nominal.lux | 108 ++++++++++++ stdlib/source/library/lux/meta/type/poly.lux | 8 +- stdlib/source/library/lux/meta/type/primitive.lux | 108 ------------ stdlib/source/library/lux/meta/type/quotient.lux | 6 +- stdlib/source/library/lux/meta/type/refinement.lux | 4 +- stdlib/source/library/lux/meta/type/unit.lux | 4 +- stdlib/source/library/lux/meta/type/variance.lux | 2 +- stdlib/source/library/lux/world/db/sql.lux | 6 +- stdlib/source/library/lux/world/environment.lux | 4 +- stdlib/source/library/lux/world/file.lux | 2 +- stdlib/source/library/lux/world/file/watch.lux | 4 +- stdlib/source/library/lux/world/locale.lux | 4 +- .../source/library/lux/world/locale/language.lux | 4 +- .../source/library/lux/world/locale/territory.lux | 4 +- .../source/library/lux/world/net/http/cookie.lux | 8 +- .../source/library/lux/world/net/http/version.lux | 12 +- stdlib/source/library/lux/world/net/mime.lux | 8 +- stdlib/source/library/lux/world/net/uri/scheme.lux | 10 +- stdlib/source/library/lux/world/time.lux | 4 +- stdlib/source/library/lux/world/time/date.lux | 4 +- stdlib/source/library/lux/world/time/duration.lux | 4 +- stdlib/source/library/lux/world/time/instant.lux | 6 +- stdlib/source/library/lux/world/time/solar.lux | 4 +- stdlib/source/library/lux/world/time/year.lux | 4 +- 125 files changed, 1003 insertions(+), 820 deletions(-) create mode 100644 stdlib/source/library/lux/data/color/hsl.lux create mode 100644 stdlib/source/library/lux/meta/type/nominal.lux delete mode 100644 stdlib/source/library/lux/meta/type/primitive.lux (limited to 'stdlib/source/library') 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 [] [{ 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 )] {#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 ( Actor s)) (Resolver ( 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 [ (these (ffi.import (java/util/concurrent/atomic/AtomicReference a) @@ -27,7 +27,7 @@ @.jvm (these))) -(primitive.def (Atom'' a) +(nominal.def (Atom'' a) (with_expansions [ (java/util/concurrent/atomic/AtomicReference a)] (for @.old @.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 [ Symbol] - (primitive.def .public Layer + (nominal.def .public Layer (.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 [ ] - [(primitive.def .public + [(nominal.def .public Any (type .public 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 [ ] [(def .public Color - (primitive.abstraction ))] + (nominal.abstraction ))] [black rgb.black] [white rgb.white] @@ -76,14 +74,14 @@ (Monoid Color) (implementation (def identity - (primitive.abstraction + (nominal.abstraction (at identity))) (def (composite left right) - (primitive.abstraction + (nominal.abstraction (at 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 [ ] [(def .public ( ratio color) (-> Frac Color Color) - (let [[hue saturation luminance] (hsl color)] - (of_hsl [hue - (|> saturation - (f.* (|> +1.0 ( (..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 ( (..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 [ <1> <2>] [(`` (def .public ( 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 [ +0.0 +1.0] - (primitive.def .public Value + (nominal.def .public Value Frac (with_template [ ] [(def .public Value - (primitive.abstraction ))] + (nominal.abstraction ))] [ least] [ 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 (|> (f.- red) (f.- key) (f.* f)) magenta (|> (f.- green) (f.- key) (f.* f)) yellow (|> (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)) 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 [ ] + [(def .public + 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 [] + [(f.= (the (nominal.representation left)) + (the (nominal.representation right)))] + + [#hue] + [#saturation] + [#luminance] + ))))))) + + (with_template [ ] + [(def .public + (-> HSL + Value) + (|>> nominal.representation + (the )))] + + [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 [] [ (|> it (the ) - primitive.representation + nominal.representation opposite_intensity - primitive.abstraction)] + nominal.abstraction)] [#red] [#green] @@ -131,9 +131,9 @@ (let [left ( left) right ( right)] (`` [(,, (with_template [] - [ (primitive.abstraction - ( (primitive.representation (the left)) - (primitive.representation (the right))))] + [ (nominal.abstraction + ( (nominal.representation (the left)) + (nominal.representation (the 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 ) "m") ..default_foreground_color] - (primitive.abstraction Command)))) + (nominal.abstraction Command)))) (`` (def .public (,, (template.symbol [ "_background"])) Command (|> [(%.format ..command (%.nat ) "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") ] - (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 [ ] - [(primitive.def Any) + [(nominal.def Any) (type .public (Generic ))] [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 (_ + +) - [(primitive.def .public + [(nominal.def .public (def .public @@ -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 [] [(with_expansions [' (template.symbol [ "'"])] - (primitive.def .public ' Any) + (nominal.def .public ' Any) (type .public (Numeric ')))] @@ -91,7 +91,7 @@ ) (with_template [ + +] - [(primitive.def .public Any) + [(nominal.def .public Any) (`` (with_template [ ] [(def .public @@ -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 [ ] - [(primitive.def Any) + [(nominal.def Any) (type .public (HTML ))] [Meta Meta'] @@ -108,11 +108,11 @@ ) (.with_template [ +] - [(primitive.def ( brand) Any) + [(nominal.def ( brand) Any) (type .public (HTML ( Any))) (`` (.with_template [ ] - [(primitive.def Any) + [(nominal.def Any) (type .public (HTML ( )))] (,, (template.spliced +))))] 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 [ ] [(def .public ( content) - (-> Text (Markdown Block)) - (abstraction (format " " (..safe content) ..blank_line)))] + (-> (Markdown Span) + (Markdown Block)) + (nominal.abstraction (format " " (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 [ ] [(def .public - (-> (Markdown Span) (Markdown Span)) - (|>> representation + (-> (Markdown Span) + (Markdown Span)) + (|>> nominal.representation (text.enclosed [ ]) - 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 ""))) + (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 [ ] [(def .public - (-> (Markdown Span)) - (|>> (text.enclosed ["<" ">"]) abstraction))] + (-> + (Markdown Span)) + (|>> (text.enclosed ["<" ">"]) nominal.abstraction))] [url URL] [email Email] @@ -188,14 +209,17 @@ (with_template [ ] [(def .public ( pre post) - (-> (Markdown ) (Markdown ) (Markdown )) - (abstraction (format (representation pre) (representation post))))] + (-> (Markdown ) (Markdown ) + (Markdown )) + (nominal.abstraction (format (nominal.representation pre) (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 (-- ))]))) - (primitive.def .public + (nominal.def .public Nat (def .public ( 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 [ ] - [(primitive.def .public + [(nominal.def .public (exception.def .public ( 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 [ (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 [ ] 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 [ ] [(`` (def .public .Type - {.#Primitive {.#End}}))] + {.#Nominal {.#End}}))] [Boolean box.boolean] [Byte box.byte] @@ -77,7 +77,7 @@ (with_template [ ] [(`` (def .public .Type - {.#Primitive (reflection.reflection ) {.#End}}))] + {.#Nominal (reflection.reflection ) {.#End}}))] ... Primitives [boolean reflection.boolean] @@ -118,9 +118,9 @@ (-> (Type Value) Text Code Code) (let [unboxed (..reflection unboxed)] (` (|> (, raw) - (.is (.Primitive (, (code.text
))))
+              (.is (.Nominal (, (code.text 
))))
               .jvm_object_cast#
-              (.is (.Primitive (, (code.text ))))))))]
+              (.is (.Nominal (, (code.text ))))))))]
 
   [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 .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 .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 [ ]
@@ -1890,7 +1890,7 @@
     (if (type#= .Any type)
       (at meta.monad in $Object)
       (when type
-        {.#Primitive name params}
+        {.#Nominal name params}
         (`` (cond (,, (with_template []
                         [(text#= (..reflection ) 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)})))
 
                     _
                     )
@@ -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 [  ]
@@ -2039,7 +2039,7 @@
                              array_jvm_type)
                          (in (list (` (.|> ( (, g!idx) (, array))
                                            .jvm_object_cast#
-                                           (.is (.Primitive (, (code.text ))))))))]
+                                           (.is (.Nominal (, (code.text ))))))))]
 
                         [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 [  ]
@@ -2078,7 +2078,7 @@
                              (jvm.array )
                              array_jvm_type)
                          (let [g!value (` (.|> (, value)
-                                               (.as (.Primitive (, (code.text ))))
+                                               (.as (.Nominal (, (code.text ))))
                                                .jvm_object_cast#))]
                            (in (list (` ( (, 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 [ (for @.js (these [Symbol]
                                                  [Null]
@@ -230,7 +230,7 @@
                      ]
     (with_template []
       [(with_expansions [ (template.symbol [ "'"])]
-         (primitive.def 
+         (nominal.def 
            Any
            
            (type .public 
@@ -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 [   ]
   [(def .public ( value)
-     (-> (Primitive ) (Primitive ))
+     (-> (Nominal ) (Nominal ))
      ( value))]
 
   [byte_to_long "jvm convert byte-to-long" "java.lang.Byte"      "java.lang.Long"]
@@ -66,11 +66,11 @@
 (with_template [   ]
   [(def .public 
      (template ( it)
-       [(|> it (.is ) (.as (Primitive )))]))
+       [(|> it (.is ) (.as (Nominal )))]))
 
    (def .public 
      (template ( it)
-       [(|> it (.is (Primitive )) (.as ))]))]
+       [(|> it (.is (Nominal )) (.as ))]))]
 
   [as_boolean .Bit "java.lang.Boolean" of_boolean]
   [as_long .Int "java.lang.Long" of_long]
@@ -81,11 +81,11 @@
 (with_template [  <$>  <$'>  ]
   [(def .public 
      (template ( it)
-       [(|> it (.is ) (.as (Primitive )) <$> (.is (Primitive )))]))
+       [(|> it (.is ) (.as (Nominal )) <$> (.is (Nominal )))]))
 
    (def .public 
      (template ( it)
-       [(|> it (.is (Primitive )) <$'> (.is (Primitive )) (.as ))]))]
+       [(|> it (.is (Nominal )) <$'> (.is (Nominal )) (.as ))]))]
 
   [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 [ ]
       [
        {.#Some (' )}])
-    (["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 .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 []
   [(with_expansions [ (template.symbol [ "'"])]
-     (primitive.def .public  Any)
+     (nominal.def .public  Any)
      (type .public 
        (..Object )))]
 
@@ -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 []
   [(with_expansions [ (template.symbol [ "'"])]
-     (primitive.def .public  Any)
+     (nominal.def .public  Any)
      (type .public 
        (..Object )))]
 
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 [ ]
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 []
       [{ 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 [ ]
   [(def .public 
      .Type
-     {.#Primitive  {.#End}})]
+     {.#Nominal  {.#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 []
                         [(text#= (..reflection ) name)]
 
@@ -583,7 +583,7 @@
 (def (check_jvm objectT)
   (-> .Type (Operation (Type Value)))
   (when objectT
-    {.#Primitive name {.#End}}
+    {.#Nominal name {.#End}}
     (`` (cond (,, (with_template []
                     [(text#= (..reflection ) name)
                      (phase#in )]
@@ -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 .any .any .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 )
                   })))]
 
-  [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 []
           [{ 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 [ ]
     [(with_expansions [ (template.symbol [ "'"])]
-       (`` (primitive.def .public ( brand) Any))
+       (`` (nominal.def .public ( brand) Any))
        (`` (type .public ( brand)
              ( ( brand)))))]
 
@@ -48,7 +48,7 @@
 
   (with_template [ ]
     [(with_expansions [ (template.symbol [ "'"])]
-       (`` (primitive.def .public  Any))
+       (`` (nominal.def .public  Any))
        (`` (type .public  ( ))))]
 
     [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 [ +]
     [(with_expansions [ (template.symbol [ "'"])]
-       (primitive.def ( brand) Any)
+       (nominal.def ( brand) Any)
        (`` (type .public  (|> Any  (,, (template.spliced +))))))]
     
     [Expression [Code]]
@@ -54,7 +54,7 @@
 
   (with_template [ +]
     [(with_expansions [ (template.symbol [ "'"])]
-       (primitive.def  Any)
+       (nominal.def  Any)
        (`` (type .public  (|>  (,, (template.spliced +))))))]
 
     [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 [ ]
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 [      <+> <->]
     [(with_expansions [ (template.symbol [ "'"])]
-       (primitive.def  Any)
+       (nominal.def  Any)
        (type .public  (Signed )))
 
      (def .public  )
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 [     <+> <-> ]
     [(with_expansions [ (template.symbol [ "'"])]
-       (primitive.def .public  Any)
+       (nominal.def .public  Any)
        (type .public  (Unsigned )))
 
      (def .public  )
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 [ ]
   [(with_expansions [ (template.symbol [ "'"])]
-     (primitive.def  Any)
+     (nominal.def  Any)
      (type .public 
        (`` (<| Return' Value' (,, (template.spliced )) ))))]
 
@@ -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 
      (Parser (Check Type))
      (<>.after 
-               (<>#in (check#in {.#Primitive (//reflection.reflection ) {.#End}}))))]
+               (<>#in (check#in {.#Nominal (//reflection.reflection ) {.#End}}))))]
 
   [boolean //parser.boolean //reflection.boolean]
   [byte //parser.byte //reflection.byte]
@@ -74,7 +74,7 @@
   [(def 
      (Parser (Check Type))
      (<>.after 
-               (<>#in (check#in {.#Primitive  {.#End}}))))]
+               (<>#in (check#in {.#Nominal  {.#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 (.this //descriptor.class_prefix))
       (<>.before (.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 []
                                                   [(text#= (//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 [ +]
     [(with_expansions [ (template.symbol [ "'"])]
-       (primitive.def ( brand) Any)
+       (nominal.def ( brand) Any)
        (`` (type .public  (|> Any  (,, (template.spliced +))))))]
     
     [Expression [Code]]
@@ -76,7 +76,7 @@
 
   (with_template [ +]
     [(with_expansions [ (template.symbol [ "'"])]
-       (primitive.def  Any)
+       (nominal.def  Any)
        (`` (type .public  (|>  (,, (template.spliced +))))))]
 
     [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 [ +]
     [(with_expansions [ (template.symbol [ "'"])]
-       (primitive.def ( brand) Any)
+       (nominal.def ( brand) Any)
        (`` (type .public  (|> Any  (,, (template.spliced +))))))]
     
     [Expression [Code]]
@@ -84,7 +84,7 @@
 
   (with_template [ +]
     [(with_expansions [ (template.symbol [ "'"])]
-       (primitive.def .public  Any)
+       (nominal.def .public  Any)
        (`` (type .public  (|>  (,, (template.spliced +))))))]
 
     [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 [ ]
     [(with_expansions [ (template.symbol [ "'"])]
-       (`` (primitive.def ( brand) Any))
+       (`` (nominal.def ( brand) Any))
        (`` (type .public ( brand)
              ( ( brand)))))]
     
@@ -95,7 +95,7 @@
 
   (with_template [ ]
     [(with_expansions [ (template.symbol [ "'"])]
-       (`` (primitive.def  Any))
+       (`` (nominal.def  Any))
        (`` (type .public  ( ))))]
 
     [Literal Computation]
@@ -104,7 +104,7 @@
     )
 
   (with_template [ ]
-    [(primitive.def .public  Any)
+    [(nominal.def .public  Any)
 
      (type .public  (Var ))]
 
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 [ +]
     [(with_expansions [ (template.symbol [ "'"])]
-       (primitive.def .public ( kind) Any)
+       (nominal.def .public ( kind) Any)
        (`` (type .public  (|> Any  (,, (template.spliced +))))))]
     
     [Expression [Code]]
@@ -35,14 +35,14 @@
 
   (with_template [ +]
     [(with_expansions [ (template.symbol [ "'"])]
-       (primitive.def .public ( kind) Any)
+       (nominal.def .public ( kind) Any)
        (`` (type .public ( ) (|>   (,, (template.spliced +))))))]
     
     [Var [Expression' Code]]
     )
 
   (with_template [ ]
-    [(primitive.def .public  Any)
+    [(nominal.def .public  Any)
      (type .public  (Var ))]
 
     [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 [ +]
     [(with_expansions [ (template.symbol [ "'"])]
-       (primitive.def ( brand) Any)
+       (nominal.def ( brand) Any)
        (`` (type .public  (|> Any  (,, (template.spliced +))))))]
     
     [Expression [Code]]
@@ -72,7 +72,7 @@
 
   (with_template [ +]
     [(with_expansions [ (template.symbol [ "'"])]
-       (primitive.def  Any)
+       (nominal.def  Any)
        (`` (type .public  (|>  (,, (template.spliced +))))))]
 
     [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 [  +]
-    [(primitive.def .public ( brand) Any)
+    [(nominal.def .public ( brand) Any)
      (`` (type .public  (|> Any  (,, (template.spliced +)))))]
     
     [Expression Expression' [Code]]
     )
 
   (with_template [  +]
-    [(primitive.def .public  Any)
+    [(nominal.def .public  Any)
      (`` (type .public  (|>  (,, (template.spliced +)))))]
 
     [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 []
               [{ 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 []
               [{ 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 [ [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])
         )
@@ -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 []
                   [{ 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 [ [Type Any]]
-  (primitive.def .public Dynamic
+  (nominal.def .public Dynamic
     
     
     (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 [ ]
@@ -82,7 +82,7 @@
     [commutative_key Commutative]
     ))
 
-(primitive.def .public (Res key value)
+(nominal.def .public (Res key value)
   value
 
   (with_template [  ]
diff --git a/stdlib/source/library/lux/meta/type/nominal.lux b/stdlib/source/library/lux/meta/type/nominal.lux
new file mode 100644
index 000000000..1d5ce2602
--- /dev/null
+++ b/stdlib/source/library/lux/meta/type/nominal.lux
@@ -0,0 +1,108 @@
+(.require
+ [library
+  [lux (.except def)
+   ["[0]" meta]
+   [abstract
+    [monad (.only do)]]
+   [control
+    ["<>" parser (.use "[1]#[0]" monad)]]
+   [data
+    ["[0]" text (.use "[1]#[0]" equivalence)]
+    [collection
+     ["[0]" list (.use "[1]#[0]" functor)]]]
+   [meta
+    ["[0]" symbol (.use "[1]#[0]" codec)]
+    ["[0]" code (.only)
+     ["<[1]>" \\parser (.only Parser)]]
+    ["[0]" macro (.only)
+     ["[0]" context]
+     [syntax (.only syntax)
+      ["[0]" export]]]]]]
+ ["[0]" //])
+
+(type .public Frame
+  (Record
+   [#name Text
+    #type_vars (List Code)
+    #abstraction Code
+    #representation Code]))
+
+(context.def
+  [frames]
+  [expression]
+  [declaration]
+  Frame)
+
+(.def .public current
+  (Meta Frame)
+  (context.peek ..frames))
+
+(.def .public (specific name)
+  (-> Text (Meta Frame))
+  (context.search (|>> (the #name) (text#= name)) ..frames))
+
+(.def cast
+  (Parser [(Maybe Text) Code])
+  (<>.either (<>.and (<>.maybe .local) .any)
+             (<>.and (<>#in {.#None}) .any)))
+
+(with_template [  ]
+  [(.def .public 
+     (syntax (_ [[frame value] ..cast])
+       (do meta.monad
+         [[name type_vars abstraction representation] (when frame
+                                                        {.#Some frame}
+                                                        (..specific frame)
+                                                        
+                                                        {.#None}
+                                                        ..current)]
+         (in (list (` (//.as [(,* type_vars)] (, ) (, )
+                             (, value))))))))]
+
+  [abstraction representation abstraction]
+  [representation abstraction representation]
+  )
+
+(.def declarationP
+  (Parser [Text (List Text)])
+  (<>.either (.form (<>.and .local (<>.some .local)))
+             (<>.and .local (at <>.monad in (list)))))
+
+(.def abstract
+  (Parser [Code [Text (List Text)] Code (List Code)])
+  (export.with
+    (all <>.and
+         ..declarationP
+         .any
+         (<>.some .any)
+         )))
+
+... 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 nominals]
+              ..abstract])
+    (do meta.monad
+      [current_module meta.current_module_name
+       g!Representation (macro.symbol "Representation")
+       .let [type_varsC (list#each code.local type_vars)
+             abstraction_declaration (` ((, (code.local name)) (,* type_varsC)))
+             representation_declaration (` ((, g!Representation) (,* type_varsC)))]]
+      (..declaration [name type_varsC abstraction_declaration representation_declaration]
+        (` (.these (type (, export_policy) (, abstraction_declaration)
+                     (Nominal (, (code.text (symbol#encoded [current_module name])))
+                              [(,* type_varsC)]))
+                   (type (, representation_declaration)
+                     (, representation_type))
+                   (,* nominals)))))))
+
+(.def selection
+  (Parser [(List Code) Code])
+  (<>.either (<>.and (<>#each (|>> list) .any) .any)
+             (<>.and (<>#in (list)) .any)))
+
+(.def .public transmutation
+  (syntax (_ [[specific value] ..selection])
+    (in (list (` (.|> (, value)
+                      (..representation (,* specific))
+                      (..abstraction (,* specific))))))))
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 []
       [{ 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/primitive.lux b/stdlib/source/library/lux/meta/type/primitive.lux
deleted file mode 100644
index 033be6d6e..000000000
--- a/stdlib/source/library/lux/meta/type/primitive.lux
+++ /dev/null
@@ -1,108 +0,0 @@
-(.require
- [library
-  [lux (.except def)
-   ["[0]" meta]
-   [abstract
-    [monad (.only do)]]
-   [control
-    ["<>" parser (.use "[1]#[0]" monad)]]
-   [data
-    ["[0]" text (.use "[1]#[0]" equivalence)]
-    [collection
-     ["[0]" list (.use "[1]#[0]" functor)]]]
-   [meta
-    ["[0]" symbol (.use "[1]#[0]" codec)]
-    ["[0]" code (.only)
-     ["<[1]>" \\parser (.only Parser)]]
-    ["[0]" macro (.only)
-     ["[0]" context]
-     [syntax (.only syntax)
-      ["[0]" export]]]]]]
- ["[0]" //])
-
-(type .public Frame
-  (Record
-   [#name Text
-    #type_vars (List Code)
-    #abstraction Code
-    #representation Code]))
-
-(context.def
-  [frames]
-  [expression]
-  [declaration]
-  Frame)
-
-(.def .public current
-  (Meta Frame)
-  (context.peek ..frames))
-
-(.def .public (specific name)
-  (-> Text (Meta Frame))
-  (context.search (|>> (the #name) (text#= name)) ..frames))
-
-(.def cast
-  (Parser [(Maybe Text) Code])
-  (<>.either (<>.and (<>.maybe .local) .any)
-             (<>.and (<>#in {.#None}) .any)))
-
-(with_template [  ]
-  [(.def .public 
-     (syntax (_ [[frame value] ..cast])
-       (do meta.monad
-         [[name type_vars abstraction representation] (when frame
-                                                        {.#Some frame}
-                                                        (..specific frame)
-                                                        
-                                                        {.#None}
-                                                        ..current)]
-         (in (list (` (//.as [(,* type_vars)] (, ) (, )
-                             (, value))))))))]
-
-  [abstraction representation abstraction]
-  [representation abstraction representation]
-  )
-
-(.def declarationP
-  (Parser [Text (List Text)])
-  (<>.either (.form (<>.and .local (<>.some .local)))
-             (<>.and .local (at <>.monad in (list)))))
-
-(.def abstract
-  (Parser [Code [Text (List Text)] Code (List Code)])
-  (export.with
-    (all <>.and
-         ..declarationP
-         .any
-         (<>.some .any)
-         )))
-
-... 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]
-              ..abstract])
-    (do meta.monad
-      [current_module meta.current_module_name
-       g!Representation (macro.symbol "Representation")
-       .let [type_varsC (list#each code.local type_vars)
-             abstraction_declaration (` ((, (code.local name)) (,* type_varsC)))
-             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)]))
-                   (type (, representation_declaration)
-                     (, representation_type))
-                   (,* primitives)))))))
-
-(.def selection
-  (Parser [(List Code) Code])
-  (<>.either (<>.and (<>#each (|>> list) .any) .any)
-             (<>.and (<>#in (list)) .any)))
-
-(.def .public transmutation
-  (syntax (_ [[specific value] ..selection])
-    (in (list (` (.|> (, value)
-                      (..representation (,* specific))
-                      (..abstraction (,* specific))))))))
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 [ ]
   [(def .public 
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 []
-  [(primitive.def .public  Any)]
+  [(nominal.def .public  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 [ ]
     [(def .public 
        CSRF_Policy
-       (primitive.abstraction ))]
+       (nominal.abstraction ))]
     
     [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 [ ]
     [(def .public 
        Version
-       (primitive.abstraction ))]
+       (nominal.abstraction ))]
 
     [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 [ ]
     [(def .public 
        Scheme
-       (primitive.abstraction ))]
+       (nominal.abstraction ))]
 
     ["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)
-- 
cgit v1.2.3