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

Improve custom quasi-quotation parsing #204

Merged
merged 1 commit into from
Feb 7, 2022
Merged

Improve custom quasi-quotation parsing #204

merged 1 commit into from
Feb 7, 2022

Conversation

Martoon-00
Copy link
Contributor

@Martoon-00 Martoon-00 commented Feb 5, 2022

Problem: currently parsing [int||Text|] fails with the current Haskell
grammar.

This happens, because we parse the beginning in a greedy way, and so
parse [int|| as beginning of typed quasi-quoter. Thus end must be
||] respectively, but we never meet it.

Solution: custom quoters are never typed, and GHC (tried with 8.10.7
version) interprets [int||Abc||] as a mere quoter with |Abc| body.

So here we adjust the pattern for custom quoters to be never typed.

Resolves #203.

Problem: currently parsing `[int||Text|]` fails with the current Haskell
grammar.

This happens, because we parse the beginning in a greedy way, and so
parse `[int||` as beginning of typed quasi-quoter. Thus end must be
`||]` respectively, but we never meet it.

Solution: custom quoters are never typed, and GHC (tried with 8.10.7
version) interprets `[int||Abc||]` as a mere quoter with `|Abc|` body.

So here we adjust the pattern for custom quoters to be never typed.
@sheaf
Copy link
Collaborator

sheaf commented Feb 7, 2022

Thank you very much for taking the time to make an MR. I didn't realise that custom quasi-quoters never used the typed syntax.

@sheaf sheaf merged commit 2363b56 into JustusAdam:master Feb 7, 2022
@Martoon-00
Copy link
Contributor Author

Thank you very much for taking the time to make an MR. I didn't realise that custom quasi-quoters never used the typed syntax.

Yeah, took me a while to come to what is the GHC's rule here. Thanks for the quick response!

@JustusAdam
Copy link
Owner

Thank you. Yeah @sheaf is for sure the active maintainer here 😄

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.

QuasiQuotes with immediate | are not parsed correctly
3 participants