emgm-0.4: Extensible and Modular Generics for the Masses

Portabilitynon-portable
Stabilityexperimental
Maintainergenerics@haskell.org

Generics.EMGM.Functions.Show

Description

Summary: Generic functions that convert values to readable strings.

The functions in this module involve generically producing a string from a value of a supported datatype. The functions showsPrec and show are modeled after those in the class Show, and shows after the related function of the same name.

The underlying unparser is designed to be as similar to deriving Show as possible. Refer to documentation in Text.Show for details.

Since this library does not have access to the syntax of a data declaration, it relies on ConDescr for information. It is important that ConDescr accurately describe, for each constructor, the name, arity, record labels (in same order as declared) if present, and fixity.

See also Generics.EMGM.Functions.Read.

Synopsis

Documentation

newtype Show a Source

The type of a generic function that takes a constructor-type argument, a number (precedence), and a value and returns a ShowS function.

Constructors

Show 

Fields

selShow :: ConType -> Int -> a -> ShowS
 

Instances

Generic Show 
Rep Show String

Ad-hoc instance for strings

Rep Show ()

Ad-hoc instance for ()

Rep Show a => Rep Show [a]

Ad-hoc instance for lists

(Rep Show a, Rep Show b) => Rep Show (a, b)

Ad-hoc instance for (a,b)

(Rep Show a, Rep Show b, Rep Show c) => Rep Show (a, b, c)

Ad-hoc instance for (a,b,c)

(Rep Show a, Rep Show b, Rep Show c, Rep Show d) => Rep Show (a, b, c, d)

Ad-hoc instance for (a,b,c,d)

(Rep Show a, Rep Show b, Rep Show c, Rep Show d, Rep Show e) => Rep Show (a, b, c, d, e)

Ad-hoc instance for (a,b,c,d,e)

(Rep Show a, Rep Show b, Rep Show c, Rep Show d, Rep Show e, Rep Show f) => Rep Show (a, b, c, d, e, f)

Ad-hoc instance for (a,b,c,d,e,f)

(Rep Show a, Rep Show b, Rep Show c, Rep Show d, Rep Show e, Rep Show f, Rep Show h) => Rep Show (a, b, c, d, e, f, h)

Ad-hoc instance for (a,b,c,d,e,f,h)

showsPrecSource

Arguments

:: Rep Show a 
=> Int

Operator precedence of the enclosing context (a number from 0 to 11).

-> a

The value to be converted to a String.

-> ShowS 

Convert a value to a readable string starting with the operator precedence of the enclosing context.

shows :: Rep Show a => a -> ShowSSource

A variant of showsPrec with the minimum precedence (0).

show :: Rep Show a => a -> StringSource

A variant of shows that returns a String instead of ShowS.