Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class (Crypto (EraCrypto era), Typeable era, KnownNat (ProtVerLow era), KnownNat (ProtVerHigh era), ProtVerLow era <= ProtVerHigh era, MinVersion <= ProtVerLow era, MinVersion <= ProtVerHigh era, CmpNat (ProtVerLow era) MaxVersion ~ 'LT, CmpNat (ProtVerHigh era) MaxVersion ~ 'LT, ProtVerLow era <= MaxVersion, ProtVerHigh era <= MaxVersion) ⇒ Era era where
- type EraCrypto era ∷ Type
- type PreviousEra era = (r ∷ Type) | r → era
- type ProtVerLow era ∷ Nat
- type ProtVerHigh era ∷ Nat
- eraName ∷ String
- data ByronEra c
- type family EraRule (rule ∷ Symbol) era = (r ∷ Type) | r → rule
- type family EraRuleFailure (rule ∷ Symbol) era = (r ∷ Type) | r → rule era
- type family EraRuleEvent (rule ∷ Symbol) era = (r ∷ Type) | r → rule era
- data VoidEraRule (rule ∷ Symbol) era
- absurdEraRule ∷ VoidEraRule rule era → a
- class EraRuleFailure rule era ~ PredicateFailure (EraRule rule era) ⇒ InjectRuleFailure (rule ∷ Symbol) t era where
- injectFailure ∷ t era → EraRuleFailure rule era
- class EraRuleEvent rule era ~ Event (EraRule rule era) ⇒ InjectRuleEvent (rule ∷ Symbol) t era where
- injectEvent ∷ t era → EraRuleEvent rule era
- type AtMostEra (eraName ∷ Type → Type) era = ProtVerAtMost era (ProtVerHigh (eraName (EraCrypto era)))
- type AtLeastEra (eraName ∷ Type → Type) era = ProtVerAtLeast era (ProtVerLow (eraName (EraCrypto era)))
- type ExactEra (inEra ∷ Type → Type) era = ProtVerInBounds era (ProtVerLow (inEra (EraCrypto era))) (ProtVerHigh (inEra (EraCrypto era)))
- type family ProtVerAtMost era (h ∷ Nat) ∷ Constraint where ...
- type family ProtVerAtLeast era (l ∷ Nat) ∷ Constraint where ...
- type ProtVerInBounds era l h = (ProtVerAtLeast era l, ProtVerAtMost era h)
- atLeastEra ∷ AtLeastEra eraName era ⇒ ()
- atMostEra ∷ AtMostEra eraName era ⇒ ()
- notSupportedInThisEra ∷ HasCallStack ⇒ a
- notSupportedInThisEraL ∷ HasCallStack ⇒ Lens' a b
- eraProtVerLow ∷ ∀ era. Era era ⇒ Version
- eraProtVerHigh ∷ ∀ era. Era era ⇒ Version
- toEraCBOR ∷ ∀ era t. (Era era, EncCBOR t) ⇒ t → Encoding
- fromEraCBOR ∷ ∀ era t s. (Era era, DecCBOR t) ⇒ Decoder s t
- fromEraShareCBOR ∷ ∀ era t s. (Era era, DecShareCBOR t) ⇒ Decoder s t
- eraDecoder ∷ ∀ era t s. Era era ⇒ Decoder s t → Decoder s t
Era
class (Crypto (EraCrypto era), Typeable era, KnownNat (ProtVerLow era), KnownNat (ProtVerHigh era), ProtVerLow era <= ProtVerHigh era, MinVersion <= ProtVerLow era, MinVersion <= ProtVerHigh era, CmpNat (ProtVerLow era) MaxVersion ~ 'LT, CmpNat (ProtVerHigh era) MaxVersion ~ 'LT, ProtVerLow era <= MaxVersion, ProtVerHigh era <= MaxVersion) ⇒ Era era where Source #
type EraCrypto era ∷ Type Source #
type PreviousEra era = (r ∷ Type) | r → era Source #
Map an era to its predecessor.
For example:
type instance PreviousEra (AllegraEra c) = ShelleyEra c
type ProtVerLow era ∷ Nat Source #
Lowest major protocol version for this era
type ProtVerHigh era ∷ Nat Source #
Highest major protocol version for this era. By default se to ProtVerLow
type ProtVerHigh era = ProtVerLow era
Textual name of the current era.
Designed to be used with TypeApplications
:
>>>
eraName @(ByronEra StandardCrypto)
Byron
This is the era that preceded Shelley era. It cannot have any other class instances,
except for Era
type class.
Instances
Crypto c ⇒ Era (ByronEra c) Source # | |
type EraCrypto (ByronEra c) Source # | |
Defined in Cardano.Ledger.Core.Era | |
type PreviousEra (ByronEra c) Source # | |
Defined in Cardano.Ledger.Core.Era | |
type ProtVerHigh (ByronEra c) Source # | |
Defined in Cardano.Ledger.Core.Era | |
type ProtVerLow (ByronEra c) Source # | |
Defined in Cardano.Ledger.Core.Era |
Rules
type family EraRuleFailure (rule ∷ Symbol) era = (r ∷ Type) | r → rule era Source #
EraRuleFailure
type family is needed for injectivity, which STS' PredicateFailure
does not provide for us unfortunately.
Instances
type EraRuleFailure "EPOCH" era Source # | |
Defined in Cardano.Ledger.Core.Era | |
type EraRuleFailure "MIR" era Source # | |
Defined in Cardano.Ledger.Core.Era | |
type EraRuleFailure "NEWEPOCH" era Source # | |
Defined in Cardano.Ledger.Core.Era | |
type EraRuleFailure "NEWPP" era Source # | |
Defined in Cardano.Ledger.Core.Era | |
type EraRuleFailure "POOLREAP" era Source # | |
Defined in Cardano.Ledger.Core.Era | |
type EraRuleFailure "RUPD" era Source # | |
Defined in Cardano.Ledger.Core.Era | |
type EraRuleFailure "SNAP" era Source # | |
Defined in Cardano.Ledger.Core.Era | |
type EraRuleFailure "TICK" era Source # | |
Defined in Cardano.Ledger.Core.Era | |
type EraRuleFailure "TICKF" era Source # | |
Defined in Cardano.Ledger.Core.Era | |
type EraRuleFailure "UPEC" era Source # | |
Defined in Cardano.Ledger.Core.Era |
type family EraRuleEvent (rule ∷ Symbol) era = (r ∷ Type) | r → rule era Source #
data VoidEraRule (rule ∷ Symbol) era Source #
This is a type with no inhabitans for the rules. It is used to indicate that a rule does not have a predicate failure as well as marking rules that have been disabled when comparing to prior eras.
Instances
absurdEraRule ∷ VoidEraRule rule era → a Source #
class EraRuleFailure rule era ~ PredicateFailure (EraRule rule era) ⇒ InjectRuleFailure (rule ∷ Symbol) t era where Source #
Nothing
injectFailure ∷ t era → EraRuleFailure rule era Source #
default injectFailure ∷ t era ~ EraRuleFailure rule era ⇒ t era → EraRuleFailure rule era Source #
class EraRuleEvent rule era ~ Event (EraRule rule era) ⇒ InjectRuleEvent (rule ∷ Symbol) t era where Source #
Nothing
injectEvent ∷ t era → EraRuleEvent rule era Source #
default injectEvent ∷ t era ~ EraRuleEvent rule era ⇒ t era → EraRuleEvent rule era Source #
Protocol Version
type AtMostEra (eraName ∷ Type → Type) era = ProtVerAtMost era (ProtVerHigh (eraName (EraCrypto era))) Source #
Restrict the era
to equal to eraName
or come before it.
type AtLeastEra (eraName ∷ Type → Type) era = ProtVerAtLeast era (ProtVerLow (eraName (EraCrypto era))) Source #
Restrict the era
to equal to eraName
or come after it
type ExactEra (inEra ∷ Type → Type) era = ProtVerInBounds era (ProtVerLow (inEra (EraCrypto era))) (ProtVerHigh (inEra (EraCrypto era))) Source #
Restrict an era to the specific era through the protocol version. This is
equivalent to (inEra (Crypto era) ~ era)
type family ProtVerAtMost era (h ∷ Nat) ∷ Constraint where ... Source #
Requirement for the era's lowest protocol version to be lower or equal to the supplied value
ProtVerAtMost era h = ProtVerIsInBounds "at most" era h (ProtVerLow era <=? h) |
type family ProtVerAtLeast era (l ∷ Nat) ∷ Constraint where ... Source #
Requirement for the era's highest protocol version to be higher or equal to the supplied value
ProtVerAtLeast era l = ProtVerIsInBounds "at least" era l (l <=? ProtVerHigh era) |
type ProtVerInBounds era l h = (ProtVerAtLeast era l, ProtVerAtMost era h) Source #
Restrict a lower and upper bounds of the protocol version for the particular era
atLeastEra ∷ AtLeastEra eraName era ⇒ () Source #
Enforce era to be at least the specified era at the type level. In other words compiler will produce type error when applied to eras prior to the specified era. This function should be used in order to avoid redundant constraints warning.
For example these will type check
>>>
atLeastEra @BabbageEra @(ConwayEra StandardCrypto)
>>>
atLeastEra @BabbageEra @(BabbageEra StandardCrypto)
However this will result in a type error
>>>
atLeastEra @BabbageEra @(AlonzoEra StandardCrypto)
atMostEra ∷ AtMostEra eraName era ⇒ () Source #
Enforce era to be at most the specified era at the type level. In other words compiler will produce type error when applied to eras prior to the specified era. This function should be used in order to avoid redundant constraints warning.
For example these will type check
>>>
atMostEra @BabbageEra @(ShelleyEra StandardCrypto)
>>>
atMostEra @AlonzoEra @(MaryEra StandardCrypto)
However this will result in a type error
>>>
atMostEra @BabbageEra @(ConwayEra StandardCrypto)
notSupportedInThisEraL ∷ HasCallStack ⇒ Lens' a b Source #
eraProtVerLow ∷ ∀ era. Era era ⇒ Version Source #
Get the value level Version
of the lowest major protocol version for the supplied era
.
eraProtVerHigh ∷ ∀ era. Era era ⇒ Version Source #
Get the value level Version
of the highest major protocol version for the supplied era
.
fromEraShareCBOR ∷ ∀ era t s. (Era era, DecShareCBOR t) ⇒ Decoder s t Source #
Convert a type that implements DecShareCBOR
to plain Decoder
using the lowest
protocol version for the supplied era