Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage unsafe coercions more carefully #115

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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.

None yet

1 participant