{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}

module Cardano.Ledger.State.Vector where

import Cardano.Ledger.Coin
import Cardano.Ledger.Credential
import Cardano.Ledger.Keys as Keys
import Cardano.Ledger.PoolParams
import Cardano.Ledger.State.UTxO
import Control.DeepSeq
import Data.Map.Strict as Map

data SnapShotM c = SnapShotM
  { forall c.
SnapShotM c -> Map (Credential 'Staking c) (CompactForm Coin)
ssStake :: !(Map (Credential 'Staking c) (CompactForm Coin))
  , forall c.
SnapShotM c -> Map (Credential 'Staking c) (KeyHash 'StakePool c)
ssDelegations :: !(Map (Credential 'Staking c) (KeyHash 'StakePool c))
  , forall c. SnapShotM c -> Map (KeyHash 'StakePool c) (PoolParams c)
ssPoolParams :: !(Map (KeyHash 'StakePool c) (PoolParams c))
  }

instance NFData (SnapShotM C) where
  rnf :: SnapShotM C -> ()
rnf (SnapShotM Map (Credential 'Staking C) (CompactForm Coin)
s Map (Credential 'Staking C) (KeyHash 'StakePool C)
d Map (KeyHash 'StakePool C) (PoolParams C)
p) = Map (Credential 'Staking C) (CompactForm Coin)
s forall a b. NFData a => a -> b -> b
`deepseq` Map (Credential 'Staking C) (KeyHash 'StakePool C)
d forall a b. NFData a => a -> b -> b
`deepseq` forall a. NFData a => a -> ()
rnf Map (KeyHash 'StakePool C) (PoolParams C)
p

data SnapShotsM c = SnapShotsM
  { forall c. SnapShotsM c -> SnapShotM c
ssPstakeMark :: !(SnapShotM c)
  , forall c. SnapShotsM c -> SnapShotM c
ssPstakeSet :: !(SnapShotM c)
  , forall c. SnapShotsM c -> SnapShotM c
ssPstakeGo :: !(SnapShotM c)
  , forall c. SnapShotsM c -> Coin
ssFeeSS :: !Coin
  }

instance NFData (SnapShotsM C) where
  rnf :: SnapShotsM C -> ()
rnf (SnapShotsM SnapShotM C
r SnapShotM C
s SnapShotM C
g Coin
f) = SnapShotM C
r forall a b. NFData a => a -> b -> b
`deepseq` SnapShotM C
s forall a b. NFData a => a -> b -> b
`deepseq` SnapShotM C
g forall a b. NFData a => a -> b -> b
`deepseq` forall a. NFData a => a -> ()
rnf Coin
f