From b9d61fe8e38cdeadb8a9e1612e101b471aefbef4 Mon Sep 17 00:00:00 2001 From: John Ky Date: Thu, 28 Sep 2023 19:19:26 +1000 Subject: [PATCH 1/2] New AnyEraInEon type --- cardano-api/internal/Cardano/Api/Eras.hs | 1 + cardano-api/internal/Cardano/Api/Eras/Core.hs | 10 ++++++++++ cardano-api/src/Cardano/Api.hs | 1 + 3 files changed, 12 insertions(+) diff --git a/cardano-api/internal/Cardano/Api/Eras.hs b/cardano-api/internal/Cardano/Api/Eras.hs index 161676164f..a21be76aa0 100644 --- a/cardano-api/internal/Cardano/Api/Eras.hs +++ b/cardano-api/internal/Cardano/Api/Eras.hs @@ -22,6 +22,7 @@ module Cardano.Api.Eras -- * IsEon , Eon(..) + , AnyEraInEon(..) , forEraInEon , inEraEonMaybe , maybeEonInEra diff --git a/cardano-api/internal/Cardano/Api/Eras/Core.hs b/cardano-api/internal/Cardano/Api/Eras/Core.hs index c09062f6e1..89b88ed55e 100644 --- a/cardano-api/internal/Cardano/Api/Eras/Core.hs +++ b/cardano-api/internal/Cardano/Api/Eras/Core.hs @@ -30,6 +30,7 @@ module Cardano.Api.Eras.Core -- * IsEon , Eon(..) + , AnyEraInEon(..) , forEraInEon , inEraEonMaybe , maybeEonInEra @@ -139,6 +140,15 @@ maybeEonInEra :: () maybeEonInEra = inEonForEra Nothing Just +-- ---------------------------------------------------------------------------- +-- AnyEraInEon + +data AnyEraInEon where + AnyEraInEon + :: Eon eon + => eon era + -> AnyEraInEon + -- ---------------------------------------------------------------------------- -- ToCardanoEra diff --git a/cardano-api/src/Cardano/Api.hs b/cardano-api/src/Cardano/Api.hs index 276ae2c1fa..a54fd0fd58 100644 --- a/cardano-api/src/Cardano/Api.hs +++ b/cardano-api/src/Cardano/Api.hs @@ -29,6 +29,7 @@ module Cardano.Api ( -- * Feature support Eon(..), + AnyEraInEon(..), forEraInEon, inEraEonMaybe, maybeEonInEra, From b25597c5fa2841fa5a8c3f51ffeb0855321cb0fd Mon Sep 17 00:00:00 2001 From: John Ky Date: Thu, 28 Sep 2023 19:25:08 +1000 Subject: [PATCH 2/2] Delete: * AnyByronEraOnly * AnyByronToAllegraEra * AnyByronToMaryEra * AnyByronToAlonzoEra * AnyShelleyToAllegraEra * AnyShelleyToMaryEra * AnyShelleyToAlonzoEra * AnyShelleyToBabbageEra * AnyShelleyBasedEra * AnyMaryEraOnwards * AnyAlonzoEraOnly * AnyAlonzoEraOnwards * AnyBabbageEraOnwards * AnyConwayEraOnwards --- .../internal/Cardano/Api/Eon/AlonzoEraOnly.hs | 6 ------ .../internal/Cardano/Api/Eon/AlonzoEraOnwards.hs | 6 ------ .../internal/Cardano/Api/Eon/BabbageEraOnwards.hs | 6 ------ .../internal/Cardano/Api/Eon/ByronEraOnly.hs | 6 ------ .../internal/Cardano/Api/Eon/ByronToAllegraEra.hs | 6 ------ .../internal/Cardano/Api/Eon/ByronToAlonzoEra.hs | 6 ------ .../internal/Cardano/Api/Eon/ByronToMaryEra.hs | 6 ------ .../internal/Cardano/Api/Eon/ConwayEraOnwards.hs | 6 ------ .../internal/Cardano/Api/Eon/MaryEraOnwards.hs | 6 ------ .../internal/Cardano/Api/Eon/ShelleyToAllegraEra.hs | 6 ------ .../internal/Cardano/Api/Eon/ShelleyToAlonzoEra.hs | 6 ------ .../internal/Cardano/Api/Eon/ShelleyToBabbageEra.hs | 6 ------ .../internal/Cardano/Api/Eon/ShelleyToMaryEra.hs | 6 ------ cardano-api/src/Cardano/Api.hs | 13 ------------- 14 files changed, 91 deletions(-) diff --git a/cardano-api/internal/Cardano/Api/Eon/AlonzoEraOnly.hs b/cardano-api/internal/Cardano/Api/Eon/AlonzoEraOnly.hs index 5ec37581e7..a45d283a3b 100644 --- a/cardano-api/internal/Cardano/Api/Eon/AlonzoEraOnly.hs +++ b/cardano-api/internal/Cardano/Api/Eon/AlonzoEraOnly.hs @@ -10,7 +10,6 @@ module Cardano.Api.Eon.AlonzoEraOnly ( AlonzoEraOnly(..) - , AnyAlonzoEraOnly(..) , alonzoEraOnlyConstraints , alonzoEraOnlyToCardanoEra , alonzoEraOnlyToShelleyBasedEra @@ -58,11 +57,6 @@ instance ToCardanoEra AlonzoEraOnly where toCardanoEra = \case AlonzoEraOnlyAlonzo -> AlonzoEra -data AnyAlonzoEraOnly where - AnyAlonzoEraOnly :: AlonzoEraOnly era -> AnyAlonzoEraOnly - -deriving instance Show AnyAlonzoEraOnly - type AlonzoEraOnlyConstraints era = ( C.HashAlgorithm (L.HASH (L.EraCrypto (ShelleyLedgerEra era))) , C.Signable (L.VRF (L.EraCrypto (ShelleyLedgerEra era))) L.Seed diff --git a/cardano-api/internal/Cardano/Api/Eon/AlonzoEraOnwards.hs b/cardano-api/internal/Cardano/Api/Eon/AlonzoEraOnwards.hs index 1d8d86468a..6b5410abcd 100644 --- a/cardano-api/internal/Cardano/Api/Eon/AlonzoEraOnwards.hs +++ b/cardano-api/internal/Cardano/Api/Eon/AlonzoEraOnwards.hs @@ -10,7 +10,6 @@ module Cardano.Api.Eon.AlonzoEraOnwards ( AlonzoEraOnwards(..) - , AnyAlonzoEraOnwards(..) , alonzoEraOnwardsConstraints , alonzoEraOnwardsToCardanoEra , alonzoEraOnwardsToShelleyBasedEra @@ -62,11 +61,6 @@ instance ToCardanoEra AlonzoEraOnwards where AlonzoEraOnwardsBabbage -> BabbageEra AlonzoEraOnwardsConway -> ConwayEra -data AnyAlonzoEraOnwards where - AnyAlonzoEraOnwards :: AlonzoEraOnwards era -> AnyAlonzoEraOnwards - -deriving instance Show AnyAlonzoEraOnwards - type AlonzoEraOnwardsConstraints era = ( C.HashAlgorithm (L.HASH (L.EraCrypto (ShelleyLedgerEra era))) , C.Signable (L.VRF (L.EraCrypto (ShelleyLedgerEra era))) L.Seed diff --git a/cardano-api/internal/Cardano/Api/Eon/BabbageEraOnwards.hs b/cardano-api/internal/Cardano/Api/Eon/BabbageEraOnwards.hs index 3a8c867365..89f516a404 100644 --- a/cardano-api/internal/Cardano/Api/Eon/BabbageEraOnwards.hs +++ b/cardano-api/internal/Cardano/Api/Eon/BabbageEraOnwards.hs @@ -10,7 +10,6 @@ module Cardano.Api.Eon.BabbageEraOnwards ( BabbageEraOnwards(..) - , AnyBabbageEraOnwards(..) , babbageEraOnwardsConstraints , babbageEraOnwardsToCardanoEra , babbageEraOnwardsToShelleyBasedEra @@ -60,11 +59,6 @@ instance ToCardanoEra BabbageEraOnwards where BabbageEraOnwardsBabbage -> BabbageEra BabbageEraOnwardsConway -> ConwayEra -data AnyBabbageEraOnwards where - AnyBabbageEraOnwards :: BabbageEraOnwards era -> AnyBabbageEraOnwards - -deriving instance Show AnyBabbageEraOnwards - type BabbageEraOnwardsConstraints era = ( C.HashAlgorithm (L.HASH (L.EraCrypto (ShelleyLedgerEra era))) , C.Signable (L.VRF (L.EraCrypto (ShelleyLedgerEra era))) L.Seed diff --git a/cardano-api/internal/Cardano/Api/Eon/ByronEraOnly.hs b/cardano-api/internal/Cardano/Api/Eon/ByronEraOnly.hs index 315ec5684f..3ec28999a3 100644 --- a/cardano-api/internal/Cardano/Api/Eon/ByronEraOnly.hs +++ b/cardano-api/internal/Cardano/Api/Eon/ByronEraOnly.hs @@ -8,7 +8,6 @@ module Cardano.Api.Eon.ByronEraOnly ( ByronEraOnly(..) - , AnyByronEraOnly(..) , byronEraOnlyConstraints , byronEraOnlyToCardanoEra @@ -39,11 +38,6 @@ instance ToCardanoEra ByronEraOnly where toCardanoEra = \case ByronEraOnlyByron -> ByronEra -data AnyByronEraOnly where - AnyByronEraOnly :: ByronEraOnly era -> AnyByronEraOnly - -deriving instance Show AnyByronEraOnly - type ByronEraOnlyConstraints era = ( IsCardanoEra era , Typeable era diff --git a/cardano-api/internal/Cardano/Api/Eon/ByronToAllegraEra.hs b/cardano-api/internal/Cardano/Api/Eon/ByronToAllegraEra.hs index 825542c7f0..2fce5b6ede 100644 --- a/cardano-api/internal/Cardano/Api/Eon/ByronToAllegraEra.hs +++ b/cardano-api/internal/Cardano/Api/Eon/ByronToAllegraEra.hs @@ -10,7 +10,6 @@ module Cardano.Api.Eon.ByronToAllegraEra ( ByronToAllegraEra(..) , IsByronToAllegraEra(..) - , AnyByronToAllegraEra(..) , byronToAllegraEraConstraints , byronToAllegraEraToCardanoEra @@ -63,11 +62,6 @@ type ByronToAllegraEraConstraints era = , Typeable era ) -data AnyByronToAllegraEra where - AnyByronToAllegraEra :: ByronToAllegraEra era -> AnyByronToAllegraEra - -deriving instance Show AnyByronToAllegraEra - byronToAllegraEraConstraints :: () => ByronToAllegraEra era -> (ByronToAllegraEraConstraints era => a) diff --git a/cardano-api/internal/Cardano/Api/Eon/ByronToAlonzoEra.hs b/cardano-api/internal/Cardano/Api/Eon/ByronToAlonzoEra.hs index 7b046dd49a..a42b1b17a7 100644 --- a/cardano-api/internal/Cardano/Api/Eon/ByronToAlonzoEra.hs +++ b/cardano-api/internal/Cardano/Api/Eon/ByronToAlonzoEra.hs @@ -10,7 +10,6 @@ module Cardano.Api.Eon.ByronToAlonzoEra ( ByronToAlonzoEra(..) , IsByronToAlonzoEra(..) - , AnyByronToAlonzoEra(..) , byronToAlonzoEraConstraints , byronToAlonzoEraToCardanoEra @@ -73,11 +72,6 @@ type ByronToAlonzoEraConstraints era = , Typeable era ) -data AnyByronToAlonzoEra where - AnyByronToAlonzoEra :: ByronToAlonzoEra era -> AnyByronToAlonzoEra - -deriving instance Show AnyByronToAlonzoEra - byronToAlonzoEraConstraints :: () => ByronToAlonzoEra era -> (ByronToAlonzoEraConstraints era => a) diff --git a/cardano-api/internal/Cardano/Api/Eon/ByronToMaryEra.hs b/cardano-api/internal/Cardano/Api/Eon/ByronToMaryEra.hs index 877bb9add8..c7f4c71907 100644 --- a/cardano-api/internal/Cardano/Api/Eon/ByronToMaryEra.hs +++ b/cardano-api/internal/Cardano/Api/Eon/ByronToMaryEra.hs @@ -10,7 +10,6 @@ module Cardano.Api.Eon.ByronToMaryEra ( ByronToMaryEra(..) , IsByronToMaryEra(..) - , AnyByronToMaryEra(..) , byronToMaryEraConstraints , byronToMaryEraToCardanoEra @@ -68,11 +67,6 @@ type ByronToMaryEraConstraints era = , Typeable era ) -data AnyByronToMaryEra where - AnyByronToMaryEra :: ByronToMaryEra era -> AnyByronToMaryEra - -deriving instance Show AnyByronToMaryEra - byronToMaryEraConstraints :: () => ByronToMaryEra era -> (ByronToMaryEraConstraints era => a) diff --git a/cardano-api/internal/Cardano/Api/Eon/ConwayEraOnwards.hs b/cardano-api/internal/Cardano/Api/Eon/ConwayEraOnwards.hs index a0da443b29..43b3032d83 100644 --- a/cardano-api/internal/Cardano/Api/Eon/ConwayEraOnwards.hs +++ b/cardano-api/internal/Cardano/Api/Eon/ConwayEraOnwards.hs @@ -10,7 +10,6 @@ module Cardano.Api.Eon.ConwayEraOnwards ( ConwayEraOnwards(..) - , AnyConwayEraOnwards(..) , conwayEraOnwardsConstraints , conwayEraOnwardsToCardanoEra , conwayEraOnwardsToShelleyBasedEra @@ -60,11 +59,6 @@ instance ToCardanoEra ConwayEraOnwards where toCardanoEra = \case ConwayEraOnwardsConway -> ConwayEra -data AnyConwayEraOnwards where - AnyConwayEraOnwards :: ConwayEraOnwards era -> AnyConwayEraOnwards - -deriving instance Show AnyConwayEraOnwards - type ConwayEraOnwardsConstraints era = ( C.HashAlgorithm (L.HASH (L.EraCrypto (ShelleyLedgerEra era))) , C.Signable (L.VRF (L.EraCrypto (ShelleyLedgerEra era))) L.Seed diff --git a/cardano-api/internal/Cardano/Api/Eon/MaryEraOnwards.hs b/cardano-api/internal/Cardano/Api/Eon/MaryEraOnwards.hs index bfe858f343..3fb0254eb4 100644 --- a/cardano-api/internal/Cardano/Api/Eon/MaryEraOnwards.hs +++ b/cardano-api/internal/Cardano/Api/Eon/MaryEraOnwards.hs @@ -11,7 +11,6 @@ module Cardano.Api.Eon.MaryEraOnwards ( MaryEraOnwards(..) , IsMaryEraOnwards(..) - , AnyMaryEraOnwards(..) , maryEraOnwardsConstraints , maryEraOnwardsToCardanoEra , maryEraOnwardsToShelleyBasedEra @@ -81,11 +80,6 @@ instance ToCardanoEra MaryEraOnwards where MaryEraOnwardsBabbage -> BabbageEra MaryEraOnwardsConway -> ConwayEra -data AnyMaryEraOnwards where - AnyMaryEraOnwards :: MaryEraOnwards era -> AnyMaryEraOnwards - -deriving instance Show AnyMaryEraOnwards - type MaryEraOnwardsConstraints era = ( C.HashAlgorithm (L.HASH (L.EraCrypto (ShelleyLedgerEra era))) , C.Signable (L.VRF (L.EraCrypto (ShelleyLedgerEra era))) L.Seed diff --git a/cardano-api/internal/Cardano/Api/Eon/ShelleyToAllegraEra.hs b/cardano-api/internal/Cardano/Api/Eon/ShelleyToAllegraEra.hs index 63a315e51e..c2cb137c84 100644 --- a/cardano-api/internal/Cardano/Api/Eon/ShelleyToAllegraEra.hs +++ b/cardano-api/internal/Cardano/Api/Eon/ShelleyToAllegraEra.hs @@ -10,7 +10,6 @@ module Cardano.Api.Eon.ShelleyToAllegraEra ( ShelleyToAllegraEra(..) - , AnyShelleyToAllegraEra(..) , shelleyToAllegraEraConstraints , shelleyToAllegraEraToCardanoEra , shelleyToAllegraEraToShelleyBasedEra @@ -91,11 +90,6 @@ type ShelleyToAllegraEraConstraints era = , Typeable era ) -data AnyShelleyToAllegraEra where - AnyShelleyToAllegraEra :: ShelleyToAllegraEra era -> AnyShelleyToAllegraEra - -deriving instance Show AnyShelleyToAllegraEra - shelleyToAllegraEraConstraints :: () => ShelleyToAllegraEra era -> (ShelleyToAllegraEraConstraints era => a) diff --git a/cardano-api/internal/Cardano/Api/Eon/ShelleyToAlonzoEra.hs b/cardano-api/internal/Cardano/Api/Eon/ShelleyToAlonzoEra.hs index 8ef4552d99..d1409ecfa6 100644 --- a/cardano-api/internal/Cardano/Api/Eon/ShelleyToAlonzoEra.hs +++ b/cardano-api/internal/Cardano/Api/Eon/ShelleyToAlonzoEra.hs @@ -10,7 +10,6 @@ module Cardano.Api.Eon.ShelleyToAlonzoEra ( ShelleyToAlonzoEra(..) - , AnyShelleyToAlonzoEra(..) , shelleyToAlonzoEraConstraints , shelleyToAlonzoEraToCardanoEra , shelleyToAlonzoEraToShelleyBasedEra @@ -92,11 +91,6 @@ type ShelleyToAlonzoEraConstraints era = , Typeable era ) -data AnyShelleyToAlonzoEra where - AnyShelleyToAlonzoEra :: ShelleyToAlonzoEra era -> AnyShelleyToAlonzoEra - -deriving instance Show AnyShelleyToAlonzoEra - shelleyToAlonzoEraConstraints :: () => ShelleyToAlonzoEra era -> (ShelleyToAlonzoEraConstraints era => a) diff --git a/cardano-api/internal/Cardano/Api/Eon/ShelleyToBabbageEra.hs b/cardano-api/internal/Cardano/Api/Eon/ShelleyToBabbageEra.hs index adb5490c38..ba76e9573f 100644 --- a/cardano-api/internal/Cardano/Api/Eon/ShelleyToBabbageEra.hs +++ b/cardano-api/internal/Cardano/Api/Eon/ShelleyToBabbageEra.hs @@ -10,7 +10,6 @@ module Cardano.Api.Eon.ShelleyToBabbageEra ( ShelleyToBabbageEra(..) - , AnyShelleyToBabbageEra(..) , shelleyToBabbageEraConstraints , shelleyToBabbageEraToCardanoEra , shelleyToBabbageEraToShelleyBasedEra @@ -93,11 +92,6 @@ type ShelleyToBabbageEraConstraints era = , Typeable era ) -data AnyShelleyToBabbageEra where - AnyShelleyToBabbageEra :: ShelleyToBabbageEra era -> AnyShelleyToBabbageEra - -deriving instance Show AnyShelleyToBabbageEra - shelleyToBabbageEraConstraints :: () => ShelleyToBabbageEra era -> (ShelleyToBabbageEraConstraints era => a) diff --git a/cardano-api/internal/Cardano/Api/Eon/ShelleyToMaryEra.hs b/cardano-api/internal/Cardano/Api/Eon/ShelleyToMaryEra.hs index d355b8cf51..b9d6f00803 100644 --- a/cardano-api/internal/Cardano/Api/Eon/ShelleyToMaryEra.hs +++ b/cardano-api/internal/Cardano/Api/Eon/ShelleyToMaryEra.hs @@ -10,7 +10,6 @@ module Cardano.Api.Eon.ShelleyToMaryEra ( ShelleyToMaryEra(..) - , AnyShelleyToMaryEra(..) , shelleyToMaryEraConstraints , shelleyToMaryEraToCardanoEra , shelleyToMaryEraToShelleyBasedEra @@ -91,11 +90,6 @@ type ShelleyToMaryEraConstraints era = , Typeable era ) -data AnyShelleyToMaryEra where - AnyShelleyToMaryEra :: ShelleyToMaryEra era -> AnyShelleyToMaryEra - -deriving instance Show AnyShelleyToMaryEra - shelleyToMaryEraConstraints :: () => ShelleyToMaryEra era -> (ShelleyToMaryEraConstraints era => a) diff --git a/cardano-api/src/Cardano/Api.hs b/cardano-api/src/Cardano/Api.hs index a54fd0fd58..8dd9417b8e 100644 --- a/cardano-api/src/Cardano/Api.hs +++ b/cardano-api/src/Cardano/Api.hs @@ -48,50 +48,42 @@ module Cardano.Api ( -- ** From Byron ByronEraOnly(..), - AnyByronEraOnly(..), byronEraOnlyConstraints, byronEraOnlyToCardanoEra, ByronToAllegraEra(..), IsByronToAllegraEra(..), - AnyByronToAllegraEra(..), byronToAllegraEraConstraints, byronToAllegraEraToCardanoEra, ByronToMaryEra(..), IsByronToMaryEra(..), - AnyByronToMaryEra(..), byronToMaryEraConstraints, byronToMaryEraToCardanoEra, ByronToAlonzoEra(..), IsByronToAlonzoEra(..), - AnyByronToAlonzoEra(..), byronToAlonzoEraConstraints, byronToAlonzoEraToCardanoEra, -- ** From Shelley ShelleyToAllegraEra(..), - AnyShelleyToAllegraEra(..), shelleyToAllegraEraConstraints, shelleyToAllegraEraToCardanoEra, shelleyToAllegraEraToShelleyBasedEra, ShelleyToMaryEra(..), - AnyShelleyToMaryEra(..), shelleyToMaryEraConstraints, shelleyToMaryEraToCardanoEra, shelleyToMaryEraToShelleyBasedEra, ShelleyToAlonzoEra(..), - AnyShelleyToAlonzoEra(..), shelleyToAlonzoEraConstraints, shelleyToAlonzoEraToCardanoEra, shelleyToAlonzoEraToShelleyBasedEra, ShelleyToBabbageEra(..), - AnyShelleyToBabbageEra(..), shelleyToBabbageEraConstraints, shelleyToBabbageEraToCardanoEra, shelleyToBabbageEraToShelleyBasedEra, @@ -110,7 +102,6 @@ module Cardano.Api ( -- ** From Mary MaryEraOnwards(..), - AnyMaryEraOnwards(..), maryEraOnwardsConstraints, maryEraOnwardsToCardanoEra, maryEraOnwardsToShelleyBasedEra, @@ -118,13 +109,11 @@ module Cardano.Api ( -- ** From Alonzo AlonzoEraOnly(..), - AnyAlonzoEraOnly(..), alonzoEraOnlyConstraints, alonzoEraOnlyToCardanoEra, alonzoEraOnlyToShelleyBasedEra, AlonzoEraOnwards(..), - AnyAlonzoEraOnwards(..), alonzoEraOnwardsConstraints, alonzoEraOnwardsToCardanoEra, alonzoEraOnwardsToShelleyBasedEra, @@ -132,7 +121,6 @@ module Cardano.Api ( -- ** From Babbage BabbageEraOnwards(..), - AnyBabbageEraOnwards(..), babbageEraOnwardsConstraints, babbageEraOnwardsToCardanoEra, babbageEraOnwardsToShelleyBasedEra, @@ -140,7 +128,6 @@ module Cardano.Api ( -- ** From Conway ConwayEraOnwards(..), - AnyConwayEraOnwards(..), conwayEraOnwardsConstraints, conwayEraOnwardsToCardanoEra, conwayEraOnwardsToShelleyBasedEra,