Skip to content

Commit d16178f

Browse files
authored
Make it build with ghc 9.10 (#1187)
2 parents ee232fb + a2cacdd commit d16178f

File tree

32 files changed

+103
-73
lines changed

32 files changed

+103
-73
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
strategy:
3939
fail-fast: false
4040
matrix:
41-
ghc: ["8.10.7", "9.6.6", "9.8.2"]
41+
ghc: ["8.10.7", "9.6.6", "9.8.2", "9.10.1"]
4242
variant: [default, no-thunks]
4343
test-set: [all, no-thunks-safe]
4444
exclude:

cabal.project

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ repository cardano-haskell-packages
1414
-- update either of these.
1515
index-state:
1616
-- Bump this if you need newer packages from Hackage
17-
, hackage.haskell.org 2024-06-23T23:01:13Z
17+
, hackage.haskell.org 2024-07-23T00:03:37Z
1818
-- Bump this if you need newer packages from CHaP
19-
, cardano-haskell-packages 2024-07-02T04:22:05Z
19+
, cardano-haskell-packages 2024-07-24T06:25:44Z
2020

2121
packages:
2222
ouroboros-consensus
@@ -38,3 +38,18 @@ import: ./asserts.cabal
3838
if(os(windows))
3939
constraints:
4040
bitvec -simd
41+
42+
if impl(ghc >= 9.10)
43+
allow-newer:
44+
-- All these cardano-ledger packages have been fixed on master but not
45+
-- yet released to CHaP and according to the team will not be released
46+
-- until after the Chang hardfork.
47+
, cardano-ledger-alonzo:plutus-ledger-api
48+
, cardano-ledger-alonzo-test:plutus-ledger-api
49+
, cardano-ledger-babbage:plutus-ledger-api
50+
, cardano-ledger-binary:plutus-ledger-api
51+
, cardano-ledger-conway:plutus-ledger-api
52+
53+
constraints:
54+
-- Earlier versions do not compile with ghc-9.10
55+
, plutus-ledger-api ^>=1.31

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ouroboros-consensus-cardano/ouroboros-consensus-cardano.cabal

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ library
127127
Ouroboros.Consensus.Shelley.Ledger.Query.PParamsLegacyEncoder
128128

129129
build-depends:
130-
base >=4.14 && <4.20,
130+
base >=4.14 && <4.21,
131131
base-deriving-via,
132132
bytestring >=0.10 && <0.13,
133133
cardano-binary,
@@ -190,7 +190,7 @@ library unstable-byronspec
190190
Ouroboros.Consensus.ByronSpec.Ledger.Rules
191191

192192
build-depends:
193-
base >=4.14 && <4.20,
193+
base >=4.14 && <4.21,
194194
bimap >=0.4 && <0.6,
195195
byron-spec-chain,
196196
byron-spec-ledger,
@@ -515,7 +515,7 @@ library unstable-cardano-tools
515515

516516
build-depends:
517517
aeson,
518-
base >=4.14 && <4.20,
518+
base >=4.14 && <4.21,
519519
base16-bytestring >=1.0,
520520
bytestring >=0.10 && <0.13,
521521
cardano-crypto,

ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Forge.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import qualified Cardano.Ledger.Shelley.BlockChain as SL (bBodySize)
1414
import qualified Cardano.Protocol.TPraos.BHeader as SL
1515
import Control.Exception
1616
import Control.Monad.Except
17-
import Data.List (foldl')
17+
import Data.List as List (foldl')
1818
import qualified Data.Sequence.Strict as Seq
1919
import Ouroboros.Consensus.Block
2020
import Ouroboros.Consensus.Config
@@ -98,5 +98,5 @@ forgeShelleyBlock
9898
= return ()
9999

100100
estimatedBodySize, actualBodySize :: Int
101-
estimatedBodySize = fromIntegral $ foldl' (+) 0 $ map (txInBlockSize . txForgetValidated) txs
101+
estimatedBodySize = fromIntegral $ List.foldl' (+) 0 $ map (txInBlockSize . txForgetValidated) txs
102102
actualBodySize = SL.bBodySize protocolVersion body

ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBAnalyser/Block/Shelley.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import qualified Cardano.Ledger.Shelley.API as SL
2929
import qualified Cardano.Ledger.Shelley.RewardUpdate as SL
3030
import Cardano.Tools.DBAnalyser.HasAnalysis
3131
import qualified Data.Aeson as Aeson
32-
import Data.Foldable (foldl', toList)
32+
import Data.Foldable as Foldable (foldl', toList)
3333
import qualified Data.Map.Strict as Map
3434
import Data.Maybe (catMaybes, maybeToList)
3535
import Data.Maybe.Strict
@@ -91,7 +91,7 @@ instance ( ShelleyCompatible proto era
9191
, decimal $ sum $ blockTxSizes blk
9292
]
9393
++
94-
[ decimal $ foldl' (\acc tx -> acc + f tx) 0 txs
94+
[ decimal $ Foldable.foldl' (\acc tx -> acc + f tx) 0 txs
9595
| f <- maybeToList txExUnitsSteps
9696
]
9797
where

ouroboros-consensus-diffusion/ouroboros-consensus-diffusion.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ library
7777
Ouroboros.Consensus.Node.Run,
7878

7979
build-depends:
80-
base >=4.14 && <4.20,
80+
base >=4.14 && <4.21,
8181
bytestring >=0.10 && <0.13,
8282
cardano-slotting,
8383
cborg ^>=0.2.2,

ouroboros-consensus-diffusion/src/unstable-diffusion-testlib/Test/ThreadNet/Network.hs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,7 @@ directedEdgeInner registry clock (version, blockVersion) (cfg, calcMessageDelay)
13611361
_ -> retry
13621362

13631363
flattenPairs :: forall a. NE.NonEmpty (a, a) -> NE.NonEmpty a
1364-
flattenPairs = uncurry (<>) . NE.unzip
1364+
flattenPairs = uncurry (<>) . neUnzip
13651365

13661366
neverReturns :: forall x void. String -> x -> void
13671367
neverReturns s !_ = error $ s <> " never returns!"
@@ -1721,3 +1721,12 @@ data TxGenFailure = TxGenFailure Int -- ^ how many times it failed
17211721
deriving (Show)
17221722

17231723
instance Exception TxGenFailure
1724+
1725+
-- In [email protected] the Data.List.NonEmpty.unzip is deprecated and suggests that
1726+
-- Data.Function.unzip should be used instead,but base versions earlier than
1727+
-- 4.20 do not have that.
1728+
-- Neatest solution is to cargo cult it here and switch to Data.Function.unzip
1729+
-- later.
1730+
neUnzip :: Functor f => f (a,b) -> (f a, f b)
1731+
neUnzip xs = (fst <$> xs, snd <$> xs)
1732+

ouroboros-consensus-diffusion/src/unstable-diffusion-testlib/Test/ThreadNet/Ref/PBFT.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module Test.ThreadNet.Ref.PBFT (
2727
import Control.Applicative ((<|>))
2828
import Control.Arrow ((&&&))
2929
import Control.Monad (guard)
30-
import Data.Foldable (foldl', toList)
30+
import Data.Foldable as Foldable (foldl', toList)
3131
import Data.Map.Strict (Map)
3232
import qualified Data.Map.Strict as Map
3333
import Data.Sequence (Seq)
@@ -609,7 +609,7 @@ nextLeader params State{nextSlot} = mkLeaderOf params nextSlot
609609
fillOut :: PBftParams -> NodeJoinPlan -> SlotNo -> NodeJoinPlan
610610
fillOut params (NodeJoinPlan m) s =
611611
NodeJoinPlan $
612-
foldl' (\acc i -> Map.insert i j acc) m $
612+
Foldable.foldl' (\acc i -> Map.insert i j acc) m $
613613
CoreNodeId <$> [i0 .. iN]
614614
where
615615
iN = oneN params - 1

ouroboros-consensus-diffusion/src/unstable-diffusion-testlib/Test/ThreadNet/Util/Expectations.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module Test.ThreadNet.Util.Expectations (
55
, determineForkLength
66
) where
77

8-
import Data.Foldable (foldl')
8+
import Data.Foldable as Foldable (foldl')
99
import qualified Data.Map.Strict as Map
1010
import Data.Word (Word64)
1111
import Ouroboros.Consensus.Block
@@ -99,7 +99,7 @@ determineForkLength ::
9999
-> LeaderSchedule
100100
-> NumBlocks
101101
determineForkLength k (NodeJoinPlan joinPlan) (LeaderSchedule sched) =
102-
prj $ foldl' step initial (Map.toAscList sched)
102+
prj $ Foldable.foldl' step initial (Map.toAscList sched)
103103
where
104104
prj Acc{maxForkLength} = NumBlocks maxForkLength
105105

0 commit comments

Comments
 (0)