From 274a415166eb151669f29c1658f6ac9dda350220 Mon Sep 17 00:00:00 2001 From: EncodePanda Date: Wed, 22 Sep 2021 11:33:25 +0200 Subject: [PATCH] Replace explicit if with a when function --- .../tools/db-analyser/Analysis.hs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ouroboros-consensus-cardano/tools/db-analyser/Analysis.hs b/ouroboros-consensus-cardano/tools/db-analyser/Analysis.hs index 3da4e05619b..291576fee42 100644 --- a/ouroboros-consensus-cardano/tools/db-analyser/Analysis.hs +++ b/ouroboros-consensus-cardano/tools/db-analyser/Analysis.hs @@ -205,15 +205,14 @@ storeLedgerStateAt slotNo (AnalysisEnv { db, registry, initLedger, cfg, hasFS }) let ledgerCfg = ExtLedgerCfg cfg appliedResult = tickThenApplyLedgerResult ledgerCfg blk oldLedger newLedger = either (error . show) lrResult $ runExcept $ appliedResult - if slotNo == blockSlot blk then - storeAndReturnNewLedger blk newLedger - else return newLedger + when (slotNo == blockSlot blk) $ storeLedgerState blk newLedger + return newLedger - storeAndReturnNewLedger :: + storeLedgerState :: blk -> ExtLedgerState blk - -> IO (ExtLedgerState blk) - storeAndReturnNewLedger blk ledgerState = do + -> IO () + storeLedgerState blk ledgerState = do let snapshot = DiskSnapshot (unSlotNo $ blockSlot blk) (Just $ "db-analyser") @@ -223,7 +222,6 @@ storeLedgerStateAt slotNo (AnalysisEnv { db, registry, initLedger, cfg, hasFS }) , show (blockSlot blk) , show (blockHash blk) ] - pure ledgerState encLedger :: ExtLedgerState blk -> Encoding encLedger =