diff --git a/cardano-api/internal/Cardano/Api/Pretty.hs b/cardano-api/internal/Cardano/Api/Pretty.hs index 73c6b41c9b..b5cff832d3 100644 --- a/cardano-api/internal/Cardano/Api/Pretty.hs +++ b/cardano-api/internal/Cardano/Api/Pretty.hs @@ -1,8 +1,10 @@ module Cardano.Api.Pretty ( Ann + , Doc , Pretty(..) , ShowOf(..) , viaShow + , prettyToLazyText , prettyToText , prettyToString , pshow @@ -17,6 +19,7 @@ module Cardano.Api.Pretty , white ) where +import qualified Data.Text as Text import qualified Data.Text.Lazy as TextLazy import Prettyprinter import Prettyprinter.Render.Terminal @@ -34,8 +37,11 @@ instance Show a => Pretty (ShowOf a) where prettyToString :: Doc AnsiStyle -> String prettyToString = show -prettyToText :: Doc AnsiStyle -> TextLazy.Text -prettyToText = renderLazy . layoutPretty defaultLayoutOptions +prettyToLazyText :: Doc AnsiStyle -> TextLazy.Text +prettyToLazyText = renderLazy . layoutPretty defaultLayoutOptions + +prettyToText :: Doc AnsiStyle -> Text.Text +prettyToText = TextLazy.toStrict . prettyToLazyText black :: Doc AnsiStyle -> Doc AnsiStyle black = annotate (color Black)