lspitzner / brittany

haskell source code formatter
GNU Affero General Public License v3.0
690 stars 72 forks source link

Support ghc-8.10 #269

Closed lspitzner closed 3 years ago

lspitzner commented 4 years ago

The next alpha is released (https://mail.haskell.org/pipermail/ghc-devs/2019-November/018337.html).

For the last two ghc released I have tried to prepare for the next GHC release ahead of time by using head.hackage or whatsitcalled. Because getting that to work has proven to be a sink of my time, this time around I plan not to start working on making brittany compatible until the dependencies work with the new GHC version (excluding the dependencies from me, of course, i.e. multistate/butcher/czipwith/data-tree-print).

This may delay a release that is compatible with ghc-8.10 a bit (but we'll keep making releases with new features until then).

You are very welcome to

Thank you for your understanding, have a nice day!

lspitzner commented 4 years ago

cabal-install is at this moment not officially compatible with ghc-8.8 yet. Probably just a bounds oversight, but good to see that brittany is ahead of the "official" ecosystem.

ChickenProp commented 4 years ago

Will ghc-exactprint need to be updated for 8.10 before brittany can be? That repo hasn't seen much activity lately.

lspitzner commented 4 years ago

yes, but I am sure alanz will make a release in time. I know most of the feature-requests in that repo don't get much attention, but it has always been updated to new ghcs quickly in the past. And there already is https://github.com/alanz/ghc-exactprint/commits/ghc-8.10.

ChickenProp commented 4 years ago

Ah, I hadn't looked at the list of branches. It totally makes sense that that work wouldn't be on master yet.

jgrosso commented 4 years ago

Bumping now that GHC 8.10.1 has been officially released.

jgrosso commented 4 years ago

@lspitzner I took a brief look, and (at least on Hackage) I think all the external dependencies support GHC 8.10.2.

jneira commented 4 years ago

I am afraid that some of them still does not support them. I got several solver errors trying to build it in windows with cabal v2-build -w ghc-8.10.1 and it needed this cabal project:

packages: .

allow-newer: multistate:base,
             data-tree-print:base,
             czipwith:base,
             czipwith:template-haskell,
             butcher:base

It could serve as the checklist of packages that would be need an update to be comatible with ghc-8.10.1.

I've added the dependencies that already support ghc-8.10.1:

diff --git a/brittany.cabal b/brittany.cabal
index d99ad17..c189532 100644
--- a/brittany.cabal
+++ b/brittany.cabal
@@ -91,10 +91,10 @@ library {
     -fno-warn-redundant-constraints
   }
   build-depends:
-    { base >=4.9 && <4.14
-    , ghc >=8.0.1 && <8.9
+    { base >=4.9 && <4.15
+    , ghc >=8.0.1 && <8.11
     , ghc-paths >=0.1.0.9 && <0.2
-    , ghc-exactprint >=0.5.8 && <0.6.3
+    , ghc-exactprint >=0.5.8 && <0.6.4
     , transformers >=0.5.2.0 && <0.6
     , containers >=0.5.7.1 && <0.7
     , mtl >=2.2.1 && <2.3
@@ -118,7 +118,7 @@ library {
     , semigroups >=0.18.2 && <0.20
     , cmdargs >=0.10.14 && <0.11
     , czipwith >=1.0.1.0 && <1.1
-    , ghc-boot-th >=8.0.1 && <8.9
+    , ghc-boot-th >=8.0.1 && <8.11
     , filepath >=1.4.1.0 && <1.5
     , random >= 1.1 && <1.2
     }

Then i started to fix compile errors, mainly due to the reorganization of ghc modules (HsSyn -> GHC.Hs and so on) After fixing some module names with CPP, I am just reach a incompatible function change error:

[13 of 32] Compiling Language.Haskell.Brittany.Internal.ExactPrintUtils ( src\Language\Haskell\Brittany\Internal\ExactPrintUtils.hs, D:\\dev\ws\haskell\brittany\dist-newstyle\build\x86_64-windows\ghc-8.10.1\brittany-0.12.1.1\build\Language\Haskell\Brittany\Internal\ExactPrintUtils.o )

src\Language\Haskell\Brittany\Internal\ExactPrintUtils.hs:101:9: error:
    • Couldn't match type ‘Bag.Bag ErrUtils.ErrMsg’ with ‘(a1, [Char])’
      Expected type: Either
                       (a1, [Char]) (ExactPrint.Anns, GHC.ParsedSource)
        Actual type: Either
                       ErrUtils.ErrorMessages (ExactPrint.Anns, GHC.ParsedSource)
    • In the second argument of ‘($)’, namely
        ‘ExactPrint.postParseTransform res opts’
      In a stmt of a 'do' block:
        either
          (\ (span, err) -> ExceptT.throwE $ show span ++ ": " ++ err)
          (\ (a, m) -> pure (a, m, x))
          $ ExactPrint.postParseTransform res opts
      In the second argument of ‘($)’, namely
        ‘do dflags0 <- lift $ GHC.getSessionDynFlags
            (dflags1, leftover, warnings) <- lift
                                               $ GHC.parseDynamicFlagsCmdLine
                                                   dflags0
                                                   (GHC.noLoc <$> ("-hide-all-packages" : args))
            void $ lift $ GHC.setSessionDynFlags dflags1
            dflags2 <- lift $ ExactPrint.initDynFlags fp
            ....’
    |
101 |       $ ExactPrint.postParseTransform res opts
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src\Language\Haskell\Brittany\Internal\ExactPrintUtils.hs:132:13: error:
    • Couldn't match type ‘(a0, [Char])’ with ‘Bag.Bag ErrUtils.ErrMsg’
      Expected type: ErrUtils.ErrorMessages
        Actual type: (a0, [Char])
    • In the pattern: (span, err)
      In the pattern: Left (span, err)
      In a case alternative:
          Left (span, err)
            -> ExceptT.throwE $ showOutputable span ++ ": " ++ err
    |
132 |       Left  (span, err) -> ExceptT.throwE $ showOutputable span ++ ": " ++ err

😞

jneira commented 4 years ago

My work so far is here: https://github.com/lspitzner/brittany/compare/master...jneira:ghc-8.10.1?expand=1 Just in case it could be useful

tfausak commented 3 years ago

Done as part of #324 and released with version 0.13.0.0.