diff --git a/cardano-cli/app/cardano-cli.hs b/cardano-cli/app/cardano-cli.hs index 9d5be599c3..79cdef1250 100644 --- a/cardano-cli/app/cardano-cli.hs +++ b/cardano-cli/app/cardano-cli.hs @@ -5,8 +5,7 @@ #define UNIX #endif -import Cardano.CLI.Pretty - +import Cardano.Api import Cardano.CLI.Environment (getEnvCli) import Cardano.CLI.Options (opts, pref) import Cardano.CLI.Run (renderClientCommandError, runClientCommand) diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index bf9e38350b..e27fe19994 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -135,7 +135,6 @@ library Cardano.CLI.Options.Ping Cardano.CLI.Orphans Cardano.CLI.Parser - Cardano.CLI.Pretty Cardano.CLI.Read Cardano.CLI.Render Cardano.CLI.Run @@ -261,6 +260,7 @@ executable cardano-cli -with-rtsopts=-T build-depends: + cardano-api, cardano-cli, cardano-crypto-class ^>=2.1.2, optparse-applicative-fork, @@ -395,7 +395,6 @@ test-suite cardano-cli-golden tasty-hedgehog, text, time, - transformers, unordered-containers, build-tool-depends: diff --git a/cardano-cli/src/Cardano/CLI/Byron/Genesis.hs b/cardano-cli/src/Cardano/CLI/Byron/Genesis.hs index 2abec861bb..0b19f95671 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Genesis.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Genesis.hs @@ -12,18 +12,18 @@ module Cardano.CLI.Byron.Genesis ) where -import Cardano.Api (Key (..), NetworkId, writeSecrets) +import Cardano.Api (Doc, Key (..), NetworkId, pretty, pshow, writeSecrets) import Cardano.Api.Byron (ByronKey, SerialiseAsRawBytes (..), SigningKey (..), toByronRequiresNetworkMagic) import qualified Cardano.Api.Byron as Byron import Cardano.CLI.Byron.Delegation import Cardano.CLI.Byron.Key -import Cardano.CLI.Pretty import Cardano.CLI.Types.Common (GenesisFile (..)) import qualified Cardano.Crypto as Crypto import Cardano.Prelude (canonicalDecodePretty, canonicalEncodePretty) +import Control.Monad.IO.Class import Control.Monad.Trans (MonadTrans (..)) import Control.Monad.Trans.Except (ExceptT (..), withExceptT) import Control.Monad.Trans.Except.Extra (firstExceptT, left, right) diff --git a/cardano-cli/src/Cardano/CLI/Byron/UpdateProposal.hs b/cardano-cli/src/Cardano/CLI/Byron/UpdateProposal.hs index 0c81225b0f..cc874b277b 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/UpdateProposal.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/UpdateProposal.hs @@ -11,7 +11,7 @@ module Cardano.CLI.Byron.UpdateProposal ) where -import Cardano.Api (NetworkId, SerialiseAsRawBytes (..), SocketPath) +import Cardano.Api import Cardano.Api.Byron (AsType (AsByronUpdateProposal), ByronProtocolParametersUpdate, ByronUpdateProposal, makeByronUpdateProposal, toByronLedgerUpdateProposal) import qualified Cardano.Api.Byron as Byron @@ -20,14 +20,11 @@ import Cardano.CLI.Byron.Genesis (ByronGenesisError) import Cardano.CLI.Byron.Key (ByronKeyFailure, readByronSigningKey) import Cardano.CLI.Byron.Tx (ByronTxError, nodeSubmitTx) import Cardano.CLI.Helpers (HelpersError, ensureNewFileLBS, renderHelpersError) -import Cardano.CLI.Pretty import Cardano.CLI.Types.Common import Ouroboros.Consensus.Ledger.SupportsMempool (txId) import Ouroboros.Consensus.Util.Condense (condense) import Control.Exception (Exception (..)) -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra (firstExceptT, handleIOExceptT, hoistEither) import Control.Tracer (stdoutTracer, traceWith) import Data.Bifunctor (Bifunctor (..)) import qualified Data.ByteString as BS diff --git a/cardano-cli/src/Cardano/CLI/Commands.hs b/cardano-cli/src/Cardano/CLI/Commands.hs index 5ab201ddb0..906e38523a 100644 --- a/cardano-cli/src/Cardano/CLI/Commands.hs +++ b/cardano-cli/src/Cardano/CLI/Commands.hs @@ -13,7 +13,6 @@ import Cardano.CLI.Commands.Key import Cardano.CLI.Commands.Node import Cardano.CLI.Commands.Ping (PingCmd (..)) import Cardano.CLI.Compatible.Commands -import Cardano.CLI.EraBased.Commands import Cardano.CLI.EraBased.Commands.Query import Cardano.CLI.EraBased.Commands.TopLevelCommands import Cardano.CLI.Legacy.Commands diff --git a/cardano-cli/src/Cardano/CLI/Helpers.hs b/cardano-cli/src/Cardano/CLI/Helpers.hs index 04a5be4852..9f7eb8deda 100644 --- a/cardano-cli/src/Cardano/CLI/Helpers.hs +++ b/cardano-cli/src/Cardano/CLI/Helpers.hs @@ -18,11 +18,10 @@ module Cardano.CLI.Helpers ) where -import Cardano.Api (AnyCardanoEra (..), CardanoEra (ConwayEra), ToCardanoEra (..)) +import Cardano.Api import qualified Cardano.Api.Byron as Byron import qualified Cardano.Api.Ledger as L -import Cardano.CLI.Pretty (Doc, pretty, pshow) import Cardano.CLI.Types.Common import Codec.CBOR.Pretty (prettyHexEnc) @@ -30,9 +29,6 @@ import Codec.CBOR.Read (DeserialiseFailure, deserialiseFromBytes) import Codec.CBOR.Term (decodeTerm, encodeTerm) import Control.Exception (Exception (..), IOException) import Control.Monad (unless, when) -import Control.Monad.IO.Class (MonadIO (..)) -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra (handleIOExceptT, left) import Data.Bifunctor (Bifunctor (..)) import Data.ByteString (ByteString) import qualified Data.ByteString as BS diff --git a/cardano-cli/src/Cardano/CLI/Pretty.hs b/cardano-cli/src/Cardano/CLI/Pretty.hs deleted file mode 100644 index a7ac199083..0000000000 --- a/cardano-cli/src/Cardano/CLI/Pretty.hs +++ /dev/null @@ -1,29 +0,0 @@ -module Cardano.CLI.Pretty - ( -- Re-exported functions from Cardano.Api related to pretty-printing - black - , blue - , cyan - , docToLazyText - , docToString - , docToText - , green - , magenta - , prettyException - , pshow - , red - , white - , yellow - , (<+>) - , hsep - , vsep - , MonadIO (..) - , Ann - , ShowOf (..) - , Doc - , Pretty (..) - ) -where - -import Cardano.Api (Ann, Doc, MonadIO (..), Pretty (..), ShowOf (..), black, blue, cyan, - docToLazyText, docToString, docToText, green, hsep, magenta, prettyException, - pshow, red, vsep, white, yellow, (<+>)) diff --git a/cardano-cli/src/Cardano/CLI/Run/Ping.hs b/cardano-cli/src/Cardano/CLI/Run/Ping.hs index 5ac32a09db..09c3e6695e 100644 --- a/cardano-cli/src/Cardano/CLI/Run/Ping.hs +++ b/cardano-cli/src/Cardano/CLI/Run/Ping.hs @@ -9,8 +9,9 @@ module Cardano.CLI.Run.Ping ) where +import Cardano.Api + import Cardano.CLI.Commands.Ping -import Cardano.CLI.Pretty import qualified Cardano.Network.Ping as CNP import Control.Concurrent.Class.MonadSTM.Strict (StrictTMVar) @@ -18,9 +19,6 @@ import qualified Control.Concurrent.Class.MonadSTM.Strict as STM import Control.Exception (SomeException) import Control.Monad (forM, unless) import Control.Monad.Class.MonadAsync (MonadAsync (async, wait, waitCatch)) -import Control.Monad.Except (throwError) -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra (left) import Control.Tracer (Tracer (..)) import qualified Data.List as L import qualified Data.List as List diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/QueryCmdLocalStateQueryError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/QueryCmdLocalStateQueryError.hs index 5ceff770aa..6b9a5f8042 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/QueryCmdLocalStateQueryError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/QueryCmdLocalStateQueryError.hs @@ -7,9 +7,8 @@ module Cardano.CLI.Types.Errors.QueryCmdLocalStateQueryError ) where -import Cardano.Api (Error (..)) +import Cardano.Api -import Cardano.CLI.Pretty import Cardano.CLI.Types.Errors.NodeEraMismatchError import Ouroboros.Consensus.Cardano.Block (EraMismatch (..)) diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/UpdateProposal.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/UpdateProposal.hs index 6e344ce4c1..aefc49c96c 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/UpdateProposal.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/UpdateProposal.hs @@ -2,11 +2,11 @@ module Test.Golden.Byron.UpdateProposal where +import Cardano.Api + import Cardano.CLI.Byron.UpdateProposal -import Cardano.CLI.Pretty import Control.Monad (void) -import Control.Monad.Trans.Except (runExceptT) import Test.Cardano.CLI.Util diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Vote.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Vote.hs index 65cbd9daf1..118d2a3e00 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Vote.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Vote.hs @@ -2,11 +2,11 @@ module Test.Golden.Byron.Vote where +import Cardano.Api + import Cardano.CLI.Byron.Vote -import Cardano.CLI.Pretty import Control.Monad (void) -import Control.Monad.Trans.Except (runExceptT) import Test.Cardano.CLI.Util