diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/meta.lux | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux index 8bf80bce5..5f6dad623 100644 --- a/stdlib/source/library/lux/meta.lux +++ b/stdlib/source/library/lux/meta.lux @@ -112,12 +112,12 @@ (All (_ a) (-> Text (Meta a))) (function (_ state) - {try.#Failure (location.with (value@ .#location state) error)})) + {try.#Failure (location.with (the .#location state) error)})) (def: .public (module name) (-> Text (Meta Module)) (function (_ lux) - (case (plist.value name (value@ .#modules lux)) + (case (plist.value name (the .#modules lux)) {.#Some module} {try.#Success [lux module]} @@ -127,7 +127,7 @@ (def: .public current_module_name (Meta Text) (function (_ lux) - (case (value@ .#current_module lux) + (case (the .#current_module lux) {.#Some current_module} {try.#Success [lux current_module]} @@ -173,7 +173,7 @@ {.#None} {try.#Success [_ this_module]} - (let [modules (value@ .#modules lux)] + (let [modules (the .#modules lux)] (loop [module module name name] (do maybe.monad @@ -181,7 +181,7 @@ definition (: (Maybe Global) (|> $module (: Module) - (value@ .#definitions) + (the .#definitions) (plist.value name)))] (case definition {.#Alias [r_module r_name]} @@ -204,13 +204,13 @@ (def: .public seed (Meta Nat) (function (_ lux) - {try.#Success [(revised@ .#seed ++ lux) - (value@ .#seed lux)]})) + {try.#Success [(revised .#seed ++ lux) + (the .#seed lux)]})) (def: .public (module_exists? module) (-> Text (Meta Bit)) (function (_ lux) - {try.#Success [lux (case (plist.value module (value@ .#modules lux)) + {try.#Success [lux (case (plist.value module (the .#modules lux)) {.#Some _} #1 @@ -241,7 +241,7 @@ {.#Var var} (function (_ lux) (case (|> lux - (value@ [.#type_context .#var_bindings]) + (the [.#type_context .#var_bindings]) (type_variable var)) (^or {.#None} {.#Some {.#Var _}}) {try.#Success [lux type]} @@ -260,15 +260,15 @@ (case (do maybe.monad [scope (list.example (function (_ env) (or (list.any? test (: (List [Text [Type Any]]) - (value@ [.#locals .#mappings] env))) + (the [.#locals .#mappings] env))) (list.any? test (: (List [Text [Type Any]]) - (value@ [.#captured .#mappings] env))))) - (value@ .#scopes lux)) + (the [.#captured .#mappings] env))))) + (the .#scopes lux)) [_ [type _]] (on_either (list.example test) (: (List [Text [Type Any]]) - (value@ [.#locals .#mappings] scope)) + (the [.#locals .#mappings] scope)) (: (List [Text [Type Any]]) - (value@ [.#captured .#mappings] scope)))] + (the [.#captured .#mappings] scope)))] (in type)) {.#Some var_type} ((clean_type var_type) lux) @@ -301,28 +301,28 @@ (case (: (Maybe Global) (do maybe.monad [(^open "[0]") (|> lux - (value@ .#modules) + (the .#modules) (plist.value normal_module))] (plist.value normal_short #definitions))) {.#Some definition} {try.#Success [lux definition]} _ - (let [current_module (|> lux (value@ .#current_module) (maybe.else "???")) + (let [current_module (|> lux (the .#current_module) (maybe.else "???")) all_known_modules (|> lux - (value@ .#modules) + (the .#modules) (list#each product.left) ..module_listing)] {try.#Failure ($_ text#composite "Unknown definition: " (symbol#encoded name) text.new_line " Current module: " current_module text.new_line - (case (plist.value current_module (value@ .#modules lux)) + (case (plist.value current_module (the .#modules lux)) {.#Some this_module} (let [candidates (|> lux - (value@ .#modules) + (the .#modules) (list#each (function (_ [module_name module]) (|> module - (value@ .#definitions) + (the .#definitions) (list.all (function (_ [def_name global]) (case global (^or {.#Definition [exported? _]} @@ -344,10 +344,10 @@ (list.sorted text#<) (text.interposed ..listing_separator)) imports (|> this_module - (value@ .#imports) + (the .#imports) ..module_listing) aliases (|> this_module - (value@ .#module_aliases) + (the .#module_aliases) (list#each (function (_ [alias real]) ($_ text#composite alias " => " real))) (list.sorted text#<) (text.interposed ..listing_separator))] @@ -454,12 +454,12 @@ (def: .public (globals module) (-> Text (Meta (List [Text Global]))) (function (_ lux) - (case (plist.value module (value@ .#modules lux)) + (case (plist.value module (the .#modules lux)) {.#None} {try.#Failure ($_ text#composite "Unknown module: " module)} {.#Some module} - {try.#Success [lux (value@ .#definitions module)]}))) + {try.#Success [lux (the .#definitions module)]}))) (def: .public (definitions module) (-> Text (Meta (List [Text Definition]))) @@ -496,7 +496,7 @@ (Meta (List [Text Module])) (function (_ lux) (|> lux - (value@ .#modules) + (the .#modules) [lux] {try.#Success}))) @@ -505,7 +505,7 @@ (do ..monad [.let [[module_name name] type_name] module (..module module_name)] - (case (plist.value name (value@ .#definitions module)) + (case (plist.value name (the .#definitions module)) {.#Some {.#Type [exported? type labels]}} (case labels (^or {.#Left labels} @@ -519,12 +519,12 @@ (def: .public location (Meta Location) (function (_ lux) - {try.#Success [lux (value@ .#location lux)]})) + {try.#Success [lux (the .#location lux)]})) (def: .public expected_type (Meta Type) (function (_ lux) - (case (value@ .#expected lux) + (case (the .#expected lux) {.#Some type} {try.#Success [lux type]} @@ -546,7 +546,7 @@ (def: .public (imported? import) (-> Text (Meta Bit)) (# ..functor each - (|>> (value@ .#imports) (list.any? (text#= import))) + (|>> (the .#imports) (list.any? (text#= import))) ..current_module)) (template [<name> <tag> <description>] @@ -556,7 +556,7 @@ [.let [[module name] label_name] =module (..module module) this_module_name ..current_module_name] - (case (plist.value name (value@ .#definitions =module)) + (case (plist.value name (the .#definitions =module)) {.#Some {<tag> [exported? type group idx]}} (if (or (text#= this_module_name module) exported?) @@ -593,18 +593,18 @@ _ {.#None})) - (value@ .#definitions =module))))) + (the .#definitions =module))))) (def: .public locals (Meta (List (List [Text Type]))) (function (_ lux) - (case (list.inits (value@ .#scopes lux)) + (case (list.inits (the .#scopes lux)) {.#None} {try.#Failure "No local environment"} {.#Some scopes} {try.#Success [lux - (list#each (|>> (value@ [.#locals .#mappings]) + (list#each (|>> (the [.#locals .#mappings]) (list#each (function (_ [name [type _]]) [name type]))) scopes)]}))) @@ -637,7 +637,7 @@ (def: .public type_context (Meta Type_Context) (function (_ lux) - {try.#Success [lux (value@ .#type_context lux)]})) + {try.#Success [lux (the .#type_context lux)]})) (def: .public (lifted result) (All (_ a) (-> (Try a) (Meta a))) @@ -651,7 +651,7 @@ (def: .public (eval type code) (-> Type Code (Meta Any)) (do [! ..monad] - [eval (# ! each (value@ .#eval) + [eval (# ! each (the .#eval) ..compiler_state)] (eval type code))) @@ -670,7 +670,7 @@ (Meta <type>) (function (_ lux) {try.#Success [lux - (value@ [.#info <slot>] lux)]}))] + (the [.#info <slot>] lux)]}))] [Text target .#target] [Text version .#version] |