{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Ouroboros.Consensus.Committee.Types
( PoolId (..)
, LedgerStake (..)
, VoteWeight (..)
, TargetCommitteeSize (..)
, Cumulative (..)
) where
import Cardano.Ledger.BaseTypes (HasZero)
import Cardano.Ledger.Core (KeyHash, KeyRole (..))
import Data.Word (Word64)
newtype PoolId = PoolId
{ PoolId -> KeyHash StakePool
unPoolId :: KeyHash StakePool
}
deriving (Int -> PoolId -> ShowS
[PoolId] -> ShowS
PoolId -> String
(Int -> PoolId -> ShowS)
-> (PoolId -> String) -> ([PoolId] -> ShowS) -> Show PoolId
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PoolId -> ShowS
showsPrec :: Int -> PoolId -> ShowS
$cshow :: PoolId -> String
show :: PoolId -> String
$cshowList :: [PoolId] -> ShowS
showList :: [PoolId] -> ShowS
Show, PoolId -> PoolId -> Bool
(PoolId -> PoolId -> Bool)
-> (PoolId -> PoolId -> Bool) -> Eq PoolId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PoolId -> PoolId -> Bool
== :: PoolId -> PoolId -> Bool
$c/= :: PoolId -> PoolId -> Bool
/= :: PoolId -> PoolId -> Bool
Eq, Eq PoolId
Eq PoolId =>
(PoolId -> PoolId -> Ordering)
-> (PoolId -> PoolId -> Bool)
-> (PoolId -> PoolId -> Bool)
-> (PoolId -> PoolId -> Bool)
-> (PoolId -> PoolId -> Bool)
-> (PoolId -> PoolId -> PoolId)
-> (PoolId -> PoolId -> PoolId)
-> Ord PoolId
PoolId -> PoolId -> Bool
PoolId -> PoolId -> Ordering
PoolId -> PoolId -> PoolId
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: PoolId -> PoolId -> Ordering
compare :: PoolId -> PoolId -> Ordering
$c< :: PoolId -> PoolId -> Bool
< :: PoolId -> PoolId -> Bool
$c<= :: PoolId -> PoolId -> Bool
<= :: PoolId -> PoolId -> Bool
$c> :: PoolId -> PoolId -> Bool
> :: PoolId -> PoolId -> Bool
$c>= :: PoolId -> PoolId -> Bool
>= :: PoolId -> PoolId -> Bool
$cmax :: PoolId -> PoolId -> PoolId
max :: PoolId -> PoolId -> PoolId
$cmin :: PoolId -> PoolId -> PoolId
min :: PoolId -> PoolId -> PoolId
Ord)
newtype LedgerStake = LedgerStake
{ LedgerStake -> Rational
unLedgerStake :: Rational
}
deriving (Int -> LedgerStake -> ShowS
[LedgerStake] -> ShowS
LedgerStake -> String
(Int -> LedgerStake -> ShowS)
-> (LedgerStake -> String)
-> ([LedgerStake] -> ShowS)
-> Show LedgerStake
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LedgerStake -> ShowS
showsPrec :: Int -> LedgerStake -> ShowS
$cshow :: LedgerStake -> String
show :: LedgerStake -> String
$cshowList :: [LedgerStake] -> ShowS
showList :: [LedgerStake] -> ShowS
Show, LedgerStake -> LedgerStake -> Bool
(LedgerStake -> LedgerStake -> Bool)
-> (LedgerStake -> LedgerStake -> Bool) -> Eq LedgerStake
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LedgerStake -> LedgerStake -> Bool
== :: LedgerStake -> LedgerStake -> Bool
$c/= :: LedgerStake -> LedgerStake -> Bool
/= :: LedgerStake -> LedgerStake -> Bool
Eq)
deriving newtype (Integer -> LedgerStake
LedgerStake -> LedgerStake
LedgerStake -> LedgerStake -> LedgerStake
(LedgerStake -> LedgerStake -> LedgerStake)
-> (LedgerStake -> LedgerStake -> LedgerStake)
-> (LedgerStake -> LedgerStake -> LedgerStake)
-> (LedgerStake -> LedgerStake)
-> (LedgerStake -> LedgerStake)
-> (LedgerStake -> LedgerStake)
-> (Integer -> LedgerStake)
-> Num LedgerStake
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
$c+ :: LedgerStake -> LedgerStake -> LedgerStake
+ :: LedgerStake -> LedgerStake -> LedgerStake
$c- :: LedgerStake -> LedgerStake -> LedgerStake
- :: LedgerStake -> LedgerStake -> LedgerStake
$c* :: LedgerStake -> LedgerStake -> LedgerStake
* :: LedgerStake -> LedgerStake -> LedgerStake
$cnegate :: LedgerStake -> LedgerStake
negate :: LedgerStake -> LedgerStake
$cabs :: LedgerStake -> LedgerStake
abs :: LedgerStake -> LedgerStake
$csignum :: LedgerStake -> LedgerStake
signum :: LedgerStake -> LedgerStake
$cfromInteger :: Integer -> LedgerStake
fromInteger :: Integer -> LedgerStake
Num, LedgerStake -> Bool
(LedgerStake -> Bool) -> HasZero LedgerStake
forall a. (a -> Bool) -> HasZero a
$cisZero :: LedgerStake -> Bool
isZero :: LedgerStake -> Bool
HasZero)
newtype VoteWeight = VoteWeight
{ VoteWeight -> Rational
unVoteWeight :: Rational
}
deriving (Int -> VoteWeight -> ShowS
[VoteWeight] -> ShowS
VoteWeight -> String
(Int -> VoteWeight -> ShowS)
-> (VoteWeight -> String)
-> ([VoteWeight] -> ShowS)
-> Show VoteWeight
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> VoteWeight -> ShowS
showsPrec :: Int -> VoteWeight -> ShowS
$cshow :: VoteWeight -> String
show :: VoteWeight -> String
$cshowList :: [VoteWeight] -> ShowS
showList :: [VoteWeight] -> ShowS
Show, VoteWeight -> VoteWeight -> Bool
(VoteWeight -> VoteWeight -> Bool)
-> (VoteWeight -> VoteWeight -> Bool) -> Eq VoteWeight
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: VoteWeight -> VoteWeight -> Bool
== :: VoteWeight -> VoteWeight -> Bool
$c/= :: VoteWeight -> VoteWeight -> Bool
/= :: VoteWeight -> VoteWeight -> Bool
Eq)
newtype TargetCommitteeSize = TargetCommitteeSize
{ TargetCommitteeSize -> Word64
unTargetCommitteeSize :: Word64
}
deriving (Int -> TargetCommitteeSize -> ShowS
[TargetCommitteeSize] -> ShowS
TargetCommitteeSize -> String
(Int -> TargetCommitteeSize -> ShowS)
-> (TargetCommitteeSize -> String)
-> ([TargetCommitteeSize] -> ShowS)
-> Show TargetCommitteeSize
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TargetCommitteeSize -> ShowS
showsPrec :: Int -> TargetCommitteeSize -> ShowS
$cshow :: TargetCommitteeSize -> String
show :: TargetCommitteeSize -> String
$cshowList :: [TargetCommitteeSize] -> ShowS
showList :: [TargetCommitteeSize] -> ShowS
Show, TargetCommitteeSize -> TargetCommitteeSize -> Bool
(TargetCommitteeSize -> TargetCommitteeSize -> Bool)
-> (TargetCommitteeSize -> TargetCommitteeSize -> Bool)
-> Eq TargetCommitteeSize
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TargetCommitteeSize -> TargetCommitteeSize -> Bool
== :: TargetCommitteeSize -> TargetCommitteeSize -> Bool
$c/= :: TargetCommitteeSize -> TargetCommitteeSize -> Bool
/= :: TargetCommitteeSize -> TargetCommitteeSize -> Bool
Eq)
newtype Cumulative a = Cumulative
{ forall a. Cumulative a -> a
unCumulative :: a
}
deriving (Int -> Cumulative a -> ShowS
[Cumulative a] -> ShowS
Cumulative a -> String
(Int -> Cumulative a -> ShowS)
-> (Cumulative a -> String)
-> ([Cumulative a] -> ShowS)
-> Show (Cumulative a)
forall a. Show a => Int -> Cumulative a -> ShowS
forall a. Show a => [Cumulative a] -> ShowS
forall a. Show a => Cumulative a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> Cumulative a -> ShowS
showsPrec :: Int -> Cumulative a -> ShowS
$cshow :: forall a. Show a => Cumulative a -> String
show :: Cumulative a -> String
$cshowList :: forall a. Show a => [Cumulative a] -> ShowS
showList :: [Cumulative a] -> ShowS
Show, Cumulative a -> Cumulative a -> Bool
(Cumulative a -> Cumulative a -> Bool)
-> (Cumulative a -> Cumulative a -> Bool) -> Eq (Cumulative a)
forall a. Eq a => Cumulative a -> Cumulative a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Eq a => Cumulative a -> Cumulative a -> Bool
== :: Cumulative a -> Cumulative a -> Bool
$c/= :: forall a. Eq a => Cumulative a -> Cumulative a -> Bool
/= :: Cumulative a -> Cumulative a -> Bool
Eq)