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 GHC 9.10 #262

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

Conversation

TristanCacqueray
Copy link
Contributor

No description provided.

@TristanCacqueray TristanCacqueray marked this pull request as draft January 6, 2025 20:10
@TristanCacqueray
Copy link
Contributor Author

This turned out to be more complicated than anticipated, this change only fixes the top-level error, now the build presently fails with:

src/Proto3/Suite/DotProto/Generate/Syntax.hs:295:21: error: [GHC-83865]
    • Couldn't match expected type: HsWildCardBndrs
                                      pass0 (GenLocated SrcSpanAnnA (GHC.HsType GhcPs))
                                    -> HsExpr GhcPs
                  with actual type: HsExpr GhcPs
    • The function ‘HsAppType’ is applied to four visible arguments,
        but its type ‘XAppTypeE p
                      -> LHsExpr p -> LHsWcType (NoGhcTc p) -> HsExpr p’
        has only three
      In the first argument of ‘noLocA’, namely
        ‘(HsAppType synDef f synDef (HsWC NoExtField (parenTy t)))’
      In the expression:
        noLocA (HsAppType synDef f synDef (HsWC NoExtField (parenTy t)))
    |
295 | appAt f t = noLocA (HsAppType synDef f
    |                     ^^^^^^^^^^^^^^^^^^...

src/Proto3/Suite/DotProto/Generate/Syntax.hs:435:11: error: [GHC-83865]
    • Couldn't match type: Maybe (ExportDoc pass2) -> IE pass2
                     with: IE GhcPs
      Expected: HsName -> HsImportSpec
        Actual: GenLocated SrcSpanAnnN GHC.Types.Name.Reader.RdrName
                -> GenLocated SrcSpanAnnA (Maybe (ExportDoc pass2) -> IE pass2)
    • In the expression: noLocA . IEVar synDef . noLocA . IEName synDef
      In an equation for ‘ieName_’:
          ieName_ = noLocA . IEVar synDef . noLocA . IEName synDef
    |
435 | ieName_ = noLocA . IEVar synDef . noLocA . IEName
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

src/Proto3/Suite/DotProto/Generate/Syntax.hs:441:14: error: [GHC-83865]
    • Couldn't match type: Maybe (ExportDoc pass1) -> IE pass1
                     with: IE GhcPs
      Expected: HsName -> HsImportSpec
        Actual: GenLocated SrcSpanAnnN GHC.Types.Name.Reader.RdrName
                -> GenLocated SrcSpanAnnA (Maybe (ExportDoc pass1) -> IE pass1)
    • In the expression:
        noLocA . IEThingAll synDef . noLocA . IEName synDef
      In an equation for ‘ieNameAll_’:
          ieNameAll_ = noLocA . IEThingAll synDef . noLocA . IEName synDef
    |
441 | ieNameAll_ = noLocA . IEThingAll synDef . noLocA . IEName
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

src/Proto3/Suite/DotProto/Generate/Syntax.hs:646:17: error: [GHC-83865]
    • Couldn't match expected type ‘Origin’
                  with actual type ‘DoPmc -> Origin’
    • Probable cause: ‘Generated’ is applied to too few arguments
      In the expression: Generated DoPmc
      In an equation for ‘generated’: generated = Generated DoPmc
      In an equation for ‘functionLike_’:
          functionLike_ strictness name alts
            = noLocA $ mkFunBind generated name (map match alts)
            where
                generated :: Origin
                generated = Generated DoPmc
                match :: ([HsPat], HsExp) -> HsMatch
                match (pats, rhs) = mkSimpleMatch ctxt pats rhs
                ....
    |
646 |     generated = Generated
    |                 ^^^^^^^^^...

src/Proto3/Suite/DotProto/Generate/Syntax.hs:648:27: error: [GHC-83865]
    • Couldn't match expected type ‘GHC.Types.Basic.GenReason’
                  with actual type ‘DoPmc’
    • In the first argument of ‘Generated’, namely ‘DoPmc’
      In the expression: Generated DoPmc
      In an equation for ‘generated’: generated = Generated DoPmc
    |
648 |                           DoPmc
    |                           ^^^^^

src/Proto3/Suite/DotProto/Generate/Syntax.hs:652:39: error: [GHC-83865]
    • Couldn't match type: GhcPass Parsed
                     with: GenLocated SrcSpanAnnN GHC.Types.Name.Reader.RdrName
      Expected: HsMatchContext (LIdP (NoGhcTc (GhcPass Parsed)))
        Actual: HsMatchContext GhcPs
    • In the first argument of ‘mkSimpleMatch’, namely ‘ctxt’
      In the expression: mkSimpleMatch ctxt pats rhs
      In an equation for ‘match’:
          match (pats, rhs) = mkSimpleMatch ctxt pats rhs
    |
652 |     match (pats, rhs) = mkSimpleMatch ctxt pats rhs
    |                                       ^^^^

src/Proto3/Suite/DotProto/Generate/Syntax.hs:656:18: error: [GHC-83865]
    • Couldn't match type: GenLocated
                             SrcSpanAnnN GHC.Types.Name.Reader.RdrName
                     with: GhcPass Parsed
      Expected: GhcPs
        Actual: HsName
    • In the ‘mc_fun’ field of a record
      In the expression:
        FunRhs
          {mc_fun = name, mc_fixity = Prefix, mc_strictness = strictness}
      In an equation for ‘ctxt’:
          ctxt
            = FunRhs
                {mc_fun = name, mc_fixity = Prefix, mc_strictness = strictness}
    |
656 |       { mc_fun = name
    |                  ^^^^

src/Proto3/Suite/DotProto/Generate/Syntax.hs:853:17: error: [GHC-83865]
    • Couldn't match expected type ‘Origin’
                  with actual type ‘DoPmc -> Origin’
    • Probable cause: ‘Generated’ is applied to too few arguments
      In the expression: Generated DoPmc
      In an equation for ‘generated’: generated = Generated DoPmc
      In an equation for ‘case_’:
          case_ e
            = noLocA . HsCase synDef e . mkMatchGroup generated . noLocA
            where
                generated :: Origin
                generated = Generated DoPmc
    |
853 |     generated = Generated
    |                 ^^^^^^^^^...

src/Proto3/Suite/DotProto/Generate/Syntax.hs:855:27: error: [GHC-83865]
    • Couldn't match expected type ‘GHC.Types.Basic.GenReason’
                  with actual type ‘DoPmc’
    • In the first argument of ‘Generated’, namely ‘DoPmc’
      In the expression: Generated DoPmc
      In an equation for ‘generated’: generated = Generated DoPmc
    |
855 |                           DoPmc
    |                           ^^^^^

src/Proto3/Suite/DotProto/Generate/Syntax.hs:862:14: error: [GHC-83865]
    • Couldn't match expected type: t0
                                    -> GenLocated SrcSpanAnnA (HsExpr GhcPs) -> HsExpr GhcPs
                  with actual type: HsExpr p0
    • The function ‘HsLet’ is applied to five visible arguments,
        but its type ‘XLet p -> HsLocalBinds p -> LHsExpr p -> HsExpr p’
        has only three
      In the second argument of ‘($)’, namely
        ‘HsLet synDef synDef binds synDef e’
      In the expression: noLocA $ HsLet synDef synDef binds synDef e
    |
862 |     noLocA $ HsLet synDef synDef binds synDef e
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

@TristanCacqueray
Copy link
Contributor Author

On second thought, most of the errors weren't that bad, we are down to the following:

src/Proto3/Suite/DotProto/Generate/Syntax.hs:669:39: error: [GHC-83865]
    • Couldn't match type: GhcPass Parsed
                     with: GenLocated SrcSpanAnnN GHC.Types.Name.Reader.RdrName
      Expected: HsMatchContext (LIdP (NoGhcTc (GhcPass Parsed)))
        Actual: HsMatchContext GhcPs
    • In the first argument of ‘mkSimpleMatch’, namely ‘ctxt’
      In the expression: mkSimpleMatch ctxt pats rhs
      In an equation for ‘match’:
          match (pats, rhs) = mkSimpleMatch ctxt pats rhs
    |
669 |     match (pats, rhs) = mkSimpleMatch ctxt pats rhs
    |                                       ^^^^

src/Proto3/Suite/DotProto/Generate/Syntax.hs:673:18: error: [GHC-83865]
    • Couldn't match type: GenLocated
                             SrcSpanAnnN GHC.Types.Name.Reader.RdrName
                     with: GhcPass Parsed
      Expected: GhcPs
        Actual: HsName
    • In the ‘mc_fun’ field of a record
      In the expression:
        FunRhs
          {mc_fun = name, mc_fixity = Prefix, mc_strictness = strictness}
      In an equation for ‘ctxt’:
          ctxt
            = FunRhs
                {mc_fun = name, mc_fixity = Prefix, mc_strictness = strictness}
    |
673 |       { mc_fun = name
    |                  ^^^^

@TristanCacqueray TristanCacqueray marked this pull request as ready for review January 7, 2025 16:39
@TristanCacqueray
Copy link
Contributor Author

This is not the prettiest thing, but at least this is now compiling with ghc-9.10.1! Marking this as ready for review.

@TristanCacqueray
Copy link
Contributor Author

TristanCacqueray commented Jan 7, 2025

Arg, unfortunately the generated code doesn't compile, this PR produces:

@(HsProtobuf.UnpackedVec HsProtobuf.String Hs.Text) 

… instead of:

@(HsProtobuf.UnpackedVec (HsProtobuf.String Hs.Text))

Would someone know how that works?

Since that's the only failure we got, it can be fixed with: sed -e 's/HsProtobuf.String Hs.Text/(HsProtobuf.String Hs.Text)/'

@j6carey
Copy link
Collaborator

j6carey commented Jan 8, 2025

Probably we need to explicitly add parentheses. That isn't automatic. There are also some changes to the Nix code that will be required; I'm investigating those.

@j6carey j6carey mentioned this pull request Jan 9, 2025
@j6carey
Copy link
Collaborator

j6carey commented Jan 9, 2025

@TristanCacqueray , I hope you don't mind but for reasons of speed I filed a separate PR to try to make the required Nix changes: #263 . If it works out and is approved then it should subsume this one, and I presume that as long as GHC 9.10 is correctly supported that satisfies your requirements. In any case #263 should provide some additional results from continuous integration.

@TristanCacqueray
Copy link
Contributor Author

@j6carey thanks, feel free to assimilate this change. Note that we had to pull #252 too as it is needed for the latest nixpkgs.

@j6carey
Copy link
Collaborator

j6carey commented Jan 13, 2025

Note that we had to pull #252 too as it is needed for the latest nixpkgs.

@TristanCacqueray , curiously, the Nix environment I set up in #263 doesn't end up using aeson-2.2, so I didn't end up needing to incorporate those changes just to get it to build.

@j6carey
Copy link
Collaborator

j6carey commented Jan 14, 2025

Note that we had to pull #252 too as it is needed for the latest nixpkgs.

@TristanCacqueray , curiously, the Nix environment I set up in #263 doesn't end up using aeson-2.2, so I didn't end up needing to incorporate those changes just to get it to build.

Ah, because we did some extra work to stay on the old version. I'll think about this...

@TristanCacqueray
Copy link
Contributor Author

Right, this aeson came with the latest nixpkgs, for the record, here is the change where we bumped to 9.10: change-metrics/monocle#1142

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