aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/meta/type/implicit.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/meta/type/implicit.lux38
1 files changed, 19 insertions, 19 deletions
diff --git a/stdlib/source/library/lux/meta/type/implicit.lux b/stdlib/source/library/lux/meta/type/implicit.lux
index 835fff931..df5da5767 100644
--- a/stdlib/source/library/lux/meta/type/implicit.lux
+++ b/stdlib/source/library/lux/meta/type/implicit.lux
@@ -29,10 +29,10 @@
(def (type_var id env)
(-> Nat Type_Context (Meta Type))
- (case (list.example (|>> product.left (n.= id))
+ (when (list.example (|>> product.left (n.= id))
(the .#var_bindings env))
{.#Some [_ {.#Some type}]}
- (case type
+ (when type
{.#Var id'}
(type_var id' env)
@@ -51,7 +51,7 @@
(do ///.monad
[raw_type (///.type var_name)
compiler ///.compiler_state]
- (case raw_type
+ (when raw_type
{.#Var id}
(type_var id (the .#type_context compiler))
@@ -60,12 +60,12 @@
(def (member_type idx sig_type)
(-> Nat Type (Check Type))
- (case sig_type
+ (when sig_type
{.#Named _ sig_type'}
(member_type idx sig_type')
{.#Apply arg func}
- (case (//.applied (list arg) func)
+ (when (//.applied (list arg) func)
{.#None}
(check.failure (format "Cannot apply type " (%.type func) " to type " (%.type arg)))
@@ -84,7 +84,7 @@
(def (member_name member)
(-> Symbol (Meta Symbol))
- (case member
+ (when member
["" simple_name]
(///.either (do ///.monad
[member (///.normal member)
@@ -97,7 +97,7 @@
.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
+ (when candidates
{.#End}
(///.failure (format "Unknown tag: " (%.symbol member)))
@@ -181,7 +181,7 @@
(def (on_argument arg func)
(-> Type Type (Check Type))
- (case func
+ (when func
{.#Named _ func'}
(on_argument arg func')
@@ -203,7 +203,7 @@
(def (concrete_type type)
(-> Type (Check [(List Nat) Type]))
- (case type
+ (when type
{.#UnivQ _}
(do check.monad
[[id var] check.var
@@ -232,9 +232,9 @@
(Meta (List Instance)))
(do ///.monad
[compiler ///.compiler_state]
- (case (|> alts
+ (when (|> alts
(list#each (function (_ [alt_name alt_type])
- (case (check.result context
+ (when (check.result context
(do [! check.monad]
[[tvars alt_type] (concrete_type alt_type)
.let [[deps alt_type] (//.flat_function alt_type)]
@@ -256,7 +256,7 @@
(def (provision sig_type compiler context dep)
(-> Type Lux Type_Context Type (Check Instance))
- (case (///.result compiler
+ (when (///.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))
@@ -265,7 +265,7 @@
(check.failure error)
{.#Right candidates}
- (case candidates
+ (when candidates
{.#End}
(check.failure (format "No candidates for provisioning: " (%.type dep)))
@@ -281,9 +281,9 @@
(do ///.monad
[compiler ///.compiler_state
context ///.type_context]
- (case (|> alts
+ (when (|> alts
(list#each (function (_ [alt_name alt_type])
- (case (<| (check.result context)
+ (when (<| (check.result context)
(do [! check.monad]
[[tvars alt_type] (concrete_type alt_type)
.let [[deps alt_type] (//.flat_function alt_type)]
@@ -315,7 +315,7 @@
(def (var? input)
(-> Code Bit)
- (case input
+ (when input
[_ {.#Symbol _}]
#1
@@ -328,7 +328,7 @@
(def (instance$ [constructor dependencies])
(-> Instance Code)
- (case dependencies
+ (when dependencies
{.#End}
(code.symbol constructor)
@@ -339,14 +339,14 @@
(syntax (_ [member <code>.symbol
args (<>.or (<>.and (<>.some <code>.symbol) <code>.end)
(<>.and (<>.some <code>.any) <code>.end))])
- (case args
+ (when args
{.#Left [args _]}
(do [! ///.monad]
[[member_idx sig_type] (..implicit_member member)
input_types (monad.each ! ..implicit_type args)
output_type ///.expected_type
chosen_ones (alternatives sig_type member_idx input_types output_type)]
- (case chosen_ones
+ (when chosen_ones
{.#End}
(///.failure (format "No implementation could be found for member: " (%.symbol member)))