Skip to content

Commit 91d11f6

Browse files
authored
Merge pull request #1984 from sgillespie/feature/remove-ghc-810
Nix: Drop GHC < 9.6 and update flake inputs
2 parents e00405d + b882df5 commit 91d11f6

File tree

33 files changed

+512
-596
lines changed

33 files changed

+512
-596
lines changed

.hlint.yaml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,31 @@
2121
# - flags:
2222
# - {name: -w, within: []} # -w is allowed nowhere
2323
#
24-
# - modules:
25-
# - {name: [Data.Set, Data.HashSet], as: Set} # if you import Data.Set qualified, it must be as 'Set'
26-
# - {name: Control.Arrow, within: []} # Certain modules are banned entirely
27-
#
28-
# - functions:
29-
# - {name: unsafePerformIO, within: []} # unsafePerformIO can only appear in no modules
30-
3124

3225
- modules:
3326
# If Data.List is imported qualified, it must be as 'List'
3427
- {name: [Data.List], as: List}
3528
- {name: [Data.Map.Strict], as: Map}
3629
- {name: [Data.Set], as: Set}
3730
- {name: [Data.Text], as: Text}
38-
- {name: [Data.ByteString.Char8], as: BS}
39-
- {name: [Data.ByteString.Lazy.Char8], as: LBS}
4031
- {name: [Data.ByteString.Short], as: SBS}
4132

42-
# Banned functions
4333
- functions:
4434
- {name: coerce, within: []}
35+
- {name: unsafePerformIO, within: []}
4536

4637
# Add custom hints for this project
4738
#
4839
# Will suggest replacing "wibbleMany [myvar]" with "wibbleOne myvar"
4940
# - error: {lhs: "wibbleMany [x]", rhs: wibbleOne x}
5041

42+
# The hints are named by the string they display in warning messages.
43+
# For example, if you see a warning starting like
44+
#
45+
# Main.hs:116:51: Warning: Redundant ==
46+
#
47+
# You can refer to that hint with `{name: Redundant ==}` (see below).
48+
5149
# The monad of no return will be here one day
5250
- error: {lhs: "return x", rhs: pure x}
5351

@@ -62,12 +60,19 @@
6260
#
6361
# Generalise map to fmap, ++ to <>
6462
# - group: {name: generalise, enabled: true}
63+
#
64+
# Warn on use of partial functions
65+
# - group: {name: partial, enabled: true}
6566

6667

6768
# Ignore some builtin hints
6869
# - ignore: {name: Use let}
6970
# - ignore: {name: Use const, within: SpecialModule} # Only within certain modules
7071

72+
# Fuse on/on conflicts with Esqueleto's `on`
73+
- ignore: { name: "Fuse on/on" }
74+
75+
7176

7277
# Define some custom infix operators
7378
# - fixity: infixr 3 ~^#^~

cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Conway/Scenarios.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ delegateAndSendBlocks n interpreter = do
5151
stakeCreds = createStakeCredentials n
5252
payCreds = createPaymentCredentials n
5353
addresses =
54-
map
55-
(\(payCred, stakeCred) -> Addr Testnet payCred (StakeRefBase stakeCred))
56-
(zip payCreds stakeCreds)
54+
zipWith
55+
(\payCred stakeCred -> Addr Testnet payCred (StakeRefBase stakeCred))
56+
payCreds
57+
stakeCreds
5758

5859
mkRegisterBlocks :: [StakeCredential] -> Interpreter -> IO [CardanoBlock]
5960
mkRegisterBlocks creds interpreter = forgeBlocksChunked interpreter creds $ \txCreds _ ->
@@ -65,7 +66,7 @@ mkRegisterBlocks creds interpreter = forgeBlocksChunked interpreter creds $ \txC
6566
mkDelegateBlocks :: [StakeCredential] -> Interpreter -> IO [CardanoBlock]
6667
mkDelegateBlocks creds interpreter = forgeBlocksChunked interpreter creds $ \txCreds state' ->
6768
Conway.mkDCertTx
68-
(map (mkDelegCert state') $ zip (cycle [0, 1, 2]) txCreds)
69+
(zipWith (curry (mkDelegCert state')) (cycle [0, 1, 2]) txCreds)
6970
(Withdrawals mempty)
7071
Nothing
7172
where

cardano-chain-gen/src/Cardano/Mock/Query.hs

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ queryDRepDistrAmount ::
9999
queryDRepDistrAmount drepHash epochNo = do
100100
res <- selectOne $ do
101101
(distr :& hash) <-
102-
from
103-
$ table @Db.DrepDistr
102+
from $
103+
table @Db.DrepDistr
104104
`innerJoin` table @Db.DrepHash
105-
`on` (\(distr :& hash) -> (hash ^. Db.DrepHashId) ==. (distr ^. Db.DrepDistrHashId))
105+
`on` (\(distr :& hash) -> (hash ^. Db.DrepHashId) ==. (distr ^. Db.DrepDistrHashId))
106106

107107
where_ $ hash ^. Db.DrepHashRaw ==. just (val drepHash)
108108
where_ $ distr ^. Db.DrepDistrEpochNo ==. val epochNo
@@ -141,16 +141,16 @@ queryConstitutionAnchor ::
141141
queryConstitutionAnchor epochNo = do
142142
res <- selectOne $ do
143143
(_ :& anchor :& epochState) <-
144-
from
145-
$ table @Db.Constitution
144+
from $
145+
table @Db.Constitution
146146
`innerJoin` table @Db.VotingAnchor
147-
`on` ( \(constit :& anchor) ->
148-
(constit ^. Db.ConstitutionVotingAnchorId) ==. (anchor ^. Db.VotingAnchorId)
149-
)
147+
`on` ( \(constit :& anchor) ->
148+
(constit ^. Db.ConstitutionVotingAnchorId) ==. (anchor ^. Db.VotingAnchorId)
149+
)
150150
`innerJoin` table @Db.EpochState
151-
`on` ( \(constit :& _ :& epoch) ->
152-
just (constit ^. Db.ConstitutionId) ==. (epoch ^. Db.EpochStateConstitutionId)
153-
)
151+
`on` ( \(constit :& _ :& epoch) ->
152+
just (constit ^. Db.ConstitutionId) ==. (epoch ^. Db.EpochStateConstitutionId)
153+
)
154154

155155
where_ (epochState ^. Db.EpochStateEpochNo ==. val epochNo)
156156

@@ -176,7 +176,7 @@ queryTreasuryDonations = do
176176
txs <- from $ table @Db.Tx
177177
pure $ sum_ (txs ^. Db.TxTreasuryDonation)
178178

179-
let total = join (unValue <$> res)
179+
let total = unValue =<< res
180180
pure $ maybe 0 Db.unDbLovelace total
181181

182182
queryVoteCounts ::
@@ -194,10 +194,10 @@ queryVoteCounts txHash idx = do
194194
countVotes v = do
195195
res <- selectOne $ do
196196
(vote :& tx) <-
197-
from
198-
$ table @Db.VotingProcedure
197+
from $
198+
table @Db.VotingProcedure
199199
`innerJoin` table @Db.Tx
200-
`on` (\(vote :& tx) -> vote ^. Db.VotingProcedureTxId ==. tx ^. Db.TxId)
200+
`on` (\(vote :& tx) -> vote ^. Db.VotingProcedureTxId ==. tx ^. Db.TxId)
201201
where_ $
202202
vote
203203
^. Db.VotingProcedureVote
@@ -226,16 +226,16 @@ queryCommitteeByTxHash ::
226226
queryCommitteeByTxHash txHash = do
227227
res <- selectOne $ do
228228
(committee :& _ :& tx) <-
229-
from
230-
$ table @Db.Committee
229+
from $
230+
table @Db.Committee
231231
`innerJoin` table @Db.GovActionProposal
232-
`on` ( \(committee :& govAction) ->
233-
committee ^. Db.CommitteeGovActionProposalId ==. just (govAction ^. Db.GovActionProposalId)
234-
)
232+
`on` ( \(committee :& govAction) ->
233+
committee ^. Db.CommitteeGovActionProposalId ==. just (govAction ^. Db.GovActionProposalId)
234+
)
235235
`innerJoin` table @Db.Tx
236-
`on` ( \(_ :& govAction :& tx) ->
237-
govAction ^. Db.GovActionProposalTxId ==. tx ^. Db.TxId
238-
)
236+
`on` ( \(_ :& govAction :& tx) ->
237+
govAction ^. Db.GovActionProposalTxId ==. tx ^. Db.TxId
238+
)
239239
where_ (tx ^. Db.TxHash ==. val txHash)
240240
pure committee
241241

@@ -248,20 +248,20 @@ queryCommitteeMemberCountByTxHash ::
248248
queryCommitteeMemberCountByTxHash txHash = do
249249
res <- selectOne $ do
250250
(_ :& committee :& _ :& tx) <-
251-
from
252-
$ table @Db.CommitteeMember
251+
from $
252+
table @Db.CommitteeMember
253253
`innerJoin` table @Db.Committee
254-
`on` ( \(member :& committee) ->
255-
member ^. Db.CommitteeMemberCommitteeId ==. committee ^. Db.CommitteeId
256-
)
254+
`on` ( \(member :& committee) ->
255+
member ^. Db.CommitteeMemberCommitteeId ==. committee ^. Db.CommitteeId
256+
)
257257
`leftJoin` table @Db.GovActionProposal
258-
`on` ( \(_ :& committee :& govAction) ->
259-
committee ^. Db.CommitteeGovActionProposalId ==. govAction ?. Db.GovActionProposalId
260-
)
258+
`on` ( \(_ :& committee :& govAction) ->
259+
committee ^. Db.CommitteeGovActionProposalId ==. govAction ?. Db.GovActionProposalId
260+
)
261261
`leftJoin` table @Db.Tx
262-
`on` ( \(_ :& _ :& govAction :& tx) ->
263-
govAction ?. Db.GovActionProposalTxId ==. tx ?. Db.TxId
264-
)
262+
`on` ( \(_ :& _ :& govAction :& tx) ->
263+
govAction ?. Db.GovActionProposalTxId ==. tx ?. Db.TxId
264+
)
265265

266266
where_ $
267267
case txHash of

cardano-chain-gen/test/Test/Cardano/Db/Mock/UnifiedApi.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import qualified Cardano.Mock.Forging.Tx.Conway.Scenarios as Conway
3333
import Cardano.Mock.Forging.Types
3434
import Cardano.Slotting.Slot (SlotNo (..))
3535
import Control.Concurrent.Class.MonadSTM.Strict (atomically)
36-
import Control.Monad (forM, replicateM)
36+
import Control.Monad (replicateM)
3737
import Data.Word (Word64)
3838
import Ouroboros.Consensus.Cardano.Block (
3939
BabbageEra,
@@ -63,7 +63,7 @@ forgeNextSkipSlotsFindLeaderAndSubmit interpreter mockServer skipSlots txs' = do
6363

6464
forgeAndSubmitBlocks :: Interpreter -> ServerHandle IO CardanoBlock -> Int -> IO [CardanoBlock]
6565
forgeAndSubmitBlocks interpreter mockServer blocksToCreate =
66-
forM [1 .. blocksToCreate] $ \_ -> forgeNextFindLeaderAndSubmit interpreter mockServer []
66+
replicateM blocksToCreate (forgeNextFindLeaderAndSubmit interpreter mockServer [])
6767

6868
withAlonzoFindLeaderAndSubmit ::
6969
Interpreter ->

cardano-db-sync/app/test-http-get-json-metadata.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ queryTestOffChainData :: MonadIO m => ReaderT SqlBackend m [TestOffChain]
142142
queryTestOffChainData = do
143143
res <- select $ do
144144
(pod :& pmr) <-
145-
from
146-
$ table @OffChainPoolData
145+
from $
146+
table @OffChainPoolData
147147
`innerJoin` table @PoolMetadataRef
148-
`on` (\(pod :& pmr) -> pod ^. OffChainPoolDataPmrId ==. pmr ^. PoolMetadataRefId)
148+
`on` (\(pod :& pmr) -> pod ^. OffChainPoolDataPmrId ==. pmr ^. PoolMetadataRefId)
149149
where_ $ notExists (from (table @PoolRetire) >>= \pr -> where_ (pod ^. OffChainPoolDataPoolId ==. pr ^. PoolRetireHashId))
150150
pure
151151
( pod ^. OffChainPoolDataTickerName

cardano-db-sync/src/Cardano/DbSync/Config/Node.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ readByteStringFromFile fp cfgType =
7878
-- -------------------------------------------------------------------------------------------------
7979

8080
instance FromJSON NodeConfig where
81-
parseJSON v =
82-
Aeson.withObject "NodeConfig" parse v
81+
parseJSON =
82+
Aeson.withObject "NodeConfig" parse
8383
where
8484
parse :: Object -> Parser NodeConfig
8585
parse o =

cardano-db-sync/src/Cardano/DbSync/DbAction.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ waitRestartState tc = do
5656
waitDoneInit :: ThreadChannels -> IO ()
5757
waitDoneInit tc = atomically $ do
5858
isDone <- readTVar (tcDoneInit tc)
59-
if isDone then pure () else retry
59+
unless isDone retry
6060

6161
runAndSetDone :: ThreadChannels -> IO Bool -> IO Bool
6262
runAndSetDone tc action = do

cardano-db-sync/src/Cardano/DbSync/Epoch.hs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,20 @@ updateEpochStart syncEnv cache slotDetails isNewEpochEvent isBoundaryBlock = do
8282
let curEpochNo = unEpochNo $ sdEpochNo slotDetails
8383

8484
if
85-
-- The tip has been reached so now replace/update the epoch every block.
86-
| getSyncStatus slotDetails == SyncFollowing ->
87-
handleEpochWhenFollowing syncEnv cache mLastMapEpochFromCache mEpochBlockDiff curEpochNo
88-
-- When syncing we check if current block is the first block in an epoch.
89-
-- If so then it's time to put the previous epoch into the DB.
90-
| isNewEpochEvent ->
91-
updateEpochWhenSyncing syncEnv cache mEpochBlockDiff mLastMapEpochFromCache curEpochNo isBoundaryBlock
92-
-- we're syncing and the epochNo are the same so we just update the cache until above check passes.
93-
| otherwise ->
94-
handleEpochCachingWhenSyncing
95-
syncEnv
96-
cache
97-
mLastMapEpochFromCache
98-
mEpochBlockDiff
85+
-- The tip has been reached so now replace/update the epoch every block.
86+
| getSyncStatus slotDetails == SyncFollowing ->
87+
handleEpochWhenFollowing syncEnv cache mLastMapEpochFromCache mEpochBlockDiff curEpochNo
88+
-- When syncing we check if current block is the first block in an epoch.
89+
-- If so then it's time to put the previous epoch into the DB.
90+
| isNewEpochEvent ->
91+
updateEpochWhenSyncing syncEnv cache mEpochBlockDiff mLastMapEpochFromCache curEpochNo isBoundaryBlock
92+
-- we're syncing and the epochNo are the same so we just update the cache until above check passes.
93+
| otherwise ->
94+
handleEpochCachingWhenSyncing
95+
syncEnv
96+
cache
97+
mLastMapEpochFromCache
98+
mEpochBlockDiff
9999

100100
-----------------------------------------------------------------------------------------------------
101101
-- When Following

cardano-db-sync/src/Cardano/DbSync/Era/Shelley/Generic/Block.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{-# LANGUAGE CPP #-}
22
{-# LANGUAGE DataKinds #-}
33
{-# LANGUAGE FlexibleContexts #-}
4-
{-# LANGUAGE OverloadedStrings #-}
54
{-# LANGUAGE RankNTypes #-}
65
{-# LANGUAGE ScopedTypeVariables #-}
76
{-# LANGUAGE TypeApplications #-}

cardano-db-sync/src/Cardano/DbSync/Era/Shelley/Generic/ProtoParams.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{-# LANGUAGE DataKinds #-}
2-
{-# LANGUAGE OverloadedStrings #-}
32
{-# LANGUAGE RankNTypes #-}
43
{-# LANGUAGE NoImplicitPrelude #-}
54

0 commit comments

Comments
 (0)