diff --git a/cardano-api/internal/Cardano/Api/Eon/ShelleyBasedEra.hs b/cardano-api/internal/Cardano/Api/Eon/ShelleyBasedEra.hs index f0384cbfc8..1d204dba4d 100644 --- a/cardano-api/internal/Cardano/Api/Eon/ShelleyBasedEra.hs +++ b/cardano-api/internal/Cardano/Api/Eon/ShelleyBasedEra.hs @@ -15,7 +15,6 @@ module Cardano.Api.Eon.ShelleyBasedEra ShelleyBasedEra(..) , IsShelleyBasedEra(..) , AnyShelleyBasedEra(..) - , anyShelleyBasedEra , InAnyShelleyBasedEra(..) , inAnyShelleyBasedEra , shelleyBasedToCardanoEra @@ -228,7 +227,8 @@ shelleyBasedEraConstraints = \case data AnyShelleyBasedEra where AnyShelleyBasedEra - :: ShelleyBasedEra era + :: Typeable era + => ShelleyBasedEra era -> AnyShelleyBasedEra deriving instance Show AnyShelleyBasedEra @@ -280,19 +280,13 @@ instance FromJSON AnyShelleyBasedEra where "Conway" -> pure $ AnyShelleyBasedEra ShelleyBasedEraConway wrong -> fail $ "Failed to parse unknown shelley-based era: " <> Text.unpack wrong -anyShelleyBasedEra :: () - => ShelleyBasedEra era - -> AnyShelleyBasedEra -anyShelleyBasedEra sbe = - AnyShelleyBasedEra sbe - -- | This pairs up some era-dependent type with a 'ShelleyBasedEra' value that -- tells us what era it is, but hides the era type. This is useful when the era -- is not statically known, for example when deserialising from a file. -- data InAnyShelleyBasedEra thing where InAnyShelleyBasedEra - :: IsShelleyBasedEra era + :: Typeable era => ShelleyBasedEra era -> thing era -> InAnyShelleyBasedEra thing diff --git a/cardano-api/internal/Cardano/Api/Eras/Core.hs b/cardano-api/internal/Cardano/Api/Eras/Core.hs index e5cf2229ae..795fa90da2 100644 --- a/cardano-api/internal/Cardano/Api/Eras/Core.hs +++ b/cardano-api/internal/Cardano/Api/Eras/Core.hs @@ -313,7 +313,7 @@ cardanoEraConstraints = \case data AnyCardanoEra where AnyCardanoEra - :: IsCardanoEra era + :: Typeable era => CardanoEra era -> AnyCardanoEra @@ -390,7 +390,7 @@ anyCardanoEra = \case -- data InAnyCardanoEra thing where InAnyCardanoEra - :: IsCardanoEra era + :: Typeable era => CardanoEra era -> thing era -> InAnyCardanoEra thing diff --git a/cardano-api/src/Cardano/Api.hs b/cardano-api/src/Cardano/Api.hs index 6dbdffc0d6..5bf914ec3c 100644 --- a/cardano-api/src/Cardano/Api.hs +++ b/cardano-api/src/Cardano/Api.hs @@ -97,7 +97,6 @@ module Cardano.Api ( ShelleyBasedEra(..), IsShelleyBasedEra(..), AnyShelleyBasedEra(..), - anyShelleyBasedEra, InAnyShelleyBasedEra(..), inAnyShelleyBasedEra, shelleyBasedToCardanoEra, diff --git a/cardano-api/test/cardano-api-test/Test/Cardano/Api/Eras.hs b/cardano-api/test/cardano-api-test/Test/Cardano/Api/Eras.hs index 682dae78aa..162979a003 100644 --- a/cardano-api/test/cardano-api-test/Test/Cardano/Api/Eras.hs +++ b/cardano-api/test/cardano-api-test/Test/Cardano/Api/Eras.hs @@ -44,7 +44,7 @@ prop_toJSON_CardanoMatchesShelley :: Property prop_toJSON_CardanoMatchesShelley = property $ do AnyShelleyBasedEra sbe <- forAll $ Gen.element [minBound..maxBound] - toJSON (anyShelleyBasedEra sbe) === toJSON (anyCardanoEra (shelleyBasedToCardanoEra sbe)) + toJSON (AnyShelleyBasedEra sbe) === toJSON (anyCardanoEra (shelleyBasedToCardanoEra sbe)) tests :: TestTree tests = testGroup "Test.Cardano.Api.Json"