Closed dunhamsteve closed 1 month ago
Is there any chance we can define the appropriate Uninhabited
instances and use absurd
instead?
Using with
just to case split on a single variable seems way overkill
Hopefully this version is better. The with
was bothering me too.
I'd like to know why the impossible doesn't knock those cases off, but I think it would require a log of digging in logs. The case trees have the same order, with the branch elided in the impossible
case.
The function
MultHomomorphism
currently relies on a bug in Idris (idris-lang/Idris2#2250) for coverage. In that issue a(,)
or()
on the LHS of an impossible clause is treated as a pattern var (wildcard) during coverage checking. If we explicitly putMkPair
inMultHomomorphism
, the coverage check fails. The PR idris-lang/Idris2#3396 fixes idris-lang/Idris2#2250 by resolving the ambiguity asMkPair
instead of inserting a pattern variable and causes frex to fail to build. So we should update frex before that PR is merged.The Pair/MkPair ambiguity in the current frex code is short-circuiting coverage checking. This coverage check failure can be reproduced with the current Idris by writing
MkPair
for the pairs in the two impossible clauses ofMultHomomorphism
to get:The
MultHomomorphism
function is indeed covering - Idris accepts it as such when there are holes on the RHS instead ofimpossible
. The issue goes away if theMkAnd
match is pushed down into awith
clause, so that's what I do in this patch. There probably is a bug in coverage checking with respect to impossible clauses here, but I haven't tracked it down and the workaround seems sufficient.