pretty-show-1.1: Tools for working with derived Show instances.Source codeContentsIndex
PortabilityHaskell 98
Functions for human-readable derived Show instances.
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
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".
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