-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Key slotting types for cardano libraries
--   
--   Key slotting types for cardano libraries
@package cardano-slotting
@version 0.1.0.0

module Cardano.Slotting.Block

-- | The 0-based index of the block in the blockchain. BlockNo is &lt;=
--   SlotNo and is only equal at slot N if there is a block for every slot
--   where N &lt;= SlotNo.
newtype BlockNo
BlockNo :: Word64 -> BlockNo
[unBlockNo] :: BlockNo -> Word64
instance NoThunks.Class.NoThunks Cardano.Slotting.Block.BlockNo
instance Codec.Serialise.Class.Serialise Cardano.Slotting.Block.BlockNo
instance GHC.Num.Num Cardano.Slotting.Block.BlockNo
instance GHC.Enum.Bounded Cardano.Slotting.Block.BlockNo
instance GHC.Enum.Enum Cardano.Slotting.Block.BlockNo
instance GHC.Show.Show Cardano.Slotting.Block.BlockNo
instance GHC.Generics.Generic Cardano.Slotting.Block.BlockNo
instance GHC.Classes.Ord Cardano.Slotting.Block.BlockNo
instance GHC.Classes.Eq Cardano.Slotting.Block.BlockNo
instance Cardano.Binary.ToCBOR.ToCBOR Cardano.Slotting.Block.BlockNo
instance Cardano.Binary.FromCBOR.FromCBOR Cardano.Slotting.Block.BlockNo

module Cardano.Slotting.Slot

-- | The 0-based index for the Ourboros time slot.
newtype SlotNo
SlotNo :: Word64 -> SlotNo
[unSlotNo] :: SlotNo -> Word64
data WithOrigin t
Origin :: WithOrigin t
At :: !t -> WithOrigin t
at :: t -> WithOrigin t
origin :: WithOrigin t
fromWithOrigin :: t -> WithOrigin t -> t
withOrigin :: b -> (t -> b) -> WithOrigin t -> b
withOriginToMaybe :: WithOrigin t -> Maybe t
withOriginFromMaybe :: Maybe t -> WithOrigin t

-- | An epoch, i.e. the number of the epoch.
newtype EpochNo
EpochNo :: Word64 -> EpochNo
[unEpochNo] :: EpochNo -> Word64
newtype EpochSize
EpochSize :: Word64 -> EpochSize
[unEpochSize] :: EpochSize -> Word64
instance Data.Aeson.Types.FromJSON.FromJSON Cardano.Slotting.Slot.SlotNo
instance Data.Aeson.Types.ToJSON.ToJSON Cardano.Slotting.Slot.SlotNo
instance NoThunks.Class.NoThunks Cardano.Slotting.Slot.SlotNo
instance Codec.Serialise.Class.Serialise Cardano.Slotting.Slot.SlotNo
instance Control.DeepSeq.NFData Cardano.Slotting.Slot.SlotNo
instance GHC.Num.Num Cardano.Slotting.Slot.SlotNo
instance GHC.Enum.Bounded Cardano.Slotting.Slot.SlotNo
instance GHC.Enum.Enum Cardano.Slotting.Slot.SlotNo
instance GHC.Show.Show Cardano.Slotting.Slot.SlotNo
instance GHC.Generics.Generic Cardano.Slotting.Slot.SlotNo
instance GHC.Classes.Ord Cardano.Slotting.Slot.SlotNo
instance GHC.Classes.Eq Cardano.Slotting.Slot.SlotNo
instance NoThunks.Class.NoThunks t => NoThunks.Class.NoThunks (Cardano.Slotting.Slot.WithOrigin t)
instance Codec.Serialise.Class.Serialise t => Codec.Serialise.Class.Serialise (Cardano.Slotting.Slot.WithOrigin t)
instance Data.Traversable.Traversable Cardano.Slotting.Slot.WithOrigin
instance Data.Foldable.Foldable Cardano.Slotting.Slot.WithOrigin
instance GHC.Base.Functor Cardano.Slotting.Slot.WithOrigin
instance GHC.Generics.Generic (Cardano.Slotting.Slot.WithOrigin t)
instance GHC.Show.Show t => GHC.Show.Show (Cardano.Slotting.Slot.WithOrigin t)
instance GHC.Classes.Ord t => GHC.Classes.Ord (Cardano.Slotting.Slot.WithOrigin t)
instance GHC.Classes.Eq t => GHC.Classes.Eq (Cardano.Slotting.Slot.WithOrigin t)
instance Data.Aeson.Types.FromJSON.FromJSON Cardano.Slotting.Slot.EpochNo
instance Data.Aeson.Types.ToJSON.ToJSON Cardano.Slotting.Slot.EpochNo
instance NoThunks.Class.NoThunks Cardano.Slotting.Slot.EpochNo
instance Cardano.Binary.FromCBOR.FromCBOR Cardano.Slotting.Slot.EpochNo
instance Cardano.Binary.ToCBOR.ToCBOR Cardano.Slotting.Slot.EpochNo
instance Codec.Serialise.Class.Serialise Cardano.Slotting.Slot.EpochNo
instance GHC.Num.Num Cardano.Slotting.Slot.EpochNo
instance GHC.Enum.Enum Cardano.Slotting.Slot.EpochNo
instance GHC.Show.Show Cardano.Slotting.Slot.EpochNo
instance GHC.Generics.Generic Cardano.Slotting.Slot.EpochNo
instance GHC.Classes.Ord Cardano.Slotting.Slot.EpochNo
instance GHC.Classes.Eq Cardano.Slotting.Slot.EpochNo
instance Data.Aeson.Types.FromJSON.FromJSON Cardano.Slotting.Slot.EpochSize
instance Data.Aeson.Types.ToJSON.ToJSON Cardano.Slotting.Slot.EpochSize
instance NoThunks.Class.NoThunks Cardano.Slotting.Slot.EpochSize
instance GHC.Real.Integral Cardano.Slotting.Slot.EpochSize
instance GHC.Real.Real Cardano.Slotting.Slot.EpochSize
instance GHC.Num.Num Cardano.Slotting.Slot.EpochSize
instance GHC.Enum.Enum Cardano.Slotting.Slot.EpochSize
instance GHC.Show.Show Cardano.Slotting.Slot.EpochSize
instance GHC.Generics.Generic Cardano.Slotting.Slot.EpochSize
instance GHC.Classes.Ord Cardano.Slotting.Slot.EpochSize
instance GHC.Classes.Eq Cardano.Slotting.Slot.EpochSize
instance (Codec.Serialise.Class.Serialise t, Data.Typeable.Internal.Typeable t) => Cardano.Binary.ToCBOR.ToCBOR (Cardano.Slotting.Slot.WithOrigin t)
instance (Codec.Serialise.Class.Serialise t, Data.Typeable.Internal.Typeable t) => Cardano.Binary.FromCBOR.FromCBOR (Cardano.Slotting.Slot.WithOrigin t)
instance GHC.Enum.Bounded t => GHC.Enum.Bounded (Cardano.Slotting.Slot.WithOrigin t)
instance Cardano.Binary.ToCBOR.ToCBOR Cardano.Slotting.Slot.SlotNo
instance Cardano.Binary.FromCBOR.FromCBOR Cardano.Slotting.Slot.SlotNo

module Cardano.Slotting.EpochInfo.API

-- | Information about epochs
--   
--   Epochs may have different sizes at different times during the lifetime
--   of the blockchain. This information is encapsulated by
--   <a>EpochInfo</a>; it is parameterized over a monad <tt>m</tt> because
--   the information about how long each epoch is may depend on information
--   derived from the blockchain itself, and hence requires access to
--   state.
--   
--   The other functions provide some derived information from epoch sizes.
--   In the default implementation all of these functions query and update
--   an internal cache maintaining cumulative epoch sizes; for that reason,
--   all of these functions live in a monad <tt>m</tt>.
data EpochInfo m
EpochInfo :: (HasCallStack => EpochNo -> m EpochSize) -> (HasCallStack => EpochNo -> m SlotNo) -> (HasCallStack => SlotNo -> m EpochNo) -> EpochInfo m

-- | Return the size of the given epoch as a number of slots
--   
--   Note that the number of slots does <i>not</i> bound the number of
--   blocks, since the EBB and a regular block share a slot number.
[epochInfoSize_] :: EpochInfo m -> HasCallStack => EpochNo -> m EpochSize

-- | First slot in the specified epoch
--   
--   See also <a>epochInfoRange</a>
[epochInfoFirst_] :: EpochInfo m -> HasCallStack => EpochNo -> m SlotNo

-- | Epoch containing the given slot
--   
--   We should have the property that
--   
--   <pre>
--   s `inRange` epochInfoRange (epochInfoEpoch s)
--   </pre>
[epochInfoEpoch_] :: EpochInfo m -> HasCallStack => SlotNo -> m EpochNo
epochInfoSize :: HasCallStack => EpochInfo m -> EpochNo -> m EpochSize
epochInfoFirst :: HasCallStack => EpochInfo m -> EpochNo -> m SlotNo
epochInfoEpoch :: HasCallStack => EpochInfo m -> SlotNo -> m EpochNo
epochInfoRange :: Monad m => EpochInfo m -> EpochNo -> m (SlotNo, SlotNo)
hoistEpochInfo :: (forall a. m a -> n a) -> EpochInfo m -> EpochInfo n
generalizeEpochInfo :: Monad m => EpochInfo Identity -> EpochInfo m
instance NoThunks.Class.NoThunks (Cardano.Slotting.EpochInfo.API.EpochInfo m)
instance GHC.Show.Show (Cardano.Slotting.EpochInfo.API.EpochInfo Data.Functor.Identity.Identity)

module Cardano.Slotting.EpochInfo.Impl
fixedSizeEpochInfo :: Monad m => EpochSize -> EpochInfo m

module Cardano.Slotting.EpochInfo
