{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}

module Cardano.Slotting.Slot
  ( SlotNo (..),
    WithOrigin (..),
    at,
    origin,
    fromWithOrigin,
    withOrigin,
    withOriginToMaybe,
    withOriginFromMaybe,
    EpochNo (..),
    EpochSize (..),
  )
where

import Cardano.Binary (FromCBOR (..), ToCBOR (..))
import Codec.Serialise (Serialise (..))
import Control.DeepSeq (NFData (rnf))
import Data.Aeson (FromJSON, ToJSON)
import Data.Typeable (Typeable)
import Data.Word (Word64)
import GHC.Generics (Generic)
import Quiet (Quiet (..))
import NoThunks.Class (NoThunks)

-- | The 0-based index for the Ourboros time slot.
newtype SlotNo = SlotNo {SlotNo -> Word64
unSlotNo :: Word64}
  deriving stock (SlotNo -> SlotNo -> Bool
(SlotNo -> SlotNo -> Bool)
-> (SlotNo -> SlotNo -> Bool) -> Eq SlotNo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SlotNo -> SlotNo -> Bool
$c/= :: SlotNo -> SlotNo -> Bool
== :: SlotNo -> SlotNo -> Bool
$c== :: SlotNo -> SlotNo -> Bool
Eq, Eq SlotNo
Eq SlotNo
-> (SlotNo -> SlotNo -> Ordering)
-> (SlotNo -> SlotNo -> Bool)
-> (SlotNo -> SlotNo -> Bool)
-> (SlotNo -> SlotNo -> Bool)
-> (SlotNo -> SlotNo -> Bool)
-> (SlotNo -> SlotNo -> SlotNo)
-> (SlotNo -> SlotNo -> SlotNo)
-> Ord SlotNo
SlotNo -> SlotNo -> Bool
SlotNo -> SlotNo -> Ordering
SlotNo -> SlotNo -> SlotNo
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 :: SlotNo -> SlotNo -> SlotNo
$cmin :: SlotNo -> SlotNo -> SlotNo
max :: SlotNo -> SlotNo -> SlotNo
$cmax :: SlotNo -> SlotNo -> SlotNo
>= :: SlotNo -> SlotNo -> Bool
$c>= :: SlotNo -> SlotNo -> Bool
> :: SlotNo -> SlotNo -> Bool
$c> :: SlotNo -> SlotNo -> Bool
<= :: SlotNo -> SlotNo -> Bool
$c<= :: SlotNo -> SlotNo -> Bool
< :: SlotNo -> SlotNo -> Bool
$c< :: SlotNo -> SlotNo -> Bool
compare :: SlotNo -> SlotNo -> Ordering
$ccompare :: SlotNo -> SlotNo -> Ordering
$cp1Ord :: Eq SlotNo
Ord, (forall x. SlotNo -> Rep SlotNo x)
-> (forall x. Rep SlotNo x -> SlotNo) -> Generic SlotNo
forall x. Rep SlotNo x -> SlotNo
forall x. SlotNo -> Rep SlotNo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SlotNo x -> SlotNo
$cfrom :: forall x. SlotNo -> Rep SlotNo x
Generic)
  deriving Int -> SlotNo -> ShowS
[SlotNo] -> ShowS
SlotNo -> String
(Int -> SlotNo -> ShowS)
-> (SlotNo -> String) -> ([SlotNo] -> ShowS) -> Show SlotNo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SlotNo] -> ShowS
$cshowList :: [SlotNo] -> ShowS
show :: SlotNo -> String
$cshow :: SlotNo -> String
showsPrec :: Int -> SlotNo -> ShowS
$cshowsPrec :: Int -> SlotNo -> ShowS
Show via Quiet SlotNo
  deriving newtype (Int -> SlotNo
SlotNo -> Int
SlotNo -> [SlotNo]
SlotNo -> SlotNo
SlotNo -> SlotNo -> [SlotNo]
SlotNo -> SlotNo -> SlotNo -> [SlotNo]
(SlotNo -> SlotNo)
-> (SlotNo -> SlotNo)
-> (Int -> SlotNo)
-> (SlotNo -> Int)
-> (SlotNo -> [SlotNo])
-> (SlotNo -> SlotNo -> [SlotNo])
-> (SlotNo -> SlotNo -> [SlotNo])
-> (SlotNo -> SlotNo -> SlotNo -> [SlotNo])
-> Enum SlotNo
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: SlotNo -> SlotNo -> SlotNo -> [SlotNo]
$cenumFromThenTo :: SlotNo -> SlotNo -> SlotNo -> [SlotNo]
enumFromTo :: SlotNo -> SlotNo -> [SlotNo]
$cenumFromTo :: SlotNo -> SlotNo -> [SlotNo]
enumFromThen :: SlotNo -> SlotNo -> [SlotNo]
$cenumFromThen :: SlotNo -> SlotNo -> [SlotNo]
enumFrom :: SlotNo -> [SlotNo]
$cenumFrom :: SlotNo -> [SlotNo]
fromEnum :: SlotNo -> Int
$cfromEnum :: SlotNo -> Int
toEnum :: Int -> SlotNo
$ctoEnum :: Int -> SlotNo
pred :: SlotNo -> SlotNo
$cpred :: SlotNo -> SlotNo
succ :: SlotNo -> SlotNo
$csucc :: SlotNo -> SlotNo
Enum, SlotNo
SlotNo -> SlotNo -> Bounded SlotNo
forall a. a -> a -> Bounded a
maxBound :: SlotNo
$cmaxBound :: SlotNo
minBound :: SlotNo
$cminBound :: SlotNo
Bounded, Integer -> SlotNo
SlotNo -> SlotNo
SlotNo -> SlotNo -> SlotNo
(SlotNo -> SlotNo -> SlotNo)
-> (SlotNo -> SlotNo -> SlotNo)
-> (SlotNo -> SlotNo -> SlotNo)
-> (SlotNo -> SlotNo)
-> (SlotNo -> SlotNo)
-> (SlotNo -> SlotNo)
-> (Integer -> SlotNo)
-> Num SlotNo
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> SlotNo
$cfromInteger :: Integer -> SlotNo
signum :: SlotNo -> SlotNo
$csignum :: SlotNo -> SlotNo
abs :: SlotNo -> SlotNo
$cabs :: SlotNo -> SlotNo
negate :: SlotNo -> SlotNo
$cnegate :: SlotNo -> SlotNo
* :: SlotNo -> SlotNo -> SlotNo
$c* :: SlotNo -> SlotNo -> SlotNo
- :: SlotNo -> SlotNo -> SlotNo
$c- :: SlotNo -> SlotNo -> SlotNo
+ :: SlotNo -> SlotNo -> SlotNo
$c+ :: SlotNo -> SlotNo -> SlotNo
Num, SlotNo -> ()
(SlotNo -> ()) -> NFData SlotNo
forall a. (a -> ()) -> NFData a
rnf :: SlotNo -> ()
$crnf :: SlotNo -> ()
NFData, Decoder s SlotNo
Decoder s [SlotNo]
[SlotNo] -> Encoding
SlotNo -> Encoding
(SlotNo -> Encoding)
-> (forall s. Decoder s SlotNo)
-> ([SlotNo] -> Encoding)
-> (forall s. Decoder s [SlotNo])
-> Serialise SlotNo
forall s. Decoder s [SlotNo]
forall s. Decoder s SlotNo
forall a.
(a -> Encoding)
-> (forall s. Decoder s a)
-> ([a] -> Encoding)
-> (forall s. Decoder s [a])
-> Serialise a
decodeList :: Decoder s [SlotNo]
$cdecodeList :: forall s. Decoder s [SlotNo]
encodeList :: [SlotNo] -> Encoding
$cencodeList :: [SlotNo] -> Encoding
decode :: Decoder s SlotNo
$cdecode :: forall s. Decoder s SlotNo
encode :: SlotNo -> Encoding
$cencode :: SlotNo -> Encoding
Serialise, Context -> SlotNo -> IO (Maybe ThunkInfo)
Proxy SlotNo -> String
(Context -> SlotNo -> IO (Maybe ThunkInfo))
-> (Context -> SlotNo -> IO (Maybe ThunkInfo))
-> (Proxy SlotNo -> String)
-> NoThunks SlotNo
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy SlotNo -> String
$cshowTypeOf :: Proxy SlotNo -> String
wNoThunks :: Context -> SlotNo -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> SlotNo -> IO (Maybe ThunkInfo)
noThunks :: Context -> SlotNo -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> SlotNo -> IO (Maybe ThunkInfo)
NoThunks, [SlotNo] -> Encoding
[SlotNo] -> Value
SlotNo -> Encoding
SlotNo -> Value
(SlotNo -> Value)
-> (SlotNo -> Encoding)
-> ([SlotNo] -> Value)
-> ([SlotNo] -> Encoding)
-> ToJSON SlotNo
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [SlotNo] -> Encoding
$ctoEncodingList :: [SlotNo] -> Encoding
toJSONList :: [SlotNo] -> Value
$ctoJSONList :: [SlotNo] -> Value
toEncoding :: SlotNo -> Encoding
$ctoEncoding :: SlotNo -> Encoding
toJSON :: SlotNo -> Value
$ctoJSON :: SlotNo -> Value
ToJSON, Value -> Parser [SlotNo]
Value -> Parser SlotNo
(Value -> Parser SlotNo)
-> (Value -> Parser [SlotNo]) -> FromJSON SlotNo
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [SlotNo]
$cparseJSONList :: Value -> Parser [SlotNo]
parseJSON :: Value -> Parser SlotNo
$cparseJSON :: Value -> Parser SlotNo
FromJSON)

instance ToCBOR SlotNo where
  toCBOR :: SlotNo -> Encoding
toCBOR = SlotNo -> Encoding
forall a. Serialise a => a -> Encoding
encode
  encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy SlotNo -> Size
encodedSizeExpr forall t. ToCBOR t => Proxy t -> Size
size = (forall t. ToCBOR t => Proxy t -> Size) -> Proxy Word64 -> Size
forall a.
ToCBOR a =>
(forall t. ToCBOR t => Proxy t -> Size) -> Proxy a -> Size
encodedSizeExpr forall t. ToCBOR t => Proxy t -> Size
size (Proxy Word64 -> Size)
-> (Proxy SlotNo -> Proxy Word64) -> Proxy SlotNo -> Size
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SlotNo -> Word64) -> Proxy SlotNo -> Proxy Word64
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SlotNo -> Word64
unSlotNo

instance FromCBOR SlotNo where
  fromCBOR :: Decoder s SlotNo
fromCBOR = Decoder s SlotNo
forall a s. Serialise a => Decoder s a
decode

{-------------------------------------------------------------------------------
  WithOrigin
-------------------------------------------------------------------------------}

data WithOrigin t = Origin | At !t
  deriving
    ( WithOrigin t -> WithOrigin t -> Bool
(WithOrigin t -> WithOrigin t -> Bool)
-> (WithOrigin t -> WithOrigin t -> Bool) -> Eq (WithOrigin t)
forall t. Eq t => WithOrigin t -> WithOrigin t -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WithOrigin t -> WithOrigin t -> Bool
$c/= :: forall t. Eq t => WithOrigin t -> WithOrigin t -> Bool
== :: WithOrigin t -> WithOrigin t -> Bool
$c== :: forall t. Eq t => WithOrigin t -> WithOrigin t -> Bool
Eq,
      Eq (WithOrigin t)
Eq (WithOrigin t)
-> (WithOrigin t -> WithOrigin t -> Ordering)
-> (WithOrigin t -> WithOrigin t -> Bool)
-> (WithOrigin t -> WithOrigin t -> Bool)
-> (WithOrigin t -> WithOrigin t -> Bool)
-> (WithOrigin t -> WithOrigin t -> Bool)
-> (WithOrigin t -> WithOrigin t -> WithOrigin t)
-> (WithOrigin t -> WithOrigin t -> WithOrigin t)
-> Ord (WithOrigin t)
WithOrigin t -> WithOrigin t -> Bool
WithOrigin t -> WithOrigin t -> Ordering
WithOrigin t -> WithOrigin t -> WithOrigin t
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
forall t. Ord t => Eq (WithOrigin t)
forall t. Ord t => WithOrigin t -> WithOrigin t -> Bool
forall t. Ord t => WithOrigin t -> WithOrigin t -> Ordering
forall t. Ord t => WithOrigin t -> WithOrigin t -> WithOrigin t
min :: WithOrigin t -> WithOrigin t -> WithOrigin t
$cmin :: forall t. Ord t => WithOrigin t -> WithOrigin t -> WithOrigin t
max :: WithOrigin t -> WithOrigin t -> WithOrigin t
$cmax :: forall t. Ord t => WithOrigin t -> WithOrigin t -> WithOrigin t
>= :: WithOrigin t -> WithOrigin t -> Bool
$c>= :: forall t. Ord t => WithOrigin t -> WithOrigin t -> Bool
> :: WithOrigin t -> WithOrigin t -> Bool
$c> :: forall t. Ord t => WithOrigin t -> WithOrigin t -> Bool
<= :: WithOrigin t -> WithOrigin t -> Bool
$c<= :: forall t. Ord t => WithOrigin t -> WithOrigin t -> Bool
< :: WithOrigin t -> WithOrigin t -> Bool
$c< :: forall t. Ord t => WithOrigin t -> WithOrigin t -> Bool
compare :: WithOrigin t -> WithOrigin t -> Ordering
$ccompare :: forall t. Ord t => WithOrigin t -> WithOrigin t -> Ordering
$cp1Ord :: forall t. Ord t => Eq (WithOrigin t)
Ord,
      Int -> WithOrigin t -> ShowS
[WithOrigin t] -> ShowS
WithOrigin t -> String
(Int -> WithOrigin t -> ShowS)
-> (WithOrigin t -> String)
-> ([WithOrigin t] -> ShowS)
-> Show (WithOrigin t)
forall t. Show t => Int -> WithOrigin t -> ShowS
forall t. Show t => [WithOrigin t] -> ShowS
forall t. Show t => WithOrigin t -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WithOrigin t] -> ShowS
$cshowList :: forall t. Show t => [WithOrigin t] -> ShowS
show :: WithOrigin t -> String
$cshow :: forall t. Show t => WithOrigin t -> String
showsPrec :: Int -> WithOrigin t -> ShowS
$cshowsPrec :: forall t. Show t => Int -> WithOrigin t -> ShowS
Show,
      (forall x. WithOrigin t -> Rep (WithOrigin t) x)
-> (forall x. Rep (WithOrigin t) x -> WithOrigin t)
-> Generic (WithOrigin t)
forall x. Rep (WithOrigin t) x -> WithOrigin t
forall x. WithOrigin t -> Rep (WithOrigin t) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall t x. Rep (WithOrigin t) x -> WithOrigin t
forall t x. WithOrigin t -> Rep (WithOrigin t) x
$cto :: forall t x. Rep (WithOrigin t) x -> WithOrigin t
$cfrom :: forall t x. WithOrigin t -> Rep (WithOrigin t) x
Generic,
      a -> WithOrigin b -> WithOrigin a
(a -> b) -> WithOrigin a -> WithOrigin b
(forall a b. (a -> b) -> WithOrigin a -> WithOrigin b)
-> (forall a b. a -> WithOrigin b -> WithOrigin a)
-> Functor WithOrigin
forall a b. a -> WithOrigin b -> WithOrigin a
forall a b. (a -> b) -> WithOrigin a -> WithOrigin b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> WithOrigin b -> WithOrigin a
$c<$ :: forall a b. a -> WithOrigin b -> WithOrigin a
fmap :: (a -> b) -> WithOrigin a -> WithOrigin b
$cfmap :: forall a b. (a -> b) -> WithOrigin a -> WithOrigin b
Functor,
      WithOrigin a -> Bool
(a -> m) -> WithOrigin a -> m
(a -> b -> b) -> b -> WithOrigin a -> b
(forall m. Monoid m => WithOrigin m -> m)
-> (forall m a. Monoid m => (a -> m) -> WithOrigin a -> m)
-> (forall m a. Monoid m => (a -> m) -> WithOrigin a -> m)
-> (forall a b. (a -> b -> b) -> b -> WithOrigin a -> b)
-> (forall a b. (a -> b -> b) -> b -> WithOrigin a -> b)
-> (forall b a. (b -> a -> b) -> b -> WithOrigin a -> b)
-> (forall b a. (b -> a -> b) -> b -> WithOrigin a -> b)
-> (forall a. (a -> a -> a) -> WithOrigin a -> a)
-> (forall a. (a -> a -> a) -> WithOrigin a -> a)
-> (forall a. WithOrigin a -> [a])
-> (forall a. WithOrigin a -> Bool)
-> (forall a. WithOrigin a -> Int)
-> (forall a. Eq a => a -> WithOrigin a -> Bool)
-> (forall a. Ord a => WithOrigin a -> a)
-> (forall a. Ord a => WithOrigin a -> a)
-> (forall a. Num a => WithOrigin a -> a)
-> (forall a. Num a => WithOrigin a -> a)
-> Foldable WithOrigin
forall a. Eq a => a -> WithOrigin a -> Bool
forall a. Num a => WithOrigin a -> a
forall a. Ord a => WithOrigin a -> a
forall m. Monoid m => WithOrigin m -> m
forall a. WithOrigin a -> Bool
forall a. WithOrigin a -> Int
forall a. WithOrigin a -> [a]
forall a. (a -> a -> a) -> WithOrigin a -> a
forall m a. Monoid m => (a -> m) -> WithOrigin a -> m
forall b a. (b -> a -> b) -> b -> WithOrigin a -> b
forall a b. (a -> b -> b) -> b -> WithOrigin a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: WithOrigin a -> a
$cproduct :: forall a. Num a => WithOrigin a -> a
sum :: WithOrigin a -> a
$csum :: forall a. Num a => WithOrigin a -> a
minimum :: WithOrigin a -> a
$cminimum :: forall a. Ord a => WithOrigin a -> a
maximum :: WithOrigin a -> a
$cmaximum :: forall a. Ord a => WithOrigin a -> a
elem :: a -> WithOrigin a -> Bool
$celem :: forall a. Eq a => a -> WithOrigin a -> Bool
length :: WithOrigin a -> Int
$clength :: forall a. WithOrigin a -> Int
null :: WithOrigin a -> Bool
$cnull :: forall a. WithOrigin a -> Bool
toList :: WithOrigin a -> [a]
$ctoList :: forall a. WithOrigin a -> [a]
foldl1 :: (a -> a -> a) -> WithOrigin a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> WithOrigin a -> a
foldr1 :: (a -> a -> a) -> WithOrigin a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> WithOrigin a -> a
foldl' :: (b -> a -> b) -> b -> WithOrigin a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> WithOrigin a -> b
foldl :: (b -> a -> b) -> b -> WithOrigin a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> WithOrigin a -> b
foldr' :: (a -> b -> b) -> b -> WithOrigin a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> WithOrigin a -> b
foldr :: (a -> b -> b) -> b -> WithOrigin a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> WithOrigin a -> b
foldMap' :: (a -> m) -> WithOrigin a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> WithOrigin a -> m
foldMap :: (a -> m) -> WithOrigin a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> WithOrigin a -> m
fold :: WithOrigin m -> m
$cfold :: forall m. Monoid m => WithOrigin m -> m
Foldable,
      Functor WithOrigin
Foldable WithOrigin
Functor WithOrigin
-> Foldable WithOrigin
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> WithOrigin a -> f (WithOrigin b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    WithOrigin (f a) -> f (WithOrigin a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> WithOrigin a -> m (WithOrigin b))
-> (forall (m :: * -> *) a.
    Monad m =>
    WithOrigin (m a) -> m (WithOrigin a))
-> Traversable WithOrigin
(a -> f b) -> WithOrigin a -> f (WithOrigin b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
WithOrigin (m a) -> m (WithOrigin a)
forall (f :: * -> *) a.
Applicative f =>
WithOrigin (f a) -> f (WithOrigin a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> WithOrigin a -> m (WithOrigin b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> WithOrigin a -> f (WithOrigin b)
sequence :: WithOrigin (m a) -> m (WithOrigin a)
$csequence :: forall (m :: * -> *) a.
Monad m =>
WithOrigin (m a) -> m (WithOrigin a)
mapM :: (a -> m b) -> WithOrigin a -> m (WithOrigin b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> WithOrigin a -> m (WithOrigin b)
sequenceA :: WithOrigin (f a) -> f (WithOrigin a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
WithOrigin (f a) -> f (WithOrigin a)
traverse :: (a -> f b) -> WithOrigin a -> f (WithOrigin b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> WithOrigin a -> f (WithOrigin b)
$cp2Traversable :: Foldable WithOrigin
$cp1Traversable :: Functor WithOrigin
Traversable,
      [WithOrigin t] -> Encoding
WithOrigin t -> Encoding
(WithOrigin t -> Encoding)
-> (forall s. Decoder s (WithOrigin t))
-> ([WithOrigin t] -> Encoding)
-> (forall s. Decoder s [WithOrigin t])
-> Serialise (WithOrigin t)
forall s. Decoder s [WithOrigin t]
forall s. Decoder s (WithOrigin t)
forall t. Serialise t => [WithOrigin t] -> Encoding
forall t. Serialise t => WithOrigin t -> Encoding
forall t s. Serialise t => Decoder s [WithOrigin t]
forall t s. Serialise t => Decoder s (WithOrigin t)
forall a.
(a -> Encoding)
-> (forall s. Decoder s a)
-> ([a] -> Encoding)
-> (forall s. Decoder s [a])
-> Serialise a
decodeList :: Decoder s [WithOrigin t]
$cdecodeList :: forall t s. Serialise t => Decoder s [WithOrigin t]
encodeList :: [WithOrigin t] -> Encoding
$cencodeList :: forall t. Serialise t => [WithOrigin t] -> Encoding
decode :: Decoder s (WithOrigin t)
$cdecode :: forall t s. Serialise t => Decoder s (WithOrigin t)
encode :: WithOrigin t -> Encoding
$cencode :: forall t. Serialise t => WithOrigin t -> Encoding
Serialise,
      Context -> WithOrigin t -> IO (Maybe ThunkInfo)
Proxy (WithOrigin t) -> String
(Context -> WithOrigin t -> IO (Maybe ThunkInfo))
-> (Context -> WithOrigin t -> IO (Maybe ThunkInfo))
-> (Proxy (WithOrigin t) -> String)
-> NoThunks (WithOrigin t)
forall t.
NoThunks t =>
Context -> WithOrigin t -> IO (Maybe ThunkInfo)
forall t. NoThunks t => Proxy (WithOrigin t) -> String
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy (WithOrigin t) -> String
$cshowTypeOf :: forall t. NoThunks t => Proxy (WithOrigin t) -> String
wNoThunks :: Context -> WithOrigin t -> IO (Maybe ThunkInfo)
$cwNoThunks :: forall t.
NoThunks t =>
Context -> WithOrigin t -> IO (Maybe ThunkInfo)
noThunks :: Context -> WithOrigin t -> IO (Maybe ThunkInfo)
$cnoThunks :: forall t.
NoThunks t =>
Context -> WithOrigin t -> IO (Maybe ThunkInfo)
NoThunks
    )

instance (Serialise t, Typeable t) => ToCBOR (WithOrigin t) where
  toCBOR :: WithOrigin t -> Encoding
toCBOR = WithOrigin t -> Encoding
forall a. Serialise a => a -> Encoding
encode

instance (Serialise t, Typeable t) => FromCBOR (WithOrigin t) where
  fromCBOR :: Decoder s (WithOrigin t)
fromCBOR = Decoder s (WithOrigin t)
forall a s. Serialise a => Decoder s a
decode

instance Bounded t => Bounded (WithOrigin t) where
  minBound :: WithOrigin t
minBound = WithOrigin t
forall t. WithOrigin t
Origin
  maxBound :: WithOrigin t
maxBound = t -> WithOrigin t
forall t. t -> WithOrigin t
At t
forall a. Bounded a => a
maxBound

instance NFData a => NFData (WithOrigin a) where
  rnf :: WithOrigin a -> ()
rnf WithOrigin a
Origin = ()
  rnf (At a
t) = a -> ()
forall a. NFData a => a -> ()
rnf a
t


at :: t -> WithOrigin t
at :: t -> WithOrigin t
at = t -> WithOrigin t
forall t. t -> WithOrigin t
At

origin :: WithOrigin t
origin :: WithOrigin t
origin = WithOrigin t
forall t. WithOrigin t
Origin

fromWithOrigin :: t -> WithOrigin t -> t
fromWithOrigin :: t -> WithOrigin t -> t
fromWithOrigin t
t WithOrigin t
Origin = t
t
fromWithOrigin t
_ (At t
t) = t
t

withOrigin :: b -> (t -> b) -> WithOrigin t -> b
withOrigin :: b -> (t -> b) -> WithOrigin t -> b
withOrigin b
a t -> b
_ WithOrigin t
Origin = b
a
withOrigin b
_ t -> b
f (At t
t) = t -> b
f t
t

withOriginToMaybe :: WithOrigin t -> Maybe t
withOriginToMaybe :: WithOrigin t -> Maybe t
withOriginToMaybe WithOrigin t
Origin = Maybe t
forall a. Maybe a
Nothing
withOriginToMaybe (At t
t) = t -> Maybe t
forall a. a -> Maybe a
Just t
t

withOriginFromMaybe :: Maybe t -> WithOrigin t
withOriginFromMaybe :: Maybe t -> WithOrigin t
withOriginFromMaybe Maybe t
Nothing = WithOrigin t
forall t. WithOrigin t
Origin
withOriginFromMaybe (Just t
t) = t -> WithOrigin t
forall t. t -> WithOrigin t
At t
t

{-------------------------------------------------------------------------------
  Epochs
-------------------------------------------------------------------------------}

-- | An epoch, i.e. the number of the epoch.
newtype EpochNo = EpochNo {EpochNo -> Word64
unEpochNo :: Word64}
  deriving stock (EpochNo -> EpochNo -> Bool
(EpochNo -> EpochNo -> Bool)
-> (EpochNo -> EpochNo -> Bool) -> Eq EpochNo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EpochNo -> EpochNo -> Bool
$c/= :: EpochNo -> EpochNo -> Bool
== :: EpochNo -> EpochNo -> Bool
$c== :: EpochNo -> EpochNo -> Bool
Eq, Eq EpochNo
Eq EpochNo
-> (EpochNo -> EpochNo -> Ordering)
-> (EpochNo -> EpochNo -> Bool)
-> (EpochNo -> EpochNo -> Bool)
-> (EpochNo -> EpochNo -> Bool)
-> (EpochNo -> EpochNo -> Bool)
-> (EpochNo -> EpochNo -> EpochNo)
-> (EpochNo -> EpochNo -> EpochNo)
-> Ord EpochNo
EpochNo -> EpochNo -> Bool
EpochNo -> EpochNo -> Ordering
EpochNo -> EpochNo -> EpochNo
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 :: EpochNo -> EpochNo -> EpochNo
$cmin :: EpochNo -> EpochNo -> EpochNo
max :: EpochNo -> EpochNo -> EpochNo
$cmax :: EpochNo -> EpochNo -> EpochNo
>= :: EpochNo -> EpochNo -> Bool
$c>= :: EpochNo -> EpochNo -> Bool
> :: EpochNo -> EpochNo -> Bool
$c> :: EpochNo -> EpochNo -> Bool
<= :: EpochNo -> EpochNo -> Bool
$c<= :: EpochNo -> EpochNo -> Bool
< :: EpochNo -> EpochNo -> Bool
$c< :: EpochNo -> EpochNo -> Bool
compare :: EpochNo -> EpochNo -> Ordering
$ccompare :: EpochNo -> EpochNo -> Ordering
$cp1Ord :: Eq EpochNo
Ord, (forall x. EpochNo -> Rep EpochNo x)
-> (forall x. Rep EpochNo x -> EpochNo) -> Generic EpochNo
forall x. Rep EpochNo x -> EpochNo
forall x. EpochNo -> Rep EpochNo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EpochNo x -> EpochNo
$cfrom :: forall x. EpochNo -> Rep EpochNo x
Generic)
  deriving Int -> EpochNo -> ShowS
[EpochNo] -> ShowS
EpochNo -> String
(Int -> EpochNo -> ShowS)
-> (EpochNo -> String) -> ([EpochNo] -> ShowS) -> Show EpochNo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EpochNo] -> ShowS
$cshowList :: [EpochNo] -> ShowS
show :: EpochNo -> String
$cshow :: EpochNo -> String
showsPrec :: Int -> EpochNo -> ShowS
$cshowsPrec :: Int -> EpochNo -> ShowS
Show via Quiet EpochNo
  deriving newtype (Int -> EpochNo
EpochNo -> Int
EpochNo -> [EpochNo]
EpochNo -> EpochNo
EpochNo -> EpochNo -> [EpochNo]
EpochNo -> EpochNo -> EpochNo -> [EpochNo]
(EpochNo -> EpochNo)
-> (EpochNo -> EpochNo)
-> (Int -> EpochNo)
-> (EpochNo -> Int)
-> (EpochNo -> [EpochNo])
-> (EpochNo -> EpochNo -> [EpochNo])
-> (EpochNo -> EpochNo -> [EpochNo])
-> (EpochNo -> EpochNo -> EpochNo -> [EpochNo])
-> Enum EpochNo
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: EpochNo -> EpochNo -> EpochNo -> [EpochNo]
$cenumFromThenTo :: EpochNo -> EpochNo -> EpochNo -> [EpochNo]
enumFromTo :: EpochNo -> EpochNo -> [EpochNo]
$cenumFromTo :: EpochNo -> EpochNo -> [EpochNo]
enumFromThen :: EpochNo -> EpochNo -> [EpochNo]
$cenumFromThen :: EpochNo -> EpochNo -> [EpochNo]
enumFrom :: EpochNo -> [EpochNo]
$cenumFrom :: EpochNo -> [EpochNo]
fromEnum :: EpochNo -> Int
$cfromEnum :: EpochNo -> Int
toEnum :: Int -> EpochNo
$ctoEnum :: Int -> EpochNo
pred :: EpochNo -> EpochNo
$cpred :: EpochNo -> EpochNo
succ :: EpochNo -> EpochNo
$csucc :: EpochNo -> EpochNo
Enum, Integer -> EpochNo
EpochNo -> EpochNo
EpochNo -> EpochNo -> EpochNo
(EpochNo -> EpochNo -> EpochNo)
-> (EpochNo -> EpochNo -> EpochNo)
-> (EpochNo -> EpochNo -> EpochNo)
-> (EpochNo -> EpochNo)
-> (EpochNo -> EpochNo)
-> (EpochNo -> EpochNo)
-> (Integer -> EpochNo)
-> Num EpochNo
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> EpochNo
$cfromInteger :: Integer -> EpochNo
signum :: EpochNo -> EpochNo
$csignum :: EpochNo -> EpochNo
abs :: EpochNo -> EpochNo
$cabs :: EpochNo -> EpochNo
negate :: EpochNo -> EpochNo
$cnegate :: EpochNo -> EpochNo
* :: EpochNo -> EpochNo -> EpochNo
$c* :: EpochNo -> EpochNo -> EpochNo
- :: EpochNo -> EpochNo -> EpochNo
$c- :: EpochNo -> EpochNo -> EpochNo
+ :: EpochNo -> EpochNo -> EpochNo
$c+ :: EpochNo -> EpochNo -> EpochNo
Num, Decoder s EpochNo
Decoder s [EpochNo]
[EpochNo] -> Encoding
EpochNo -> Encoding
(EpochNo -> Encoding)
-> (forall s. Decoder s EpochNo)
-> ([EpochNo] -> Encoding)
-> (forall s. Decoder s [EpochNo])
-> Serialise EpochNo
forall s. Decoder s [EpochNo]
forall s. Decoder s EpochNo
forall a.
(a -> Encoding)
-> (forall s. Decoder s a)
-> ([a] -> Encoding)
-> (forall s. Decoder s [a])
-> Serialise a
decodeList :: Decoder s [EpochNo]
$cdecodeList :: forall s. Decoder s [EpochNo]
encodeList :: [EpochNo] -> Encoding
$cencodeList :: [EpochNo] -> Encoding
decode :: Decoder s EpochNo
$cdecode :: forall s. Decoder s EpochNo
encode :: EpochNo -> Encoding
$cencode :: EpochNo -> Encoding
Serialise, Typeable EpochNo
Typeable EpochNo
-> (EpochNo -> Encoding)
-> ((forall t. ToCBOR t => Proxy t -> Size)
    -> Proxy EpochNo -> Size)
-> ((forall t. ToCBOR t => Proxy t -> Size)
    -> Proxy [EpochNo] -> Size)
-> ToCBOR EpochNo
EpochNo -> Encoding
(forall t. ToCBOR t => Proxy t -> Size) -> Proxy [EpochNo] -> Size
(forall t. ToCBOR t => Proxy t -> Size) -> Proxy EpochNo -> 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 [EpochNo] -> Size
$cencodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [EpochNo] -> Size
encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy EpochNo -> Size
$cencodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy EpochNo -> Size
toCBOR :: EpochNo -> Encoding
$ctoCBOR :: EpochNo -> Encoding
$cp1ToCBOR :: Typeable EpochNo
ToCBOR, Typeable EpochNo
Decoder s EpochNo
Typeable EpochNo
-> (forall s. Decoder s EpochNo)
-> (Proxy EpochNo -> Text)
-> FromCBOR EpochNo
Proxy EpochNo -> Text
forall s. Decoder s EpochNo
forall a.
Typeable a
-> (forall s. Decoder s a) -> (Proxy a -> Text) -> FromCBOR a
label :: Proxy EpochNo -> Text
$clabel :: Proxy EpochNo -> Text
fromCBOR :: Decoder s EpochNo
$cfromCBOR :: forall s. Decoder s EpochNo
$cp1FromCBOR :: Typeable EpochNo
FromCBOR, Context -> EpochNo -> IO (Maybe ThunkInfo)
Proxy EpochNo -> String
(Context -> EpochNo -> IO (Maybe ThunkInfo))
-> (Context -> EpochNo -> IO (Maybe ThunkInfo))
-> (Proxy EpochNo -> String)
-> NoThunks EpochNo
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy EpochNo -> String
$cshowTypeOf :: Proxy EpochNo -> String
wNoThunks :: Context -> EpochNo -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> EpochNo -> IO (Maybe ThunkInfo)
noThunks :: Context -> EpochNo -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> EpochNo -> IO (Maybe ThunkInfo)
NoThunks, [EpochNo] -> Encoding
[EpochNo] -> Value
EpochNo -> Encoding
EpochNo -> Value
(EpochNo -> Value)
-> (EpochNo -> Encoding)
-> ([EpochNo] -> Value)
-> ([EpochNo] -> Encoding)
-> ToJSON EpochNo
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [EpochNo] -> Encoding
$ctoEncodingList :: [EpochNo] -> Encoding
toJSONList :: [EpochNo] -> Value
$ctoJSONList :: [EpochNo] -> Value
toEncoding :: EpochNo -> Encoding
$ctoEncoding :: EpochNo -> Encoding
toJSON :: EpochNo -> Value
$ctoJSON :: EpochNo -> Value
ToJSON, Value -> Parser [EpochNo]
Value -> Parser EpochNo
(Value -> Parser EpochNo)
-> (Value -> Parser [EpochNo]) -> FromJSON EpochNo
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [EpochNo]
$cparseJSONList :: Value -> Parser [EpochNo]
parseJSON :: Value -> Parser EpochNo
$cparseJSON :: Value -> Parser EpochNo
FromJSON, EpochNo -> ()
(EpochNo -> ()) -> NFData EpochNo
forall a. (a -> ()) -> NFData a
rnf :: EpochNo -> ()
$crnf :: EpochNo -> ()
NFData)

newtype EpochSize = EpochSize {EpochSize -> Word64
unEpochSize :: Word64}
  deriving stock (EpochSize -> EpochSize -> Bool
(EpochSize -> EpochSize -> Bool)
-> (EpochSize -> EpochSize -> Bool) -> Eq EpochSize
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EpochSize -> EpochSize -> Bool
$c/= :: EpochSize -> EpochSize -> Bool
== :: EpochSize -> EpochSize -> Bool
$c== :: EpochSize -> EpochSize -> Bool
Eq, Eq EpochSize
Eq EpochSize
-> (EpochSize -> EpochSize -> Ordering)
-> (EpochSize -> EpochSize -> Bool)
-> (EpochSize -> EpochSize -> Bool)
-> (EpochSize -> EpochSize -> Bool)
-> (EpochSize -> EpochSize -> Bool)
-> (EpochSize -> EpochSize -> EpochSize)
-> (EpochSize -> EpochSize -> EpochSize)
-> Ord EpochSize
EpochSize -> EpochSize -> Bool
EpochSize -> EpochSize -> Ordering
EpochSize -> EpochSize -> EpochSize
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 :: EpochSize -> EpochSize -> EpochSize
$cmin :: EpochSize -> EpochSize -> EpochSize
max :: EpochSize -> EpochSize -> EpochSize
$cmax :: EpochSize -> EpochSize -> EpochSize
>= :: EpochSize -> EpochSize -> Bool
$c>= :: EpochSize -> EpochSize -> Bool
> :: EpochSize -> EpochSize -> Bool
$c> :: EpochSize -> EpochSize -> Bool
<= :: EpochSize -> EpochSize -> Bool
$c<= :: EpochSize -> EpochSize -> Bool
< :: EpochSize -> EpochSize -> Bool
$c< :: EpochSize -> EpochSize -> Bool
compare :: EpochSize -> EpochSize -> Ordering
$ccompare :: EpochSize -> EpochSize -> Ordering
$cp1Ord :: Eq EpochSize
Ord, (forall x. EpochSize -> Rep EpochSize x)
-> (forall x. Rep EpochSize x -> EpochSize) -> Generic EpochSize
forall x. Rep EpochSize x -> EpochSize
forall x. EpochSize -> Rep EpochSize x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EpochSize x -> EpochSize
$cfrom :: forall x. EpochSize -> Rep EpochSize x
Generic)
  deriving Int -> EpochSize -> ShowS
[EpochSize] -> ShowS
EpochSize -> String
(Int -> EpochSize -> ShowS)
-> (EpochSize -> String)
-> ([EpochSize] -> ShowS)
-> Show EpochSize
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EpochSize] -> ShowS
$cshowList :: [EpochSize] -> ShowS
show :: EpochSize -> String
$cshow :: EpochSize -> String
showsPrec :: Int -> EpochSize -> ShowS
$cshowsPrec :: Int -> EpochSize -> ShowS
Show via Quiet EpochSize
  deriving newtype (Int -> EpochSize
EpochSize -> Int
EpochSize -> [EpochSize]
EpochSize -> EpochSize
EpochSize -> EpochSize -> [EpochSize]
EpochSize -> EpochSize -> EpochSize -> [EpochSize]
(EpochSize -> EpochSize)
-> (EpochSize -> EpochSize)
-> (Int -> EpochSize)
-> (EpochSize -> Int)
-> (EpochSize -> [EpochSize])
-> (EpochSize -> EpochSize -> [EpochSize])
-> (EpochSize -> EpochSize -> [EpochSize])
-> (EpochSize -> EpochSize -> EpochSize -> [EpochSize])
-> Enum EpochSize
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: EpochSize -> EpochSize -> EpochSize -> [EpochSize]
$cenumFromThenTo :: EpochSize -> EpochSize -> EpochSize -> [EpochSize]
enumFromTo :: EpochSize -> EpochSize -> [EpochSize]
$cenumFromTo :: EpochSize -> EpochSize -> [EpochSize]
enumFromThen :: EpochSize -> EpochSize -> [EpochSize]
$cenumFromThen :: EpochSize -> EpochSize -> [EpochSize]
enumFrom :: EpochSize -> [EpochSize]
$cenumFrom :: EpochSize -> [EpochSize]
fromEnum :: EpochSize -> Int
$cfromEnum :: EpochSize -> Int
toEnum :: Int -> EpochSize
$ctoEnum :: Int -> EpochSize
pred :: EpochSize -> EpochSize
$cpred :: EpochSize -> EpochSize
succ :: EpochSize -> EpochSize
$csucc :: EpochSize -> EpochSize
Enum, Integer -> EpochSize
EpochSize -> EpochSize
EpochSize -> EpochSize -> EpochSize
(EpochSize -> EpochSize -> EpochSize)
-> (EpochSize -> EpochSize -> EpochSize)
-> (EpochSize -> EpochSize -> EpochSize)
-> (EpochSize -> EpochSize)
-> (EpochSize -> EpochSize)
-> (EpochSize -> EpochSize)
-> (Integer -> EpochSize)
-> Num EpochSize
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> EpochSize
$cfromInteger :: Integer -> EpochSize
signum :: EpochSize -> EpochSize
$csignum :: EpochSize -> EpochSize
abs :: EpochSize -> EpochSize
$cabs :: EpochSize -> EpochSize
negate :: EpochSize -> EpochSize
$cnegate :: EpochSize -> EpochSize
* :: EpochSize -> EpochSize -> EpochSize
$c* :: EpochSize -> EpochSize -> EpochSize
- :: EpochSize -> EpochSize -> EpochSize
$c- :: EpochSize -> EpochSize -> EpochSize
+ :: EpochSize -> EpochSize -> EpochSize
$c+ :: EpochSize -> EpochSize -> EpochSize
Num, Num EpochSize
Ord EpochSize
Num EpochSize
-> Ord EpochSize -> (EpochSize -> Rational) -> Real EpochSize
EpochSize -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
toRational :: EpochSize -> Rational
$ctoRational :: EpochSize -> Rational
$cp2Real :: Ord EpochSize
$cp1Real :: Num EpochSize
Real, Enum EpochSize
Real EpochSize
Real EpochSize
-> Enum EpochSize
-> (EpochSize -> EpochSize -> EpochSize)
-> (EpochSize -> EpochSize -> EpochSize)
-> (EpochSize -> EpochSize -> EpochSize)
-> (EpochSize -> EpochSize -> EpochSize)
-> (EpochSize -> EpochSize -> (EpochSize, EpochSize))
-> (EpochSize -> EpochSize -> (EpochSize, EpochSize))
-> (EpochSize -> Integer)
-> Integral EpochSize
EpochSize -> Integer
EpochSize -> EpochSize -> (EpochSize, EpochSize)
EpochSize -> EpochSize -> EpochSize
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
toInteger :: EpochSize -> Integer
$ctoInteger :: EpochSize -> Integer
divMod :: EpochSize -> EpochSize -> (EpochSize, EpochSize)
$cdivMod :: EpochSize -> EpochSize -> (EpochSize, EpochSize)
quotRem :: EpochSize -> EpochSize -> (EpochSize, EpochSize)
$cquotRem :: EpochSize -> EpochSize -> (EpochSize, EpochSize)
mod :: EpochSize -> EpochSize -> EpochSize
$cmod :: EpochSize -> EpochSize -> EpochSize
div :: EpochSize -> EpochSize -> EpochSize
$cdiv :: EpochSize -> EpochSize -> EpochSize
rem :: EpochSize -> EpochSize -> EpochSize
$crem :: EpochSize -> EpochSize -> EpochSize
quot :: EpochSize -> EpochSize -> EpochSize
$cquot :: EpochSize -> EpochSize -> EpochSize
$cp2Integral :: Enum EpochSize
$cp1Integral :: Real EpochSize
Integral, Typeable EpochSize
Typeable EpochSize
-> (EpochSize -> Encoding)
-> ((forall t. ToCBOR t => Proxy t -> Size)
    -> Proxy EpochSize -> Size)
-> ((forall t. ToCBOR t => Proxy t -> Size)
    -> Proxy [EpochSize] -> Size)
-> ToCBOR EpochSize
EpochSize -> Encoding
(forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [EpochSize] -> Size
(forall t. ToCBOR t => Proxy t -> Size) -> Proxy EpochSize -> 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 [EpochSize] -> Size
$cencodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size)
-> Proxy [EpochSize] -> Size
encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy EpochSize -> Size
$cencodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy EpochSize -> Size
toCBOR :: EpochSize -> Encoding
$ctoCBOR :: EpochSize -> Encoding
$cp1ToCBOR :: Typeable EpochSize
ToCBOR, Typeable EpochSize
Decoder s EpochSize
Typeable EpochSize
-> (forall s. Decoder s EpochSize)
-> (Proxy EpochSize -> Text)
-> FromCBOR EpochSize
Proxy EpochSize -> Text
forall s. Decoder s EpochSize
forall a.
Typeable a
-> (forall s. Decoder s a) -> (Proxy a -> Text) -> FromCBOR a
label :: Proxy EpochSize -> Text
$clabel :: Proxy EpochSize -> Text
fromCBOR :: Decoder s EpochSize
$cfromCBOR :: forall s. Decoder s EpochSize
$cp1FromCBOR :: Typeable EpochSize
FromCBOR, Context -> EpochSize -> IO (Maybe ThunkInfo)
Proxy EpochSize -> String
(Context -> EpochSize -> IO (Maybe ThunkInfo))
-> (Context -> EpochSize -> IO (Maybe ThunkInfo))
-> (Proxy EpochSize -> String)
-> NoThunks EpochSize
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy EpochSize -> String
$cshowTypeOf :: Proxy EpochSize -> String
wNoThunks :: Context -> EpochSize -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> EpochSize -> IO (Maybe ThunkInfo)
noThunks :: Context -> EpochSize -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> EpochSize -> IO (Maybe ThunkInfo)
NoThunks, [EpochSize] -> Encoding
[EpochSize] -> Value
EpochSize -> Encoding
EpochSize -> Value
(EpochSize -> Value)
-> (EpochSize -> Encoding)
-> ([EpochSize] -> Value)
-> ([EpochSize] -> Encoding)
-> ToJSON EpochSize
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [EpochSize] -> Encoding
$ctoEncodingList :: [EpochSize] -> Encoding
toJSONList :: [EpochSize] -> Value
$ctoJSONList :: [EpochSize] -> Value
toEncoding :: EpochSize -> Encoding
$ctoEncoding :: EpochSize -> Encoding
toJSON :: EpochSize -> Value
$ctoJSON :: EpochSize -> Value
ToJSON, Value -> Parser [EpochSize]
Value -> Parser EpochSize
(Value -> Parser EpochSize)
-> (Value -> Parser [EpochSize]) -> FromJSON EpochSize
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [EpochSize]
$cparseJSONList :: Value -> Parser [EpochSize]
parseJSON :: Value -> Parser EpochSize
$cparseJSON :: Value -> Parser EpochSize
FromJSON, EpochSize -> ()
(EpochSize -> ()) -> NFData EpochSize
forall a. (a -> ()) -> NFData a
rnf :: EpochSize -> ()
$crnf :: EpochSize -> ()
NFData)