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 PreviousEra era = (r ∷ Type) | r → era
- type ProtVerLow era ∷ Nat
- type ProtVerHigh era ∷ Nat
- eraName ∷ Era era ⇒ String
- data ByronEra c
- type Shelley = ShelleyEra StandardCrypto
- data ShelleyEra c
- type Allegra = AllegraEra StandardCrypto
- data AllegraEra c
- type Mary = MaryEra StandardCrypto
- data MaryEra era
- type Alonzo = AlonzoEra StandardCrypto
- data AlonzoEra c
- type Babbage = BabbageEra StandardCrypto
- data BabbageEra c
- type Conway = ConwayEra StandardCrypto
- data ConwayEra c
- type LatestKnownEra c = ConwayEra c
- data StandardCrypto
- class (HashAlgorithm (HASH c), HashAlgorithm (ADDRHASH c), DSIGNAlgorithm (DSIGN c), KESAlgorithm (KES c), VRFAlgorithm (VRF c), ContextDSIGN (DSIGN c) ~ (), ContextKES (KES c) ~ (), ContextVRF (VRF c) ~ (), Typeable c) ⇒ Crypto c where
- eraProtVerHigh ∷ Era era ⇒ Version
- eraProtVerLow ∷ Era era ⇒ Version
- type AtLeastEra (eraName ∷ Type → Type) era = ProtVerAtLeast era (ProtVerLow (eraName (EraCrypto era)))
- type AtMostEra (eraName ∷ Type → Type) era = ProtVerAtMost era (ProtVerHigh (eraName (EraCrypto era)))
- type ExactEra (inEra ∷ Type → Type) era = ProtVerInBounds era (ProtVerLow (inEra (EraCrypto era))) (ProtVerHigh (inEra (EraCrypto era)))
- type family ProtVerAtLeast era (l ∷ Nat) where ...
- type family ProtVerAtMost era (h ∷ Nat) where ...
- type ProtVerInBounds era (l ∷ Nat) (h ∷ Nat) = (ProtVerAtLeast era l, ProtVerAtMost era h)
- atLeastEra ∷ ∀ (eraName ∷ Type → Type) era. AtLeastEra eraName era ⇒ ()
- atMostEra ∷ ∀ (eraName ∷ Type → Type) era. AtMostEra eraName era ⇒ ()
Eras
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 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
Instances
Crypto c ⇒ Era (AllegraEra c) | |
Defined in Cardano.Ledger.Allegra.Era type EraCrypto (AllegraEra c) Source # type PreviousEra (AllegraEra c) = (r ∷ Type) Source # type ProtVerLow (AllegraEra c) ∷ Nat Source # type ProtVerHigh (AllegraEra c) ∷ Nat Source # | |
Crypto c ⇒ Era (AlonzoEra c) | |
Crypto c ⇒ Era (BabbageEra c) | |
Defined in Cardano.Ledger.Babbage.Era type EraCrypto (BabbageEra c) Source # type PreviousEra (BabbageEra c) = (r ∷ Type) Source # type ProtVerLow (BabbageEra c) ∷ Nat Source # type ProtVerHigh (BabbageEra c) ∷ Nat Source # | |
Crypto c ⇒ Era (ConwayEra c) | |
Crypto c ⇒ Era (ByronEra c) | |
Crypto c ⇒ Era (MaryEra c) | |
Crypto c ⇒ Era (ShelleyEra c) | |
Defined in Cardano.Ledger.Shelley.Era type EraCrypto (ShelleyEra c) Source # type PreviousEra (ShelleyEra c) = (r ∷ Type) Source # type ProtVerLow (ShelleyEra c) ∷ Nat Source # type ProtVerHigh (ShelleyEra c) ∷ Nat Source # |
eraName ∷ Era era ⇒ String Source #
Textual name of the current era.
Designed to be used with TypeApplications
:
>>>
eraName @(ByronEra StandardCrypto)
Byron
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) | |
type EraCrypto (ByronEra c) | |
Defined in Cardano.Ledger.Core.Era | |
type PreviousEra (ByronEra c) | |
Defined in Cardano.Ledger.Core.Era | |
type ProtVerHigh (ByronEra c) | |
Defined in Cardano.Ledger.Core.Era | |
type ProtVerLow (ByronEra c) | |
Defined in Cardano.Ledger.Core.Era |
Shelley
type Shelley = ShelleyEra StandardCrypto Source #
data ShelleyEra c Source #
Instances
Allegra
type Allegra = AllegraEra StandardCrypto Source #
data AllegraEra c Source #
The Allegra era
Instances
Mary
type Mary = MaryEra StandardCrypto Source #
Instances
Alonzo
type Alonzo = AlonzoEra StandardCrypto Source #
The Alonzo era
Instances
Babbage
type Babbage = BabbageEra StandardCrypto Source #
data BabbageEra c Source #
The Babbage era
Instances
Conway
type Conway = ConwayEra StandardCrypto Source #
The Conway era
Instances
Latest Known
type LatestKnownEra c = ConwayEra c Source #
Sometimes it is useful to specify that a type corresponds to a latest era that is currently implemented
Crypto
data StandardCrypto Source #
The same crypto used on the net
Instances
Crypto StandardCrypto | |
Defined in Cardano.Ledger.Crypto type HASH StandardCrypto Source # type ADDRHASH StandardCrypto Source # type DSIGN StandardCrypto Source # type KES StandardCrypto Source # type VRF StandardCrypto Source # | |
type ADDRHASH StandardCrypto | |
Defined in Cardano.Ledger.Crypto | |
type DSIGN StandardCrypto | |
Defined in Cardano.Ledger.Crypto | |
type HASH StandardCrypto | |
Defined in Cardano.Ledger.Crypto | |
type KES StandardCrypto | |
Defined in Cardano.Ledger.Crypto | |
type VRF StandardCrypto | |
Defined in Cardano.Ledger.Crypto |
class (HashAlgorithm (HASH c), HashAlgorithm (ADDRHASH c), DSIGNAlgorithm (DSIGN c), KESAlgorithm (KES c), VRFAlgorithm (VRF c), ContextDSIGN (DSIGN c) ~ (), ContextKES (KES c) ~ (), ContextVRF (VRF c) ~ (), Typeable c) ⇒ Crypto c Source #
Instances
Crypto StandardCrypto | |
Defined in Cardano.Ledger.Crypto type HASH StandardCrypto Source # type ADDRHASH StandardCrypto Source # type DSIGN StandardCrypto Source # type KES StandardCrypto Source # type VRF StandardCrypto Source # |
Protocol version
Value level
eraProtVerHigh ∷ Era era ⇒ Version Source #
Get the value level Version
of the highest major protocol version for the supplied era
.
eraProtVerLow ∷ Era era ⇒ Version Source #
Get the value level Version
of the lowest major protocol version for the supplied era
.
Type level constraints
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 AtMostEra (eraName ∷ Type → Type) era = ProtVerAtMost era (ProtVerHigh (eraName (EraCrypto era))) Source #
Restrict the era
to equal to eraName
or come before 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 ProtVerAtLeast era (l ∷ Nat) 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 family ProtVerAtMost era (h ∷ Nat) 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 ProtVerInBounds era (l ∷ Nat) (h ∷ Nat) = (ProtVerAtLeast era l, ProtVerAtMost era h) Source #
Restrict a lower and upper bounds of the protocol version for the particular era
atLeastEra ∷ ∀ (eraName ∷ Type → Type) era. 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 ∷ ∀ (eraName ∷ Type → Type) era. 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)