Skip to content

GHC 9.0#722

Merged
mrkkrp merged 1 commit intomasterfrom
ghc-9.0
Aug 7, 2021
Merged

GHC 9.0#722
mrkkrp merged 1 commit intomasterfrom
ghc-9.0

Conversation

@amesgen
Copy link
Copy Markdown
Contributor

@amesgen amesgen commented Jul 23, 2021

Closes #688
Closes #452
Closes #720
Closes #480

See the comment below for an overview.

@amesgen amesgen changed the title wip GHC 9.0 Jul 23, 2021
@amesgen amesgen marked this pull request as draft July 23, 2021 12:38
@amesgen amesgen marked this pull request as ready for review July 26, 2021 17:41
@amesgen
Copy link
Copy Markdown
Contributor Author

amesgen commented Jul 26, 2021

Overview:

  • There a many minor changes in the GHC AST in GHC 9.0:
    • The new module hierarchy is mostly a mechanical translation.
    • The extension constructors now have NoExtCon as a strict field, and the GHC 8.8+ pattern match coverage checker is clever enough to detect that we don't have to match it (no more noExtCon calls).
    • Some unreachable constructs (e.g. ConPatOut) removed (less notImplemented calls)
    • The RealSrcLoc constructor of SrcLoc now has an extra field Maybe BufPos which indicates the raw location of a syntactic construct (so it ignores e.g. LINE pragmas). We simply ignore this field.
    • Due to parsing changes in whitespace sensitivity, some code that is valid in older GHC versions will no longer be able to be parsed.
      As a side effect, we can enable TypeApplications be default, (Guess that TypeApplications is used without being enabled #452) as I am not aware of any code snippets where parsing with or without TypeApplications would make any difference.
    • Some language extensions got added or changed:
  • Previously, ormolize was applied to the haskell packages of the current GHC version. Some packages have different versions at different GHC versions (hlint, lens), so we now use the haskell packages of 8.10.4 for ormelization or all GHC versions.

Two questions to be resolved:

  1. The leksah test revealed a haddock edge case:
    -- |
    --
    ---
    module Test where
    gets formatted (both with and without this PR) to
    ---
    
    -- |
    module Test where
    but with this PR (due to parser changes), the AST is no longer considered to be equal (so formatting fails without -u).
  2. This snippet
    test ::
      -- |
      a -> 
      b
    was a fixed point before this PR, but now it is formatted to
    test ::
      a ->
      b
    and this works even without -u, as empty haddock strings no longer appear in the AST.

I am not sure whether these are considered to be bugs, and if so, whether they should block this PR. EDIT see this comment for an update.

@amesgen
Copy link
Copy Markdown
Contributor Author

amesgen commented Jul 26, 2021

Update to the questions above: We decided that 2. is OK, and created #726 to track 1.

@mrkkrp mrkkrp merged commit f55ab70 into master Aug 7, 2021
@mrkkrp mrkkrp deleted the ghc-9.0 branch August 7, 2021 12:28
@Tritlo
Copy link
Copy Markdown

Tritlo commented Aug 18, 2021

Question: I'm running ghc-8.10.4 due to issues with 9.0.1 in the plugins I'm writing. Should I stay on 0.1.4.1, or is it OK to switch to 0.2?

@amesgen
Copy link
Copy Markdown
Contributor Author

amesgen commented Aug 18, 2021

@Tritlo ormolu-0.2.0.0 should compile just fine on GHC 8.10.x; it is also tested on CI.

@Tritlo
Copy link
Copy Markdown

Tritlo commented Aug 18, 2021

Ok thanks! I just saw the lib-parser scroll by for 9.0.1, and was worried it might be inconsistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants