diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/language/compiler/analysis/case.lux | 23 | ||||
-rw-r--r-- | stdlib/source/lux/language/compiler/analysis/case/coverage.lux | 25 |
2 files changed, 25 insertions, 23 deletions
diff --git a/stdlib/source/lux/language/compiler/analysis/case.lux b/stdlib/source/lux/language/compiler/analysis/case.lux index 2f5162fbd..34a2b38d6 100644 --- a/stdlib/source/lux/language/compiler/analysis/case.lux +++ b/stdlib/source/lux/language/compiler/analysis/case.lux @@ -1,28 +1,29 @@ (.module: [lux (#- case) [control - [monad (#+ do)] + ["." monad (#+ do)] ["ex" exception (#+ exception:)]] [data - [product] - [error] - [maybe] + ["." product] + ["." error] + ["." maybe] [text format] - [collection [list ("list/" Fold<List> Monoid<List> Functor<List>)]]] + [collection + ["." list ("list/" Fold<List> Monoid<List> Functor<List>)]]] ["." macro - [code]]] - [// (#+ Pattern Analysis Operation Compiler) - [scope] + ["." code]]] + ["." // (#+ Pattern Analysis Operation Compiler) + ["." scope] ["//." type] - [structure] + ["." structure] ["/." // - [extension] + ["." extension] [// ["." type ["tc" check]]]]] [/ - [coverage]]) + ["." coverage]]) (exception: #export (cannot-match-type-with-pattern {type Type} {pattern Code}) (ex.report ["Type" (%type type)] diff --git a/stdlib/source/lux/language/compiler/analysis/case/coverage.lux b/stdlib/source/lux/language/compiler/analysis/case/coverage.lux index c19003df6..5c3ff1d72 100644 --- a/stdlib/source/lux/language/compiler/analysis/case/coverage.lux +++ b/stdlib/source/lux/language/compiler/analysis/case/coverage.lux @@ -1,20 +1,21 @@ (.module: [lux #* [control - [monad (#+ do)] + ["." monad (#+ do)] ["ex" exception (#+ exception:)] equivalence] [data [bit ("bit/" Equivalence<Bit>)] - [number] + ["." number] ["e" error ("error/" Monad<Error>)] - [maybe] - [text format] + ["." maybe] + [text + format] [collection - [list ("list/" Fold<List>)] + ["." list ("list/" Fold<List>)] ["dict" dictionary (#+ Dictionary)]]]] - [//// ("operation/" Monad<Operation>)] - [/// (#+ Pattern Variant Operation)]) + ["." //// ("operation/" Monad<Operation>)] + ["." /// (#+ Pattern Variant Operation)]) (def: cases (-> (Maybe Nat) Nat) @@ -174,7 +175,7 @@ _ #0))) -(open: "C/" Equivalence<Coverage>) +(open: "coverage/" Equivalence<Coverage>) ## After determining the coverage of each individual pattern, it is ## necessary to merge them all to figure out if the entire @@ -226,7 +227,7 @@ (#Variant allSF casesM))))) [(#Seq leftA rightA) (#Seq leftSF rightSF)] - (case [(C/= leftSF leftA) (C/= rightSF rightA)] + (case [(coverage/= leftSF leftA) (coverage/= rightSF rightA)] ## There is nothing the addition adds to the coverage. [#1 #1] redundant-pattern @@ -254,12 +255,12 @@ ## The left part will always match, so the addition is redundant. (^multi [(#Seq left right) single] - (C/= left single)) + (coverage/= left single)) redundant-pattern ## The right part is not necessary, since it can always match the left. (^multi [single (#Seq left right)] - (C/= left single)) + (coverage/= left single)) (error/wrap single) ## When merging a new coverage against one based on Alt, it may be @@ -317,7 +318,7 @@ (undefined))))) _ - (if (C/= so-far addition) + (if (coverage/= so-far addition) ## The addition cannot possibly improve the coverage. redundant-pattern ## There are now 2 alternative paths. |