From b72fc8db2a82ff62837a07b886e9213aab68b71f Mon Sep 17 00:00:00 2001 From: Mateusz Galazyn Date: Mon, 28 Oct 2024 10:59:39 +0100 Subject: [PATCH] Remove `Show (Some a)` and `Eq (Some a)`. Add `Show (Some Era)` and `Eq (Some Era)`. --- .../internal/Cardano/Api/Experimental/Eras.hs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/cardano-api/internal/Cardano/Api/Experimental/Eras.hs b/cardano-api/internal/Cardano/Api/Experimental/Eras.hs index 2b2e40cd0..c2517e2ee 100644 --- a/cardano-api/internal/Cardano/Api/Experimental/Eras.hs +++ b/cardano-api/internal/Cardano/Api/Experimental/Eras.hs @@ -66,8 +66,8 @@ type family LedgerEra era = (r :: Type) | r -> era where LedgerEra BabbageEra = Ledger.Babbage LedgerEra ConwayEra = Ledger.Conway --- | An existential type for singleton types. Use to hold any era e.g. @Some Era@. One can then bring the --- era witness back into scope for example using this pattern: +-- | An existential wrapper for types of kind @k -> Types@. Use it to hold any era e.g. @Some Era@. One can +-- then bring the era witness back into scope for example using this pattern: -- @ -- anyEra = Some ConwayEra -- -- then later in the code @@ -81,15 +81,6 @@ data Some (f :: k -> Type) where => f a -> Some f --- | Assumes that @f@ is a singleton -instance Show (Some f) where - showsPrec _ (Some v) = showsTypeRep (typeOf v) - --- | Assumes that @f@ is a singleton -instance TestEquality f => Eq (Some f) where - Some era1 == Some era2 = - isJust $ testEquality era1 era2 - -- | Represents the eras in Cardano's blockchain. -- This type represents eras currently on mainnet and new eras which are -- in development. @@ -119,6 +110,12 @@ instance TestEquality Era where instance ToJSON (Era era) where toJSON = eraToStringLike +instance Show (Some Era) where + showsPrec _ (Some era) = shows era + +instance Eq (Some Era) where + Some era1 == Some era2 = isJust $ testEquality era1 era2 + instance Bounded (Some Era) where minBound = Some BabbageEra maxBound = Some ConwayEra