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

ghc-lib-parser 9.12 #1140

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

ghc-lib-parser 9.12 #1140

wants to merge 10 commits into from

Conversation

amesgen
Copy link
Member

@amesgen amesgen commented Oct 16, 2024

See the new changelog entries for details.

The commits can be reviewed individually.

Also closes #1146, closes #1152

Also upgrade cabal and enable multi-repl, so ghcid will now work across all components out of the box!

@amesgen amesgen force-pushed the amesgen/ghc-9.12 branch 2 times, most recently from 38cb72a to e9ea55f Compare October 16, 2024 22:06
Copy link

github-actions bot commented Oct 16, 2024

@github-actions github-actions bot temporarily deployed to pull request October 16, 2024 22:28 Inactive
@github-actions github-actions bot temporarily deployed to pull request November 26, 2024 20:25 Inactive
@amesgen amesgen linked an issue Nov 26, 2024 that may be closed by this pull request
@github-actions github-actions bot temporarily deployed to pull request November 26, 2024 20:45 Inactive
@amesgen amesgen mentioned this pull request Jan 5, 2025
@amesgen amesgen force-pushed the amesgen/ghc-9.12 branch 2 times, most recently from 56c5430 to ebd4c6a Compare January 5, 2025 16:44
@github-actions github-actions bot temporarily deployed to pull request January 5, 2025 16:59 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 5, 2025 17:16 Inactive
@amesgen amesgen force-pushed the amesgen/ghc-9.12 branch 7 times, most recently from 44fb942 to 473a86b Compare January 16, 2025 11:17
@github-actions github-actions bot temporarily deployed to pull request January 16, 2025 11:43 Inactive
@amesgen amesgen marked this pull request as ready for review January 16, 2025 13:35
and use GHC 9.10 by default in preparation for ghc-lib-parser 9.12
This can only occur with `NoListTuplePuns`.

Closes #1146
`FastString`s `Data` instance doesn't look at the underlying data, so our
check here will consider all `FastStrings` to be equal. They are used for
example for string literals `HsLit`/`HsTyLit`, where we definitely want to make
sure that we don't mess up.
@github-actions github-actions bot temporarily deployed to pull request January 17, 2025 01:29 Inactive
ncaq added a commit to ncaq/fourmolu that referenced this pull request Jan 17, 2025
Address the following GHC breaking changes.
[!13511: EPA: Remove AnnKeywordId · Merge requests · Glasgow Haskell Compiler / GHC · GitLab](https://gitlab.haskell.org/ghc/ghc/-/merge_requests/13511)
I merge from [ghc-lib-parser 9.12 by amesgen · Pull Request #1140 · tweag/ormolu](tweag/ormolu#1140).
This is merely buildable, not fully tested.
ncaq added a commit to ncaq/fourmolu that referenced this pull request Jan 17, 2025
Address the following GHC breaking changes.
[!13511: EPA: Remove AnnKeywordId · Merge requests · Glasgow Haskell Compiler / GHC · GitLab](https://gitlab.haskell.org/ghc/ghc/-/merge_requests/13511)
I merge from [ghc-lib-parser 9.12 by amesgen · Pull Request #1140 · tweag/ormolu](tweag/ormolu#1140).
This is merely buildable, not fully tested.
CHANGELOG.md Outdated
* Switched to `ghc-lib-parser-9.12`, with the following new syntactic features:
* GHC proposal [#522](https://github.com/ghc-proposals/ghc-proposals/blob/c9401f037cb22d1661931b2ec621925101052997/proposals/0522-or-patterns.rst): `OrPatterns` (enabled by default)
* GHC proposal [#569](https://github.com/ghc-proposals/ghc-proposals/blob/c9401f037cb22d1661931b2ec621925101052997/proposals/0569-multiline-strings.rst): `MultilineStrings` (disabled by default)
* GHC proposal [#409](https://github.com/ghc-proposals/ghc-proposals/blob/c9401f037cb22d1661931b2ec621925101052997/proposals/0569-multiline-strings.rst): `NamedDefaults` (enabled by default)
Copy link
Member

Choose a reason for hiding this comment

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

Is the link for NamedDefaults incorrect? It is pointing to the multiline strings proposal.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, fixed in 7eb8c79

where
leadingSpace = T.length $ T.takeWhile is_space l

-- | The start/end marker of the literal, whether it is a regular or a multiline
Copy link
Member

Choose a reason for hiding this comment

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

Can we put the type definitions at the top?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done in 7aee7cc

-- | The start/end marker of the literal, whether it is a regular or a multiline
-- literal, and the segments of the literals (separated by gaps for a regular
-- literal, and separated by newlines for a multiline literal).
type ParsedStringLiteral = StringLiteralData (StringLiteralKind [Text])
Copy link
Member

Choose a reason for hiding this comment

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

Would this be simpler?

data ParsedStringLiteral = ParsedStringLiteral
  { startMarker, endMarker :: Text,
    content :: [Text],
    stringLiteralKind :: StringLiteralKind
}

data StringLiteralKind = RegularStringLiteral | MultilineStringLiteral

Copy link
Member Author

Choose a reason for hiding this comment

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

I adopted this in 635b354

StringLiteralKind was parametric such that stripStartEndMarker could return StringLiteralKind Text (compared to StringLiteralKind [Text] for ParsedStringLiteral). I changed it such that stripStartEndMarker now returns a singleton list, which seems is fine, and it simplifies the data flow a bit I think.

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.

Support cabal v3.14 Unparseable output with type-level tuples and NoListTuplePuns
3 participants