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

Support for -XTypeApplications #279

Merged
merged 3 commits into from
Aug 5, 2024
Merged

Conversation

mixphix
Copy link
Contributor

@mixphix mixphix commented May 6, 2024

Augments the Shakespeare base parser to support parsing type applications, e.g. #{show @Integer 4}, to improve working with polymorphism within quasi-quotes. Will parse type constructors, symbol types, type-level naturals, and single-depth compositions thereof, but will not parse things like @(Const (Maybe a) b) with nested parentheses.

@mixphix
Copy link
Contributor Author

mixphix commented May 7, 2024

The earliest GHC version this could support is 8.2.1 (2017), according to the metadata for the commit introducing AppTypeE to template-haskell. If older compiler support is required, we can add the preprocessor directives.

Copy link
Member

@snoyberg snoyberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! Can you add a minor version bump and a ChangeLog comment about the addition?

@snoyberg
Copy link
Member

If older compiler support is required, we can add the preprocessor directives.

No, it's fine to support only GHC 8.2 and up.

@mixphix
Copy link
Contributor Author

mixphix commented May 13, 2024

I've bumped the version number and edited the changelog. Thanks!

@mixphix
Copy link
Contributor Author

mixphix commented Aug 2, 2024

Is this ready for merge?

Copy link
Member

@snoyberg snoyberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, looks good, thanks!

@snoyberg snoyberg merged commit 4fcf511 into yesodweb:master Aug 5, 2024
@parsonsmatt
Copy link
Collaborator

I'm seeing a test failure on this PR:

Failures:

  test/Text/Shakespeare/BaseSpec.hs:55:5: 
  1) Text.Shakespeare.Base parseDeref parse single @ as operator
       expected: Right (DerefBranch (DerefBranch (DerefIdent (Ident "@")) (DerefIdent (Ident "x"))) (DerefIdent (Ident "y")))
        but got: Right (DerefIdent (Ident "x"))

  To rerun use: --match "/Text.Shakespeare.Base/parseDeref parse single @ as operator/" --seed 713123586

Randomized with seed 713123586

Finished in 0.0160 seconds
275 examples, 1 failure
Test suite test: FAIL
Test suite logged to:
/home/matt/Projects/shakespeare/dist-newstyle/build/x86_64-linux/ghc-8.8.4/shakespeare-2.1.1/t/test/noopt/test/shakespeare-2.1.1-test.log
0 of 1 test suites (0 of 1 test cases) passed.
Error: [Cabal-7125]
Tests failed for test:test from shakespeare-2.1.1.

I think we need to mark this release as broken on Hackage, and possibly do a revert of this PR until it can be fixed. Thoughts @snoyberg @mixphix ?

@mixphix
Copy link
Contributor Author

mixphix commented Aug 6, 2024

This commit solves the failing test.

@lvn-rusty-dragon
Copy link

I'll do both of those @parsonsmatt.

snoyberg added a commit that referenced this pull request Aug 6, 2024
This reverts commit 4fcf511, reversing
changes made to 6ca155b.
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.

4 participants