Skip to content

Re-enabling Cabal-3.12 #493

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

Merged
merged 2 commits into from
Apr 18, 2025
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/ci.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.6.6", "9.8", "9.10"]
ghc: ["9.6.6", "9.8", "9.10"] #using 9.6.6 as ghc-lib-parser-9.10.1.20250103 is not compatible with ghc-9.6.7. Re-enable when sorted

steps:
- uses: actions/checkout@v4
Expand Down
12 changes: 11 additions & 1 deletion lib/Language/Haskell/Stylish/Config/Cabal.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
--------------------------------------------------------------------------------
module Language.Haskell.Stylish.Config.Cabal
( findLanguageExtensions
Expand All @@ -14,7 +15,7 @@
import qualified Distribution.PackageDescription.Parsec as Cabal
import qualified Distribution.Parsec as Cabal
import qualified Distribution.Simple.Utils as Cabal
import qualified Distribution.Utils.Path as Cabal

Check warning on line 18 in lib/Language/Haskell/Stylish/Config/Cabal.hs

View workflow job for this annotation

GitHub Actions / Build on ubuntu-latest with GHC 9.6.6

The qualified import of ‘Distribution.Utils.Path’ is redundant

Check warning on line 18 in lib/Language/Haskell/Stylish/Config/Cabal.hs

View workflow job for this annotation

GitHub Actions / Build on ubuntu-latest with GHC 9.8

The qualified import of ‘Distribution.Utils.Path’ is redundant

Check warning on line 18 in lib/Language/Haskell/Stylish/Config/Cabal.hs

View workflow job for this annotation

GitHub Actions / Build on ubuntu-latest with GHC 9.10

The qualified import of ‘Distribution.Utils.Path’ is redundant

Check warning on line 18 in lib/Language/Haskell/Stylish/Config/Cabal.hs

View workflow job for this annotation

GitHub Actions / Build on macOS-latest with GHC 9.6.6

The qualified import of ‘Distribution.Utils.Path’ is redundant

Check warning on line 18 in lib/Language/Haskell/Stylish/Config/Cabal.hs

View workflow job for this annotation

GitHub Actions / Build on macOS-latest with GHC 9.8

The qualified import of ‘Distribution.Utils.Path’ is redundant

Check warning on line 18 in lib/Language/Haskell/Stylish/Config/Cabal.hs

View workflow job for this annotation

GitHub Actions / Build on macOS-latest with GHC 9.10

The qualified import of ‘Distribution.Utils.Path’ is redundant
import qualified Distribution.Verbosity as Cabal
import GHC.Data.Maybe (mapMaybe)
import qualified Language.Haskell.Extension as Language
Expand Down Expand Up @@ -50,11 +51,20 @@
verbose $ "Stylish Haskell will work basing on LANGUAGE pragmas in source files."
return Nothing
go searched (p : ps) = do
let projectRoot = Just $ Cabal.makeSymbolicPath p

#if MIN_VERSION_Cabal(3,14,0)
let projectRoot = Just $ makeSymbolicPath p
potentialCabalFile <- Cabal.findPackageDesc projectRoot
#else
potentialCabalFile <- Cabal.findPackageDesc p
#endif
case potentialCabalFile of
Right cabalFile -> pure $ Just $
#if MIN_VERSION_Cabal(3,14,0)
Cabal.interpretSymbolicPath projectRoot cabalFile
#else
cabalFile
#endif
_ -> go (p : searched) ps


Expand Down
9 changes: 2 additions & 7 deletions src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ import System.Exit (exitFailure)
import qualified System.IO as IO
import qualified System.IO.Strict as IO.Strict

--------------------------------------------------------------------------------
#if __GLASGOW_HASKELL__ < 808
import Data.Monoid ((<>))
#endif

--------------------------------------------------------------------------------
import Language.Haskell.Stylish
Expand Down Expand Up @@ -108,9 +104,8 @@ stylishHaskell sa = do
BC8.putStr defaultConfigBytes

else do
conf <- loadConfig verbose' $ case saConfig sa of
Nothing -> SearchFromCurrentDirectory
Just fp -> UseConfig fp
conf <- loadConfig verbose' $
maybe SearchFromCurrentDirectory UseConfig (saConfig sa)
filesR <- case (saRecursive sa) of
True -> findHaskellFiles (saVerbose sa) (saFiles sa)
_ -> return $ saFiles sa
Expand Down
2 changes: 1 addition & 1 deletion stylish-haskell.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Common depends
aeson >= 0.6 && < 2.3,
base >= 4.8 && < 5,
bytestring >= 0.9 && < 0.13,
Cabal >= 3.14 && < 4.0,
Cabal >= 3.10 && < 4.0,
containers >= 0.3 && < 0.9,
directory >= 1.2.3 && < 1.4,
filepath >= 1.1 && < 1.6,
Expand Down
Loading