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

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

import Cardano.Binary (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]
(Int -> ReadS SlotCount)
-> ReadS [SlotCount]
-> ReadPrec SlotCount
-> ReadPrec [SlotCount]
-> Read 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
(Int -> SlotCount -> ShowS)
-> (SlotCount -> String)
-> ([SlotCount] -> ShowS)
-> Show SlotCount
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. SlotCount -> Rep SlotCount x)
-> (forall x. Rep SlotCount x -> SlotCount) -> Generic SlotCount
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
(SlotCount -> SlotCount -> Bool)
-> (SlotCount -> SlotCount -> Bool) -> Eq SlotCount
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
Eq SlotCount
-> (SlotCount -> SlotCount -> Ordering)
-> (SlotCount -> SlotCount -> Bool)
-> (SlotCount -> SlotCount -> Bool)
-> (SlotCount -> SlotCount -> Bool)
-> (SlotCount -> SlotCount -> Bool)
-> (SlotCount -> SlotCount -> SlotCount)
-> (SlotCount -> SlotCount -> SlotCount)
-> Ord 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
$cp1Ord :: Eq SlotCount
Ord, SlotCount -> Builder
(SlotCount -> Builder) -> Buildable SlotCount
forall p. (p -> Builder) -> Buildable p
build :: SlotCount -> Builder
$cbuild :: SlotCount -> Builder
Buildable, Typeable SlotCount
Typeable SlotCount
-> (SlotCount -> Encoding)
-> ((forall t. ToCBOR t => Proxy t -> Size)
    -> Proxy SlotCount -> Size)
-> ((forall t. ToCBOR t => Proxy t -> Size)
    -> Proxy [SlotCount] -> Size)
-> ToCBOR 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
$cp1ToCBOR :: Typeable SlotCount
ToCBOR, Typeable SlotCount
Decoder s SlotCount
Typeable SlotCount
-> (forall s. Decoder s SlotCount)
-> (Proxy SlotCount -> Text)
-> FromCBOR 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 :: Decoder s SlotCount
$cfromCBOR :: forall s. Decoder s SlotCount
$cp1FromCBOR :: Typeable SlotCount
FromCBOR)
  deriving anyclass (SlotCount -> ()
(SlotCount -> ()) -> NFData SlotCount
forall a. (a -> ()) -> NFData a
rnf :: SlotCount -> ()
$crnf :: SlotCount -> ()
NFData)