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

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

import           NoThunks.Class (NoThunks, OnlyCheckWhnfNamed (..))

import           Ouroboros.Consensus.Ledger.Abstract
import           Ouroboros.Consensus.TypeFamilyWrappers

import           Ouroboros.Consensus.HardFork.Combinator.State.Types
import           Ouroboros.Consensus.HardFork.Combinator.Util.InPairs
                     (InPairs (..), RequiringBoth (..))

{-------------------------------------------------------------------------------
  Translate from one era to the next
-------------------------------------------------------------------------------}

data EraTranslation xs = EraTranslation {
      EraTranslation xs
-> InPairs
     (RequiringBoth WrapLedgerConfig (Translate LedgerState)) xs
translateLedgerState   :: InPairs (RequiringBoth WrapLedgerConfig    (Translate LedgerState))       xs
    , EraTranslation xs
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     xs
translateChainDepState :: InPairs (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState)) xs
    , EraTranslation xs
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (TranslateForecast LedgerState WrapLedgerView))
     xs
translateLedgerView    :: InPairs (RequiringBoth WrapLedgerConfig    (TranslateForecast 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
showTypeOf :: Proxy (EraTranslation xs) -> String
$cshowTypeOf :: forall (xs :: [*]). Proxy (EraTranslation xs) -> String
wNoThunks :: Context -> EraTranslation xs -> IO (Maybe ThunkInfo)
$cwNoThunks :: forall (xs :: [*]).
Context -> EraTranslation xs -> IO (Maybe ThunkInfo)
noThunks :: Context -> EraTranslation xs -> IO (Maybe ThunkInfo)
$cnoThunks :: forall (xs :: [*]).
Context -> EraTranslation xs -> IO (Maybe ThunkInfo)
NoThunks
       via OnlyCheckWhnfNamed "EraTranslation" (EraTranslation xs)

trivialEraTranslation :: EraTranslation '[blk]
trivialEraTranslation :: EraTranslation '[blk]
trivialEraTranslation = EraTranslation :: forall (xs :: [*]).
InPairs (RequiringBoth WrapLedgerConfig (Translate LedgerState)) xs
-> InPairs
     (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState))
     xs
-> InPairs
     (RequiringBoth
        WrapLedgerConfig (TranslateForecast LedgerState WrapLedgerView))
     xs
-> EraTranslation xs
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
    , translateLedgerView :: InPairs
  (RequiringBoth
     WrapLedgerConfig (TranslateForecast LedgerState WrapLedgerView))
  '[blk]
translateLedgerView    = InPairs
  (RequiringBoth
     WrapLedgerConfig (TranslateForecast 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
    }