Skip to content

Commit 630ac1b

Browse files
authored
GHC 9.8 support (#471)
1 parent 5503e27 commit 630ac1b

File tree

7 files changed

+22
-17
lines changed

7 files changed

+22
-17
lines changed

.github/workflows/cabal.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
strategy:
1010
matrix:
1111
os: [ubuntu-latest, macOS-latest]
12-
ghc: ["9.2", "9.4", "9.6"]
12+
ghc: ["9.4", "9.6", "9.8"]
1313
fail-fast: false
1414

1515
steps:

lib/Language/Haskell/Stylish/Printer.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ putType ltp = case GHC.unLoc ltp of
239239
putOutputable ltp
240240
GHC.HsQualTy {} ->
241241
putOutputable ltp
242-
GHC.HsAppKindTy _ _ _ ->
242+
GHC.HsAppKindTy _ _ _ _ ->
243243
putOutputable ltp
244244
GHC.HsListTy _ _ ->
245245
putOutputable ltp

lib/Language/Haskell/Stylish/Step/Data.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,10 @@ putName decl@MkDataDecl{..} =
313313
maybePutKindSig
314314

315315
where
316-
firstTvar :: Maybe (GHC.LHsTyVarBndr () GHC.GhcPs)
316+
firstTvar :: Maybe (GHC.LHsTyVarBndr (GHC.HsBndrVis GHC.GhcPs) GHC.GhcPs)
317317
firstTvar = listToMaybe $ GHC.hsq_explicit dataTypeVars
318318

319-
secondTvar :: Maybe (GHC.LHsTyVarBndr () GHC.GhcPs)
319+
secondTvar :: Maybe (GHC.LHsTyVarBndr (GHC.HsBndrVis GHC.GhcPs) GHC.GhcPs)
320320
secondTvar = listToMaybe . drop 1 $ GHC.hsq_explicit dataTypeVars
321321

322322
maybePutKindSig :: Printer ()

lib/Language/Haskell/Stylish/Step/Imports.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,8 @@ importModuleNameLength imp =
594594
--------------------------------------------------------------------------------
595595
stringLiteral :: GHC.StringLiteral -> String
596596
stringLiteral sl = case GHC.sl_st sl of
597-
GHC.NoSourceText -> show . GHC.unpackFS $ GHC.sl_fs sl
598-
GHC.SourceText s -> s
597+
GHC.NoSourceText -> GHC.unpackFS $ GHC.sl_fs sl
598+
GHC.SourceText s -> GHC.unpackFS $ s
599599

600600

601601
--------------------------------------------------------------------------------

stack.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
resolver: nightly-2023-06-23
1+
resolver: nightly-2024-01-05
22

33
extra-deps:
4-
- ghc-lib-parser-9.6.2.20230523
5-
- ghc-lib-parser-ex-9.6.0.0
4+
- ghc-lib-parser-9.8.1.20231121
5+
- ghc-lib-parser-ex-9.8.0.0
66
- test-framework-0.8.2.0
77
- test-framework-hunit-0.3.0.2
88
- ansi-wl-pprint-0.6.9
99

1010
save-hackage-creds: false
11-
compiler: ghc-9.6.1
11+
compiler: ghc-9.8.1

stylish-haskell.cabal

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ Common depends
3434
Default-language: Haskell2010
3535

3636
Build-depends:
37-
aeson >= 0.6 && < 2.2,
37+
aeson >= 0.6 && < 2.3,
3838
base >= 4.8 && < 5,
39-
bytestring >= 0.9 && < 0.12,
39+
bytestring >= 0.9 && < 0.13,
4040
Cabal >= 3.4 && < 4.0,
4141
containers >= 0.3 && < 0.7,
4242
directory >= 1.2.3 && < 1.4,
@@ -45,7 +45,7 @@ Common depends
4545
mtl >= 2.0 && < 2.4,
4646
regex-tdfa >= 1.3 && < 1.4,
4747
syb >= 0.3 && < 0.8,
48-
text >= 1.2 && < 2.1,
48+
text >= 1.2 && < 2.2,
4949
HsYAML-aeson >=0.2.0 && < 0.3,
5050
HsYAML >=0.2.0 && < 0.3,
5151

@@ -57,17 +57,17 @@ Common depends
5757
-- and we have a new enough GHC. Note that
5858
-- this will only work if the user's
5959
-- compiler is of the matching major version!
60-
if !flag(ghc-lib) && impl(ghc >= 9.6) && impl(ghc < 9.7)
60+
if !flag(ghc-lib) && impl(ghc >= 9.8) && impl(ghc < 9.9)
6161
Build-depends:
62-
ghc >= 9.6 && < 9.7,
62+
ghc >= 9.8 && < 9.9,
6363
ghc-boot,
6464
ghc-boot-th
6565
else
6666
Build-depends:
67-
ghc-lib-parser >= 9.6 && < 9.7
67+
ghc-lib-parser >= 9.8 && < 9.9
6868

6969
Build-depends:
70-
ghc-lib-parser-ex >= 9.6 && < 9.7
70+
ghc-lib-parser-ex >= 9.8 && < 9.9
7171

7272
Library
7373
Import: depends

tests/Language/Haskell/Stylish/Step/LanguagePragmas/Tests.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ case02 = assertSnippet
6161
(step (Just 80) Vertical True True lANG)
6262
[ "{-# LANGUAGE BangPatterns #-}"
6363
, "{-# LANGUAGE ViewPatterns #-}"
64+
, "module Main where"
6465
, "increment ((+ 1) -> x) = x"
6566
]
6667

6768
[ "{-# LANGUAGE ViewPatterns #-}"
69+
, "module Main where"
6870
, "increment ((+ 1) -> x) = x"
6971
]
7072

@@ -75,10 +77,12 @@ case03 = assertSnippet
7577
(step (Just 80) Vertical True True lANG)
7678
[ "{-# LANGUAGE BangPatterns #-}"
7779
, "{-# LANGUAGE ViewPatterns #-}"
80+
, "module Main where"
7881
, "increment x = case x of !_ -> x + 1"
7982
]
8083

8184
[ "{-# LANGUAGE BangPatterns #-}"
85+
, "module Main where"
8286
, "increment x = case x of !_ -> x + 1"
8387
]
8488

@@ -226,6 +230,7 @@ case13 = assertSnippet
226230
input =
227231
[ "{-# LANGUAGE BangPatterns #-}"
228232
, "{-# LANGUAGE DeriveFunctor #-}"
233+
, "module Main where"
229234
, "main = let !x = 1 + 1 in print x"
230235
]
231236

0 commit comments

Comments
 (0)