Skip to content

Commit

Permalink
bench: Remove dependency on microlens
Browse files Browse the repository at this point in the history
This just unfolds the definition of (^.) in terms of
Control.Applicative.Const in order to evade the import of the Lens
module and link to the microlens package. The lens getter appears to be
the sole accessor from data abstraction techniques used i.e. the import
and export of the Shelley TransitionConfig as an abstract type by
Cardano.Ledger.Api.Transition, so the explicitness and readability of
the dependency removal are unfortunately limited.
  • Loading branch information
NadiaYvette committed Oct 11, 2023
1 parent f1ce770 commit 9f26250
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ module Cardano.TxGenerator.Setup.NodeConfig
(module Cardano.TxGenerator.Setup.NodeConfig)
where

import Control.Applicative (Const (Const), getConst)
import Control.Monad.Trans.Except (runExceptT)
import Data.Bifunctor (first)
import Data.Monoid
import Lens.Micro ((^.))

import qualified Ouroboros.Consensus.Cardano as Consensus

import Cardano.Api (BlockType (..), ProtocolInfoArgs (..))
import qualified Cardano.Ledger.Api.Transition as Ledger
import qualified Cardano.Ledger.Api.Transition as Ledger (tcShelleyGenesisL)
import Cardano.Node.Configuration.POM
import Cardano.Node.Handlers.Shutdown (ShutdownConfig (..))
import Cardano.Node.Protocol.Cardano
Expand All @@ -32,7 +32,7 @@ import Cardano.TxGenerator.Types
-- as this guarantees proper error handling when trying to create a non-Cardano protocol.
getGenesis :: SomeConsensusProtocol -> ShelleyGenesis
getGenesis (SomeConsensusProtocol CardanoBlockType proto)
= transCfg ^. Ledger.tcShelleyGenesisL
= getConst $ Ledger.tcShelleyGenesisL Const transCfg
where
ProtocolInfoArgsCardano Consensus.CardanoProtocolParams
{ Consensus.ledgerTransitionConfig = transCfg
Expand Down
1 change: 0 additions & 1 deletion bench/tx-generator/tx-generator.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ library
, generic-monoid
, ghc-prim
, io-classes
, microlens
, mtl
, network
, network-mux
Expand Down

0 comments on commit 9f26250

Please sign in to comment.