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 GHC-9.0 #297

Closed
35 tasks done
mouse07410 opened this issue Aug 8, 2020 · 43 comments
Closed
35 tasks done

Support for GHC-9.0 #297

mouse07410 opened this issue Aug 8, 2020 · 43 comments
Labels

Comments

@mouse07410
Copy link

mouse07410 commented Aug 8, 2020

State of support

  • The core functionality of haskell-language-server is supported.
  • Only some plugins and formatters needs to be updated to make it work with ghc-9.0.1 so they are not included until then.
  • So you should consider use other ghc version only if you are specially interested in those plugins o formatters

Has ghc-9.0 support

Formatters

Build system and CI

  • stack-9.0.1.yaml - Disables not-yet-working plugins and fetches upstream patches
  • cabal-ghc901.project - Used for disabling the not yet working plugins and fetching upstream patches
  • flake.nix - Needs to fetch upstream patches and disable not-yet-working plugins (nix: add support for ghc 9.0.1 #1995)
  • .circleci/config.yml
  • .github/workflows/test.yml - Uses the custom cabal.project and disables tests for non-working plugins. Needs to be updated when more plugins gain ghc-9.0.1 support
  • .github/workflows/build.yml - The release script is not updated to make a ghc-9.0.1 release yet (PR Add ghc-9.0.1 to the build release script #1940)
  • mergify.io We should probably make it manditory for PRs to successfully build/test on ghc-9.0.1 as well

Dependencies which needs updates and hackage release

Dependencies needed to inlcude brittany in hackage for 9.0:

@Ailrun Ailrun added component: ghcide type: enhancement New feature or request labels Aug 9, 2020
@jneira jneira added the status: blocked Not actionable, because blocked by upstream/GHC etc. label Nov 9, 2020
@jneira
Copy link
Member

jneira commented Nov 9, 2020

STATUS

It still has not been released

upstream packages that should be updated to being buildable with ghc-9.0.4, to build hls-plugin-api alone

  • regex-tdfa:base,
  • regex-base:base,
  • lens:template-haskell,
  • lens:setup
  • parallel:base,
  • haskell-lsp:base, (we are about to change it as the new package lsp that has the upper bound on 4.15 too)
  • haskell-lsp-types:base, (same as haskell-lsp)
  • hashable:base,
  • time-compat:base,
  • these:base,
  • assoc:base,
  • deepseq:base,
  • hslogger:base

//cc @Kleidukos

@jneira
Copy link
Member

jneira commented Jan 18, 2021

The release candidate has been uploaded: https://www.haskell.org/ghc/blog/20201229-ghc-9.0.1-rc1-released.html
So we could start to add support for it 😄

@poscat0x04
Copy link

Now that ghc 9.0.1 has been released, maybe we should bump up the priority?

@jneira
Copy link
Member

jneira commented Feb 5, 2021

Yeah, but i guess it will be a complex change, given we are totally tied to ghc

@jneira jneira added status: needs attention and removed status: blocked Not actionable, because blocked by upstream/GHC etc. labels Feb 5, 2021
@konn
Copy link
Collaborator

konn commented Feb 5, 2021

As the module structure of the ghc package drastically changed in 9.0.1, it might make sense to provide some compatibility layer in ghcide or its dependency. I once tried ghc-api-compat with GHC 9.0.1-rc1 as a compact layer, but its Hackage version didn't compile at that time.

@jneira
Copy link
Member

jneira commented Feb 5, 2021

We have already a compat module in ghcide but it does not export everything we need and it is misused in some code regions (for example i did not use in hlint puglin until recently)
We can leverage it while we add support for the new ghc version.

https://github.com/haskell/haskell-language-server/blob/master/ghcide/src/Development/IDE/GHC/Compat.hs

@Ailrun Ailrun pinned this issue Feb 7, 2021
@jneira jneira added the status: blocked Not actionable, because blocked by upstream/GHC etc. label Feb 10, 2021
@jneira
Copy link
Member

jneira commented Feb 10, 2021

I've started a branch to give a quick try to ghc-9.0.1. I am afraid that only trying to build hls-plugin-api our simpler subpackage with less dependencies i have needed several allow-newer:

packages: .

allow-newer:
  regex-tdfa:base,
  regex-base:base,
  lens:template-haskell,
  parallel:base,
  haskell-lsp:base,
  haskell-lsp-types:base,
  hashable:base,
  time-compat:base,
  these:base,
  assoc:base,
  deepseq:base,
  hslogger:base

With this in a cabal.project in ./hls-plugin-api i still got:

cabal: Could not resolve dependencies:
[__0] trying: hls-plugin-api-0.7.0.0 (user goal)
[__1] trying: lens-4.19.2 (dependency of hls-plugin-api)
[__2] trying: lens:setup.base-4.15.0.0/installed-4.15.0.0 (dependency of lens)
[__3] next goal: lens:setup.Cabal (dependency of lens)
[__3] rejecting: lens:setup.Cabal-3.4.0.0/installed-3.4.0.0,
lens:setup.Cabal-3.4.0.0 (constraint from maximum version of Cabal used by
Setup.hs requires <3.4)

So the build type setup of lens is preventing the build. Not sure how to avoid it in the call site.

So we have to wait or patch upstream packages. If we would try to install ghcide or hls with plugins the list of pending packages will be interminable so let's start with this one.

@jneira
Copy link
Member

jneira commented Feb 10, 2021

As commented in reddit cabal-3.4.0.0 is required to avoid constraint from maximum version of Cabal used by Setup.hs requires <3.4 in addition to allow-newer: mypkg:Cabal
The binaries are available here

Time to regenerate the index cache 😝

@Bodigrim
Copy link
Contributor

You can try lens-5, which switched to build-type: Simple and bumped several upper bounds.

@anka-213
Copy link
Contributor

I've managed to get hls-plugin-api to compile by adding a bunch of source-repository-packages with references to the various (mostly unmerged) upstream patches for ghc-9.0.1 support in cabal.project. And by adding

allow-newer:
    *:*,

to the same file.

You can check out this branch: https://github.com/anka-213/haskell-language-server/tree/ghc-9.0.1-with-lsp-1.2

It combines #1635 with #1631 in addition to modifying cabal.project.

@jneira
Copy link
Member

jneira commented Mar 30, 2021

@anka-213 In case it could help, i had a WIP branch over hls here: https://github.com/jneira/haskell-language-server/tree/ghc-9.0.1
It has the (now outdated) list of the precise packages that needed allow-newer at the moment

@mouse07410
Copy link
Author

@jneira is there a downside to allowing _all_the packages "newer"?

@jneira
Copy link
Member

jneira commented Mar 30, 2021

You could get bad versions that might break the build, out of established bounds in .cabal files so it is advisable to restrict them as much as possible
Otoh they are useful to track what dependencies needs to be chased and patched
It would be very nice that cabal could generate the automatically as @anka-213 suggested in other issue, maybe it would worth a feature request?

@anka-213
Copy link
Contributor

anka-213 commented Apr 1, 2021

I've managed to get ghcide to compile now, but it fails with the error:

Message:  ghcide: Couldn't find a target code interpreter. Try with -fexternal-interpreter

Does anyone know what that could be caused by?

@anka-213
Copy link
Contributor

anka-213 commented Apr 1, 2021

For some reason, changing this

env <- runGhc (Just libDir) getSession

to this

env <- runGhc (Just libDir) $ do df <- getSessionDynFlags; setSessionDynFlags df; getSession

worked. The function initDynLinker was sad that the interpreter was not set, which apparently is set as a side effect of calling setSessionDynFlags.

But it is still very far from functional and I get new difficult-to debug errors. :/

@jneira
Copy link
Member

jneira commented Aug 27, 2021

I've opened #2131 to:

  • updating and cleaning up cabal-ghc901.project
  • same for stack-9.0.1,yaml, enabling all supported plugins already available for cabal

@jneira
Copy link
Member

jneira commented Sep 27, 2021

  • Updated description with the state of the support

@jneira
Copy link
Member

jneira commented Oct 4, 2021

Support for fourmolu with #2254

@Ailrun
Copy link
Member

Ailrun commented Oct 29, 2021

FWIW, GHC 9.2.1 is now released: https://discourse.haskell.org/t/ghc-9-2-1-released/3527

@mouse07410
Copy link
Author

Should this issue be closed, as HLS 1.4.0 seems to support GHC-9.0.1?

@anka-213
Copy link
Contributor

anka-213 commented Nov 5, 2021

@mouse07410 There are still a few plugins that doesn’t support GHC-9.0.1 yet, as can be seen in the checklist.

@jneira
Copy link
Member

jneira commented Nov 20, 2021

czipwith and th-extras already has 9.0.1 support in hackage

@Anton-Latukha
Copy link
Collaborator

Anton-Latukha commented Dec 12, 2021

brittany solved mentioned report & release 0.14 with 9.0.2 support got published: https://hackage.haskell.org/package/brittany-0.14.0.0/changelog


Part of the configuration code: #2473, I closed that to be non-blocking to others.


The plugin for brittany process would be open to continuation after #297.

@jneira jneira changed the title Support for GHC-9.0.1 Support for GHC-9.0 Jan 24, 2022
@jneira jneira mentioned this issue Jan 24, 2022
8 tasks
@re-xyr
Copy link

re-xyr commented Mar 18, 2022

Seems stylish-haskell-0.14.0.0 supports GHC 9.0 now. Any chance we're going to have it?

@pepeiborra
Copy link
Collaborator

Seems stylish-haskell-0.14.0.0 supports GHC 9.0 now. Any chance we're going to have it?

Unfortunately hlint requires ghc-lib-parser ==9.0 whereas stylish-haskell wants ==9.2, so no way to build HLS with both.

@re-xyr
Copy link

re-xyr commented Mar 19, 2022

Unfortunately hlint requires ghc-lib-parser ==9.0 whereas stylish-haskell wants ==9.2, so no way to build HLS with both.

Yes, I noticed that shortly after and filed an issue for stylish-haskell: haskell/stylish-haskell#391

@July541
Copy link
Collaborator

July541 commented May 20, 2022

I think we have fully supported ghc-9.0.

@Ailrun Ailrun removed the status: blocked Not actionable, because blocked by upstream/GHC etc. label May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests