typerep-map icon indicating copy to clipboard operation
typerep-map copied to clipboard

Manage unsafe coercions more carefully

Open treeowl opened this issue 4 years ago • 1 comments

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.

treeowl avatar Feb 01 '22 23:02 treeowl

@chshersh , @vrom911 , this seems an obvious and conservative improvement. Could one of you review/merge?

treeowl avatar Feb 03 '22 23:02 treeowl