How to prove that the type parameters of an Injective Type Family are Equivalent?

52 Views Asked by At

If I have an injective type family, and a proof of type equivalence, how can I get a proof of equivalence of the parameters?

The best I've been able to come up with uses unsafeCoerce, and it seems justified to me since the TypeFamily is injective, but... the function itself doesn't check if the TypeFamily is injective, so, this could be a source for bugs. I could also be wrong, in that, not even this is a safe use of unsafeCoerce.

type family MyTF a = b | b -> a
...

coerceTypeFamily :: (MyTF a :~: MyTF b) -> (a :~: b)
coerceTypeFamily Refl = unsafeCoerce Refl
0

There are 0 best solutions below