Skip to content

Commit f7b060e

Browse files
re-enabling Cabal-3.12
1 parent e24009f commit f7b060e

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

.github/workflows/ci.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.6.6", "9.8", "9.10"]
12+
ghc: ["9.6", "9.8", "9.10"]
1313

1414
steps:
1515
- uses: actions/checkout@v4

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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ import Data.Monoid ((<>))
2222
--------------------------------------------------------------------------------
2323
import Language.Haskell.Stylish
2424

25+
#if MIN_VERSION_GLASGOW_HASKELL(9,9,0,0)
26+
-- Unique64 patch was present in 9.10 and later
27+
#define HAVE_UNIQUE64 1
28+
#elif !MIN_VERSION_GLASGOW_HASKELL(9,9,0,0) && MIN_VERSION_GLASGOW_HASKELL(9,8,4,0)
29+
-- Unique64 patch was backported to 9.8.4
30+
#define HAVE_UNIQUE64 1
31+
#elif !MIN_VERSION_GLASGOW_HASKELL(9,7,0,0) && MIN_VERSION_GLASGOW_HASKELL(9,6,7,0)
32+
-- Unique64 patch was backported to 9.6.7
33+
#define HAVE_UNIQUE64 1
34+
#endif
35+
36+
#if !defined(HAVE_UNIQUE64)
37+
HsWord64 ghc_unique_counter64 = 0;
38+
#endif
2539

2640
--------------------------------------------------------------------------------
2741
data StylishArgs = StylishArgs

stylish-haskell.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Common depends
3939
aeson >= 0.6 && < 2.3,
4040
base >= 4.8 && < 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)