Skip to content

Support Cabal-3.16 #1419

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion exes/Main.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE PatternSynonyms #-}

{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns #-}

Expand Down Expand Up @@ -41,7 +42,7 @@ import Network.URI
( URI(..), URIAuth(..), parseAbsoluteURI )
import Distribution.Simple.Command
import Distribution.Simple.Setup
( Flag(..), fromFlag, fromFlagOrDefault, flagToList, flagToMaybe )
( Flag, pattern Flag, pattern NoFlag, fromFlag, fromFlagOrDefault, flagToList, flagToMaybe )
import Data.Maybe
( isNothing )
import Data.List
Expand Down
4 changes: 2 additions & 2 deletions hackage-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ common defaults
-- other dependencies shared by most components
build-depends:
, aeson >= 2.1.0.0 && < 2.3
, Cabal >= 3.14.2.0 && < 3.16
, Cabal-syntax >= 3.14.2.0 && < 3.16
, Cabal >= 3.14.2.0 && < 3.18
, Cabal-syntax >= 3.14.2.0 && < 3.18
-- Cabal-syntax needs to be bound to constrain hackage-security
-- see https://github.com/haskell/hackage-server/issues/1130
, fail ^>= 4.9.0
Expand Down
6 changes: 6 additions & 0 deletions src/Distribution/Server/Framework/Instances.hs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ instance SafeCopy CompilerFlavor where
putCopy JHC = contain $ putWord8 7
putCopy LHC = contain $ putWord8 8
putCopy UHC = contain $ putWord8 9
#if !MIN_VERSION_Cabal_syntax(3,16,0)
Copy link
Contributor

@ulysses4ever ulysses4ever Jul 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it make sense to drop support for HaskellSuite as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dunno, this is just a minimal patch to get Hackage Server building.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no mention of HaskellSuite removal in https://github.com/haskell/cabal/blob/master/release-notes/Cabal-3.16.0.0.md. Is that a mistake in code or changelog?

Copy link
Contributor

@phadej phadej Jul 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: the safe-copy instances are part of acid-state persistence. Hopefully this won't cause problems with migration, but it could (it's not the same as adding constructor, like with MHS few releases back).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no mention of HaskellSuite removal in https://github.com/haskell/cabal/blob/master/release-notes/Cabal-3.16.0.0.md. Is that a mistake in code or changelog?

I see:

Remove knowledge about hmake and haskell-suite haskell/cabal#10912

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ulysses4ever that's a breaking change in library API. It's significant change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, thank you! Will try to adjust the process so that we get all API changes marked as significant.

Copy link
Contributor

@phadej phadej Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, removing HaskellSuite constructor was completely unnecessary, AFAICT.

There is e.g. Helium and being in this (pseudo)enum is the only reference of it.

putCopy (HaskellSuite s) = contain $ putWord8 10 >> safePut s
#endif
putCopy GHCJS = contain $ putWord8 11
putCopy Eta = contain $ putWord8 12
#if MIN_VERSION_Cabal_syntax(3,12,1)
Expand All @@ -270,7 +272,9 @@ instance SafeCopy CompilerFlavor where
7 -> return JHC
8 -> return LHC
9 -> return UHC
#if !MIN_VERSION_Cabal_syntax(3,16,0)
10 -> return HaskellSuite <*> safeGet
#endif
11 -> return GHCJS
12 -> return Eta
#if MIN_VERSION_Cabal_syntax(3,12,1)
Expand Down Expand Up @@ -411,7 +415,9 @@ instance Arbitrary CompilerFlavor where
, pure JHC
, pure LHC
, pure UHC
#if !MIN_VERSION_Cabal_syntax(3,16,0)
, pure HaskellSuite <*> vectorOf 3 (choose ('A', 'Z'))
#endif
, pure GHCJS
, pure Eta
#if MIN_VERSION_Cabal_syntax(3,12,1)
Expand Down
Loading