From 9f2625041757bce92d26aa82f904896c7023000b Mon Sep 17 00:00:00 2001 From: Nadia Yvette Chambers Date: Mon, 9 Oct 2023 12:52:25 -0400 Subject: [PATCH] bench: Remove dependency on microlens 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. --- .../src/Cardano/TxGenerator/Setup/NodeConfig.hs | 6 +++--- bench/tx-generator/tx-generator.cabal | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/bench/tx-generator/src/Cardano/TxGenerator/Setup/NodeConfig.hs b/bench/tx-generator/src/Cardano/TxGenerator/Setup/NodeConfig.hs index 60bb91d10a0..890b0275d7b 100644 --- a/bench/tx-generator/src/Cardano/TxGenerator/Setup/NodeConfig.hs +++ b/bench/tx-generator/src/Cardano/TxGenerator/Setup/NodeConfig.hs @@ -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 @@ -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 diff --git a/bench/tx-generator/tx-generator.cabal b/bench/tx-generator/tx-generator.cabal index 64b8b5435be..a93b757e000 100644 --- a/bench/tx-generator/tx-generator.cabal +++ b/bench/tx-generator/tx-generator.cabal @@ -120,7 +120,6 @@ library , generic-monoid , ghc-prim , io-classes - , microlens , mtl , network , network-mux