typerep-map
typerep-map copied to clipboard
Manage unsafe coercions more carefully
Instead of using Any, use TypeRep Any or f Any. This makes it
considerably easier to see what each coercion is actually doing. It
also allows the compiler to use more type information around the unsafe
coercions. For example, Const a b and Const a Any are
representationally the same, so converting between them should be able
to compile to a safe coercion (better for optimization). This doesn't
happen in GHC 9.0, but I think that may have been fixed in 9.2.
@chshersh , @vrom911 , this seems an obvious and conservative improvement. Could one of you review/merge?