-
-
Notifications
You must be signed in to change notification settings - Fork 371
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
Refactor collectLiterals in AlternateNumberFormat. #2516
Conversation
Hi, thanks for working in the fix, maybe the best way to reenable the plugin could be start the pr with a revert of the commit disabling it (to restore docs and other changes) |
Have you read the original SYB paper? I read it a long time ago and don't remember the details, but I suspect that a simple traversal cannot collect literals inside expressions inside patterns inside expressions. So I think your |
I'm going to close this once I have a fix. Then I'll reopen a PR with a clean history. |
I'm ashamed... I didn't understand what you meant when you were comparing Now I realize my original error. I've made a new change to include I chose to refrain from applying This seems to capture most literals. I can imagine a pattern has been missed but I haven't exhaustively searched. |
Sorry, I probably meant How is the performance now? |
Performance looks good. It's back in line with other plugins. I don't have a heavy enough Haskell workload to do exhaustive testing. I went through large files in HLS to make sure there were no issues. If everyones ok I will probably close this PR and reopen a new PR with the full changes (reverting prior commits etc) |
- In the process of development, it was forgotten that the "parent" type of patterns and exprs is different. When traversal occurs, SYB would throw out `Pat` types as it was only expecting `HsExpr` types. - Using `extQ` allows us to chain the expected types and we can then destructure patterns appropriately.
This reverts commit 15d7402.
04e1c06
to
b068031
Compare
Nevermind, I cleaned up the history on this branch. This is ready for PR. |
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.
Looks good to me. You checked the performance on HLS repo itself, right? I think then it's good to go.
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.
looks great, many thanks for take care, I am sure people doing numeric stuff are gonna love this plugin
This is not the final iteration I'm just looking for some quick feedback and suggestions:
This commit resolves #2490, but exposes other issues.
Re-enable the alternateNumberFormat plugin
Refactor collectLiterals to look for HsLit and HsOverLit directly
rather than HsExpr.
This new change removes the issue of finding duplicate Literal
entries, as well as drastically reducing the time to parse
ISSUE:
function declaration. Patterns are not being matched properly. This
was found in the prior iteration, but was remediated (at the cost of
performance). As a result, some tests will fail.
NOTES:
collectLiterals
one iscollectLiterals
and the other iscollectLiterals'
both function the same and are "equally" performant. However both suffer from the issue mentioned above where patterns are not captured...If anyone has some advice/help (especially regarding the missing LHS literals) that would be great.