-
Notifications
You must be signed in to change notification settings - Fork 113
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
Switch from haskell-src-exts
to ghc-lib-parser
#593
Switch from haskell-src-exts
to ghc-lib-parser
#593
Conversation
haskell-src-exts
with ghc-lib-parser
abbdc12
to
4330ed4
Compare
@mihaimaruseac Hello. I have a question. Do we still need to support GHC versions that are older than 8.10? Though it's not impossible, supporting these versions is hard because I think supporting GHC 8.10.7 and 9.2.2 is enough. 8.10.7 is the current recommended version by Do you have any thoughts on this? |
Sorry, was not following the progress here too closely. I think it's good to drop the old versions, I'll send a fix to remove them from CI right now |
Made #596 |
Thank you for the quick PR! |
@mihaimaruseac It seems that building with GHC 9.4.1 fails because of a GHC bug. I've created #597 to remove the support of the version. |
This commit is split from mihaimaruseac#593 to reduce the PR's size.
Thank you for the other PR. From reading the issue (and the CI on #596, I shouldn't have merged it that early) it looks like only Windows is affected? Made a suggestion on your PR for that end. |
Thanks. Yes, it only affects Windows. I've fixed it in #597. |
Awesome. Thank you. Merged. |
ded61c2
to
d928610
Compare
haskell-src-exts
with ghc-lib-parser
haskell-src-exts
to ghc-lib-parser
@mihaimaruseac There are still a few things to do (e.g., removing files used in the development from commits, exporting necessary symbols, etc.), and a few FIXMEs which I can't solve immediately, but I think the work of switching from I apologize that the diffs have become very large. Some of the diffs are not needed for this PR and can be submitted as separate PRs. I have two thoughts.
Thank you. |
This commit is separated from mihaimaruseac#593 and has tests that added there and pass with the current HIndent.
84bb9b1
to
cda4ac8
Compare
See mihaimaruseac#587 for the background.
294f9d7
to
e5424e9
Compare
Hi @toku-sa-n. I see you merged all commits and removed the TODO-checklist. Does this mean this is ready for review? :) Sorry if I'm too eager and this is not yet ready :) |
Yes, it's ready for review! I was planning to mark this PR as ready after
running benchmarks, but you can start reviewing now.
…On Sat, Dec 24, 2022, 01:31 Mihai Maruseac ***@***.***> wrote:
Hi @toku-sa-n <https://github.com/toku-sa-n>.
I see you merged all commits and removed the TODO-checklist. Does this
mean this is ready for review? :)
Sorry if I'm too eager and this is not yet ready :)
—
Reply to this email directly, view it on GitHub
<#593 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKDAAUYZJXWDM3C6ZDI7WKDWOXHVHANCNFSM6AAAAAAQGIPOCE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
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 looks so great! There's only one nit about a comment that looks incomplete: "since GHC"
Thank you very much.
if S8.null xs | ||
then False | ||
else S8.last xs == '\n' | ||
hasTrailingLine xs = not (S8.null xs) && S8.last xs == '\n' |
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!!
-- ,QuasiQuotes -- breaks [x| ...], making whitespace free list comps break | ||
, GLP.PatternSynonyms -- steals the pattern keyword | ||
, GLP.RecursiveDo -- steals the rec keyword | ||
, GLP.TypeApplications -- since GHC |
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.
Is this missing a version number?
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.
Oops. I'll fix it.
-- > f :: Int | ||
-- > f = 1 | ||
-- > | ||
-- > -- A comment between f and g | ||
-- > | ||
-- > -- Another comment between f and g | ||
-- > | ||
-- > g :: Int | ||
-- > g = 2 | ||
-- | ||
-- to | ||
-- | ||
-- > f :: Int | ||
-- > f = 1 | ||
-- > | ||
-- > -- A comment between f and g | ||
-- > -- Another comment between f and g | ||
-- > g :: Int | ||
-- > g = 2 |
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.
It would be nice if comment separation would be maintained, but maybe we can push this to a separate issue.
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.
Yes. We need to change this behavior. I'll try it later. The issue is here: #608.
Thank you for reviewing and merging this PR! I also appreciate that you invited me as a collaborator of this repository! |
In mihaimaruseac#593, I didn't format the files with the above command for fear of huge diffs.
See #587 for the background.
Problems
LINE
pragmas (e.g.,{-# LINE 1 "foo/bar.hs" #-}
). It causes a parse error.stack bench
indicates that the HIndent after rewriting is much slower than the original one.ghc-lib-parser
's internal formatted, and we should avoid it if possible. See the comment inHIndent.Pretty.Combinators.Outputable
.Notes
Some formatting results differ from the one by the original HIndent due to several reasons.
haskell-src-exts
wrongly parses a left-associative infix operator as right-associative and vice versa.haskell-src-exts
' internal formatter and reproducing it is difficult.Benchmark results
Before the switch
After the switch
Fixes: #587
Fixes: #600
Closes: #582
Closes: #599