when simplifying a structure, there are no checks if new patterns together catch all possibilities early:
case ( bool, a ) of
( True, _ ) -> ...
( False, _ ) -> ...
_ -> ...
fixed to
case bool of
True -> ...
False -> ...
_ -> ...
which results in a compiler error: "all possibilities exhaustively matched before third case".
To check for that, we'd have to effectively re-implement exhaustiveness-checking from the compiler.
In comparison, single premature catch-all cases do lead to the removal of later cases.
case ( bool, a ) of
( b, _ ) -> ...
_ -> ...
fixed to
case bool of
b -> ...
Personally, I'm fine with fixing to code that throws a compiler error there but maybe you have a better idea.
known shortcoming B
Currently there's no knowledge in CheckInfo about whether a variant is the only one of a type. This means there will be suggested simplifications like
case Toop.T3 ... of
Toop.T3 O O O ->
Collage.circle 1
Toop.T3 O O I ->
Collage.rectangle 0.5 1.5
Toop.T3 O I O ->
Collage.rectangle 1.5 0.5
Toop.T3 b0 b1 b2 ->
{- 3 to 8 -}
Collage.ngon
(ArraySized.l3 b0 b1 b2
|> Bits.toN
|> N.toInt
)
1
The goal is fully implementing #99
known shortcoming A
when simplifying a structure, there are no checks if new patterns together catch all possibilities early:
fixed to
which results in a compiler error: "all possibilities exhaustively matched before third case". To check for that, we'd have to effectively re-implement exhaustiveness-checking from the compiler.
In comparison, single premature catch-all cases do lead to the removal of later cases.
fixed to
Personally, I'm fine with fixing to code that throws a compiler error there but maybe you have a better idea.
known shortcoming B
Currently there's no knowledge in
CheckInfo
about whether a variant is the only one of atype
. This means there will be suggested simplifications likefixed to
Especially with more descriptive single-variants like
User
we might wanna poll in slack whether these should be simplified to tuples.