diff options
Diffstat (limited to 'new-luxc/test/test/luxc/analyser/case.lux')
-rw-r--r-- | new-luxc/test/test/luxc/analyser/case.lux | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/new-luxc/test/test/luxc/analyser/case.lux b/new-luxc/test/test/luxc/analyser/case.lux index 3c05f5dad..983dff6f5 100644 --- a/new-luxc/test/test/luxc/analyser/case.lux +++ b/new-luxc/test/test/luxc/analyser/case.lux @@ -40,7 +40,7 @@ head head+] (wrap (#;Cons head tail+))))) -(def: (exhaustive-branches-for allow-literals? variantTC inputC) +(def: #export (exhaustive-branches allow-literals? variantTC inputC) (-> Bool (List [Code Code]) Code (r;Random (List Code))) (case inputC [_ (#;Bool _)] @@ -54,7 +54,7 @@ (case ?sample (#;Some sample) (do @ - [else (exhaustive-branches-for allow-literals? variantTC inputC)] + [else (exhaustive-branches allow-literals? variantTC inputC)] (wrap (list& (<wrapper> sample) else))) #;None @@ -74,7 +74,7 @@ [_ (#;Tuple members)] (do r;Monad<Random> - [member-wise-patterns (monad;map @ (exhaustive-branches-for allow-literals? variantTC) members)] + [member-wise-patterns (monad;map @ (exhaustive-branches allow-literals? variantTC) members)] (wrap (|> member-wise-patterns exhaustive-weaving (L/map code;tuple)))) @@ -83,7 +83,7 @@ (do r;Monad<Random> [#let [ks (L/map product;left kvs) vs (L/map product;right kvs)] - member-wise-patterns (monad;map @ (exhaustive-branches-for allow-literals? variantTC) vs)] + member-wise-patterns (monad;map @ (exhaustive-branches allow-literals? variantTC) vs)] (wrap (|> member-wise-patterns exhaustive-weaving (L/map (|>. (list;zip2 ks) code;record))))) @@ -93,7 +93,7 @@ [bundles (monad;map @ (function [[_tag _code]] (do @ - [v-branches (exhaustive-branches-for allow-literals? variantTC _code)] + [v-branches (exhaustive-branches allow-literals? variantTC _code)] (wrap (L/map (function [pattern] (` ((~ _tag) (~ pattern)))) v-branches)))) variantTC)] @@ -103,10 +103,10 @@ (r/wrap (list)) )) -(def: (gen-input variant-tags record-tags primitivesC) +(def: #export (input variant-tags record-tags primitivesC) (-> (List Code) (List Code) (List Code) (r;Random Code)) (r;rec - (function [gen-input] + (function [input] ($_ r;either (r/map product;right gen-primitive) (do r;Monad<Random> @@ -116,7 +116,7 @@ (wrap (` ((~ choiceT) (~ choiceC))))) (do r;Monad<Random> [size (|> r;nat (:: @ map (n.% +3))) - elems (r;list size gen-input)] + elems (r;list size input)] (wrap (code;tuple elems))) (r/wrap (code;record (list;zip2 record-tags primitivesC))) )))) @@ -141,12 +141,12 @@ variant-tags+ (L/map (|>. [module-name] code;tag) variant-tags) record-tags+ (L/map (|>. [module-name] code;tag) record-tags) variantTC (list;zip2 variant-tags+ primitivesC)] - inputC (gen-input variant-tags+ record-tags+ primitivesC) + inputC (input variant-tags+ record-tags+ primitivesC) [outputT outputC] gen-primitive [heterogeneousT heterogeneousC] (|> gen-primitive (r;filter (|>. product;left (tc;checks? outputT) not))) - exhaustive-patterns (exhaustive-branches-for true variantTC inputC) - redundant-patterns (exhaustive-branches-for false variantTC inputC) + exhaustive-patterns (exhaustive-branches true variantTC inputC) + redundant-patterns (exhaustive-branches false variantTC inputC) redundancy-idx (|> r;nat (:: @ map (n.% (list;size redundant-patterns)))) heterogeneous-idx (|> r;nat (:: @ map (n.% (list;size exhaustive-patterns)))) #let [exhaustive-branchesC (L/map (branch outputC) |