{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Cardano.Ledger.Alonzo.Forecast () where

import Cardano.Ledger.Alonzo.Era (AlonzoEra)
import Cardano.Ledger.Alonzo.PParams ()
import Cardano.Ledger.Alonzo.State.CertState ()
import Cardano.Ledger.Shelley (
  ShelleyForecast (..),
  mkShelleyForecast,
  sfDecentralizationL,
  sfExtraEntropyL,
  sfGenDelegsL,
  sfMaxBlockBodySizeL,
  sfMaxBlockHeaderSizeL,
  sfPoolDistrL,
  sfProtocolVersionL,
 )
import Cardano.Ledger.Shelley.API.Forecast (EraForecast (..), ShelleyEraForecast (..))

instance EraForecast AlonzoEra where
  type Forecast t AlonzoEra = ShelleyForecast t AlonzoEra
  mkForecast :: forall (t :: Timeline).
NewEpochState AlonzoEra -> Forecast t AlonzoEra
mkForecast = NewEpochState AlonzoEra -> Forecast t AlonzoEra
NewEpochState AlonzoEra -> ShelleyForecast t AlonzoEra
forall era (t :: Timeline).
(AtMostEra "Alonzo" era, EraGov era, EraCertState era) =>
NewEpochState era -> ShelleyForecast t era
mkShelleyForecast
  poolDistrForecastL :: forall (t :: Timeline). Lens' (Forecast t AlonzoEra) PoolDistr
poolDistrForecastL = (PoolDistr -> f PoolDistr)
-> Forecast t AlonzoEra -> f (Forecast t AlonzoEra)
(PoolDistr -> f PoolDistr)
-> ShelleyForecast t AlonzoEra -> f (ShelleyForecast t AlonzoEra)
forall (t :: Timeline) era (f :: * -> *).
Functor f =>
(PoolDistr -> f PoolDistr)
-> ShelleyForecast t era -> f (ShelleyForecast t era)
sfPoolDistrL
  maxBlockHeaderSizeForecastL :: forall (t :: Timeline). Lens' (Forecast t AlonzoEra) Word16
maxBlockHeaderSizeForecastL = (Word16 -> f Word16)
-> Forecast t AlonzoEra -> f (Forecast t AlonzoEra)
(Word16 -> f Word16)
-> ShelleyForecast t AlonzoEra -> f (ShelleyForecast t AlonzoEra)
forall (t :: Timeline) era (f :: * -> *).
Functor f =>
(Word16 -> f Word16)
-> ShelleyForecast t era -> f (ShelleyForecast t era)
sfMaxBlockHeaderSizeL
  maxBlockBodySizeForecastL :: forall (t :: Timeline). Lens' (Forecast t AlonzoEra) Word32
maxBlockBodySizeForecastL = (Word32 -> f Word32)
-> Forecast t AlonzoEra -> f (Forecast t AlonzoEra)
(Word32 -> f Word32)
-> ShelleyForecast t AlonzoEra -> f (ShelleyForecast t AlonzoEra)
forall (t :: Timeline) era (f :: * -> *).
Functor f =>
(Word32 -> f Word32)
-> ShelleyForecast t era -> f (ShelleyForecast t era)
sfMaxBlockBodySizeL
  protocolVersionForecastL :: forall (t :: Timeline). Lens' (Forecast t AlonzoEra) ProtVer
protocolVersionForecastL = (ProtVer -> f ProtVer)
-> Forecast t AlonzoEra -> f (Forecast t AlonzoEra)
(ProtVer -> f ProtVer)
-> ShelleyForecast t AlonzoEra -> f (ShelleyForecast t AlonzoEra)
forall (t :: Timeline) era (f :: * -> *).
Functor f =>
(ProtVer -> f ProtVer)
-> ShelleyForecast t era -> f (ShelleyForecast t era)
sfProtocolVersionL

instance ShelleyEraForecast AlonzoEra where
  genDelegsForecastL :: forall (t :: Timeline). Lens' (Forecast t AlonzoEra) GenDelegs
genDelegsForecastL = (GenDelegs -> f GenDelegs)
-> Forecast t AlonzoEra -> f (Forecast t AlonzoEra)
(GenDelegs -> f GenDelegs)
-> ShelleyForecast t AlonzoEra -> f (ShelleyForecast t AlonzoEra)
forall (t :: Timeline) era (f :: * -> *).
Functor f =>
(GenDelegs -> f GenDelegs)
-> ShelleyForecast t era -> f (ShelleyForecast t era)
sfGenDelegsL
  decentralizationForecastL :: forall (t :: Timeline). Lens' (Forecast t AlonzoEra) UnitInterval
decentralizationForecastL = (UnitInterval -> f UnitInterval)
-> Forecast t AlonzoEra -> f (Forecast t AlonzoEra)
(UnitInterval -> f UnitInterval)
-> ShelleyForecast t AlonzoEra -> f (ShelleyForecast t AlonzoEra)
forall (t :: Timeline) era (f :: * -> *).
Functor f =>
(UnitInterval -> f UnitInterval)
-> ShelleyForecast t era -> f (ShelleyForecast t era)
sfDecentralizationL
  extraEntropyForecastL :: forall (t :: Timeline). Lens' (Forecast t AlonzoEra) Nonce
extraEntropyForecastL = (Nonce -> f Nonce)
-> Forecast t AlonzoEra -> f (Forecast t AlonzoEra)
(Nonce -> f Nonce)
-> ShelleyForecast t AlonzoEra -> f (ShelleyForecast t AlonzoEra)
forall (t :: Timeline) era (f :: * -> *).
Functor f =>
(Nonce -> f Nonce)
-> ShelleyForecast t era -> f (ShelleyForecast t era)
sfExtraEntropyL