Skip to content

Commit

Permalink
Add various NFData instances
Browse files Browse the repository at this point in the history
  • Loading branch information
HeinrichApfelmus committed Apr 1, 2023
1 parent 80fec43 commit fdb17a5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/balance-tx/cardano-balance-tx.cabal
Expand Up @@ -43,6 +43,7 @@ library
, cardano-wallet-primitive
, cardano-wallet-test-utils
, containers
, deepseq
, fmt
, generic-lens
, generics-sop
Expand Down
Expand Up @@ -117,6 +117,8 @@ import Cardano.Wallet.Primitive.Types.UTxOSelection
( UTxOSelection )
import Control.Arrow
( (&&&) )
import Control.DeepSeq
( NFData )
import Control.Monad.Random.Class
( MonadRandom (..) )
import Control.Monad.Trans.Except
Expand Down Expand Up @@ -414,6 +416,8 @@ data SelectionOf change = Selection
}
deriving (Generic, Eq, Show)

instance NFData change => NFData (SelectionOf change)

-- | The default type of selection.
--
-- In this type of selection, change values do not have addresses assigned.
Expand Down
4 changes: 3 additions & 1 deletion lib/wallet/src/Cardano/Wallet.hs
Expand Up @@ -2850,7 +2850,9 @@ calcMinimumDeposit DBLayer{..} netLayer wid =
data DelegationFee = DelegationFee
{ feePercentiles :: (Percentile 10 Fee, Percentile 90 Fee)
, deposit :: Coin
}
} deriving (Generic)

instance NFData DelegationFee

delegationFee
:: forall s k (n :: NetworkDiscriminant)
Expand Down
4 changes: 4 additions & 0 deletions lib/wallet/src/Cardano/Wallet/Primitive/Migration.hs
Expand Up @@ -34,6 +34,8 @@ import Cardano.Wallet.Primitive.Types.Tx.TxOut
( TxOut )
import Cardano.Wallet.Primitive.Types.UTxO
( UTxO )
import Control.DeepSeq
( NFData )
import Data.Generics.Internal.VL.Lens
( view )
import Data.Generics.Labels
Expand All @@ -59,6 +61,8 @@ data MigrationPlan = MigrationPlan
}
deriving (Eq, Generic, Show)

instance NFData MigrationPlan

-- | Creates a migration plan for the given UTxO set and reward withdrawal
-- amount.
--
Expand Down
Expand Up @@ -72,6 +72,8 @@ import Cardano.Wallet.Primitive.Types.Tx.Constraints
, txOutputHasValidSize
, txOutputHasValidTokenQuantities
)
import Control.DeepSeq
( NFData )
import Control.Monad
( (>=>) )
import Data.Bifunctor
Expand Down Expand Up @@ -125,6 +127,8 @@ data Selection input = Selection
}
deriving (Eq, Generic, Show)

instance NFData input => NFData (Selection input)

newtype RewardWithdrawal = RewardWithdrawal
{ unRewardWithdrawal :: Coin }
deriving (Eq, Show)
Expand Down

0 comments on commit fdb17a5

Please sign in to comment.