| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bcc.Api.Eras
Description
Bcc eras, sometimes we have to distinguish them.
Synopsis
- data ColeEra
- data SophieEra
- data EvieEra
- data JenEra
- data AurumEra
- data BccEra era where
- class HasTypeProxy era ⇒ IsBccEra era where
- data AnyBccEra where
- anyBccEra ∷ BccEra era → AnyBccEra
- data InAnyBccEra thing where
- InAnyBccEra ∷ IsBccEra era ⇒ BccEra era → thing era → InAnyBccEra thing
- type Cole = ColeEra
- type Sophie = SophieEra
- type Evie = EvieEra
- type Jen = JenEra
- data SophieBasedEra era where
- class IsBccEra era ⇒ IsSophieBasedEra era where
- sophieBasedEra ∷ SophieBasedEra era
- data InAnySophieBasedEra thing where
- InAnySophieBasedEra ∷ IsSophieBasedEra era ⇒ SophieBasedEra era → thing era → InAnySophieBasedEra thing
- sophieBasedToBccEra ∷ SophieBasedEra era → BccEra era
- type family SophieLedgerEra era where ...
- data BccEraStyle era where
- LegacyColeEra ∷ BccEraStyle ColeEra
- SophieBasedEra ∷ IsSophieBasedEra era ⇒ SophieBasedEra era → BccEraStyle era
- bccEraStyle ∷ BccEra era → BccEraStyle era
- data family AsType t
Eras
A type used as a tag to distinguish the Cole era.
A type used as a tag to distinguish the Sophie era.
Instances
| HasTypeProxy SophieEra Source # | |
| IsSophieBasedEra SophieEra Source # | |
Defined in Bcc.Api.Eras Methods | |
| IsBccEra SophieEra Source # | |
| data AsType SophieEra Source # | |
Defined in Bcc.Api.Eras | |
A type used as a tag to distinguish the Evie era.
Instances
| HasTypeProxy EvieEra Source # | |
| IsSophieBasedEra EvieEra Source # | |
Defined in Bcc.Api.Eras Methods | |
| IsBccEra EvieEra Source # | |
| data AsType EvieEra Source # | |
Defined in Bcc.Api.Eras | |
A type used as a tag to distinguish the Jen era.
Instances
| HasTypeProxy JenEra Source # | |
| IsSophieBasedEra JenEra Source # | |
Defined in Bcc.Api.Eras Methods | |
| IsBccEra JenEra Source # | |
| data AsType JenEra Source # | |
Defined in Bcc.Api.Eras | |
A type used as a tag to distinguish the Aurum era.
Instances
| HasTypeProxy AurumEra Source # | |
| IsSophieBasedEra AurumEra Source # | |
Defined in Bcc.Api.Eras Methods | |
| IsBccEra AurumEra Source # | |
| data AsType AurumEra Source # | |
Defined in Bcc.Api.Eras | |
data BccEra era where Source #
This GADT provides a value-level representation of all the Bcc 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 IsBccEra 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
| ColeEra ∷ BccEra ColeEra | |
| SophieEra ∷ BccEra SophieEra | |
| EvieEra ∷ BccEra EvieEra | |
| JenEra ∷ BccEra JenEra | |
| AurumEra ∷ BccEra AurumEra |
Instances
| Eq (BccEra era) Source # | |
| Ord (BccEra era) Source # | |
Defined in Bcc.Api.Eras | |
| Show (BccEra era) Source # | |
| ToJSON (BccEra era) Source # | |
Defined in Bcc.Api.Eras Methods toEncoding ∷ BccEra era → Encoding # toJSONList ∷ [BccEra era] → Value # toEncodingList ∷ [BccEra era] → Encoding # | |
| TestEquality BccEra Source # | |
Defined in Bcc.Api.Eras | |
class HasTypeProxy era ⇒ IsBccEra era where Source #
The class of Bcc eras. This allows uniform handling of all Bcc
eras, but also non-uniform by making case distinctions on the BccEra
constructors, or the BccEraStyle constructors via bccEraStyle.
data InAnyBccEra thing where Source #
This pairs up some era-dependent type with a BccEra 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
| InAnyBccEra ∷ IsBccEra era ⇒ BccEra era → thing era → InAnyBccEra thing |
Deprecated aliases
Sophie-based eras
data SophieBasedEra era where Source #
While the Cole and Sophie eras are quite different, there are several eras that are based on Sophie with only minor differences. It is useful to be able to treat the Sophie-based eras in a mostly-uniform way.
Values of this type witness the fact that the era is Sophie-based. This can be used to constrain the era to being a Sophie-based on. It allows non-uniform handling making case distinctions on the constructor.
Constructors
| SophieBasedEraSophie ∷ SophieBasedEra SophieEra | |
| SophieBasedEraEvie ∷ SophieBasedEra EvieEra | |
| SophieBasedEraJen ∷ SophieBasedEra JenEra | |
| SophieBasedEraAurum ∷ SophieBasedEra AurumEra |
Instances
| Eq (SophieBasedEra era) Source # | |
Defined in Bcc.Api.Eras Methods (==) ∷ SophieBasedEra era → SophieBasedEra era → Bool Source # (/=) ∷ SophieBasedEra era → SophieBasedEra era → Bool Source # | |
| Ord (SophieBasedEra era) Source # | |
Defined in Bcc.Api.Eras Methods compare ∷ SophieBasedEra era → SophieBasedEra era → Ordering Source # (<) ∷ SophieBasedEra era → SophieBasedEra era → Bool Source # (<=) ∷ SophieBasedEra era → SophieBasedEra era → Bool Source # (>) ∷ SophieBasedEra era → SophieBasedEra era → Bool Source # (>=) ∷ SophieBasedEra era → SophieBasedEra era → Bool Source # max ∷ SophieBasedEra era → SophieBasedEra era → SophieBasedEra era Source # min ∷ SophieBasedEra era → SophieBasedEra era → SophieBasedEra era Source # | |
| Show (SophieBasedEra era) Source # | |
Defined in Bcc.Api.Eras | |
class IsBccEra era ⇒ IsSophieBasedEra era where Source #
The class of eras that are based on Sophie. This allows uniform handling
of Sophie-based eras, but also non-uniform by making case distinctions on
the SophieBasedEra constructors.
Methods
sophieBasedEra ∷ SophieBasedEra era Source #
Instances
| IsSophieBasedEra AurumEra Source # | |
Defined in Bcc.Api.Eras Methods | |
| IsSophieBasedEra JenEra Source # | |
Defined in Bcc.Api.Eras Methods | |
| IsSophieBasedEra EvieEra Source # | |
Defined in Bcc.Api.Eras Methods | |
| IsSophieBasedEra SophieEra Source # | |
Defined in Bcc.Api.Eras Methods | |
data InAnySophieBasedEra thing where Source #
This pairs up some era-dependent type with a SophieBasedEra 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
| InAnySophieBasedEra ∷ IsSophieBasedEra era ⇒ SophieBasedEra era → thing era → InAnySophieBasedEra thing |
sophieBasedToBccEra ∷ SophieBasedEra era → BccEra era Source #
Converts a SophieBasedEra to the broader BccEra.
Mapping to era types from the Sophie ledger library
type family SophieLedgerEra era where ... Source #
A type family that connects our era type tags to equivalent type tags used in the Sophie ledger library.
This type mapping connect types from this API with types in the Sophie ledger library which allows writing conversion functions in a more generic way.
Equations
| SophieLedgerEra SophieEra = StandardSophie | |
| SophieLedgerEra EvieEra = StandardEvie | |
| SophieLedgerEra JenEra = StandardJen | |
| SophieLedgerEra AurumEra = StandardAurum |
Bcc eras, as Cole vs Sophie-based
data BccEraStyle era where Source #
This is the same essential information as BccEra but instead of a
flat set of alternative eras, it is factored into the legcy Cole era and
the current Sophie-based eras.
This way of factoring the eras is useful because in many cases the major differences are between the Cole and Sophie-based eras, and the Sophie-based eras can often be treated uniformly.
Constructors
| LegacyColeEra ∷ BccEraStyle ColeEra | |
| SophieBasedEra ∷ IsSophieBasedEra era ⇒ SophieBasedEra era → BccEraStyle era |
Instances
| Eq (BccEraStyle era) Source # | |
Defined in Bcc.Api.Eras Methods (==) ∷ BccEraStyle era → BccEraStyle era → Bool Source # (/=) ∷ BccEraStyle era → BccEraStyle era → Bool Source # | |
| Ord (BccEraStyle era) Source # | |
Defined in Bcc.Api.Eras Methods compare ∷ BccEraStyle era → BccEraStyle era → Ordering Source # (<) ∷ BccEraStyle era → BccEraStyle era → Bool Source # (<=) ∷ BccEraStyle era → BccEraStyle era → Bool Source # (>) ∷ BccEraStyle era → BccEraStyle era → Bool Source # (>=) ∷ BccEraStyle era → BccEraStyle era → Bool Source # max ∷ BccEraStyle era → BccEraStyle era → BccEraStyle era Source # min ∷ BccEraStyle era → BccEraStyle era → BccEraStyle era Source # | |
| Show (BccEraStyle era) Source # | |
Defined in Bcc.Api.Eras | |
bccEraStyle ∷ BccEra era → BccEraStyle era Source #
The BccEraStyle for a BccEra.
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.