-
Notifications
You must be signed in to change notification settings - Fork 82
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
Migrate to ghc-lib-parser #423
Conversation
-- located 'Pat's. However, sometimes we want to use the location to render | ||
-- something other than the given 'Pat'. | ||
-- | ||
-- If given 'Pat' does not contain a location, we error out. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm rather disappointed with GHC here.
Of course, an alternative option is swallowing the bug and doing p -> ($ p)
if we get something other than an XPat
. I'm not sure what is the best course of action here.
@@ -103,8 +103,9 @@ p_funDep (before, after) = do | |||
defltEqnToInstDecl :: TyFamDefltEqn GhcPs -> TyFamInstDecl GhcPs | |||
defltEqnToInstDecl FamEqn {..} = TyFamInstDecl {..} | |||
where | |||
eqn = FamEqn {feqn_pats = tyVarsToTypes feqn_pats, ..} | |||
eqn = FamEqn {feqn_pats = map HsValArg (tyVarsToTypes feqn_pats), ..} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is questionable. I don't have enough experience with GHC internals to say whether it's the right thing to do.
typeArgToType = \case | ||
HsValArg tm -> tm | ||
HsTypeArg _ ty -> ty | ||
HsArgPar _ -> notImplemented "HsArgPar" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{-
Note [HsArgPar]
A HsArgPar indicates that everything to the left of this in the argument list is
enclosed in parentheses together with the function itself. It is necessary so
that we can recreate the parenthesis structure in the original source after
typechecking the arguments.
The SrcSpan is the span of the original HsPar
((f arg1) arg2 arg3) results in an input argument list of
[HsValArg arg1, HsArgPar span1, HsValArg arg2, HsValArg arg3, HsArgPar span2]
-}
This is weird. And we probably don't need to handle it because currying?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not know. I'm OK with this as long as everything works in practice.
b009b03
to
cf6a116
Compare
6dde4c4
to
c94ecbb
Compare
What is the status of this one? |
All tests pass and it's ready to be reviewed. |
I don't know why CI fails, might be a timeout. |
d2c3313
to
e296e11
Compare
04e934f
to
14bcf80
Compare
@@ -43,16 +47,6 @@ p_ruleDecl = \case | |||
p_ruleName :: (SourceText, RuleName) -> R () | |||
p_ruleName (_, name) = atom $ HsString NoSourceText name | |||
|
|||
p_ruleBndrs :: [LRuleBndr GhcPs] -> R () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job at reducing the duplication!
This is good to go but is blocked on the CI issues. |
0416101
to
994b9b9
Compare
This would let us have features from GHC 8.8.1 while still using GHC 8.6.5 from Nixpkgs. Bonus: Ormolu will be compilable with GHCJS.
994b9b9
to
648edcc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Fixes #422, fixes #344.
Note to the reviewer
This can be reviewed commit-by-commit.
TODO
Fix the way I work with
XPat
.Run nixpkgs tests.
Check that the executable is buildable.
Fix warnings.
Format with Ormolu.
Add a test for:
Implement support for the point above.
Investigate:
Go through singletons and look for more regressions.
Add a test and implementation for:
Add tests for:
Add paren tests:
Try out a rule with two levels of multiline foralls.
Fix regression: the forall should not be broken across several lines:
Add a test for an (accidental?) improvement: the
:<>:
declaration should remain on the same line: