Skip to content
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

Fix parsing of (~) #428

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Fix parsing of (~) #428

wants to merge 2 commits into from

Conversation

yairchu
Copy link

@yairchu yairchu commented Feb 2, 2019

Bugfix and test for #421 and ndmitchell/hlint#559

@mpickering
Copy link
Collaborator

Why does this have to be treated specially rather than as a normal infix operator? What does GHC do here?

@yairchu
Copy link
Author

yairchu commented Feb 19, 2019

Why does this have to be treated specially rather than as a normal infix operator?

That's a good question :) I'm not intimately familiar with haskell-src-exts nor GHC, so honestly I don't know for sure. Maybe if I knew why FunCon required special treatment I'd have a better direction on answering it.

I extrapolated on haskell-src-exts's treatment for (->), which is also a special built-in type operator in Haskell, and just made the treatment for (~) consistent with it.

If you think that this isn't the right fix and have a suggestion for a different approach I'll gladly try implementing it.

@mpickering
Copy link
Collaborator

The way to tell what is the right thing to do is look at how GHC implements it in its parser.

@yairchu
Copy link
Author

yairchu commented Feb 26, 2019

Perhaps @niklasbroberg which implemented FunCon this way can offer insight into why it needs to be treated specially, and whether he thinks that reasoning should also apply to ~?

(not in any way disagreeing with the above claim that the GHC implements it is the right thing to do, just looking for possible shortcuts instead of going into GHC's code)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants