Skip to content

Commit 8c6b399

Browse files
committed
PerasRoundNo/PerasWeight: add Condense instances
This is purely for concise QuickCheck counterexample output.
1 parent 5062355 commit 8c6b399

File tree

1 file changed

+7
-0
lines changed
  • ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Block

1 file changed

+7
-0
lines changed

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Block/SupportsPeras.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,26 @@ import Data.Word (Word64)
2121
import GHC.Generics (Generic)
2222
import NoThunks.Class
2323
import Ouroboros.Consensus.Block.Abstract
24+
import Ouroboros.Consensus.Util.Condense
2425
import Quiet (Quiet (..))
2526

2627
newtype PerasRoundNo = PerasRoundNo {unPerasRoundNo :: Word64}
2728
deriving Show via Quiet PerasRoundNo
2829
deriving stock Generic
2930
deriving newtype (Eq, Ord, NoThunks)
3031

32+
instance Condense PerasRoundNo where
33+
condense = show . unPerasRoundNo
34+
3135
newtype PerasWeight = PerasWeight {unPerasWeight :: Word64}
3236
deriving Show via Quiet PerasWeight
3337
deriving stock Generic
3438
deriving newtype (Eq, Ord, NoThunks)
3539
deriving (Semigroup, Monoid) via Sum Word64
3640

41+
instance Condense PerasWeight where
42+
condense = show . unPerasWeight
43+
3744
-- | TODO this will become a Ledger protocol parameter
3845
boostPerCert :: PerasWeight
3946
boostPerCert = PerasWeight 15

0 commit comments

Comments
 (0)