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

9.8 support #471

Merged
merged 5 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cabal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
ghc: ["9.2", "9.4", "9.6"]
ghc: ["9.4", "9.6", "9.8"]
fail-fast: false

steps:
Expand Down
2 changes: 1 addition & 1 deletion lib/Language/Haskell/Stylish/Printer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ putType ltp = case GHC.unLoc ltp of
putOutputable ltp
GHC.HsQualTy {} ->
putOutputable ltp
GHC.HsAppKindTy _ _ _ ->
GHC.HsAppKindTy _ _ _ _ ->
putOutputable ltp
GHC.HsListTy _ _ ->
putOutputable ltp
Expand Down
4 changes: 2 additions & 2 deletions lib/Language/Haskell/Stylish/Step/Data.hs
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,10 @@ putName decl@MkDataDecl{..} =
maybePutKindSig

where
firstTvar :: Maybe (GHC.LHsTyVarBndr () GHC.GhcPs)
firstTvar :: Maybe (GHC.LHsTyVarBndr (GHC.HsBndrVis GHC.GhcPs) GHC.GhcPs)
firstTvar = listToMaybe $ GHC.hsq_explicit dataTypeVars

secondTvar :: Maybe (GHC.LHsTyVarBndr () GHC.GhcPs)
secondTvar :: Maybe (GHC.LHsTyVarBndr (GHC.HsBndrVis GHC.GhcPs) GHC.GhcPs)
secondTvar = listToMaybe . drop 1 $ GHC.hsq_explicit dataTypeVars

maybePutKindSig :: Printer ()
Expand Down
4 changes: 2 additions & 2 deletions lib/Language/Haskell/Stylish/Step/Imports.hs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@
-- groups is non-empty by the pattern for this case
-- imports is non-empty as long as groups is non-empty
block = Block
(GHC.srcSpanStartLine . src $ head imports)

Check warning on line 289 in lib/Language/Haskell/Stylish/Step/Imports.hs

View workflow job for this annotation

GitHub Actions / Build on ubuntu-latest GHC 9.8

In the use of ‘head’

Check warning on line 289 in lib/Language/Haskell/Stylish/Step/Imports.hs

View workflow job for this annotation

GitHub Actions / Build on macOS-latest GHC 9.8

In the use of ‘head’

Check warning on line 289 in lib/Language/Haskell/Stylish/Step/Imports.hs

View workflow job for this annotation

GitHub Actions / Build on macOS-latest

In the use of ‘head’

Check warning on line 289 in lib/Language/Haskell/Stylish/Step/Imports.hs

View workflow job for this annotation

GitHub Actions / Build on macOS-latest

In the use of ‘head’

Check warning on line 289 in lib/Language/Haskell/Stylish/Step/Imports.hs

View workflow job for this annotation

GitHub Actions / Build on ubuntu-latest

In the use of ‘head’

Check warning on line 289 in lib/Language/Haskell/Stylish/Step/Imports.hs

View workflow job for this annotation

GitHub Actions / Build on ubuntu-latest

In the use of ‘head’
(GHC.srcSpanEndLine . src $ last imports)
src = fromMaybe (error "regroupImports: missing location") .
GHC.srcSpanToRealSrcSpan . GHC.getLocA
Expand Down Expand Up @@ -594,8 +594,8 @@
--------------------------------------------------------------------------------
stringLiteral :: GHC.StringLiteral -> String
stringLiteral sl = case GHC.sl_st sl of
GHC.NoSourceText -> show . GHC.unpackFS $ GHC.sl_fs sl
GHC.SourceText s -> s
GHC.NoSourceText -> GHC.unpackFS $ GHC.sl_fs sl
GHC.SourceText s -> GHC.unpackFS $ s


--------------------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
resolver: nightly-2023-06-23
resolver: nightly-2024-01-05

extra-deps:
- ghc-lib-parser-9.6.2.20230523
- ghc-lib-parser-ex-9.6.0.0
- ghc-lib-parser-9.8.1.20231121
- ghc-lib-parser-ex-9.8.0.0
- test-framework-0.8.2.0
- test-framework-hunit-0.3.0.2
- ansi-wl-pprint-0.6.9

save-hackage-creds: false
compiler: ghc-9.6.1
compiler: ghc-9.8.1
14 changes: 7 additions & 7 deletions stylish-haskell.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ Common depends
Default-language: Haskell2010

Build-depends:
aeson >= 0.6 && < 2.2,
aeson >= 0.6 && < 2.3,
base >= 4.8 && < 5,
bytestring >= 0.9 && < 0.12,
bytestring >= 0.9 && < 0.13,
Cabal >= 3.4 && < 4.0,
containers >= 0.3 && < 0.7,
directory >= 1.2.3 && < 1.4,
Expand All @@ -45,7 +45,7 @@ Common depends
mtl >= 2.0 && < 2.4,
regex-tdfa >= 1.3 && < 1.4,
syb >= 0.3 && < 0.8,
text >= 1.2 && < 2.1,
text >= 1.2 && < 2.2,
HsYAML-aeson >=0.2.0 && < 0.3,
HsYAML >=0.2.0 && < 0.3,

Expand All @@ -57,17 +57,17 @@ Common depends
-- and we have a new enough GHC. Note that
-- this will only work if the user's
-- compiler is of the matching major version!
if !flag(ghc-lib) && impl(ghc >= 9.6) && impl(ghc < 9.7)
if !flag(ghc-lib) && impl(ghc >= 9.8) && impl(ghc < 9.9)
Build-depends:
ghc >= 9.6 && < 9.7,
ghc >= 9.8 && < 9.9,
ghc-boot,
ghc-boot-th
else
Build-depends:
ghc-lib-parser >= 9.6 && < 9.7
ghc-lib-parser >= 9.8 && < 9.9

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

Library
Import: depends
Expand Down
5 changes: 5 additions & 0 deletions tests/Language/Haskell/Stylish/Step/LanguagePragmas/Tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ case02 = assertSnippet
(step (Just 80) Vertical True True lANG)
[ "{-# LANGUAGE BangPatterns #-}"
, "{-# LANGUAGE ViewPatterns #-}"
, "module Main where"
, "increment ((+ 1) -> x) = x"
]

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

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

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

Expand Down Expand Up @@ -226,6 +230,7 @@ case13 = assertSnippet
input =
[ "{-# LANGUAGE BangPatterns #-}"
, "{-# LANGUAGE DeriveFunctor #-}"
, "module Main where"
, "main = let !x = 1 + 1 in print x"
]

Expand Down
Loading