GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Support deriving via by kl0tl · Pull Request #3824 · purescript/purescript Conversation
|
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Oh thank you, I added the guilty case 🙇 Also I fixed my error messages and moved most of the deriving via checks into the type checker because I was duplicating a lot of work to infer kinds. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| 'then' { SourceToken _ (TokLowerName [] "then") } | ||
| 'true' { SourceToken _ (TokLowerName [] "true") } | ||
| 'type' { SourceToken _ (TokLowerName [] "type") } | ||
| 'via' { SourceToken _ (TokLowerName [] "via") } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Since this is a contextual keyword, you will need to make sure to add it ident, qualIdent, and label.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Sorry about that, I added a few test cases to cover this.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I managed to ensure the via kind unifies with the kind of the type for which the instance is derived! Elaborating the kinds didn’t work but inferring them after binding all free variables to fresh kinds (like it is done when checking instances declarations) does 🎉 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
2a3abeb to
25050ef
Compare
| , solverDeferErrors = False | ||
| } | ||
| void . flip runStateT M.empty . runWriterT $ | ||
| entails solverOptions constraint M.empty [] |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Does this throw away the unsolved constraints?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Oh, but that's fine because of the current SolverOptions, so the solver won't emit unsolved constraints and instead just fail, right? I guess that means we can't write something like
data T derive via (...) instance blah :: Coercible X Y => Cls T
i.e. defer Coercible constraints in the instance head, but that's not a big loss, and maybe something that can be solved later?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The solver indeed fails when typechecking the instance declaration if the generated constraint can’t be solved but it doesn’t try to solve the instance context, so you can write such instance.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| gSimple (MissingNewtypeSuperclassInstance cl1 cl2 ts) = MissingNewtypeSuperclassInstance cl1 cl2 <$> traverse f ts | ||
| gSimple (UnverifiableSuperclassInstance cl1 cl2 ts) = UnverifiableSuperclassInstance cl1 cl2 <$> traverse f ts | ||
| gSimple (InvalidViaType cl ts viaTy) = InvalidViaType cl <$> traverse f ts <*> f viaTy | ||
| gSimple (InvalidViaKind cl ts viaTy viaKind expectedKind) = InvalidViaKind cl <$> traverse f ts <*> f viaTy <*> f viaKind <*> f expectedKind |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Should f be called on kinds here? There’s no case for the KindsDoNotUnify error for instance so maybe it shouldn’t 🤔
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
If there are cases that are missing it's probably an oversight.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The following SimpleErrorMessage constructors hold SourceTypes but aren’t matched:
InfiniteKindEscapedSkolemKindsDoNotUnifyMissingClassMemberUserDefinedWarningQuantificationCheckFailureInTypeUnsupportedTypeInKindShould I add cases for them in this PR? Matching every constructor explicitly would be verbose but could help to prevent this in the future.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
One thing to consider with this syntax is #1120. If we allowed |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
At least 1 approving review is required to merge this pull request.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Supportderiving via
There was an error while loading. Please reload this page.