blockfrost-pretty: blockfrost.io pretty-printing utilities

[ apache, library, web ] [ Propose Tags ] [ Report a vulnerability ]

prettyprinter Docs and standalone prettyPrinters


[Skip to Readme]

Flags

Manual Flags

NameDescriptionDefault
production

Production build

Disabled
Automatic Flags
NameDescriptionDefault
buildfast

Turn off optimizations

Enabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0
Change log CHANGELOG.md
Dependencies base (>=4.7 && <5), blockfrost-api, data-default, lens, prettyprinter, prettyprinter-ansi-terminal, safe-money, text, time [details]
License Apache-2.0
Copyright 2021 blockfrost.io
Author blockfrost.io
Maintainer srk@48.io
Category Web
Home page https://github.com/blockfrost/blockfrost-haskell
Source repo head: git clone https://github.com/blockfrost/blockfrost-haskell
Uploaded by srk at 2021-09-14T12:24:11Z
Distributions NixOS:0.1.0.0
Downloads 257 total (6 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2021-09-14 [all 1 reports]

Readme for blockfrost-pretty-0.1.0.0

[back to package description]

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