From 4659f9f529db9798d06bb3c771443dd52f160450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Go=C5=9Blinowski?= Date: Fri, 20 Sep 2024 23:51:31 +0200 Subject: [PATCH] Introduce superclasses for IsXXXBasedEra classes --- cardano-api/internal/Cardano/Api/Eon/AllegraEraOnwards.hs | 2 +- cardano-api/internal/Cardano/Api/Eon/AlonzoEraOnwards.hs | 3 ++- cardano-api/internal/Cardano/Api/Eon/BabbageEraOnwards.hs | 3 ++- cardano-api/internal/Cardano/Api/Eon/ConwayEraOnwards.hs | 2 +- cardano-api/internal/Cardano/Api/Eon/MaryEraOnwards.hs | 3 ++- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cardano-api/internal/Cardano/Api/Eon/AllegraEraOnwards.hs b/cardano-api/internal/Cardano/Api/Eon/AllegraEraOnwards.hs index e7adbc0979..1bc8c80856 100644 --- a/cardano-api/internal/Cardano/Api/Eon/AllegraEraOnwards.hs +++ b/cardano-api/internal/Cardano/Api/Eon/AllegraEraOnwards.hs @@ -111,7 +111,7 @@ allegraEraOnwardsToShelleyBasedEra = \case AllegraEraOnwardsBabbage -> ShelleyBasedEraBabbage AllegraEraOnwardsConway -> ShelleyBasedEraConway -class IsAllegraBasedEra era where +class IsShelleyBasedEra era => IsAllegraBasedEra era where allegraBasedEra :: AllegraEraOnwards era instance IsAllegraBasedEra AllegraEra where diff --git a/cardano-api/internal/Cardano/Api/Eon/AlonzoEraOnwards.hs b/cardano-api/internal/Cardano/Api/Eon/AlonzoEraOnwards.hs index 150f9a6ca2..b4997b90e1 100644 --- a/cardano-api/internal/Cardano/Api/Eon/AlonzoEraOnwards.hs +++ b/cardano-api/internal/Cardano/Api/Eon/AlonzoEraOnwards.hs @@ -17,6 +17,7 @@ module Cardano.Api.Eon.AlonzoEraOnwards ) where +import Cardano.Api.Eon.MaryEraOnwards import Cardano.Api.Eon.ShelleyBasedEra import Cardano.Api.Eras.Core import Cardano.Api.Modes @@ -119,7 +120,7 @@ alonzoEraOnwardsToShelleyBasedEra = \case AlonzoEraOnwardsBabbage -> ShelleyBasedEraBabbage AlonzoEraOnwardsConway -> ShelleyBasedEraConway -class IsAlonzoBasedEra era where +class IsMaryBasedEra era => IsAlonzoBasedEra era where alonzoBasedEra :: AlonzoEraOnwards era instance IsAlonzoBasedEra AlonzoEra where diff --git a/cardano-api/internal/Cardano/Api/Eon/BabbageEraOnwards.hs b/cardano-api/internal/Cardano/Api/Eon/BabbageEraOnwards.hs index 979e144f18..32fe98c4b4 100644 --- a/cardano-api/internal/Cardano/Api/Eon/BabbageEraOnwards.hs +++ b/cardano-api/internal/Cardano/Api/Eon/BabbageEraOnwards.hs @@ -17,6 +17,7 @@ module Cardano.Api.Eon.BabbageEraOnwards ) where +import Cardano.Api.Eon.AlonzoEraOnwards import Cardano.Api.Eon.ShelleyBasedEra import Cardano.Api.Eras.Core import Cardano.Api.Modes @@ -113,7 +114,7 @@ babbageEraOnwardsToShelleyBasedEra = \case BabbageEraOnwardsBabbage -> ShelleyBasedEraBabbage BabbageEraOnwardsConway -> ShelleyBasedEraConway -class IsBabbageBasedEra era where +class IsAlonzoBasedEra era => IsBabbageBasedEra era where babbageBasedEra :: BabbageEraOnwards era instance IsBabbageBasedEra BabbageEra where diff --git a/cardano-api/internal/Cardano/Api/Eon/ConwayEraOnwards.hs b/cardano-api/internal/Cardano/Api/Eon/ConwayEraOnwards.hs index d991fdfbd3..f8d5210925 100644 --- a/cardano-api/internal/Cardano/Api/Eon/ConwayEraOnwards.hs +++ b/cardano-api/internal/Cardano/Api/Eon/ConwayEraOnwards.hs @@ -120,7 +120,7 @@ conwayEraOnwardsToBabbageEraOnwards :: ConwayEraOnwards era -> BabbageEraOnwards conwayEraOnwardsToBabbageEraOnwards = \case ConwayEraOnwardsConway -> BabbageEraOnwardsConway -class IsConwayBasedEra era where +class IsBabbageBasedEra era => IsConwayBasedEra era where conwayBasedEra :: ConwayEraOnwards era instance IsConwayBasedEra ConwayEra where diff --git a/cardano-api/internal/Cardano/Api/Eon/MaryEraOnwards.hs b/cardano-api/internal/Cardano/Api/Eon/MaryEraOnwards.hs index 3f59847306..fd4f1ab85c 100644 --- a/cardano-api/internal/Cardano/Api/Eon/MaryEraOnwards.hs +++ b/cardano-api/internal/Cardano/Api/Eon/MaryEraOnwards.hs @@ -17,6 +17,7 @@ module Cardano.Api.Eon.MaryEraOnwards ) where +import Cardano.Api.Eon.AllegraEraOnwards import Cardano.Api.Eon.ShelleyBasedEra import Cardano.Api.Eras.Core import Cardano.Api.Modes @@ -111,7 +112,7 @@ maryEraOnwardsToShelleyBasedEra = \case MaryEraOnwardsBabbage -> ShelleyBasedEraBabbage MaryEraOnwardsConway -> ShelleyBasedEraConway -class IsMaryBasedEra era where +class IsAllegraBasedEra era => IsMaryBasedEra era where maryBasedEra :: MaryEraOnwards era instance IsMaryBasedEra MaryEra where