{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE DerivingVia #-} {-# LANGUAGE GeneralisedNewtypeDeriving #-} module Ouroboros.Network.SizeInBytes (SizeInBytes (..)) where import Control.DeepSeq (NFData (..)) import Data.Monoid (Sum (..)) import Data.Word (Word32) import GHC.Generics import Data.Measure qualified as Measure import NoThunks.Class (NoThunks (..)) import Quiet (Quiet (..)) newtype SizeInBytes = SizeInBytes { SizeInBytes -> Word32 getSizeInBytes :: Word32 } deriving (SizeInBytes -> SizeInBytes -> Bool (SizeInBytes -> SizeInBytes -> Bool) -> (SizeInBytes -> SizeInBytes -> Bool) -> Eq SizeInBytes forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a $c== :: SizeInBytes -> SizeInBytes -> Bool == :: SizeInBytes -> SizeInBytes -> Bool $c/= :: SizeInBytes -> SizeInBytes -> Bool /= :: SizeInBytes -> SizeInBytes -> Bool Eq, Eq SizeInBytes Eq SizeInBytes => (SizeInBytes -> SizeInBytes -> Ordering) -> (SizeInBytes -> SizeInBytes -> Bool) -> (SizeInBytes -> SizeInBytes -> Bool) -> (SizeInBytes -> SizeInBytes -> Bool) -> (SizeInBytes -> SizeInBytes -> Bool) -> (SizeInBytes -> SizeInBytes -> SizeInBytes) -> (SizeInBytes -> SizeInBytes -> SizeInBytes) -> Ord SizeInBytes SizeInBytes -> SizeInBytes -> Bool SizeInBytes -> SizeInBytes -> Ordering SizeInBytes -> SizeInBytes -> SizeInBytes 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 :: SizeInBytes -> SizeInBytes -> Ordering compare :: SizeInBytes -> SizeInBytes -> Ordering $c< :: SizeInBytes -> SizeInBytes -> Bool < :: SizeInBytes -> SizeInBytes -> Bool $c<= :: SizeInBytes -> SizeInBytes -> Bool <= :: SizeInBytes -> SizeInBytes -> Bool $c> :: SizeInBytes -> SizeInBytes -> Bool > :: SizeInBytes -> SizeInBytes -> Bool $c>= :: SizeInBytes -> SizeInBytes -> Bool >= :: SizeInBytes -> SizeInBytes -> Bool $cmax :: SizeInBytes -> SizeInBytes -> SizeInBytes max :: SizeInBytes -> SizeInBytes -> SizeInBytes $cmin :: SizeInBytes -> SizeInBytes -> SizeInBytes min :: SizeInBytes -> SizeInBytes -> SizeInBytes Ord) deriving Int -> SizeInBytes -> ShowS [SizeInBytes] -> ShowS SizeInBytes -> String (Int -> SizeInBytes -> ShowS) -> (SizeInBytes -> String) -> ([SizeInBytes] -> ShowS) -> Show SizeInBytes forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a $cshowsPrec :: Int -> SizeInBytes -> ShowS showsPrec :: Int -> SizeInBytes -> ShowS $cshow :: SizeInBytes -> String show :: SizeInBytes -> String $cshowList :: [SizeInBytes] -> ShowS showList :: [SizeInBytes] -> ShowS Show via Quiet SizeInBytes deriving Int -> SizeInBytes SizeInBytes -> Int SizeInBytes -> [SizeInBytes] SizeInBytes -> SizeInBytes SizeInBytes -> SizeInBytes -> [SizeInBytes] SizeInBytes -> SizeInBytes -> SizeInBytes -> [SizeInBytes] (SizeInBytes -> SizeInBytes) -> (SizeInBytes -> SizeInBytes) -> (Int -> SizeInBytes) -> (SizeInBytes -> Int) -> (SizeInBytes -> [SizeInBytes]) -> (SizeInBytes -> SizeInBytes -> [SizeInBytes]) -> (SizeInBytes -> SizeInBytes -> [SizeInBytes]) -> (SizeInBytes -> SizeInBytes -> SizeInBytes -> [SizeInBytes]) -> Enum SizeInBytes forall a. (a -> a) -> (a -> a) -> (Int -> a) -> (a -> Int) -> (a -> [a]) -> (a -> a -> [a]) -> (a -> a -> [a]) -> (a -> a -> a -> [a]) -> Enum a $csucc :: SizeInBytes -> SizeInBytes succ :: SizeInBytes -> SizeInBytes $cpred :: SizeInBytes -> SizeInBytes pred :: SizeInBytes -> SizeInBytes $ctoEnum :: Int -> SizeInBytes toEnum :: Int -> SizeInBytes $cfromEnum :: SizeInBytes -> Int fromEnum :: SizeInBytes -> Int $cenumFrom :: SizeInBytes -> [SizeInBytes] enumFrom :: SizeInBytes -> [SizeInBytes] $cenumFromThen :: SizeInBytes -> SizeInBytes -> [SizeInBytes] enumFromThen :: SizeInBytes -> SizeInBytes -> [SizeInBytes] $cenumFromTo :: SizeInBytes -> SizeInBytes -> [SizeInBytes] enumFromTo :: SizeInBytes -> SizeInBytes -> [SizeInBytes] $cenumFromThenTo :: SizeInBytes -> SizeInBytes -> SizeInBytes -> [SizeInBytes] enumFromThenTo :: SizeInBytes -> SizeInBytes -> SizeInBytes -> [SizeInBytes] Enum via Word32 deriving Integer -> SizeInBytes SizeInBytes -> SizeInBytes SizeInBytes -> SizeInBytes -> SizeInBytes (SizeInBytes -> SizeInBytes -> SizeInBytes) -> (SizeInBytes -> SizeInBytes -> SizeInBytes) -> (SizeInBytes -> SizeInBytes -> SizeInBytes) -> (SizeInBytes -> SizeInBytes) -> (SizeInBytes -> SizeInBytes) -> (SizeInBytes -> SizeInBytes) -> (Integer -> SizeInBytes) -> Num SizeInBytes forall a. (a -> a -> a) -> (a -> a -> a) -> (a -> a -> a) -> (a -> a) -> (a -> a) -> (a -> a) -> (Integer -> a) -> Num a $c+ :: SizeInBytes -> SizeInBytes -> SizeInBytes + :: SizeInBytes -> SizeInBytes -> SizeInBytes $c- :: SizeInBytes -> SizeInBytes -> SizeInBytes - :: SizeInBytes -> SizeInBytes -> SizeInBytes $c* :: SizeInBytes -> SizeInBytes -> SizeInBytes * :: SizeInBytes -> SizeInBytes -> SizeInBytes $cnegate :: SizeInBytes -> SizeInBytes negate :: SizeInBytes -> SizeInBytes $cabs :: SizeInBytes -> SizeInBytes abs :: SizeInBytes -> SizeInBytes $csignum :: SizeInBytes -> SizeInBytes signum :: SizeInBytes -> SizeInBytes $cfromInteger :: Integer -> SizeInBytes fromInteger :: Integer -> SizeInBytes Num via Word32 deriving Num SizeInBytes Ord SizeInBytes (Num SizeInBytes, Ord SizeInBytes) => (SizeInBytes -> Rational) -> Real SizeInBytes SizeInBytes -> Rational forall a. (Num a, Ord a) => (a -> Rational) -> Real a $ctoRational :: SizeInBytes -> Rational toRational :: SizeInBytes -> Rational Real via Word32 deriving Enum SizeInBytes Real SizeInBytes (Real SizeInBytes, Enum SizeInBytes) => (SizeInBytes -> SizeInBytes -> SizeInBytes) -> (SizeInBytes -> SizeInBytes -> SizeInBytes) -> (SizeInBytes -> SizeInBytes -> SizeInBytes) -> (SizeInBytes -> SizeInBytes -> SizeInBytes) -> (SizeInBytes -> SizeInBytes -> (SizeInBytes, SizeInBytes)) -> (SizeInBytes -> SizeInBytes -> (SizeInBytes, SizeInBytes)) -> (SizeInBytes -> Integer) -> Integral SizeInBytes SizeInBytes -> Integer SizeInBytes -> SizeInBytes -> (SizeInBytes, SizeInBytes) SizeInBytes -> SizeInBytes -> SizeInBytes forall a. (Real a, Enum a) => (a -> a -> a) -> (a -> a -> a) -> (a -> a -> a) -> (a -> a -> a) -> (a -> a -> (a, a)) -> (a -> a -> (a, a)) -> (a -> Integer) -> Integral a $cquot :: SizeInBytes -> SizeInBytes -> SizeInBytes quot :: SizeInBytes -> SizeInBytes -> SizeInBytes $crem :: SizeInBytes -> SizeInBytes -> SizeInBytes rem :: SizeInBytes -> SizeInBytes -> SizeInBytes $cdiv :: SizeInBytes -> SizeInBytes -> SizeInBytes div :: SizeInBytes -> SizeInBytes -> SizeInBytes $cmod :: SizeInBytes -> SizeInBytes -> SizeInBytes mod :: SizeInBytes -> SizeInBytes -> SizeInBytes $cquotRem :: SizeInBytes -> SizeInBytes -> (SizeInBytes, SizeInBytes) quotRem :: SizeInBytes -> SizeInBytes -> (SizeInBytes, SizeInBytes) $cdivMod :: SizeInBytes -> SizeInBytes -> (SizeInBytes, SizeInBytes) divMod :: SizeInBytes -> SizeInBytes -> (SizeInBytes, SizeInBytes) $ctoInteger :: SizeInBytes -> Integer toInteger :: SizeInBytes -> Integer Integral via Word32 deriving Context -> SizeInBytes -> IO (Maybe ThunkInfo) Proxy SizeInBytes -> String (Context -> SizeInBytes -> IO (Maybe ThunkInfo)) -> (Context -> SizeInBytes -> IO (Maybe ThunkInfo)) -> (Proxy SizeInBytes -> String) -> NoThunks SizeInBytes forall a. (Context -> a -> IO (Maybe ThunkInfo)) -> (Context -> a -> IO (Maybe ThunkInfo)) -> (Proxy a -> String) -> NoThunks a $cnoThunks :: Context -> SizeInBytes -> IO (Maybe ThunkInfo) noThunks :: Context -> SizeInBytes -> IO (Maybe ThunkInfo) $cwNoThunks :: Context -> SizeInBytes -> IO (Maybe ThunkInfo) wNoThunks :: Context -> SizeInBytes -> IO (Maybe ThunkInfo) $cshowTypeOf :: Proxy SizeInBytes -> String showTypeOf :: Proxy SizeInBytes -> String NoThunks via Word32 deriving NonEmpty SizeInBytes -> SizeInBytes SizeInBytes -> SizeInBytes -> SizeInBytes (SizeInBytes -> SizeInBytes -> SizeInBytes) -> (NonEmpty SizeInBytes -> SizeInBytes) -> (forall b. Integral b => b -> SizeInBytes -> SizeInBytes) -> Semigroup SizeInBytes forall b. Integral b => b -> SizeInBytes -> SizeInBytes forall a. (a -> a -> a) -> (NonEmpty a -> a) -> (forall b. Integral b => b -> a -> a) -> Semigroup a $c<> :: SizeInBytes -> SizeInBytes -> SizeInBytes <> :: SizeInBytes -> SizeInBytes -> SizeInBytes $csconcat :: NonEmpty SizeInBytes -> SizeInBytes sconcat :: NonEmpty SizeInBytes -> SizeInBytes $cstimes :: forall b. Integral b => b -> SizeInBytes -> SizeInBytes stimes :: forall b. Integral b => b -> SizeInBytes -> SizeInBytes Semigroup via Sum Word32 deriving Semigroup SizeInBytes SizeInBytes Semigroup SizeInBytes => SizeInBytes -> (SizeInBytes -> SizeInBytes -> SizeInBytes) -> ([SizeInBytes] -> SizeInBytes) -> Monoid SizeInBytes [SizeInBytes] -> SizeInBytes SizeInBytes -> SizeInBytes -> SizeInBytes forall a. Semigroup a => a -> (a -> a -> a) -> ([a] -> a) -> Monoid a $cmempty :: SizeInBytes mempty :: SizeInBytes $cmappend :: SizeInBytes -> SizeInBytes -> SizeInBytes mappend :: SizeInBytes -> SizeInBytes -> SizeInBytes $cmconcat :: [SizeInBytes] -> SizeInBytes mconcat :: [SizeInBytes] -> SizeInBytes Monoid via Sum Word32 deriving (forall x. SizeInBytes -> Rep SizeInBytes x) -> (forall x. Rep SizeInBytes x -> SizeInBytes) -> Generic SizeInBytes forall x. Rep SizeInBytes x -> SizeInBytes forall x. SizeInBytes -> Rep SizeInBytes x forall a. (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a $cfrom :: forall x. SizeInBytes -> Rep SizeInBytes x from :: forall x. SizeInBytes -> Rep SizeInBytes x $cto :: forall x. Rep SizeInBytes x -> SizeInBytes to :: forall x. Rep SizeInBytes x -> SizeInBytes Generic deriving newtype SizeInBytes -> () (SizeInBytes -> ()) -> NFData SizeInBytes forall a. (a -> ()) -> NFData a $crnf :: SizeInBytes -> () rnf :: SizeInBytes -> () NFData deriving Eq SizeInBytes SizeInBytes Eq SizeInBytes => SizeInBytes -> (SizeInBytes -> SizeInBytes -> SizeInBytes) -> (SizeInBytes -> SizeInBytes -> SizeInBytes) -> (SizeInBytes -> SizeInBytes -> SizeInBytes) -> Measure SizeInBytes SizeInBytes -> SizeInBytes -> SizeInBytes forall a. Eq a => a -> (a -> a -> a) -> (a -> a -> a) -> (a -> a -> a) -> Measure a $czero :: SizeInBytes zero :: SizeInBytes $cplus :: SizeInBytes -> SizeInBytes -> SizeInBytes plus :: SizeInBytes -> SizeInBytes -> SizeInBytes $cmin :: SizeInBytes -> SizeInBytes -> SizeInBytes min :: SizeInBytes -> SizeInBytes -> SizeInBytes $cmax :: SizeInBytes -> SizeInBytes -> SizeInBytes max :: SizeInBytes -> SizeInBytes -> SizeInBytes Measure.Measure via Word32 deriving Measure SizeInBytes SizeInBytes Measure SizeInBytes => SizeInBytes -> BoundedMeasure SizeInBytes forall a. Measure a => a -> BoundedMeasure a $cmaxBound :: SizeInBytes maxBound :: SizeInBytes Measure.BoundedMeasure via Word32