From 4c6a17331f24e27772a700afef7f90653db9a119 Mon Sep 17 00:00:00 2001 From: Aniket Deshpande Date: Mon, 6 May 2024 16:09:18 +0530 Subject: [PATCH] Replace the call to error with absurd in RATIFY --- .../src/Cardano/Ledger/Conway/Governance/DRepPulser.hs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/eras/conway/impl/src/Cardano/Ledger/Conway/Governance/DRepPulser.hs b/eras/conway/impl/src/Cardano/Ledger/Conway/Governance/DRepPulser.hs index 36af03ccc00..3e01fce0a02 100644 --- a/eras/conway/impl/src/Cardano/Ledger/Conway/Governance/DRepPulser.hs +++ b/eras/conway/impl/src/Cardano/Ledger/Conway/Governance/DRepPulser.hs @@ -70,15 +70,16 @@ import Control.Monad.Trans.Reader (Reader, runReader) import Control.State.Transition.Extended import Data.Aeson (KeyValue, ToJSON (..), object, pairs, (.=)) import Data.Default.Class (Default (..)) -import Data.Foldable (toList) import Data.Functor.Identity (Identity) import Data.Kind (Type) +import Data.List.NonEmpty (NonEmpty ((:|))) import Data.Map.Strict (Map) import qualified Data.Map.Strict as Map import Data.Maybe (fromMaybe) import Data.Pulse (Pulsable (..), pulse) import Data.Sequence.Strict (StrictSeq (..)) import qualified Data.Sequence.Strict as SS +import Data.Void (Void, absurd) import GHC.Generics (Generic) import Lens.Micro import NoThunks.Class (NoThunks (..), allNoThunks) @@ -296,6 +297,7 @@ class , BaseM (ConwayRATIFY era) ~ Reader Globals , Environment (ConwayRATIFY era) ~ RatifyEnv era , State (ConwayRATIFY era) ~ RatifyState era + , PredicateFailure (ConwayRATIFY era) ~ Void ) => RunConwayRatify era where @@ -309,11 +311,7 @@ class ) globals in case ratifyResult of - Left ps -> - error $ - unlines $ - "Impossible: RATIFY rule never fails, but it did:" - : map show (toList ps) + Left (x :| _) -> absurd x Right ratifyState' -> ratifyState' finishDRepPulser :: forall era. DRepPulsingState era -> (PulsingSnapshot era, RatifyState era)