@hackage blockfrost-pretty0.1.0.0

blockfrost.io pretty-printing utilities

blockfrost-pretty

Pretty printing for Ada/Lovelace values and some Blockfrost types.

Example of pretty printing lovelace values.

λ: :set -XNumericUnderscores
λ: import Blockfrost.Pretty
λ: import Data.Text.IO
λ: Data.Text.IO.putStrLn $ prettyLovelaces 123_456
123 456 lovelaces
λ: Data.Text.IO.putStrLn $ prettyLovelaces 42_123_456
42.123456 ₳
λ: Data.Text.IO.putStrLn $ prettyLovelaces' testnetConfig 42_123_456
42.123456 t₳
λ: Data.Text.IO.putStrLn $ prettyLovelaces' (testnetConfig { pcUnicode = False }) 42_123_456
42.123456 tADA

Using Prettyprinter

To pretty print a Block to terminal with colors, we use prettyprinter package with prettyprinter-ansi-terminal.

Example:

λ: import Prettyprinter
λ: import Prettyprinter.Render.Terminal
λ: import Data.Text.IO

λ: Data.Text.IO.putStrLn $ renderStrict $ layoutPretty defaultLayoutOptions $ prettyBlock b