{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} module Cardano.Api.Eon.ShelleyToAllegraEra ( ShelleyToAllegraEra (..) , shelleyToAllegraEraConstraints , shelleyToAllegraEraToShelleyBasedEra , ShelleyToAllegraEraConstraints ) where import Cardano.Api.Eon.Convert import Cardano.Api.Eon.ShelleyBasedEra import Cardano.Api.Eras.Core import Cardano.Api.Modes import Cardano.Api.Query.Types import Cardano.Binary import qualified Cardano.Crypto.Hash.Blake2b as Blake2b import qualified Cardano.Crypto.Hash.Class as C import qualified Cardano.Crypto.VRF as C import qualified Cardano.Ledger.Api as L import qualified Cardano.Ledger.BaseTypes as L import qualified Cardano.Ledger.Coin as L import qualified Cardano.Ledger.Core as L import qualified Cardano.Ledger.SafeHash as L import qualified Cardano.Ledger.Shelley.TxCert as L import qualified Cardano.Ledger.UTxO as L import qualified Ouroboros.Consensus.Protocol.Abstract as Consensus import qualified Ouroboros.Consensus.Protocol.Praos.Common as Consensus import qualified Ouroboros.Consensus.Shelley.Ledger as Consensus import Data.Aeson import Data.Typeable (Typeable) data ShelleyToAllegraEra era where ShelleyToAllegraEraShelley :: ShelleyToAllegraEra ShelleyEra ShelleyToAllegraEraAllegra :: ShelleyToAllegraEra AllegraEra deriving instance Show (ShelleyToAllegraEra era) deriving instance Eq (ShelleyToAllegraEra era) instance Eon ShelleyToAllegraEra where inEonForEra :: forall a era. a -> (ShelleyToAllegraEra era -> a) -> CardanoEra era -> a inEonForEra a no ShelleyToAllegraEra era -> a yes = \case CardanoEra era ByronEra -> a no CardanoEra era ShelleyEra -> ShelleyToAllegraEra era -> a yes ShelleyToAllegraEra era ShelleyToAllegraEra ShelleyEra ShelleyToAllegraEraShelley CardanoEra era AllegraEra -> ShelleyToAllegraEra era -> a yes ShelleyToAllegraEra era ShelleyToAllegraEra AllegraEra ShelleyToAllegraEraAllegra CardanoEra era MaryEra -> a no CardanoEra era AlonzoEra -> a no CardanoEra era BabbageEra -> a no CardanoEra era ConwayEra -> a no instance ToCardanoEra ShelleyToAllegraEra where toCardanoEra :: forall era. ShelleyToAllegraEra era -> CardanoEra era toCardanoEra = \case ShelleyToAllegraEra era ShelleyToAllegraEraShelley -> CardanoEra era CardanoEra ShelleyEra ShelleyEra ShelleyToAllegraEra era ShelleyToAllegraEraAllegra -> CardanoEra era CardanoEra AllegraEra AllegraEra instance Convert ShelleyToAllegraEra CardanoEra where convert :: forall era. ShelleyToAllegraEra era -> CardanoEra era convert = ShelleyToAllegraEra era -> CardanoEra era forall era. ShelleyToAllegraEra era -> CardanoEra era forall (eon :: * -> *) era. ToCardanoEra eon => eon era -> CardanoEra era toCardanoEra instance Convert ShelleyToAllegraEra ShelleyBasedEra where convert :: forall era. ShelleyToAllegraEra era -> ShelleyBasedEra era convert = \case ShelleyToAllegraEra era ShelleyToAllegraEraShelley -> ShelleyBasedEra era ShelleyBasedEra ShelleyEra ShelleyBasedEraShelley ShelleyToAllegraEra era ShelleyToAllegraEraAllegra -> ShelleyBasedEra era ShelleyBasedEra AllegraEra ShelleyBasedEraAllegra type ShelleyToAllegraEraConstraints era = ( C.HashAlgorithm (L.HASH (L.EraCrypto (ShelleyLedgerEra era))) , C.Signable (L.VRF (L.EraCrypto (ShelleyLedgerEra era))) L.Seed , Consensus.PraosProtocolSupportsNode (ConsensusProtocol era) , Consensus.ShelleyBlock (ConsensusProtocol era) (ShelleyLedgerEra era) ~ ConsensusBlockForEra era , Consensus.ShelleyCompatible (ConsensusProtocol era) (ShelleyLedgerEra era) , L.ADDRHASH (Consensus.PraosProtocolSupportsNodeCrypto (ConsensusProtocol era)) ~ Blake2b.Blake2b_224 , L.Crypto (L.EraCrypto (ShelleyLedgerEra era)) , L.Era (ShelleyLedgerEra era) , L.EraCrypto (ShelleyLedgerEra era) ~ L.StandardCrypto , L.EraPParams (ShelleyLedgerEra era) , L.EraTx (ShelleyLedgerEra era) , L.EraTxBody (ShelleyLedgerEra era) , L.EraTxOut (ShelleyLedgerEra era) , L.EraUTxO (ShelleyLedgerEra era) , L.HashAnnotated (L.TxBody (ShelleyLedgerEra era)) L.EraIndependentTxBody L.StandardCrypto , L.ProtVerAtMost (ShelleyLedgerEra era) 4 , L.ProtVerAtMost (ShelleyLedgerEra era) 6 , L.ProtVerAtMost (ShelleyLedgerEra era) 8 , L.ShelleyEraTxBody (ShelleyLedgerEra era) , L.ShelleyEraTxCert (ShelleyLedgerEra era) , L.TxCert (ShelleyLedgerEra era) ~ L.ShelleyTxCert (ShelleyLedgerEra era) , L.Value (ShelleyLedgerEra era) ~ L.Coin , FromCBOR (Consensus.ChainDepState (ConsensusProtocol era)) , FromCBOR (DebugLedgerState era) , IsCardanoEra era , IsShelleyBasedEra era , ToJSON (DebugLedgerState era) , Typeable era ) shelleyToAllegraEraConstraints :: () => ShelleyToAllegraEra era -> (ShelleyToAllegraEraConstraints era => a) -> a shelleyToAllegraEraConstraints :: forall era a. ShelleyToAllegraEra era -> (ShelleyToAllegraEraConstraints era => a) -> a shelleyToAllegraEraConstraints = \case ShelleyToAllegraEra era ShelleyToAllegraEraShelley -> a -> a (ShelleyToAllegraEraConstraints era => a) -> a forall a. a -> a id ShelleyToAllegraEra era ShelleyToAllegraEraAllegra -> a -> a (ShelleyToAllegraEraConstraints era => a) -> a forall a. a -> a id {-# DEPRECATED shelleyToAllegraEraToShelleyBasedEra "Use 'convert' instead." #-} shelleyToAllegraEraToShelleyBasedEra :: ShelleyToAllegraEra era -> ShelleyBasedEra era shelleyToAllegraEraToShelleyBasedEra :: forall era. ShelleyToAllegraEra era -> ShelleyBasedEra era shelleyToAllegraEraToShelleyBasedEra = ShelleyToAllegraEra era -> ShelleyBasedEra era forall era. ShelleyToAllegraEra era -> ShelleyBasedEra era forall a (f :: a -> *) (g :: a -> *) (era :: a). Convert f g => f era -> g era convert