Skip to content

Commit 91931b4

Browse files
committed
Merge branch 'main' into ghc9.12
2 parents 1bbf21c + 620d130 commit 91931b4

File tree

4 files changed

+43
-33
lines changed

4 files changed

+43
-33
lines changed

CHANGELOG

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,45 @@
11
# CHANGELOG
22

3-
- UNRELEASED
4-
* #482 Add `ConfigSearchStrategy` to allow avoiding `getCurrentDirectory`
5-
when loading config (by Jan Hrček)
3+
- 0.15.0.1 (2025-04-13)
4+
* #493 Support Cabal 3.12 again (By GuillaumedeVolpiano)
65

7-
This is breaking API change that can be fixed like this:
6+
- 0.15.0.0 (2025-04-13)
7+
* #480 Support with GHC 9.10 (By Jan Hrček)
88

9-
```diff
10-
-format Nothing maybeFile contents
11-
+format SearchFromCurrentDirectory maybeFile contents
9+
* #482 Add `ConfigSearchStrategy` to allow avoiding `getCurrentDirectory`
10+
when loading config (by Jan Hrček)
1211

13-
-format (Just cfgFile) maybeFile content
14-
+format (UseConfig cfgFile) maybeFile content
15-
```
12+
This is breaking API change that can be fixed like this:
1613

17-
* Bump `Cabal` lower bound to 3.14
14+
```diff
15+
-format Nothing maybeFile contents
16+
+format SearchFromCurrentDirectory maybeFile contents
17+
18+
-format (Just cfgFile) maybeFile content
19+
+format (UseConfig cfgFile) maybeFile content
20+
```
21+
22+
* Bump `Cabal` lower bound to 3.14
1823

1924
- 0.14.6.0 (2024-01-19)
20-
* #471 Support GHC 9.8 (by Michael Peyton Jones)
21-
* #440 Fix dissappearing `DEPRECATED` pragma on module (by Lev Dvorkin)
22-
* #464 Fix compilation issue with GHC 9.4
25+
* #471 Support GHC 9.8 (by Michael Peyton Jones)
26+
* #440 Fix dissappearing `DEPRECATED` pragma on module (by Lev Dvorkin)
27+
* #464 Fix compilation issue with GHC 9.4
2328

2429
- 0.14.5.0 (2023-06-23)
25-
* #459 Support GHC 9.6 (by Michael Peyton Jones)
26-
* #445 Default `ghc-lib` flag to True (by amesgen)
30+
* #459 Support GHC 9.6 (by Michael Peyton Jones)
31+
* #445 Default `ghc-lib` flag to True (by amesgen)
2732

2833
- 0.14.4.0 (2023-01-09)
29-
* #421 Support GHC 9.4 (by Lei Zhu)
30-
* #439 Fix NoXyz extension issues for .cabal files (by Lev Dvorkin)
31-
* #424 Deriving alignment for enums (by Lev Dvorkin)
32-
* #416 Support Safe/Trustworthy/Unsafe extensions
34+
* #421 Support GHC 9.4 (by Lei Zhu)
35+
* #439 Fix NoXyz extension issues for .cabal files (by Lev Dvorkin)
36+
* #424 Deriving alignment for enums (by Lev Dvorkin)
37+
* #416 Support Safe/Trustworthy/Unsafe extensions
3338

3439
- 0.14.3.0 (2022-09-28)
35-
* Fix parsing of NoXyz extensions
36-
* Bump `Cabal` upper bound to 4.0
37-
* Add option to automatically group imports (by Tikhon Jelvis)
40+
* Fix parsing of NoXyz extensions
41+
* Bump `Cabal` upper bound to 4.0
42+
* Add option to automatically group imports (by Tikhon Jelvis)
3843

3944
- 0.14.2.0 (2022-04-27)
4045
* Add a build flag to force the use of ghc-lib-parser

lib/Language/Haskell/Stylish/Config/Cabal.hs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE CPP #-}
12
--------------------------------------------------------------------------------
23
module Language.Haskell.Stylish.Config.Cabal
34
( findLanguageExtensions
@@ -50,11 +51,20 @@ findCabalFile verbose configSearchStrategy = case configSearchStrategy of
5051
verbose $ "Stylish Haskell will work basing on LANGUAGE pragmas in source files."
5152
return Nothing
5253
go searched (p : ps) = do
53-
let projectRoot = Just $ Cabal.makeSymbolicPath p
54+
55+
#if MIN_VERSION_Cabal(3,14,0)
56+
let projectRoot = Just $ makeSymbolicPath p
5457
potentialCabalFile <- Cabal.findPackageDesc projectRoot
58+
#else
59+
potentialCabalFile <- Cabal.findPackageDesc p
60+
#endif
5561
case potentialCabalFile of
5662
Right cabalFile -> pure $ Just $
63+
#if MIN_VERSION_Cabal(3,14,0)
5764
Cabal.interpretSymbolicPath projectRoot cabalFile
65+
#else
66+
cabalFile
67+
#endif
5868
_ -> go (p : searched) ps
5969

6070

src/Main.hs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ import System.Exit (exitFailure)
1414
import qualified System.IO as IO
1515
import qualified System.IO.Strict as IO.Strict
1616

17-
--------------------------------------------------------------------------------
18-
#if __GLASGOW_HASKELL__ < 808
19-
import Data.Monoid ((<>))
20-
#endif
2117

2218
--------------------------------------------------------------------------------
2319
import Language.Haskell.Stylish
@@ -108,9 +104,8 @@ stylishHaskell sa = do
108104
BC8.putStr defaultConfigBytes
109105

110106
else do
111-
conf <- loadConfig verbose' $ case saConfig sa of
112-
Nothing -> SearchFromCurrentDirectory
113-
Just fp -> UseConfig fp
107+
conf <- loadConfig verbose' $
108+
maybe SearchFromCurrentDirectory UseConfig (saConfig sa)
114109
filesR <- case (saRecursive sa) of
115110
True -> findHaskellFiles (saVerbose sa) (saFiles sa)
116111
_ -> return $ saFiles sa

stylish-haskell.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Cabal-version: 2.4
22
Name: stylish-haskell
3-
Version: 0.14.6.0
3+
Version: 0.15.0.1
44
Synopsis: Haskell code prettifier
55
Homepage: https://github.com/haskell/stylish-haskell
66
License: BSD-3-Clause
@@ -39,7 +39,7 @@ Common depends
3939
aeson >= 0.6 && < 2.3,
4040
base >= 4.19 && < 5,
4141
bytestring >= 0.9 && < 0.13,
42-
Cabal >= 3.14 && < 4.0,
42+
Cabal >= 3.10 && < 4.0,
4343
containers >= 0.3 && < 0.9,
4444
directory >= 1.2.3 && < 1.4,
4545
filepath >= 1.1 && < 1.6,

0 commit comments

Comments
 (0)