hey David, heres a simpler version (attached below), that I think accomplishes the same goal.
One issue, that would need to be evaluated empirically: how many type class instances would break from this change? Would any?
is it Storable instances that are an issue, or things that use storable?
what safety is gained vs what is impacted? (i guess i mostly just wanna understand what would be broken by this change, a lot of code in the wild uses pointers for systems integrations)
newtype Ptr a = Ptr Addr#
type role Ptr nominal
castPtr :: Ptr a -> Ptr b
castPtr = unsafeCoerce
ptrCoercible
:: ((forall a b. Coercible (Ptr a) (Ptr b)) => r)
-> r
ptrCoercible r = r
ptrCoercion :: Coercion (Ptr a) (Ptr b)
ptrCoercion = Coercion