Skip to content

Commit

Permalink
Merge pull request #641 from Swordlash/main
Browse files Browse the repository at this point in the history
Make `IsXXXBasedEra` a class hierarchy
  • Loading branch information
carbolymer authored Sep 23, 2024
2 parents 7792eb9 + 4659f9f commit a08aa37
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cardano-api/internal/Cardano/Api/Eon/AllegraEraOnwards.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion cardano-api/internal/Cardano/Api/Eon/AlonzoEraOnwards.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion cardano-api/internal/Cardano/Api/Eon/BabbageEraOnwards.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cardano-api/internal/Cardano/Api/Eon/ConwayEraOnwards.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion cardano-api/internal/Cardano/Api/Eon/MaryEraOnwards.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a08aa37

Please sign in to comment.