Skip to content

Manage unsafe coercions more carefully#115

Open
treeowl wants to merge 1 commit intokowainik:mainfrom
treeowl:gentler-uc
Open

Manage unsafe coercions more carefully#115
treeowl wants to merge 1 commit intokowainik:mainfrom
treeowl:gentler-uc

Conversation

@treeowl
Copy link

@treeowl treeowl commented Feb 1, 2022

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.

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
Copy link
Author

treeowl commented Feb 3, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant