{-# 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 Control.DeepSeq
import Data.Map.Strict as Map

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

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

data SnapShotsM = SnapShotsM
  { SnapShotsM -> SnapShotM
ssPstakeMark :: !SnapShotM
  , SnapShotsM -> SnapShotM
ssPstakeSet :: !SnapShotM
  , SnapShotsM -> SnapShotM
ssPstakeGo :: !SnapShotM
  , SnapShotsM -> Coin
ssFeeSS :: !Coin
  }

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