Skip to content

ci: constrain megaparsec < 9.8 on GHC < 9.10#1630

Open
jkeuhlen wants to merge 2 commits into
yesodweb:masterfrom
jkeuhlen:ci-constrain-megaparsec
Open

ci: constrain megaparsec < 9.8 on GHC < 9.10#1630
jkeuhlen wants to merge 2 commits into
yesodweb:masterfrom
jkeuhlen:ci-constrain-megaparsec

Conversation

@jkeuhlen

@jkeuhlen jkeuhlen commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

While trying to fix a CI issue in another PR (which came up on the actual functionality PR I was working on), I ran into this update to megaparsec which causes it to fail to build on older GHC versions. This pins the constraint for older versions so that everything can keep building.

Claude summary below, in case it's useful.

9.8 also causes test failures due to some other changes, so rather than a conditional fix I just pinned it below 9.8 everywhere:

  test/Database/Persist/QuasiSpec.hs:1261:17: 
  1) Database.Persist.Quasi, tab error level setting, when configured to disallow tabs, rejects tab indentation
       expected: 2:1:
                   |
                 2 |  Id Text
                   | ^
                 unexpected tab
                 expecting valid whitespace
                 
                 3:1:
                   |
                 3 |  name String
                   | ^
                 unexpected tab
                 expecting valid whitespace
                 
        but got: 2:1:
                   |
                 2 |  Id Text
                   | 
                 unexpected tab
                 expecting valid whitespace
                 
                 3:1:
                   |
                 3 |  name String
                   | 
                 unexpected tab
                 expecting valid whitespace
                 

  To rerun use: --match "/Database/Persist/Quasi/tab error level setting/when configured to disallow tabs/rejects tab indentation/" --seed 608015465

Problem

CI builds recently began failing on every GHC below 9.10 (8.8 – 9.8) while compiling a transitive dependency:

Text/Megaparsec/Stream.hs:517:26: error:
    • Variable not in scope: foldl' :: (b -> Char -> b) -> b -> [Char] -> b
    • Perhaps you want to add ‘foldl'’ to the import list
      in the import of ‘Data.Foldable’
Failed to build megaparsec-9.8.0 (which is required by test:test from
persistent-postgresql, test:test from persistent-sqlite and others).

megaparsec-9.8.0 uses an unqualified foldl', which is only re-exported from Prelude as of base-4.20 (GHC 9.10). On older compilers it's a hard "not in scope" compile error.

It surfaced now because the workflow runs cabal v2-freeze fresh on every run (there's no committed cabal.project.freeze), so the solver always floats to the newest Hackage release — and megaparsec-9.8.0 was recently published. GHC 9.10/9.12 compile it fine; everything ≤ 9.8 breaks. This affects master and every open PR equally, not any one branch.

CI builds recently started failing on GHC 8.8–9.8 with:

    Text/Megaparsec/Stream.hs:517:26: error:
        Variable not in scope: foldl'
    Failed to build megaparsec-9.8.0

megaparsec-9.8.0 uses an unqualified `foldl'`, which is only re-exported
from Prelude as of base-4.20 (GHC 9.10). Because CI runs `cabal v2-freeze`
fresh on every run (no committed freeze file), it floats to the newest
Hackage release, and 9.8.0 fails to compile on every GHC below 9.10.

Pin megaparsec < 9.8 for those compilers via a project conditional; GHC
9.10+ continue to use 9.8.0, which builds there without issue.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jkeuhlen jkeuhlen marked this pull request as ready for review June 18, 2026 21:52
Broaden the previous GHC < 9.10 constraint to the whole matrix.
megaparsec-9.8.0 breaks the build two different ways:

  * GHC < 9.10: fails to compile ("Variable not in scope: foldl'"),
    relying on foldl' being re-exported from Prelude (base-4.20 / GHC 9.10).
  * GHC >= 9.10: compiles, but changes parse-error rendering (the `^` caret
    under the offending token), breaking the expected strings in
    Database.Persist.Quasi's test suite (3 failures in QuasiSpec).

The earlier conditional only fixed the compile error; pin unconditionally
so every job uses the pre-9.8 error format the tests expect.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant