-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Tools for working with derived `Show` instances and generic
--   inspection of values.
--   
--   We provide a library and an executable for working with derived
--   <a>Show</a> instances. By using the library, we can parse derived
--   <a>Show</a> instances into a generic data structure. The <tt>ppsh</tt>
--   tool uses the library to produce human-readable versions of
--   <a>Show</a> instances, which can be quite handy for debugging Haskell
--   programs. We can also render complex generic values into an
--   interactive Html page, for easier examination.
@package pretty-show
@version 1.6.13


-- | Functions for human-readable derived <a>Show</a> instances.
module Text.Show.Pretty

-- | Generic Haskell values. <tt>NaN</tt> and <tt>Infinity</tt> are
--   represented as constructors. The <a>String</a> in the literals is the
--   text for the literals "as is".
--   
--   A chain of infix constructors means that they appeared in the input
--   string without parentheses, i.e
--   
--   <tt>1 :+: 2 :*: 3</tt> is represented with <tt>InfixCons 1
--   [(":+:",2),(":*:",3)]</tt>, whereas
--   
--   <tt>1 :+: (2 :*: 3)</tt> is represented with <tt>InfixCons 1
--   [(":+:",InfixCons 2 [(":*:",3)])]</tt>.
data Value

-- | Data constructor
Con :: Name -> [Value] -> Value

-- | Infix data constructor chain
InfixCons :: Value -> [(Name, Value)] -> Value

-- | Record value
Rec :: Name -> [(Name, Value)] -> Value

-- | Tuple
Tuple :: [Value] -> Value

-- | List
List :: [Value] -> Value

-- | Negated value
Neg :: Value -> Value

-- | Rational
Ratio :: Value -> Value -> Value

-- | Non-negative integer
Integer :: String -> Value

-- | Non-negative floating num.
Float :: String -> Value

-- | Character
Char :: String -> Value

-- | String
String :: String -> Value

-- | A name.
type Name = String

-- | Pretty print a generic value. Our intention is that the result is
--   equivalent to the <a>Show</a> instance for the original value, except
--   possibly easier to understand by a human.
valToStr :: Value -> String

-- | Pretty print a generic value. Our intention is that the result is
--   equivalent to the <a>Show</a> instance for the original value, except
--   possibly easier to understand by a human.
valToDoc :: Value -> Doc

-- | Make an Html page representing the given value.
valToHtmlPage :: HtmlOpts -> Value -> String
parseValue :: String -> Maybe Value
reify :: Show a => a -> Maybe Value

-- | Try to show a value, prettily. If we do not understand the value, then
--   we just use its standard <a>Show</a> instance.
ppDoc :: Show a => a -> Doc

-- | Convert a generic value into a pretty <a>String</a>, if possible.
ppShow :: Show a => a -> String

-- | Pretty print a generic value to stdout. This is particularly useful in
--   the GHCi interactive environment.
pPrint :: Show a => a -> IO ()

-- | Render a value in the <a>PrettyVal</a> class to a <a>Doc</a>. The
--   benefit of this function is that <a>PrettyVal</a> instances may be
--   derived automatically using generics.
dumpDoc :: PrettyVal a => a -> Doc

-- | Render a value in the <a>PrettyVal</a> class to a <a>String</a>. The
--   benefit of this function is that <a>PrettyVal</a> instances may be
--   derived automatically using generics.
dumpStr :: PrettyVal a => a -> String

-- | A class for types that may be reified into a value. Instances of this
--   class may be derived automatically, for datatypes that support
--   <tt>Generics</tt>.
class PrettyVal a where prettyVal = oneVal . gdump . from listValue = List . map prettyVal
prettyVal :: PrettyVal a => a -> Value
prettyVal :: (PrettyVal a, GDump (Rep a), Generic a) => a -> Value

-- | Convert a value into an Html fragment.
valToHtml :: HtmlOpts -> Value -> Html

-- | Options on how to generate Html (more to come).
data HtmlOpts
HtmlOpts :: FilePath -> Int -> HtmlOpts

-- | Path for extra files. If empty, we look in directory <tt>style</tt>,
--   relative to document.
[dataDir] :: HtmlOpts -> FilePath

-- | Max. number of columns in wide lists.
[wideListWidth] :: HtmlOpts -> Int

-- | Default options.
defaultHtmlOpts :: HtmlOpts

-- | Wrap an Html fragment to make an Html page.
htmlPage :: HtmlOpts -> Html -> String
newtype Html
Html :: String -> Html
[exportHtml] :: Html -> String
getDataDir :: IO FilePath

-- | <i>Deprecated: Please use <a>valToDoc</a> instead.</i>
ppValue :: Value -> Doc
