Skip to content

Commit

Permalink
Merge pull request #289 from input-output-hk/newhoggy/rename-AnyEraIn…
Browse files Browse the repository at this point in the history
…Eon-to-EraInEon

Rename `AnyEraInEon` to `EraInEon`
  • Loading branch information
newhoggy authored Oct 3, 2023
2 parents 1a694b7 + a331c6b commit fa58de8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 29 deletions.
3 changes: 1 addition & 2 deletions cardano-api/internal/Cardano/Api/Eras.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ module Cardano.Api.Eras

-- * IsEon
, Eon(..)
, AnyEon(..)
, AnyEraInEon(..)
, EraInEon(..)

, inEonForEraMaybe
, forEraInEon
Expand Down
35 changes: 10 additions & 25 deletions cardano-api/internal/Cardano/Api/Eras/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ module Cardano.Api.Eras.Core

-- * IsEon
, Eon(..)
, AnyEon(..)
, AnyEraInEon(..)
, EraInEon(..)
, inEonForEraMaybe
, forEraInEon
, forEraInEonMaybe
Expand Down Expand Up @@ -163,38 +162,24 @@ maybeEon =
-- ----------------------------------------------------------------------------
-- Era and eon existential types

data AnyEraInEon eon where
AnyEraInEon
data EraInEon eon where
EraInEon
:: ( Typeable era
, Typeable (eon era)
, Eon eon )
, Eon eon
)
=> eon era
-> AnyEraInEon eon
-> EraInEon eon

-- | Assumes that eons are singletons
instance Show (AnyEraInEon eon) where
showsPrec _ (AnyEraInEon eonEra) = showsTypeRep (typeOf eonEra)
instance Show (EraInEon eon) where
showsPrec _ (EraInEon eonEra) = showsTypeRep (typeOf eonEra)

-- | Assumes that eons are singletons
instance TestEquality eon => Eq (AnyEraInEon eon) where
AnyEraInEon era1 == AnyEraInEon era2 =
instance TestEquality eon => Eq (EraInEon eon) where
EraInEon era1 == EraInEon era2 =
isJust $ testEquality era1 era2

data AnyEon where
AnyEon
:: ( Typeable era
, Typeable (eon era)
, ToCardanoEra eon
, IsCardanoEra era
, Eon eon )
=> eon era
-> AnyEon

-- | Assumes that eons are singletons
instance Show AnyEon where
showsPrec _ (AnyEon eonEra) = showsTypeRep (typeOf eonEra)


-- ----------------------------------------------------------------------------
-- ToCardanoEra

Expand Down
3 changes: 1 addition & 2 deletions cardano-api/src/Cardano/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ module Cardano.Api (

-- * Eon support
Eon(..),
AnyEon(..),
AnyEraInEon(..),
EraInEon(..),

inEonForEraMaybe,
forEraInEon,
Expand Down

0 comments on commit fa58de8

Please sign in to comment.