blockfrost-pretty: blockfrost.io pretty-printing utilities

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Warnings:

prettyprinter Docs and standalone prettyPrinters


[Skip to Readme]

Properties

Versions 0.1.0.0, 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-14T11:08:30Z

Modules

[Index] [Quick Jump]

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


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