bech32-th-1.1.1: Template Haskell extensions to the Bech32 library.
Copyright© 2020 IOHK
LicenseApache-2.0
Safe HaskellNone
LanguageHaskell2010

Codec.Binary.Bech32.TH

Description

This module contains Template-Haskell-specific extensions to the Bech32 library.

Synopsis

Quasi-Quotation Support

humanReadablePart :: QuasiQuoter Source #

A quasiquoter for Bech32 human-readable prefixes.

This quasiquoter makes it possible to construct values of type HumanReadablePart at compile time, using string literals.

Failure to parse a string literal will result in a compile-time error.

See HumanReadablePartError for the set of possible errors that can be raised.

Example:

>>> :set -XQuasiQuotes
>>> import Codec.Binary.Bech32
>>> import Codec.Binary.Bech32.TH
>>> let addrPrefix = [humanReadablePart|addr|]
>>> addrPrefix
HumanReadablePart "addr"
>>> :t addrPrefix
addrPrefix :: HumanReadablePart