@hackage / blockfrost-pretty

blockfrost.io pretty-printing utilities

Latest0.1.0.0

About

Metadata

  • Last updated , by srk
  • License Apache-2.0
  • Categories Web Development
  • Maintained by: srk@48.io

  • Lottery factor: 0

Links

Installation

Package Flags

Use the -f option with cabal commands to enable flags

    buildfast (on by default)

    Turn off optimizations

    production (off by default)

    Production build

Readme

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
123456 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