-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #254 from input-output-hk/newhoggy/replace-OnlyAda…
…SupportedInEra-and-MultiAssetSupportedInEra-with-eons Replace only `AdaSupportedInEra` and `MultiAssetSupportedInEra` with eons
- Loading branch information
Showing
18 changed files
with
765 additions
and
419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{-# LANGUAGE ConstraintKinds #-} | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE GADTs #-} | ||
{-# LANGUAGE LambdaCase #-} | ||
{-# LANGUAGE RankNTypes #-} | ||
{-# LANGUAGE StandaloneDeriving #-} | ||
{-# LANGUAGE TypeFamilies #-} | ||
|
||
module Cardano.Api.Eon.ByronToAllegraEra | ||
( ByronToAllegraEra(..) | ||
, IsByronToAllegraEra(..) | ||
, AnyByronToAllegraEra(..) | ||
, byronToAllegraEraConstraints | ||
, byronToAllegraEraToCardanoEra | ||
|
||
, ByronToAllegraEraConstraints | ||
) where | ||
|
||
import Cardano.Api.Eras.Core | ||
|
||
import Data.Typeable (Typeable) | ||
|
||
class IsByronToAllegraEra era where | ||
byronToAllegraEra :: ByronToAllegraEra era | ||
|
||
data ByronToAllegraEra era where | ||
ByronToAllegraEraByron :: ByronToAllegraEra ByronEra | ||
ByronToAllegraEraShelley :: ByronToAllegraEra ShelleyEra | ||
ByronToAllegraEraAllegra :: ByronToAllegraEra AllegraEra | ||
|
||
deriving instance Show (ByronToAllegraEra era) | ||
deriving instance Eq (ByronToAllegraEra era) | ||
|
||
instance IsByronToAllegraEra ByronEra where | ||
byronToAllegraEra = ByronToAllegraEraByron | ||
|
||
instance IsByronToAllegraEra ShelleyEra where | ||
byronToAllegraEra = ByronToAllegraEraShelley | ||
|
||
instance IsByronToAllegraEra AllegraEra where | ||
byronToAllegraEra = ByronToAllegraEraAllegra | ||
|
||
instance Eon ByronToAllegraEra where | ||
inEonForEra no yes = \case | ||
ByronEra -> yes ByronToAllegraEraByron | ||
ShelleyEra -> yes ByronToAllegraEraShelley | ||
AllegraEra -> yes ByronToAllegraEraAllegra | ||
MaryEra -> no | ||
AlonzoEra -> no | ||
BabbageEra -> no | ||
ConwayEra -> no | ||
|
||
instance ToCardanoEra ByronToAllegraEra where | ||
toCardanoEra = \case | ||
ByronToAllegraEraByron -> ByronEra | ||
ByronToAllegraEraShelley -> ShelleyEra | ||
ByronToAllegraEraAllegra -> AllegraEra | ||
|
||
type ByronToAllegraEraConstraints era = | ||
( IsCardanoEra era | ||
, IsByronToAllegraEra era | ||
, Typeable era | ||
) | ||
|
||
data AnyByronToAllegraEra where | ||
AnyByronToAllegraEra :: ByronToAllegraEra era -> AnyByronToAllegraEra | ||
|
||
deriving instance Show AnyByronToAllegraEra | ||
|
||
byronToAllegraEraConstraints :: () | ||
=> ByronToAllegraEra era | ||
-> (ByronToAllegraEraConstraints era => a) | ||
-> a | ||
byronToAllegraEraConstraints = \case | ||
ByronToAllegraEraByron -> id | ||
ByronToAllegraEraShelley -> id | ||
ByronToAllegraEraAllegra -> id | ||
|
||
byronToAllegraEraToCardanoEra :: ByronToAllegraEra era -> CardanoEra era | ||
byronToAllegraEraToCardanoEra = \case | ||
ByronToAllegraEraByron -> ByronEra | ||
ByronToAllegraEraShelley -> ShelleyEra | ||
ByronToAllegraEraAllegra -> AllegraEra |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
{-# LANGUAGE ConstraintKinds #-} | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE GADTs #-} | ||
{-# LANGUAGE LambdaCase #-} | ||
{-# LANGUAGE RankNTypes #-} | ||
{-# LANGUAGE StandaloneDeriving #-} | ||
{-# LANGUAGE TypeFamilies #-} | ||
|
||
module Cardano.Api.Eon.ByronToAlonzoEra | ||
( ByronToAlonzoEra(..) | ||
, IsByronToAlonzoEra(..) | ||
, AnyByronToAlonzoEra(..) | ||
, byronToAlonzoEraConstraints | ||
, byronToAlonzoEraToCardanoEra | ||
|
||
, ByronToAlonzoEraConstraints | ||
) where | ||
|
||
import Cardano.Api.Eras.Core | ||
|
||
import Data.Typeable (Typeable) | ||
|
||
class IsByronToAlonzoEra era where | ||
byronToAlonzoEra :: ByronToAlonzoEra era | ||
|
||
data ByronToAlonzoEra era where | ||
ByronToAlonzoEraByron :: ByronToAlonzoEra ByronEra | ||
ByronToAlonzoEraShelley :: ByronToAlonzoEra ShelleyEra | ||
ByronToAlonzoEraAllegra :: ByronToAlonzoEra AllegraEra | ||
ByronToAlonzoEraMary :: ByronToAlonzoEra MaryEra | ||
ByronToAlonzoEraAlonzo :: ByronToAlonzoEra AlonzoEra | ||
|
||
deriving instance Show (ByronToAlonzoEra era) | ||
deriving instance Eq (ByronToAlonzoEra era) | ||
|
||
instance IsByronToAlonzoEra ByronEra where | ||
byronToAlonzoEra = ByronToAlonzoEraByron | ||
|
||
instance IsByronToAlonzoEra ShelleyEra where | ||
byronToAlonzoEra = ByronToAlonzoEraShelley | ||
|
||
instance IsByronToAlonzoEra AllegraEra where | ||
byronToAlonzoEra = ByronToAlonzoEraAllegra | ||
|
||
instance IsByronToAlonzoEra MaryEra where | ||
byronToAlonzoEra = ByronToAlonzoEraMary | ||
|
||
instance IsByronToAlonzoEra AlonzoEra where | ||
byronToAlonzoEra = ByronToAlonzoEraAlonzo | ||
|
||
instance Eon ByronToAlonzoEra where | ||
inEonForEra no yes = \case | ||
ByronEra -> yes ByronToAlonzoEraByron | ||
ShelleyEra -> yes ByronToAlonzoEraShelley | ||
AllegraEra -> yes ByronToAlonzoEraAllegra | ||
MaryEra -> yes ByronToAlonzoEraMary | ||
AlonzoEra -> yes ByronToAlonzoEraAlonzo | ||
BabbageEra -> no | ||
ConwayEra -> no | ||
|
||
instance ToCardanoEra ByronToAlonzoEra where | ||
toCardanoEra = \case | ||
ByronToAlonzoEraByron -> ByronEra | ||
ByronToAlonzoEraShelley -> ShelleyEra | ||
ByronToAlonzoEraAllegra -> AllegraEra | ||
ByronToAlonzoEraMary -> MaryEra | ||
ByronToAlonzoEraAlonzo -> AlonzoEra | ||
|
||
type ByronToAlonzoEraConstraints era = | ||
( IsCardanoEra era | ||
, IsByronToAlonzoEra era | ||
, Typeable era | ||
) | ||
|
||
data AnyByronToAlonzoEra where | ||
AnyByronToAlonzoEra :: ByronToAlonzoEra era -> AnyByronToAlonzoEra | ||
|
||
deriving instance Show AnyByronToAlonzoEra | ||
|
||
byronToAlonzoEraConstraints :: () | ||
=> ByronToAlonzoEra era | ||
-> (ByronToAlonzoEraConstraints era => a) | ||
-> a | ||
byronToAlonzoEraConstraints = \case | ||
ByronToAlonzoEraByron -> id | ||
ByronToAlonzoEraShelley -> id | ||
ByronToAlonzoEraAllegra -> id | ||
ByronToAlonzoEraMary -> id | ||
ByronToAlonzoEraAlonzo -> id | ||
|
||
byronToAlonzoEraToCardanoEra :: ByronToAlonzoEra era -> CardanoEra era | ||
byronToAlonzoEraToCardanoEra = \case | ||
ByronToAlonzoEraByron -> ByronEra | ||
ByronToAlonzoEraShelley -> ShelleyEra | ||
ByronToAlonzoEraAllegra -> AllegraEra | ||
ByronToAlonzoEraMary -> MaryEra | ||
ByronToAlonzoEraAlonzo -> AlonzoEra |
Oops, something went wrong.