Skip to content
This repository was archived by the owner on Jan 2, 2021. It is now read-only.

Use GADTs for all ghc versions in Development.IDE.Plugin.Completions.Logic #947

Merged
merged 7 commits into from
Dec 11, 2020

Conversation

jneira
Copy link
Member

@jneira jneira commented Dec 10, 2020

  • It fixes the build for ghc-8.8.3 and ghc-8.8.2 that was failing with:
Progress 166/173: ghcide ghcide > /root/build/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs:267:5: error:
Progress 166/173: ghcide ghcide >     • Illegal equational constraint NoGhcTcPass pass
Progress 166/173: ghcide ghcide >                                     ~ NoGhcTcPass (NoGhcTcPass pass)
Progress 166/173: ghcide ghcide >       (Use GADTs or TypeFamilies to permit this)
Progress 166/173: ghcide ghcide >     • When checking the inferred type
Progress 166/173: ghcide ghcide >         f :: forall (pass :: Pass).
Progress 166/173: ghcide ghcide >              (Outputable.OutputableBndr
Progress 166/173: ghcide ghcide >                 (NameOrRdrName (IdP (GhcPass (NoGhcTcPass pass)))),
Progress 166/173: ghcide ghcide >               Outputable.OutputableBndr (IdP (GhcPass (NoGhcTcPass pass))),
Progress 166/173: ghcide ghcide >               Outputable.OutputableBndr (IdP (GhcPass pass)),
Progress 166/173: ghcide ghcide >               Outputable.OutputableBndr (NameOrRdrName (IdP (GhcPass pass))),
Progress 166/173: ghcide ghcide >               Outputable (XIPBinds (GhcPass pass)),
Progress 166/173: ghcide ghcide >               Outputable (XViaStrategy (GhcPass pass)),
Progress 166/173: ghcide ghcide >               Outputable (XIPBinds (GhcPass (NoGhcTcPass pass))),
Progress 166/173: ghcide ghcide >               Outputable (XViaStrategy (GhcPass (NoGhcTcPass pass))),
Progress 166/173: ghcide ghcide >               NoGhcTcPass pass ~ NoGhcTcPass (NoGhcTcPass pass)) =>
Progress 166/173: ghcide ghcide >              Maybe Range -> ImportDecl (GhcPass pass) -> Maybe [TextEdit]
Progress 166/173: ghcide ghcide >       In the expression:
Progress 166/173: ghcide ghcide >         let
Progress 166/173: ghcide ghcide >           f (Just range) ImportDecl {ideclHiding}
Progress 166/173: ghcide ghcide >             = case ideclHiding of
Progress 166/173: ghcide ghcide >                 Just (False, x)
Progress 166/173: ghcide ghcide >                   | Set.notMember name (Set.fromList ...) -> ...
Progress 166/173: ghcide ghcide >                   | otherwise -> ...
Progress 166/173: ghcide ghcide >                 _ -> ...
Progress 166/173: ghcide ghcide >           f _ _ = Nothing
Progress 166/173: ghcide ghcide >           src_span = srcSpanToRange . getLoc $ lDecl
Progress 166/173: ghcide ghcide >         in f src_span . unLoc $ lDecl
Progress 166/173: ghcide ghcide >       In an equation for ‘extendImportList’:
Progress 166/173: ghcide ghcide >           extendImportList name lDecl
Progress 166/173: ghcide ghcide >             = let
Progress 166/173: ghcide ghcide >                 f (Just range) ImportDecl {ideclHiding} = ...
Progress 166/173: ghcide ghcide >                 f _ _ = Nothing
Progress 166/173: ghcide ghcide >                 src_span = srcSpanToRange . getLoc $ lDecl
Progress 166/173: ghcide ghcide >               in f src_span . unLoc $ lDecl
Progress 166/173: ghcide ghcide >     |
Progress 166/173: ghcide ghcide > 267 |     f (Just range) ImportDecl {ideclHiding} = case ideclHiding of
Progress 166/173: ghcide ghcide >     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
Progress 166/173: ghcide ghcide > 

It unblocks the bump of ghcide in hls (and the incoming release): haskell/haskell-language-server#658.
Will rebase #946 when it is ready

@jneira jneira requested a review from pepeiborra December 10, 2020 10:31
@jneira jneira changed the title Use GADTs for all ghc-8.x versions Use GADTs for all ghc-8.x versions in Development.IDE.Plugin.Completions.Logic Dec 10, 2020
Copy link
Collaborator

@ndmitchell ndmitchell left a comment

Choose a reason for hiding this comment

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

Why not just include the GADTs extension unconditionally? CPP seems significantly worse than a fairly harmless extension.

@jneira
Copy link
Member Author

jneira commented Dec 10, 2020

Why not just include the GADTs extension unconditionally? CPP seems significantly worse than a fairly harmless extension.

ghc-8.6 definitely does not need it but we can give a try

@ndmitchell
Copy link
Collaborator

Yes, it might be not required, but it's not harmful, so might as well simplify and include it.

@jneira jneira changed the title Use GADTs for all ghc-8.x versions in Development.IDE.Plugin.Completions.Logic Use GADTs for all ghc versions in Development.IDE.Plugin.Completions.Logic Dec 10, 2020
@pepeiborra
Copy link
Collaborator

Can we move this to #946? Otherwise, how do we know that it works?

@jneira
Copy link
Member Author

jneira commented Dec 10, 2020

Can we move this to #946? Otherwise, how do we know that it works?

my plan is rebase master after merging #946 in master
(it has worked for me locally though)

@jneira
Copy link
Member Author

jneira commented Dec 10, 2020

well in fact we should rebase #946 onto this one, to make ci pass

@pepeiborra
Copy link
Collaborator

No, we should merge them both :)

@jneira
Copy link
Member Author

jneira commented Dec 10, 2020

ok, will include it here

@jneira
Copy link
Member Author

jneira commented Dec 10, 2020

dicho y hecho

@jneira
Copy link
Member Author

jneira commented Dec 10, 2020

the ghc-lib build had test:true by default

Copy link
Collaborator

@pepeiborra pepeiborra left a comment

Choose a reason for hiding this comment

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

Thanks!

@jneira
Copy link
Member Author

jneira commented Dec 10, 2020

Too much jobs, the matrix dont "overwrite" major versions with test enabled but create new ones, investigating

@jneira
Copy link
Member Author

jneira commented Dec 11, 2020

After further investigation in my repo:

  • include and exclude dont support lists like the matrix so you have to write all combinations one by one 😞
  • we could make two separate jobs but it would duplicate allmost all steps
    • it seems the unique current way to share steps between jobs is create a dedicate github action 😞
  • we have several axis and corner cases:
    • os, ghc version, testability, using ghc-lib
      • we have three versions to test and four versions to only build
    • windows only supports some of those ghc versions (to build and to test) and has a specific one (ghc-8.10.2.2) that can be testable

So the unique solution i can think of is create a matrix with all combinations (except ghc-lib and windows ghc-8.10.2.2) and exclude one by one the other ones. Or create a minimal matrix over test (3 versions) or only build (4 versions) without windows and include all desired cases one by one.
In both cases the list of inclusions or exclusions will be annoying. 😟

I am gonna start to sketch the second option (minimal matrix build over only build + inclusions)

- os: windows-latest
ghc: '8.10.2' # broken due to https://gitlab.haskell.org/ghc/ghc/-/issues/18550
- os: windows-latest
ghc: '8.8.4' # also fails due to segfault :(
include:
Copy link
Member Author

@jneira jneira Dec 11, 2020

Choose a reason for hiding this comment

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

this is the less bad version i got to work, feel free to suggest another better one 🙂
//cc @pepeiborra @ndmitchell

@jneira
Copy link
Member Author

jneira commented Dec 11, 2020

I've opened a issue in github actions to let use lists in matrix include and exclude props: actions/runner#857

@jneira jneira merged commit 27b4250 into master Dec 11, 2020
@jneira jneira deleted the fix-ghc-8.x branch December 11, 2020 11:23
@jneira
Copy link
Member Author

jneira commented Dec 11, 2020

@pepeiborra Unfortunately we already released ghcide-0.6 in hackage (but no in github afaics, only exists the tag)
Could we release 0.6.1 with this merged, to use it in hls?

EDIT: I've just make the github 0.6.0 release, using the pr list from ChangeLog.md

@pepeiborra
Copy link
Collaborator

I don't have any objections against a 0.6.0.1 release in Hackage. But why is this needed though?

  • hls-plugin-api need only depend on ghcide 0.6.0
  • HLS too, but it doesn't get released to Hackage anyway
  • We can make a Hackage revision for ghcide 0.6.0 that lists it as incompatible with ghc 8.8.2 and 8.8.3

@pepeiborra
Copy link
Collaborator

EDIT: I've just make the github 0.6.0 release, using the pr list from ChangeLog.md

I don't see the value in GitHub releases so I don't bother with them

@jneira
Copy link
Member Author

jneira commented Dec 11, 2020

I don't have any objections against a 0.6.0.1 release in Hackage. But why is this needed though?

If someone wants to build its own version of hls without the ghcide submodule, or a project (a standalone private plugin?) that uses ghcide or hls-plugin-api from hackage, with ghc-8.8.3 or ghc-8.8.2, it will fail.

Not sure if that case exists in the wild but it is possible and it is nicer for those users being able to use its current ghc version instead warn them in the package metadata that they can't.

But we can wait for someone asking for it, so as you consider.

I don't see the value in GitHub releases so I don't bother with them

Well they are merely informative but we did releases for previous versions, so at least for consistency.

pepeiborra added a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
…8.3 and ghc-8.8.2 builds (haskell/ghcide#947)

* Extend CI matrix with all the GHC minor versions supported by HLS
  * Adding a new job for windows: ghc-8.10.2.2

* Use GADTs for all ghc versions in Development.IDE.Plugin.Completions.Logic 
  * Fix ghc-8.8.2 and ghc-8.8.3 builds

Co-authored-by: Pepe Iborra <[email protected]>
pepeiborra added a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
…8.3 and ghc-8.8.2 builds (haskell/ghcide#947)

* Extend CI matrix with all the GHC minor versions supported by HLS
  * Adding a new job for windows: ghc-8.10.2.2

* Use GADTs for all ghc versions in Development.IDE.Plugin.Completions.Logic 
  * Fix ghc-8.8.2 and ghc-8.8.3 builds

Co-authored-by: Pepe Iborra <[email protected]>
pepeiborra added a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
…8.3 and ghc-8.8.2 builds (haskell/ghcide#947)

* Extend CI matrix with all the GHC minor versions supported by HLS
  * Adding a new job for windows: ghc-8.10.2.2

* Use GADTs for all ghc versions in Development.IDE.Plugin.Completions.Logic 
  * Fix ghc-8.8.2 and ghc-8.8.3 builds

Co-authored-by: Pepe Iborra <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants