Skip to content

Commit

Permalink
Reformat to fourmolu's taste
Browse files Browse the repository at this point in the history
  • Loading branch information
teodanciu committed Sep 14, 2023
1 parent 56f8bcb commit 5c2617c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
13 changes: 8 additions & 5 deletions eras/babbage/impl/src/Cardano/Ledger/Babbage/PParams.hs
Original file line number Diff line number Diff line change
Expand Up @@ -509,11 +509,14 @@ upgradeBabbagePParams updateCoinsPerUTxOWord AlonzoPParams {..} =
, bppTau = appTau
, bppProtocolVersion = appProtocolVersion
, bppMinPoolCost = appMinPoolCost
, bppCoinsPerUTxOByte = hkdMap (Proxy @f)
(if updateCoinsPerUTxOWord then
coinsPerUTxOWordToCoinsPerUTxOByte else
coinsPerUTxOWordToCoinsPerUTxOByteInTx)
appCoinsPerUTxOWord
, bppCoinsPerUTxOByte =
hkdMap
(Proxy @f)
( if updateCoinsPerUTxOWord
then coinsPerUTxOWordToCoinsPerUTxOByte
else coinsPerUTxOWordToCoinsPerUTxOByteInTx
)
appCoinsPerUTxOWord
, bppCostModels = appCostModels
, bppPrices = appPrices
, bppMaxTxExUnits = appMaxTxExUnits
Expand Down
9 changes: 5 additions & 4 deletions eras/babbage/impl/src/Cardano/Ledger/Babbage/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,25 @@ import Cardano.Ledger.Babbage.TxBody (
BabbageEraTxBody (..),
BabbageEraTxOut (..),
BabbageTxBody (..),
dataHashTxOutL, BabbageTxBodyUpgradeError,
BabbageTxBodyUpgradeError,
dataHashTxOutL,
)
import Cardano.Ledger.Babbage.TxWits ()
import Cardano.Ledger.Core
import Cardano.Ledger.Crypto
import Cardano.Ledger.TxIn (TxIn)
import Cardano.Ledger.UTxO (UTxO (..))
import Control.Applicative ((<|>))
import Control.Arrow (left)
import Control.SetAlgebra (eval, (◁))
import qualified Data.Map.Strict as Map
import Data.Maybe.Strict (StrictMaybe (SJust, SNothing), strictMaybeToMaybe)
import Data.Set (Set)
import qualified Data.Set as Set
import Lens.Micro
import Control.Arrow (left)

newtype BabbageTxUpgradeError =
BTUEBodyUpgradeError BabbageTxBodyUpgradeError
newtype BabbageTxUpgradeError
= BTUEBodyUpgradeError BabbageTxBodyUpgradeError
deriving (Eq, Show)

instance Crypto c => EraTx (BabbageEra c) where
Expand Down
22 changes: 12 additions & 10 deletions eras/babbage/impl/src/Cardano/Ledger/Babbage/TxBody.hs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ module Cardano.Ledger.Babbage.TxBody (

import Cardano.Ledger.Allegra.Scripts (ValidityInterval (..))
import Cardano.Ledger.Alonzo (AlonzoEra)
import Cardano.Ledger.Alonzo.PParams (AlonzoPParams (appExtraEntropy), appD)
import Cardano.Ledger.Alonzo.Scripts.Data (Datum (..))
import Cardano.Ledger.Alonzo.TxAuxData (AuxiliaryDataHash (..))
import Cardano.Ledger.Alonzo.TxBody as AlonzoTxBodyReExports (
Expand All @@ -127,7 +128,8 @@ import Cardano.Ledger.Babbage.TxCert ()
import Cardano.Ledger.Babbage.TxOut hiding (TxOut)
import Cardano.Ledger.BaseTypes (
Network (..),
StrictMaybe (..), isSJust,
StrictMaybe (..),
isSJust,
)
import Cardano.Ledger.Binary (
Annotator (..),
Expand Down Expand Up @@ -160,7 +162,9 @@ import Cardano.Ledger.Shelley.PParams (ProposedPPUpdates (ProposedPPUpdates), Up
import Cardano.Ledger.Shelley.TxBody (totalTxDepositsShelley)
import Cardano.Ledger.TreeDiff (ToExpr)
import Cardano.Ledger.TxIn (TxIn (..))
import Control.Arrow (left)
import Control.DeepSeq (NFData)
import Control.Monad (when)
import Data.Sequence.Strict (StrictSeq, (|>))
import qualified Data.Sequence.Strict as StrictSeq
import Data.Set (Set)
Expand All @@ -170,9 +174,6 @@ import GHC.Generics (Generic)
import Lens.Micro
import NoThunks.Class (NoThunks)
import Prelude hiding (lookup)
import Cardano.Ledger.Alonzo.PParams (AlonzoPParams(appExtraEntropy), appD)
import Control.Monad (when)
import Control.Arrow (left)

-- ======================================

Expand Down Expand Up @@ -428,8 +429,8 @@ allSizedOutputsBabbageTxBodyF =
SJust collTxOut -> txOuts |> collTxOut
{-# INLINEABLE allSizedOutputsBabbageTxBodyF #-}

data BabbageTxBodyUpgradeError =
-- | The update attempts to update the decentralistion parameter, which is
data BabbageTxBodyUpgradeError
= -- | The update attempts to update the decentralistion parameter, which is
-- dropped in Babbage.
BTBUEUpdatesD
| -- | The update attempts to update the extra entropy, which is dropped in
Expand Down Expand Up @@ -491,8 +492,9 @@ instance Crypto c => EraTxBody (BabbageEra c) where
( error "upgradeTxCert has a Void error type, so this error cannot occur"
)
. upgradeTxCert
) atbCerts
updates <- traverse upgradeUpdate atbUpdate
)
atbCerts
updates <- traverse upgradeUpdate atbUpdate
pure $
BabbageTxBody
{ btbInputs = atbInputs
Expand Down Expand Up @@ -527,8 +529,8 @@ instance Crypto c => EraTxBody (BabbageEra c) where
ProposedPPUpdates (AlonzoEra c) ->
Either BabbageTxBodyUpgradeError (ProposedPPUpdates (BabbageEra c))
upgradeProposedPPUpdates (ProposedPPUpdates m) =
ProposedPPUpdates <$>
traverse
ProposedPPUpdates
<$> traverse
( \(PParamsUpdate pphkd) -> do
when (isSJust $ appD pphkd) $
Left BTBUEUpdatesD
Expand Down

0 comments on commit 5c2617c

Please sign in to comment.