pretty-show-1.2: Tools for working with derived Show instances.

PortabilityHaskell 98
Stabilityprovisional
Maintaineriavor.diatchki@gmail.com

Text.Show.Pretty

Description

Functions for human-readable derived Show instances.

Synopsis

Documentation

type Name = StringSource

A name.

data Value Source

Generic Haskell values. NaN and Infinity are represented as constructors. The String in the literals is the text for the literals "as is".

Constructors

Con Name [Value]

Data constructor

Rec Name [(Name, Value)]

Record value

Tuple [Value]

Tuple

List [Value]

List

Neg Value

Negated value

Ratio Value Value

Rational

Integer String

Non-negative integer

Float String

Non-negative floating num.

Char String

Character

String String

String

Instances

ppValue :: Value -> DocSource

Pretty print a generic value. Our intention is that the result is equivalent to the Show instance for the original value, except possibly easier to understand by a human.

ppDoc :: Show a => a -> DocSource

Try to show a value, prettily. If we do not understand the value, then we just use its standard Show instance.

ppShow :: Show a => a -> StringSource

Convert a generic value into a pretty String, if possible.