Instantiate polymorphic kinds when unwrapping newtypes while solving Coercible constraints#4040
Merged
hdgarrood merged 3 commits intopurescript:masterfrom Apr 8, 2021
Conversation
rhendric
approved these changes
Apr 3, 2021
Contributor
|
Restarting the build. |
Contributor
|
CI fails with this issue now: |
…Coercible constraints
…olving Coercible constraints
b6731ec to
6520f79
Compare
Member
Author
|
I really should take the habit to compile with |
Contributor
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the change
@thomashoneyman shared on Slack that the compiler is unable to derive a
Newtypeinstance for newtypes applying a variable to a row:The issue is easier to understand with an empty row, and compiling with
--verbose-errors:Now we see the types differ in how their polymorphic kind is instantiated!
The unknown kind applied to the newtype in the original constraint is replaced by a
kvariable, bound in the (inferred) newtype kind signature. This pull request instantiates those variables when unwrapping newtypes, so thatCoercible (X @t0 r1) (r1 (() @t0))yieldsCoercible (r1 (() @t0)) (r1 (() @t0))as expected.Checklist: