pretty-show-1.1: Tools for working with derived Show instances.Source codeContentsIndex
Text.Show.Pretty
PortabilityHaskell 98
Stabilityprovisional
Maintaineriavor.diatchki@gmail.com
Description
Functions for human-readable derived Show instances.
Synopsis
type Name = String
data Value
= Con Name [Value]
| Rec Name [(Name, Value)]
| Tuple [Value]
| List [Value]
| Neg Value
| Ratio Value Value
| Integer String
| Float String
| Char String
| String String
parseValue :: String -> Maybe Value
reify :: Show a => a -> Maybe Value
ppValue :: Value -> Doc
ppDoc :: Show a => a -> Doc
ppShow :: Show a => a -> String
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 ValueNegated value
Ratio Value ValueRational
Integer StringNon-negative integer
Float StringNon-negative floating num.
Char StringCharacter
String StringString
show/hide Instances
parseValue :: String -> Maybe ValueSource
reify :: Show a => a -> Maybe ValueSource
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.
Produced by Haddock version 2.4.2