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

0.20.0 doesn't build on ghc 9.4.2 #383

Closed
danwdart opened this issue Oct 8, 2022 · 6 comments
Closed

0.20.0 doesn't build on ghc 9.4.2 #383

danwdart opened this issue Oct 8, 2022 · 6 comments

Comments

@danwdart
Copy link

danwdart commented Oct 8, 2022

Removing version constraints to upgrade gave me:

src/Extract.hs:185:27: error:
    • Couldn't match expected type: Maybe a0 -> IO HscEnv
                  with actual type: IO HscEnv
    • The function ‘initializePlugins’
      is applied to two value arguments,
        but its type ‘HscEnv -> IO HscEnv’ has only one
      In the first argument of ‘liftIO’, namely
        ‘(initializePlugins hsc_env Nothing)’
      In a stmt of a 'do' block:
        hsc_env' <- liftIO (initializePlugins hsc_env Nothing)
    |
185 |       hsc_env' <- liftIO (initializePlugins hsc_env Nothing)
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Extract.hs:230:56: error:
    Variable not in scope: unpackHDS :: HsDoc GhcPs -> String
    Suggested fix: Perhaps use ‘unpackHDSC’ (imported from GHC)
    |
230 | docStringsFromModule mod = map (fmap (toLocated . fmap unpackHDS)) docs
    |                                                        ^^^^^^^^^

src/Extract.hs:235:26: error:
    • Couldn't match type: GenLocated SrcSpan (HsDoc GhcPs)
                     with: WithHsDocIdentifiers HsDocString GhcPs
      Expected: [(Maybe String, LHsDoc GhcPs)]
        Actual: [(Maybe String, GenLocated SrcSpan (LHsDoc GhcPs))]
    • In the first argument of ‘(++)’, namely ‘exports’
      In the second argument of ‘(++)’, namely ‘exports ++ decls’
      In the expression: header ++ exports ++ decls
    |
235 |     docs     = header ++ exports ++ decls
    |                          ^^^^^^^

src/Extract.hs:235:37: error:
    • Couldn't match type ‘HsDocString’
                     with ‘WithHsDocIdentifiers HsDocString GhcPs’
      Expected: [(Maybe String, LHsDoc GhcPs)]
        Actual: [(Maybe String, LHsDocString)]
    • In the second argument of ‘(++)’, namely ‘decls’
      In the second argument of ‘(++)’, namely ‘exports ++ decls’
      In the expression: header ++ exports ++ decls
    |
235 |     docs     = header ++ exports ++ decls
    |                                     ^^^^^

src/Extract.hs:322:31: error:
    • Expecting one more argument to ‘DocDecl’
      Expected a type, but ‘DocDecl’ has kind ‘* -> *’
    • In the type signature:
        fromDocDecl :: SrcSpan -> DocDecl -> (Maybe String, LHsDocString)
      In an equation for ‘extractDocStrings’:
          extractDocStrings
            = everythingBut
                (++)
                (([], False) `mkQ` fromLHsDecl `extQ` fromLDocDecl
                   `extQ` fromLHsDocString)
            where
                fromLHsDecl :: Selector (LHsDecl GhcPs)
                fromLHsDecl (L loc decl)
                  = case decl of
                      DocD _ x -> select (fromDocDecl (locA loc) x)
                      _ -> ...
                fromLDocDecl :: Selector (LDocDecl GhcPs)
                fromLDocDecl (L loc x) = select (fromDocDecl (locA loc) x)
                ....
    |
322 |     fromDocDecl :: SrcSpan -> DocDecl -> (Maybe String, LHsDocString)

Any idea about that one? Thanks!

@danwdart
Copy link
Author

Looks like maybe a shim or a bit of CPP is required to switch between the new behaviour of some of these:

Strangely the first one wouldn't work on ghc 9.2 either:
https://hackage.haskell.org/package/ghc-9.0.2/docs/GHC-Runtime-Loader.html#v:initializePlugins
vs
https://hackage.haskell.org/package/ghc-9.2.4/docs/GHC-Runtime-Loader.html#v:initializePlugins
vs
https://hackage.haskell.org/package/ghc-9.4.2/docs/GHC-Runtime-Loader.html#v:initializePlugins

HDS now come in chunks:
https://hackage.haskell.org/package/ghc-9.2.4/docs/GHC-Hs-DocString.html#v:unpackHDS
vs
https://hackage.haskell.org/package/ghc-9.4.2/docs/GHC-Hs-DocString.html#v:unpackHDSC

I also see that there are several PRs in progress:

#382
#379
#376
#375

so I'll be doing my testing on one of those, so awesome job, folks.

@sol
Copy link
Owner

sol commented Oct 10, 2022

#382 by @eddiejessup looks promising, but there's a possible space leak that needs investigation.

@eddiejessup
Copy link
Contributor

Just a shout that #382 is now merged, so if the problems are now gone maybe we can close this issue?

@danwdart
Copy link
Author

Thanks - I see 0.20.1 in Hackage, I'll put it through my pipeline tonight and make sure I can build it with no issues.

@ysangkok
Copy link

@danwdart Did it work? Builds fine for me.

@danwdart
Copy link
Author

Seems great to me. Nix may have forgotten to remove the check though... I'm just letting them know.

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

No branches or pull requests

4 participants