1313
1414module Ouroboros.Consensus.Block.SupportsPeras
1515 ( PerasRoundNo (.. )
16+ , onPerasRoundNo
1617 , PerasWeight (.. )
1718 , BlockSupportsPeras (.. )
1819 , PerasCert (.. )
@@ -31,6 +32,7 @@ module Ouroboros.Consensus.Block.SupportsPeras
3132import Codec.Serialise (Serialise (.. ))
3233import Codec.Serialise.Decoding (decodeListLenOf )
3334import Codec.Serialise.Encoding (encodeListLen )
35+ import Data.Coerce (coerce )
3436import Data.Monoid (Sum (.. ))
3537import Data.Proxy (Proxy (.. ))
3638import Data.Word (Word64 )
@@ -45,14 +47,20 @@ import Quiet (Quiet (..))
4547newtype PerasRoundNo = PerasRoundNo { unPerasRoundNo :: Word64 }
4648 deriving Show via Quiet PerasRoundNo
4749 deriving stock Generic
48- deriving newtype (Enum , Eq , Ord , NoThunks , Serialise )
50+ deriving newtype (Enum , Eq , Ord , Num , Bounded , NoThunks , Serialise )
4951
5052instance Condense PerasRoundNo where
5153 condense = show . unPerasRoundNo
5254
5355instance ShowProxy PerasRoundNo where
5456 showProxy _ = " PerasRoundNo"
5557
58+ -- | Lift a binary operation on 'Word64' to 'PerasRoundNo'
59+ onPerasRoundNo ::
60+ (Word64 -> Word64 -> Word64 ) ->
61+ (PerasRoundNo -> PerasRoundNo -> PerasRoundNo )
62+ onPerasRoundNo = coerce
63+
5664newtype PerasWeight = PerasWeight { unPerasWeight :: Word64 }
5765 deriving Show via Quiet PerasWeight
5866 deriving stock Generic
0 commit comments