{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}

module Cardano.Chain.Slotting.SlotCount (
  SlotCount (..),
)
where

import Cardano.Ledger.Binary (DecCBOR, EncCBOR, FromCBOR, ToCBOR)
import Cardano.Prelude
import Formatting.Buildable (Buildable)

-- | A number of slots
newtype SlotCount = SlotCount
  { SlotCount -> Word64
unSlotCount :: Word64
  }
  deriving stock (ReadPrec [SlotCount]
ReadPrec SlotCount
Int -> ReadS SlotCount
ReadS [SlotCount]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SlotCount]
$creadListPrec :: ReadPrec [SlotCount]
readPrec :: ReadPrec SlotCount
$creadPrec :: ReadPrec SlotCount
readList :: ReadS [SlotCount]
$creadList :: ReadS [SlotCount]
readsPrec :: Int -> ReadS SlotCount
$creadsPrec :: Int -> ReadS SlotCount
Read, Int -> SlotCount -> ShowS
[SlotCount] -> ShowS
SlotCount -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SlotCount] -> ShowS
$cshowList :: [SlotCount] -> ShowS
show :: SlotCount -> String
$cshow :: SlotCount -> String
showsPrec :: Int -> SlotCount -> ShowS
$cshowsPrec :: Int -> SlotCount -> ShowS
Show, forall x. Rep SlotCount x -> SlotCount
forall x. SlotCount -> Rep SlotCount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SlotCount x -> SlotCount
$cfrom :: forall x. SlotCount -> Rep SlotCount x
Generic)
  deriving newtype (SlotCount -> SlotCount -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SlotCount -> SlotCount -> Bool
$c/= :: SlotCount -> SlotCount -> Bool
== :: SlotCount -> SlotCount -> Bool
$c== :: SlotCount -> SlotCount -> Bool
Eq, Eq SlotCount
SlotCount -> SlotCount -> Bool
SlotCount -> SlotCount -> Ordering
SlotCount -> SlotCount -> SlotCount
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
min :: SlotCount -> SlotCount -> SlotCount
$cmin :: SlotCount -> SlotCount -> SlotCount
max :: SlotCount -> SlotCount -> SlotCount
$cmax :: SlotCount -> SlotCount -> SlotCount
>= :: SlotCount -> SlotCount -> Bool
$c>= :: SlotCount -> SlotCount -> Bool
> :: SlotCount -> SlotCount -> Bool
$c> :: SlotCount -> SlotCount -> Bool
<= :: SlotCount -> SlotCount -> Bool
$c<= :: SlotCount -> SlotCount -> Bool
< :: SlotCount -> SlotCount -> Bool
$c< :: SlotCount -> SlotCount -> Bool
compare :: SlotCount -> SlotCount -> Ordering
$ccompare :: SlotCount -> SlotCount -> Ordering
Ord, SlotCount -> Builder
forall p. (p -> Builder) -> Buildable p
build :: SlotCount -> Builder
$cbuild :: SlotCount -> Builder
Buildable, Typeable SlotCount
SlotCount -> Encoding
(forall t. EncCBOR t => Proxy t -> Size)
-> Proxy [SlotCount] -> Size
(forall t. EncCBOR t => Proxy t -> Size) -> Proxy SlotCount -> Size
forall a.
Typeable a
-> (a -> Encoding)
-> ((forall t. EncCBOR t => Proxy t -> Size) -> Proxy a -> Size)
-> ((forall t. EncCBOR t => Proxy t -> Size) -> Proxy [a] -> Size)
-> EncCBOR a
encodedListSizeExpr :: (forall t. EncCBOR t => Proxy t -> Size)
-> Proxy [SlotCount] -> Size
$cencodedListSizeExpr :: (forall t. EncCBOR t => Proxy t -> Size)
-> Proxy [SlotCount] -> Size
encodedSizeExpr :: (forall t. EncCBOR t => Proxy t -> Size) -> Proxy SlotCount -> Size
$cencodedSizeExpr :: (forall t. EncCBOR t => Proxy t -> Size) -> Proxy SlotCount -> Size
encCBOR :: SlotCount -> Encoding
$cencCBOR :: SlotCount -> Encoding
EncCBOR, Typeable SlotCount
Proxy SlotCount -> Text
forall s. Decoder s SlotCount
forall a.
Typeable a
-> (forall s. Decoder s a)
-> (forall s. Proxy a -> Decoder s ())
-> (Proxy a -> Text)
-> DecCBOR a
forall s. Proxy SlotCount -> Decoder s ()
label :: Proxy SlotCount -> Text
$clabel :: Proxy SlotCount -> Text
dropCBOR :: forall s. Proxy SlotCount -> Decoder s ()
$cdropCBOR :: forall s. Proxy SlotCount -> Decoder s ()
decCBOR :: forall s. Decoder s SlotCount
$cdecCBOR :: forall s. Decoder s SlotCount
DecCBOR, Typeable SlotCount
SlotCount -> Encoding
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [SlotCount] -> Size
(forall t. ToCBOR t => Proxy t -> Size) -> Proxy SlotCount -> Size
forall a.
Typeable a
-> (a -> Encoding)
-> ((forall t. ToCBOR t => Proxy t -> Size) -> Proxy a -> Size)
-> ((forall t. ToCBOR t => Proxy t -> Size) -> Proxy [a] -> Size)
-> ToCBOR a
encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [SlotCount] -> Size
$cencodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [SlotCount] -> Size
encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy SlotCount -> Size
$cencodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy SlotCount -> Size
toCBOR :: SlotCount -> Encoding
$ctoCBOR :: SlotCount -> Encoding
ToCBOR, Typeable SlotCount
Proxy SlotCount -> Text
forall s. Decoder s SlotCount
forall a.
Typeable a
-> (forall s. Decoder s a) -> (Proxy a -> Text) -> FromCBOR a
label :: Proxy SlotCount -> Text
$clabel :: Proxy SlotCount -> Text
fromCBOR :: forall s. Decoder s SlotCount
$cfromCBOR :: forall s. Decoder s SlotCount
FromCBOR)
  deriving anyclass (SlotCount -> ()
forall a. (a -> ()) -> NFData a
rnf :: SlotCount -> ()
$crnf :: SlotCount -> ()
NFData)