@hackage blockfrost-pretty0.1.0.0
blockfrost.io pretty-printing utilities
Categories
License
Apache-2.0
Maintainer
srk@48.io
Links
Versions
- 0.1.0.0 Tue, 14 Sep 2021
Installation
Dependencies (9)
Dependents (0)
Package Flags
buildfast
(on by default)
Turn off optimizations
production
(off by default)
Production build
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