-- 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
--   Show instances. By using the library, we can parse derived
--   Show instances into a generic data structure. The ppsh
--   tool uses the library to produce human-readable versions of
--   Show 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.15

-- | Functions for human-readable derived Show instances.
module Text.Show.Pretty

-- | Generic Haskell values. NaN and Infinity are
--   represented as constructors. The String 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
--   
--   1 :+: 2 :*: 3 is represented with InfixCons 1
--   [(":+:",2),(":*:",3)], whereas
--   
--   1 :+: (2 :*: 3) is represented with InfixCons 1
--   [(":+:",InfixCons 2 [(":*:",3)])].
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 Show 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 Show 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 Show instance.
ppDoc :: Show a => a -> Doc

-- | Convert a generic value into a pretty String, 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 ()

-- | Pretty print something that may be converted to a list as a list. Each
--   entry is on a separate line, which means that we don't do clever
--   pretty printing, and so this works well for large strucutures.
ppDocList :: (Foldable f, Show a) => f a -> Doc

-- | Pretty print something that may be converted to a list as a list. Each
--   entry is on a separate line, which means that we don't do clever
--   pretty printing, and so this works well for large strucutures.
ppShowList :: (Foldable f, Show a) => f a -> String

-- | Pretty print something that may be converted to a list as a list. Each
--   entry is on a separate line, which means that we don't do clever
--   pretty printing, and so this works well for large strucutures.
pPrintList :: (Foldable f, Show a) => f a -> IO ()

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

-- | Render a value in the PrettyVal class to a String. The
--   benefit of this function is that PrettyVal 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
--   Generics.
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 style,
--   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

-- | Deprecated: Please use valToDoc instead.
ppValue :: Value -> Doc
