Make IndexOf and Index throw custom type errors when indexing fails. As these type families are transitively used in (:<) through the Member type family, I think they should error instead of being stuck (which can cause large error messages).
Use an accumulator for IndexOf, which avoids page-long error messages involving (1 + ( 1 + ( 1 + ( 1 + ( ...
Make MaybeIndexOf the main type family which performs computation, trying to re-use it as much as possible.
I understand that the intention was to have two separate type families, one for checking (CheckMember) and one for computing the index (Index), but that seems wasteful to me as it causes the constraint solver to needlessly traverse the list twice.
IndexOf
andIndex
throw custom type errors when indexing fails. As these type families are transitively used in(:<)
through theMember
type family, I think they should error instead of being stuck (which can cause large error messages).IndexOf
, which avoids page-long error messages involving(1 + ( 1 + ( 1 + ( 1 + ( ...
MaybeIndexOf
the main type family which performs computation, trying to re-use it as much as possible.I understand that the intention was to have two separate type families, one for checking (
CheckMember
) and one for computing the index (Index
), but that seems wasteful to me as it causes the constraint solver to needlessly traverse the list twice.