Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cardano.Api.Eras.Core
Description
Cardano eras, sometimes we have to distinguish them.
Synopsis
- data ByronEra
- data ShelleyEra
- data AllegraEra
- data MaryEra
- data AlonzoEra
- data BabbageEra
- data ConwayEra
- data CardanoEra era where
- class HasTypeProxy era => IsCardanoEra era where
- cardanoEra :: CardanoEra era
- data AnyCardanoEra where
- AnyCardanoEra :: Typeable era => CardanoEra era -> AnyCardanoEra
- anyCardanoEra :: CardanoEra era -> AnyCardanoEra
- data InAnyCardanoEra thing where
- InAnyCardanoEra :: Typeable era => CardanoEra era -> thing era -> InAnyCardanoEra thing
- inAnyCardanoEra :: CardanoEra era -> thing era -> InAnyCardanoEra thing
- type family CardanoLedgerEra era = ledgerera | ledgerera -> era where ...
- class ToCardanoEra (eon :: Type -> Type) where
- toCardanoEra :: eon era -> CardanoEra era
- class Eon (eon :: Type -> Type) where
- inEonForEra :: a -> (eon era -> a) -> CardanoEra era -> a
- data EraInEon eon where
- inEonForEraMaybe :: Eon eon => (eon era -> a) -> CardanoEra era -> Maybe a
- forEraInEon :: Eon eon => CardanoEra era -> a -> (eon era -> a) -> a
- forEraInEonMaybe :: Eon eon => CardanoEra era -> (eon era -> a) -> Maybe a
- forEraMaybeEon :: Eon eon => CardanoEra era -> Maybe (eon era)
- maybeEon :: Eon eon => IsCardanoEra era => Maybe (eon era)
- monoidForEraInEon :: Eon eon => Monoid a => CardanoEra era -> (eon era -> a) -> a
- monoidForEraInEonA :: Eon eon => Applicative f => Monoid a => CardanoEra era -> (eon era -> f a) -> f a
- data family AsType t
- type CardanoEraConstraints era = (Typeable era, IsCardanoEra era)
- cardanoEraConstraints :: CardanoEra era -> (CardanoEraConstraints era => a) -> a
Eras
A type used as a tag to distinguish the Byron era.
Instances
HasTypeProxy ByronEra Source # | |
IsCardanoEra ByronEra Source # | |
Defined in Cardano.Api.Eras.Core Methods | |
data AsType ByronEra Source # | |
Defined in Cardano.Api.Eras.Core |
data ShelleyEra Source #
A type used as a tag to distinguish the Shelley era.
Instances
HasTypeProxy ShelleyEra Source # | |
Defined in Cardano.Api.Eras.Core Associated Types data AsType ShelleyEra Source # Methods proxyToAsType :: Proxy ShelleyEra -> AsType ShelleyEra Source # | |
IsCardanoEra ShelleyEra Source # | |
Defined in Cardano.Api.Eras.Core Methods | |
IsShelleyBasedEra ShelleyEra Source # | |
Defined in Cardano.Api.Eon.ShelleyBasedEra Methods | |
data AsType ShelleyEra Source # | |
Defined in Cardano.Api.Eras.Core |
data AllegraEra Source #
A type used as a tag to distinguish the Allegra era.
Instances
HasTypeProxy AllegraEra Source # | |
Defined in Cardano.Api.Eras.Core Associated Types data AsType AllegraEra Source # Methods proxyToAsType :: Proxy AllegraEra -> AsType AllegraEra Source # | |
IsCardanoEra AllegraEra Source # | |
Defined in Cardano.Api.Eras.Core Methods | |
IsShelleyBasedEra AllegraEra Source # | |
Defined in Cardano.Api.Eon.ShelleyBasedEra Methods | |
data AsType AllegraEra Source # | |
Defined in Cardano.Api.Eras.Core |
A type used as a tag to distinguish the Mary era.
Instances
HasTypeProxy MaryEra Source # | |
IsCardanoEra MaryEra Source # | |
Defined in Cardano.Api.Eras.Core Methods | |
IsShelleyBasedEra MaryEra Source # | |
Defined in Cardano.Api.Eon.ShelleyBasedEra Methods | |
data AsType MaryEra Source # | |
Defined in Cardano.Api.Eras.Core |
A type used as a tag to distinguish the Alonzo era.
Instances
HasTypeProxy AlonzoEra Source # | |
IsCardanoEra AlonzoEra Source # | |
Defined in Cardano.Api.Eras.Core Methods | |
IsShelleyBasedEra AlonzoEra Source # | |
Defined in Cardano.Api.Eon.ShelleyBasedEra Methods | |
data AsType AlonzoEra Source # | |
Defined in Cardano.Api.Eras.Core |
data BabbageEra Source #
A type used as a tag to distinguish the Babbage era.
Instances
HasTypeProxy BabbageEra Source # | |
Defined in Cardano.Api.Eras.Core Associated Types data AsType BabbageEra Source # Methods proxyToAsType :: Proxy BabbageEra -> AsType BabbageEra Source # | |
IsCardanoEra BabbageEra Source # | |
Defined in Cardano.Api.Eras.Core Methods | |
IsShelleyBasedEra BabbageEra Source # | |
Defined in Cardano.Api.Eon.ShelleyBasedEra Methods | |
data AsType BabbageEra Source # | |
Defined in Cardano.Api.Eras.Core |
A type used as a tag to distinguish the Conway era.
Instances
HasTypeProxy ConwayEra Source # | |
IsCardanoEra ConwayEra Source # | |
Defined in Cardano.Api.Eras.Core Methods | |
IsShelleyBasedEra ConwayEra Source # | |
Defined in Cardano.Api.Eon.ShelleyBasedEra Methods | |
data AsType ConwayEra Source # | |
Defined in Cardano.Api.Eras.Core |
CardanoEra
data CardanoEra era where Source #
This GADT provides a value-level representation of all the Cardano eras. This enables pattern matching on the era to allow them to be treated in a non-uniform way.
This can be used in combination with the IsCardanoEra
class to get access
to this value.
In combination this can often enable code that handles all eras, and does so uniformly where possible, and non-uniformly where necessary.
Constructors
Instances
class HasTypeProxy era => IsCardanoEra era where Source #
The class of Cardano eras. This allows uniform handling of all Cardano
eras, but also non-uniform by making case distinctions on the CardanoEra
constructors, or the CardanoEraStyle
constructors via cardanoEraStyle
.
Methods
cardanoEra :: CardanoEra era Source #
Instances
IsCardanoEra ConwayEra Source # | |
Defined in Cardano.Api.Eras.Core Methods | |
IsCardanoEra BabbageEra Source # | |
Defined in Cardano.Api.Eras.Core Methods | |
IsCardanoEra AlonzoEra Source # | |
Defined in Cardano.Api.Eras.Core Methods | |
IsCardanoEra MaryEra Source # | |
Defined in Cardano.Api.Eras.Core Methods | |
IsCardanoEra AllegraEra Source # | |
Defined in Cardano.Api.Eras.Core Methods | |
IsCardanoEra ShelleyEra Source # | |
Defined in Cardano.Api.Eras.Core Methods | |
IsCardanoEra ByronEra Source # | |
Defined in Cardano.Api.Eras.Core Methods |
data AnyCardanoEra where Source #
Constructors
AnyCardanoEra :: Typeable era => CardanoEra era -> AnyCardanoEra |
Instances
anyCardanoEra :: CardanoEra era -> AnyCardanoEra Source #
Like the AnyCardanoEra
constructor but does not demand a IsCardanoEra
class constraint.
data InAnyCardanoEra thing where Source #
This pairs up some era-dependent type with a CardanoEra
value that tells
us what era it is, but hides the era type. This is useful when the era is
not statically known, for example when deserialising from a file.
Constructors
InAnyCardanoEra :: Typeable era => CardanoEra era -> thing era -> InAnyCardanoEra thing |
Instances
Eq (InAnyCardanoEra Tx) Source # | |
Defined in Cardano.Api.Tx Methods (==) :: InAnyCardanoEra Tx -> InAnyCardanoEra Tx -> Bool Source # (/=) :: InAnyCardanoEra Tx -> InAnyCardanoEra Tx -> Bool Source # | |
Show (InAnyCardanoEra Tx) Source # | |
Defined in Cardano.Api.Tx |
inAnyCardanoEra :: CardanoEra era -> thing era -> InAnyCardanoEra thing Source #
type family CardanoLedgerEra era = ledgerera | ledgerera -> era where ... Source #
A type family that connects our era type tags to equivalent type tags used in the ledger library.
This type mapping connect types from this API with types in the ledger library which allows writing conversion functions in a more generic way.
Equations
CardanoLedgerEra ByronEra = ByronEra StandardCrypto | |
CardanoLedgerEra ShelleyEra = ShelleyEra StandardCrypto | |
CardanoLedgerEra AllegraEra = AllegraEra StandardCrypto | |
CardanoLedgerEra MaryEra = MaryEra StandardCrypto | |
CardanoLedgerEra AlonzoEra = AlonzoEra StandardCrypto | |
CardanoLedgerEra BabbageEra = BabbageEra StandardCrypto | |
CardanoLedgerEra ConwayEra = ConwayEra StandardCrypto |
class ToCardanoEra (eon :: Type -> Type) where Source #
Methods
toCardanoEra :: eon era -> CardanoEra era Source #
Instances
IsEon
class Eon (eon :: Type -> Type) where Source #
An Eon is a span of multiple eras. Eons are used to scope functionality to particular eras such that it isn't possible construct code that uses functionality that is outside of given eras.
Methods
Arguments
:: a | Value to use if the eon does not include the era |
-> (eon era -> a) | Function to get the value to use if the eon includes the era |
-> CardanoEra era | Era to check |
-> a | The value to use |
Determine the value to use in an eon (a span of multiple eras).
Note that the negative case is the first argument, and the positive case is the second as per
the either
function convention.
Instances
Arguments
:: Eon eon | |
=> (eon era -> a) | Function to get the value to use if the eon includes the era |
-> CardanoEra era | Era to check |
-> Maybe a | The value to use |
Arguments
:: Eon eon | |
=> CardanoEra era | Era to check |
-> a | Value to use if the eon does not include the era |
-> (eon era -> a) | Function to get the value to use if the eon includes the era |
-> a | The value to use |
Arguments
:: Eon eon | |
=> CardanoEra era | Era to check |
-> (eon era -> a) | Function to get the value to use if the eon includes the era |
-> Maybe a | The value to use |
Arguments
:: Eon eon | |
=> CardanoEra era | Era to check |
-> Maybe (eon era) | The eon if supported in the era |
Arguments
:: Eon eon | |
=> IsCardanoEra era | |
=> Maybe (eon era) | The eon if supported in the era |
monoidForEraInEon :: Eon eon => Monoid a => CardanoEra era -> (eon era -> a) -> a Source #
monoidForEraInEonA :: Eon eon => Applicative f => Monoid a => CardanoEra era -> (eon era -> f a) -> f a Source #
Data family instances
A family of singleton types used in this API to indicate which type to use where it would otherwise be ambiguous or merely unclear.
Values of this type are passed to deserialisation functions for example.
Instances
type CardanoEraConstraints era = (Typeable era, IsCardanoEra era) Source #
cardanoEraConstraints :: CardanoEra era -> (CardanoEraConstraints era => a) -> a Source #