{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingVia #-}

module Ouroboros.Consensus.HardFork.Combinator.Translation (
    -- * Translate from one era to the next
    EraTranslation (..)
  , trivialEraTranslation
  ) where

import           Data.SOP.InPairs (InPairs (..), RequiringBoth (..))
import           NoThunks.Class (NoThunks, OnlyCheckWhnfNamed (..))
import           Ouroboros.Consensus.HardFork.Combinator.State.Types
import           Ouroboros.Consensus.Ledger.Abstract
import           Ouroboros.Consensus.TypeFamilyWrappers
{-------------------------------------------------------------------------------
  Translate from one era to the next
-------------------------------------------------------------------------------}

data EraTranslation xs = EraTranslation {
      forall (xs :: [*]).
EraTranslation xs
-> InPairs
     (RequiringBoth WrapLedgerConfig (Translate LedgerState)) xs
translateLedgerState   :: InPairs (RequiringBoth WrapLedgerConfig    (Translate LedgerState))       xs
    , forall (xs :: [*]).
EraTranslation xs
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     xs
translateChainDepState :: InPairs (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState)) xs
    , forall (xs :: [*]).
EraTranslation xs
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
     xs
crossEraForecast       :: InPairs (RequiringBoth WrapLedgerConfig    (CrossEraForecaster LedgerState WrapLedgerView)) xs
    }
  deriving Context -> EraTranslation xs -> IO (Maybe ThunkInfo)
Proxy (EraTranslation xs) -> String
(Context -> EraTranslation xs -> IO (Maybe ThunkInfo))
-> (Context -> EraTranslation xs -> IO (Maybe ThunkInfo))
-> (Proxy (EraTranslation xs) -> String)
-> NoThunks (EraTranslation xs)
forall (xs :: [*]).
Context -> EraTranslation xs -> IO (Maybe ThunkInfo)
forall (xs :: [*]). Proxy (EraTranslation xs) -> String
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
$cnoThunks :: forall (xs :: [*]).
Context -> EraTranslation xs -> IO (Maybe ThunkInfo)
noThunks :: Context -> EraTranslation xs -> IO (Maybe ThunkInfo)
$cwNoThunks :: forall (xs :: [*]).
Context -> EraTranslation xs -> IO (Maybe ThunkInfo)
wNoThunks :: Context -> EraTranslation xs -> IO (Maybe ThunkInfo)
$cshowTypeOf :: forall (xs :: [*]). Proxy (EraTranslation xs) -> String
showTypeOf :: Proxy (EraTranslation xs) -> String
NoThunks
       via OnlyCheckWhnfNamed "EraTranslation" (EraTranslation xs)

trivialEraTranslation :: EraTranslation '[blk]
trivialEraTranslation :: forall blk. EraTranslation '[blk]
trivialEraTranslation = EraTranslation {
      translateLedgerState :: InPairs
  (RequiringBoth WrapLedgerConfig (Translate LedgerState)) '[blk]
translateLedgerState   = InPairs
  (RequiringBoth WrapLedgerConfig (Translate LedgerState)) '[blk]
forall {k} (f :: k -> k -> *) (x :: k). InPairs f '[x]
PNil
    , crossEraForecast :: InPairs
  (RequiringBoth
     WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
  '[blk]
crossEraForecast       = InPairs
  (RequiringBoth
     WrapLedgerConfig (CrossEraForecaster LedgerState WrapLedgerView))
  '[blk]
forall {k} (f :: k -> k -> *) (x :: k). InPairs f '[x]
PNil
    , translateChainDepState :: InPairs
  (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
  '[blk]
translateChainDepState = InPairs
  (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
  '[blk]
forall {k} (f :: k -> k -> *) (x :: k). InPairs f '[x]
PNil
    }