diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/meta/type.lux (renamed from stdlib/source/library/lux/type.lux) | 0 | ||||
-rw-r--r-- | stdlib/source/library/lux/meta/type/check.lux (renamed from stdlib/source/library/lux/type/check.lux) | 0 | ||||
-rw-r--r-- | stdlib/source/library/lux/meta/type/dynamic.lux (renamed from stdlib/source/library/lux/type/dynamic.lux) | 8 | ||||
-rw-r--r-- | stdlib/source/library/lux/meta/type/implicit.lux (renamed from stdlib/source/library/lux/type/implicit.lux) | 160 | ||||
-rw-r--r-- | stdlib/source/library/lux/meta/type/poly.lux (renamed from stdlib/source/library/lux/type/poly.lux) | 28 | ||||
-rw-r--r-- | stdlib/source/library/lux/meta/type/primitive.lux (renamed from stdlib/source/library/lux/type/primitive.lux) | 0 | ||||
-rw-r--r-- | stdlib/source/library/lux/meta/type/quotient.lux (renamed from stdlib/source/library/lux/type/quotient.lux) | 8 | ||||
-rw-r--r-- | stdlib/source/library/lux/meta/type/refinement.lux (renamed from stdlib/source/library/lux/type/refinement.lux) | 8 | ||||
-rw-r--r-- | stdlib/source/library/lux/meta/type/resource.lux (renamed from stdlib/source/library/lux/type/resource.lux) | 6 | ||||
-rw-r--r-- | stdlib/source/library/lux/meta/type/unit.lux (renamed from stdlib/source/library/lux/type/unit.lux) | 0 | ||||
-rw-r--r-- | stdlib/source/library/lux/meta/type/unit/scale.lux (renamed from stdlib/source/library/lux/type/unit/scale.lux) | 0 | ||||
-rw-r--r-- | stdlib/source/library/lux/meta/type/variance.lux (renamed from stdlib/source/library/lux/type/variance.lux) | 0 |
12 files changed, 109 insertions, 109 deletions
diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/meta/type.lux index 00afaddc0..00afaddc0 100644 --- a/stdlib/source/library/lux/type.lux +++ b/stdlib/source/library/lux/meta/type.lux diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/meta/type/check.lux index cb49cc6e4..cb49cc6e4 100644 --- a/stdlib/source/library/lux/type/check.lux +++ b/stdlib/source/library/lux/meta/type/check.lux diff --git a/stdlib/source/library/lux/type/dynamic.lux b/stdlib/source/library/lux/meta/type/dynamic.lux index fd98afcdf..86ccf5753 100644 --- a/stdlib/source/library/lux/type/dynamic.lux +++ b/stdlib/source/library/lux/meta/type/dynamic.lux @@ -11,9 +11,9 @@ [macro (.only with_symbols) ["[0]" syntax (.only syntax)] ["[0]" code - ["<[1]>" \\parser]]] - ["[0]" type (.only) - ["[0]" primitive (.only primitive)]]]]) + ["<[1]>" \\parser]]]]] + ["[0]" // (.only) + ["[0]" primitive (.only primitive)]]) (exception .public (wrong_type [expected Type actual Type]) @@ -44,7 +44,7 @@ (with_symbols [g!type g!value] (in (list (` (.let [[(~ g!type) (~ g!value)] ((~! ..representation) (~ value))] (.is ((~! try.Try) (~ type)) - (.if (.at (~! type.equivalence) (~' =) + (.if (.at (~! //.equivalence) (~' =) (.type_literal (~ type)) (~ g!type)) {try.#Success (.as (~ type) (~ g!value))} ((~! exception.except) ..wrong_type [(.type_literal (~ type)) (~ g!type)])))))))))) diff --git a/stdlib/source/library/lux/type/implicit.lux b/stdlib/source/library/lux/meta/type/implicit.lux index f831c551b..977467202 100644 --- a/stdlib/source/library/lux/type/implicit.lux +++ b/stdlib/source/library/lux/meta/type/implicit.lux @@ -21,10 +21,10 @@ ["<[1]>" \\parser (.only Parser)]]] [math ["[0]" number (.only) - ["n" nat]]] - ["[0]" meta] - ["[0]" type (.use "[1]#[0]" equivalence) - ["[0]" check (.only Check)]]]]) + ["n" nat]]]]] + ["[0]" // (.use "[1]#[0]" equivalence) + ["/[1]" //] + ["[0]" check (.only Check)]]) (def (type_var id env) (-> Nat Type_Context (Meta Type)) @@ -36,20 +36,20 @@ (type_var id' env) _ - (at meta.monad in type)) + (at ///.monad in type)) {.#Some [_ {.#None}]} - (meta.failure (format "Unbound type-var " (%.nat id))) + (///.failure (format "Unbound type-var " (%.nat id))) {.#None} - (meta.failure (format "Unknown type-var " (%.nat id))) + (///.failure (format "Unknown type-var " (%.nat id))) )) (def (implicit_type var_name) (-> Symbol (Meta Type)) - (do meta.monad - [raw_type (meta.type var_name) - compiler meta.compiler_state] + (do ///.monad + [raw_type (///.type var_name) + compiler ///.compiler_state] (case raw_type {.#Var id} (type_var id (the .#type_context compiler)) @@ -64,7 +64,7 @@ (member_type idx sig_type') {.#Apply arg func} - (case (type.applied (list arg) func) + (case (//.applied (list arg) func) {.#None} (check.failure (format "Cannot apply type " (%.type func) " to type " (%.type arg))) @@ -85,52 +85,52 @@ (-> Symbol (Meta Symbol)) (case member ["" simple_name] - (meta.either (do meta.monad - [member (meta.normal member) - _ (meta.slot member)] - (in member)) - (do [! meta.monad] - [this_module_name meta.current_module_name - imp_mods (meta.imported_modules this_module_name) - tag_lists (monad.each ! meta.tag_lists imp_mods) - .let [tag_lists (|> tag_lists list#conjoint (list#each product.left) list#conjoint) - candidates (list.only (|>> product.right (text#= simple_name)) - tag_lists)]] - (case candidates - {.#End} - (meta.failure (format "Unknown tag: " (%.symbol member))) - - {.#Item winner {.#End}} - (in winner) - - _ - (meta.failure (format "Too many candidate tags: " (%.list %.symbol candidates)))))) + (///.either (do ///.monad + [member (///.normal member) + _ (///.slot member)] + (in member)) + (do [! ///.monad] + [this_module_name ///.current_module_name + imp_mods (///.imported_modules this_module_name) + tag_lists (monad.each ! ///.tag_lists imp_mods) + .let [tag_lists (|> tag_lists list#conjoint (list#each product.left) list#conjoint) + candidates (list.only (|>> product.right (text#= simple_name)) + tag_lists)]] + (case candidates + {.#End} + (///.failure (format "Unknown tag: " (%.symbol member))) + + {.#Item winner {.#End}} + (in winner) + + _ + (///.failure (format "Too many candidate tags: " (%.list %.symbol candidates)))))) _ - (at meta.monad in member))) + (at ///.monad in member))) (def (implicit_member member) (-> Symbol (Meta [Nat Type])) - (do meta.monad + (do ///.monad [member (member_name member) - [idx tag_list sig_type] (meta.slot member)] + [idx tag_list sig_type] (///.slot member)] (in [idx sig_type]))) (def (compatible_type? interface candidate) (-> Type Type Bit) - (with_expansions [<found?> (type#= interface candidate)] + (with_expansions [<found?> (//#= interface candidate)] (<| (or <found?>) - (let [[parameters candidate] (type.flat_univ_q candidate)]) + (let [[parameters candidate] (//.flat_univ_q candidate)]) (or <found?>) - (let [[inputs candidate] (type.flat_function candidate)]) + (let [[inputs candidate] (//.flat_function candidate)]) (or <found?>) - (let [[candidate parameters] (type.flat_application candidate)]) + (let [[candidate parameters] (//.flat_application candidate)]) (or <found?>) - (let [candidate (type.de_aliased candidate)]) + (let [candidate (//.de_aliased candidate)]) <found?>))) (def (available_definitions sig_type source_module target_module constants aggregate) @@ -146,8 +146,8 @@ (def (local_env sig_type) (-> Type (Meta (List [Symbol Type]))) - (do meta.monad - [local_batches meta.locals + (do ///.monad + [local_batches ///.locals .let [total_locals (list#mix (function (_ [name type] table) (try.else table (dictionary.has' name type table))) (is (Dictionary Text Type) @@ -162,17 +162,17 @@ (def (local_structs sig_type) (-> Type (Meta (List [Symbol Type]))) - (do [! meta.monad] - [this_module_name meta.current_module_name - definitions (meta.definitions this_module_name)] + (do [! ///.monad] + [this_module_name ///.current_module_name + definitions (///.definitions this_module_name)] (in (available_definitions sig_type this_module_name this_module_name definitions {.#End})))) (def (imported_structs sig_type) (-> Type (Meta (List [Symbol Type]))) - (do [! meta.monad] - [this_module_name meta.current_module_name - imported_modules (meta.imported_modules this_module_name) - accessible_definitions (monad.each ! meta.definitions imported_modules)] + (do [! ///.monad] + [this_module_name ///.current_module_name + imported_modules (///.imported_modules this_module_name) + accessible_definitions (monad.each ! ///.definitions imported_modules)] (in (list#mix (function (_ [imported_module definitions] tail) (available_definitions sig_type imported_module this_module_name definitions tail)) {.#End} @@ -188,7 +188,7 @@ (do check.monad [[id var] check.var] (|> func - (type.applied (list var)) + (//.applied (list var)) maybe.trusted (on_argument arg))) @@ -206,7 +206,7 @@ {.#UnivQ _} (do check.monad [[id var] check.var - [ids final_output] (concrete_type (maybe.trusted (type.applied (list var) type)))] + [ids final_output] (concrete_type (maybe.trusted (//.applied (list var) type)))] (in [{.#Item id ids} final_output])) @@ -229,14 +229,14 @@ (-> (-> Lux Type_Context Type (Check Instance)) Type_Context Type (List [Symbol Type]) (Meta (List Instance))) - (do meta.monad - [compiler meta.compiler_state] + (do ///.monad + [compiler ///.compiler_state] (case (|> alts (list#each (function (_ [alt_name alt_type]) (case (check.result context (do [! check.monad] [[tvars alt_type] (concrete_type alt_type) - .let [[deps alt_type] (type.flat_function alt_type)] + .let [[deps alt_type] (//.flat_function alt_type)] _ (check.check dep alt_type) context' check.context =deps (monad.each ! (provision compiler context') deps)] @@ -248,18 +248,18 @@ (list [alt_name =deps])))) list#conjoint) {.#End} - (meta.failure (format "No candidates for provisioning: " (%.type dep))) + (///.failure (format "No candidates for provisioning: " (%.type dep))) found (in found)))) (def (provision sig_type compiler context dep) (-> Type Lux Type_Context Type (Check Instance)) - (case (meta.result compiler - (all meta.either - (do meta.monad [alts (..local_env sig_type)] (..candidate_provision (provision sig_type) context dep alts)) - (do meta.monad [alts (..local_structs sig_type)] (..candidate_provision (provision sig_type) context dep alts)) - (do meta.monad [alts (..imported_structs sig_type)] (..candidate_provision (provision sig_type) context dep alts)))) + (case (///.result compiler + (all ///.either + (do ///.monad [alts (..local_env sig_type)] (..candidate_provision (provision sig_type) context dep alts)) + (do ///.monad [alts (..local_structs sig_type)] (..candidate_provision (provision sig_type) context dep alts)) + (do ///.monad [alts (..imported_structs sig_type)] (..candidate_provision (provision sig_type) context dep alts)))) {.#Left error} (check.failure error) @@ -277,15 +277,15 @@ (def (candidate_alternatives sig_type member_idx input_types output_type alts) (-> Type Nat (List Type) Type (List [Symbol Type]) (Meta (List Instance))) - (do meta.monad - [compiler meta.compiler_state - context meta.type_context] + (do ///.monad + [compiler ///.compiler_state + context ///.type_context] (case (|> alts (list#each (function (_ [alt_name alt_type]) (case (<| (check.result context) (do [! check.monad] [[tvars alt_type] (concrete_type alt_type) - .let [[deps alt_type] (type.flat_function alt_type)] + .let [[deps alt_type] (//.flat_function alt_type)] _ (check.check alt_type sig_type) member_type (member_type member_idx alt_type) _ (ensure_function_application! member_type input_types output_type) @@ -299,7 +299,7 @@ (list [alt_name =deps])))) list#conjoint) {.#End} - (meta.failure (format "No alternatives for " (%.type (type.function input_types output_type)))) + (///.failure (format "No alternatives for " (%.type (//.function input_types output_type)))) found (in found)))) @@ -307,10 +307,10 @@ (def (alternatives sig_type member_idx input_types output_type) (-> Type Nat (List Type) Type (Meta (List Instance))) (let [test (candidate_alternatives sig_type member_idx input_types output_type)] - (all meta.either - (do meta.monad [alts (..local_env sig_type)] (test alts)) - (do meta.monad [alts (..local_structs sig_type)] (test alts)) - (do meta.monad [alts (..imported_structs sig_type)] (test alts))))) + (all ///.either + (do ///.monad [alts (..local_env sig_type)] (test alts)) + (do ///.monad [alts (..local_structs sig_type)] (test alts)) + (do ///.monad [alts (..imported_structs sig_type)] (test alts))))) (def (var? input) (-> Code Bit) @@ -340,14 +340,14 @@ (<>.and (<>.some <code>.any) <code>.end))]) (case args {.#Left [args _]} - (do [! meta.monad] + (do [! ///.monad] [[member_idx sig_type] (..implicit_member member) input_types (monad.each ! ..implicit_type args) - output_type meta.expected_type + output_type ///.expected_type chosen_ones (alternatives sig_type member_idx input_types output_type)] (case chosen_ones {.#End} - (meta.failure (format "No implementation could be found for member: " (%.symbol member))) + (///.failure (format "No implementation could be found for member: " (%.symbol member))) {.#Item chosen {.#End}} (in (list (` (.at (~ (instance$ chosen)) @@ -355,14 +355,14 @@ (~+ (list#each code.symbol args)))))) _ - (meta.failure (format "Too many implementations available: " - (|> chosen_ones - (list#each (|>> product.left %.symbol)) - (text.interposed ", ")) - " --- for type: " (%.type sig_type))))) + (///.failure (format "Too many implementations available: " + (|> chosen_ones + (list#each (|>> product.left %.symbol)) + (text.interposed ", ")) + " --- for type: " (%.type sig_type))))) {.#Right [args _]} - (do [! meta.monad] + (do [! ///.monad] [labels (|> (macro.symbol "g!parameter") (list.repeated (list.size args)) (monad.all !))] @@ -377,12 +377,12 @@ (-> Nat (Meta (List Code))) (|> (macro.symbol "g!implicit") (list.repeated amount) - (monad.all meta.monad))) + (monad.all ///.monad))) (def .public with (syntax (_ [implementations (<code>.tuple (<>.many <code>.any)) body <code>.any]) - (do meta.monad + (do ///.monad [g!implicit+ (implicit_bindings (list.size implementations))] (in (list (` (let [(~+ (|> (list.zipped_2 g!implicit+ implementations) (list#each (function (_ [g!implicit implementation]) @@ -392,7 +392,7 @@ (def .public implicitly (syntax (_ [implementations (<>.many <code>.any)]) - (do meta.monad + (do ///.monad [g!implicit+ (implicit_bindings (list.size implementations))] (in (|> (list.zipped_2 g!implicit+ implementations) (list#each (function (_ [g!implicit implementation]) diff --git a/stdlib/source/library/lux/type/poly.lux b/stdlib/source/library/lux/meta/type/poly.lux index 4f70bb937..95d9f8ea7 100644 --- a/stdlib/source/library/lux/type/poly.lux +++ b/stdlib/source/library/lux/meta/type/poly.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["[0]" meta] [abstract ["[0]" monad (.only do)]] [control @@ -20,9 +19,10 @@ ["<[1]>" \\parser (.only Parser)]]] [math [number - ["n" nat]]] - ["[0]" type (.only) - ["<[1]>" \\parser (.only Env)]]]]) + ["n" nat]]]]] + ["[0]" // (.only) + ["<[1]>" \\parser (.only Env)] + ["/[1]" //]]) (def .public polytypic (syntax (_ [name <code>.local @@ -30,18 +30,18 @@ (with_symbols [g!_ g!type g!output] (let [g!name (code.symbol ["" name])] (in (.list (` ((~! syntax) ((~ g!_) [(~ g!type) (~! <code>.any)]) - ((~! do) (~! meta.monad) - [(~ g!type) ((~! meta.eval) .Type (~ g!type))] + ((~! do) (~! ///.monad) + [(~ g!type) ((~! ///.eval) .Type (~ g!type))] (case (is (.Either .Text .Code) - ((~! <type>.result) ((~! <>.rec) - (function ((~ g!_) (~ g!name)) - (~ body))) + ((~! <//>.result) ((~! <>.rec) + (function ((~ g!_) (~ g!name)) + (~ body))) (.as .Type (~ g!type)))) {.#Right (~ g!output)} ((~' in) (.list (~ g!output))) {.#Left (~ g!output)} - ((~! meta.failure) (~ g!output)))))))))))) + ((~! ///.failure) (~ g!output)))))))))))) (def .public (code env type) (-> Env Type Code) @@ -56,14 +56,14 @@ ([.#Var] [.#Ex]) {.#Parameter idx} - (let [idx (<type>.argument env idx)] + (let [idx (<//>.argument env idx)] (if (n.= 0 idx) (|> (dictionary.value idx env) maybe.trusted product.left (code env)) (` (.$ (~ (code.nat (-- idx))))))) {.#Apply {.#Primitive "" {.#End}} {.#Parameter idx}} - (case (<type>.argument env idx) + (case (<//>.argument env idx) 0 (|> env (dictionary.value 0) maybe.trusted product.left (code env)) idx (undefined)) @@ -76,8 +76,8 @@ (^.with_template [<macro> <tag> <flattener>] [{<tag> left right} (` (<macro> (~+ (list#each (code env) (<flattener> type)))))]) - ([.Union .#Sum type.flat_variant] - [.Tuple .#Product type.flat_tuple]) + ([.Union .#Sum //.flat_variant] + [.Tuple .#Product //.flat_tuple]) {.#Named name sub_type} (code.symbol name) diff --git a/stdlib/source/library/lux/type/primitive.lux b/stdlib/source/library/lux/meta/type/primitive.lux index 50c288e1c..50c288e1c 100644 --- a/stdlib/source/library/lux/type/primitive.lux +++ b/stdlib/source/library/lux/meta/type/primitive.lux diff --git a/stdlib/source/library/lux/type/quotient.lux b/stdlib/source/library/lux/meta/type/quotient.lux index 98292553c..72088cd46 100644 --- a/stdlib/source/library/lux/type/quotient.lux +++ b/stdlib/source/library/lux/meta/type/quotient.lux @@ -6,9 +6,9 @@ [macro (.only with_symbols) [syntax (.only syntax)] ["[0]" code - ["<[1]>" \\parser]]] - ["[0]" type - [primitive (.except)]]]]) + ["<[1]>" \\parser]]]]] + ["[0]" // (.only) + [primitive (.except)]]) (primitive .public (Class t c %) (-> t c) @@ -56,7 +56,7 @@ (~ g!_) (.undefined)))) - ... (` ((~! type.by_example) [(~ g!t) (~ g!c) (~ g!%)] + ... (` ((~! //.by_example) [(~ g!t) (~ g!c) (~ g!%)] ... (is (..Class (~ g!t) (~ g!c) (~ g!%)) ... (~ class)) ... (..Quotient (~ g!t) (~ g!c) (~ g!%)))) diff --git a/stdlib/source/library/lux/type/refinement.lux b/stdlib/source/library/lux/meta/type/refinement.lux index 225edc957..24e0aa2e2 100644 --- a/stdlib/source/library/lux/type/refinement.lux +++ b/stdlib/source/library/lux/meta/type/refinement.lux @@ -7,9 +7,9 @@ ["[0]" macro (.only) [syntax (.only syntax)] ["[0]" code - ["<[1]>" \\parser]]] - ["[0]" type (.only) - [primitive (.except)]]]]) + ["<[1]>" \\parser]]]]] + ["[0]" // (.only) + [primitive (.except)]]) (primitive .public (Refined t %) (Record @@ -98,7 +98,7 @@ (~ g!_) (.undefined)))) - ... (` ((~! type.by_example) [(~ g!t) (~ g!%)] + ... (` ((~! //.by_example) [(~ g!t) (~ g!%)] ... (is (..Refiner (~ g!t) (~ g!%)) ... (~ refiner)) ... (..Refined (~ g!t) (~ g!%)))) diff --git a/stdlib/source/library/lux/type/resource.lux b/stdlib/source/library/lux/meta/type/resource.lux index 760f07dc2..bd9e71c08 100644 --- a/stdlib/source/library/lux/type/resource.lux +++ b/stdlib/source/library/lux/meta/type/resource.lux @@ -22,9 +22,9 @@ ["<[1]>" \\parser (.only Parser)]]] [math [number - ["n" nat]]] - [type - [primitive (.except)]]]]) + ["n" nat]]]]] + [// + [primitive (.except)]]) (type .public (Procedure monad input output value) (-> input (monad [output value]))) diff --git a/stdlib/source/library/lux/type/unit.lux b/stdlib/source/library/lux/meta/type/unit.lux index 994e7ad11..994e7ad11 100644 --- a/stdlib/source/library/lux/type/unit.lux +++ b/stdlib/source/library/lux/meta/type/unit.lux diff --git a/stdlib/source/library/lux/type/unit/scale.lux b/stdlib/source/library/lux/meta/type/unit/scale.lux index b7f598d13..b7f598d13 100644 --- a/stdlib/source/library/lux/type/unit/scale.lux +++ b/stdlib/source/library/lux/meta/type/unit/scale.lux diff --git a/stdlib/source/library/lux/type/variance.lux b/stdlib/source/library/lux/meta/type/variance.lux index ac7e120d4..ac7e120d4 100644 --- a/stdlib/source/library/lux/type/variance.lux +++ b/stdlib/source/library/lux/meta/type/variance.lux |