diff options
Diffstat (limited to 'stdlib/source/lux/language/compiler/analysis/case')
-rw-r--r-- | stdlib/source/lux/language/compiler/analysis/case/coverage.lux | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/stdlib/source/lux/language/compiler/analysis/case/coverage.lux b/stdlib/source/lux/language/compiler/analysis/case/coverage.lux index bce8512e5..b718c382d 100644 --- a/stdlib/source/lux/language/compiler/analysis/case/coverage.lux +++ b/stdlib/source/lux/language/compiler/analysis/case/coverage.lux @@ -5,7 +5,7 @@ ["ex" exception (#+ exception:)] equivalence] [data - [bool ("bool/" Equivalence<Bool>)] + [bit ("bit/" Equivalence<Bit>)] [number] ["e" error ("error/" Monad<Error>)] [maybe] @@ -50,18 +50,18 @@ ## as insuficient (since it could lead to runtime errors due to values ## not being handled by any pattern). ## The #Partial tag covers arbitrary partial coverages in a general -## way, while the other tags cover more specific cases for booleans +## way, while the other tags cover more specific cases for bits ## and variants. (type: #export #rec Coverage #Partial - (#Bool Bool) + (#Bit Bit) (#Variant (Maybe Nat) (Dictionary Nat Coverage)) (#Seq Coverage Coverage) (#Alt Coverage Coverage) #Exhaustive) (def: #export (exhaustive? coverage) - (-> Coverage Bool) + (-> Coverage Bit) (case coverage (#Exhaustive _) true @@ -87,11 +87,11 @@ [#///.Frac] [#///.Text]) - ## Bools are the exception, since there is only "true" and - ## "false", which means it is possible for boolean + ## Bits are the exception, since there is only "true" and + ## "false", which means it is possible for bit ## pattern-matching to become exhaustive if complementary parts meet. - (#///.Simple (#///.Bool value)) - (operation/wrap (#Bool value)) + (#///.Simple (#///.Bit value)) + (operation/wrap (#Bit value)) ## Tuple patterns can be exhaustive if there is exhaustiveness for all of ## their sub-patterns. @@ -122,7 +122,7 @@ (dict.put variant-idx value-coverage)))))))) (def: (xor left right) - (-> Bool Bool Bool) + (-> Bit Bit Bit) (or (and left (not right)) (and (not left) right))) @@ -151,8 +151,8 @@ [#Exhaustive #Exhaustive] true - [(#Bool sideR) (#Bool sideS)] - (bool/= sideR sideS) + [(#Bit sideR) (#Bit sideS)] + (bit/= sideR sideS) [(#Variant allR casesR) (#Variant allS casesS)] (and (n/= (cases allR) @@ -194,8 +194,8 @@ [#Partial #Partial] (error/wrap #Partial) - ## 2 boolean coverages are exhaustive if they compliment one another. - (^multi [(#Bool sideA) (#Bool sideSF)] + ## 2 bit coverages are exhaustive if they complement one another. + (^multi [(#Bit sideA) (#Bit sideSF)] (xor sideA sideSF)) (error/wrap #Exhaustive) |