Split up coercionKind
coercionKind :: Coercion -> Pair Type
produces both sides of a coercion's type. But little (if any) work is shared between the computation of the left-hand type and the right-hand type. The only thing Simon and I can find is the pointer-chasing required in looking at the input coercion. On the other hand, the current structure makes and discards tons of Pair
objects.
Instead, let's have coercionLeftKind, coercionRightKind :: Coercion -> Type
that computes the two types separately. Should be a small, but consistent, performance win. Even more so in the places where only one of the two types is used.