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


-- | pretty printer for data types with a 'Show' instance.
--   
--   Please see <a>README.md</a>.
@package pretty-simple
@version 3.2.3.0


module Text.Pretty.Simple.Internal.Color

-- | These options are for colorizing the output of functions like
--   <tt>pPrint</tt>.
--   
--   For example, if you set <a>colorQuote</a> to something like
--   <a>colorVividBlueBold</a>, then the quote character (<tt>"</tt>) will
--   be output as bright blue in bold.
--   
--   If you don't want to use a color for one of the options, use
--   <a>colorNull</a>.
data ColorOptions
ColorOptions :: Builder -> Builder -> Builder -> Builder -> [Builder] -> ColorOptions

-- | Color to use for quote characters (<tt>"</tt>) around strings.
[colorQuote] :: ColorOptions -> Builder

-- | Color to use for strings.
[colorString] :: ColorOptions -> Builder

-- | (currently not used)
[colorError] :: ColorOptions -> Builder

-- | Color to use for numbers.
[colorNum] :: ColorOptions -> Builder

-- | A list of <a>Builder</a> colors to use for rainbow parenthesis output.
--   Use '[]' if you don't want rainbow parenthesis. Use just a single item
--   if you want all the rainbow parenthesis to be colored the same.
[colorRainbowParens] :: ColorOptions -> [Builder]

-- | Default color options for use on a dark background.
--   
--   <a>colorQuote</a> is <a>defaultColorQuoteDarkBg</a>.
--   <a>colorString</a> is <a>defaultColorStringDarkBg</a>.
--   <a>colorError</a> is <a>defaultColorErrorDarkBg</a>. <a>colorNum</a>
--   is <a>defaultColorNumDarkBg</a>. <a>colorRainbowParens</a> is
--   <tt>defaultColorRainboxParensDarkBg</tt>.
defaultColorOptionsDarkBg :: ColorOptions

-- | Default color for <a>colorQuote</a> for dark backgrounds. This is
--   <a>colorVividWhiteBold</a>.
defaultColorQuoteDarkBg :: Builder

-- | Default color for <a>colorString</a> for dark backgrounds. This is
--   <a>colorVividBlueBold</a>.
defaultColorStringDarkBg :: Builder

-- | Default color for <a>colorError</a> for dark backgrounds. This is
--   <a>colorVividRedBold</a>.
defaultColorErrorDarkBg :: Builder

-- | Default color for <a>colorNum</a> for dark backgrounds. This is
--   <a>colorVividGreenBold</a>.
defaultColorNumDarkBg :: Builder

-- | Default colors for <a>colorRainbowParens</a> for dark backgrounds.
defaultColorRainbowParensDarkBg :: [Builder]

-- | Default color options for use on a light background.
--   
--   <a>colorQuote</a> is <a>defaultColorQuoteLightBg</a>.
--   <a>colorString</a> is <a>defaultColorStringLightBg</a>.
--   <a>colorError</a> is <a>defaultColorErrorLightBg</a>. <a>colorNum</a>
--   is <a>defaultColorNumLightBg</a>. <a>colorRainbowParens</a> is
--   <tt>defaultColorRainboxParensLightBg</tt>.
defaultColorOptionsLightBg :: ColorOptions

-- | Default color for <a>colorQuote</a> for light backgrounds. This is
--   <a>colorVividWhiteBold</a>.
defaultColorQuoteLightBg :: Builder

-- | Default color for <a>colorString</a> for light backgrounds. This is
--   <a>colorVividBlueBold</a>.
defaultColorStringLightBg :: Builder

-- | Default color for <a>colorError</a> for light backgrounds. This is
--   <a>colorVividRedBold</a>.
defaultColorErrorLightBg :: Builder

-- | Default color for <a>colorNum</a> for light backgrounds. This is
--   <a>colorVividGreenBold</a>.
defaultColorNumLightBg :: Builder

-- | Default colors for <a>colorRainbowParens</a> for light backgrounds.
defaultColorRainbowParensLightBg :: [Builder]
colorVividBlackBold :: Builder
colorVividBlueBold :: Builder
colorVividCyanBold :: Builder
colorVividGreenBold :: Builder
colorVividMagentaBold :: Builder
colorVividRedBold :: Builder
colorVividWhiteBold :: Builder
colorVividYellowBold :: Builder
colorDullBlackBold :: Builder
colorDullBlueBold :: Builder
colorDullCyanBold :: Builder
colorDullGreenBold :: Builder
colorDullMagentaBold :: Builder
colorDullRedBold :: Builder
colorDullWhiteBold :: Builder
colorDullYellowBold :: Builder
colorVividBlack :: Builder
colorVividBlue :: Builder
colorVividCyan :: Builder
colorVividGreen :: Builder
colorVividMagenta :: Builder
colorVividRed :: Builder
colorVividWhite :: Builder
colorVividYellow :: Builder
colorDullBlack :: Builder
colorDullBlue :: Builder
colorDullCyan :: Builder
colorDullGreen :: Builder
colorDullMagenta :: Builder
colorDullRed :: Builder
colorDullWhite :: Builder
colorDullYellow :: Builder

-- | Change the intensity to <a>BoldIntensity</a>.
colorBold :: Builder

-- | <a>Reset</a> the console color back to normal.
colorReset :: Builder

-- | Empty string.
colorNull :: Builder

-- | Helper for creating a <a>Builder</a> for an ANSI escape sequence color
--   based on a <a>ColorIntensity</a> and a <a>Color</a>.
colorHelper :: ColorIntensity -> Color -> Builder

-- | Convert a list of <a>SGR</a> to a <a>Builder</a>.
setSGRCodeBuilder :: [SGR] -> Builder
instance GHC.Show.Show Text.Pretty.Simple.Internal.Color.ColorOptions
instance GHC.Generics.Generic Text.Pretty.Simple.Internal.Color.ColorOptions
instance GHC.Classes.Eq Text.Pretty.Simple.Internal.Color.ColorOptions


module Text.Pretty.Simple.Internal.Expr
newtype CommaSeparated a
CommaSeparated :: [a] -> CommaSeparated a
[unCommaSeparated] :: CommaSeparated a -> [a]
data Expr
Brackets :: !CommaSeparated [Expr] -> Expr
Braces :: !CommaSeparated [Expr] -> Expr
Parens :: !CommaSeparated [Expr] -> Expr
StringLit :: !String -> Expr
CharLit :: !String -> Expr

-- | We could store this as a <a>Rational</a>, say, instead of a
--   <a>String</a>. However, we will never need to use its value for
--   anything. Indeed, the only thing we will be doing with it is turning
--   it <i>back</i> into a string at some stage, so we might as well cut
--   out the middle man and store it directly like this.
NumberLit :: !String -> Expr
Other :: !String -> Expr
instance GHC.Show.Show Text.Pretty.Simple.Internal.Expr.Expr
instance GHC.Generics.Generic Text.Pretty.Simple.Internal.Expr.Expr
instance GHC.Classes.Eq Text.Pretty.Simple.Internal.Expr.Expr
instance Data.Data.Data Text.Pretty.Simple.Internal.Expr.Expr
instance GHC.Show.Show a => GHC.Show.Show (Text.Pretty.Simple.Internal.Expr.CommaSeparated a)
instance GHC.Generics.Generic (Text.Pretty.Simple.Internal.Expr.CommaSeparated a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Text.Pretty.Simple.Internal.Expr.CommaSeparated a)
instance Data.Data.Data a => Data.Data.Data (Text.Pretty.Simple.Internal.Expr.CommaSeparated a)


module Text.Pretty.Simple.Internal.ExprParser

-- | <a>testString1</a> and <a>testString2</a> are convenient to use in
--   GHCi when playing around with how parsing works.
testString1 :: String

-- | See <a>testString1</a>.
testString2 :: String
expressionParse :: String -> [Expr]
parseExpr :: String -> (Expr, String)

-- | Parse multiple expressions.
--   
--   <pre>
--   &gt;&gt;&gt; parseExprs "Just 'a'"
--   ([Other "Just ",CharLit "a"],"")
--   </pre>
--   
--   Handle escaped characters correctly
--   
--   <pre>
--   &gt;&gt;&gt; parseExprs $ "Foo \"hello \\\"world!\""
--   ([Other "Foo ",StringLit "hello \\\"world!"],"")
--   
--   &gt;&gt;&gt; parseExprs $ "'\\''"
--   ([CharLit "\\'"],"")
--   </pre>
parseExprs :: String -> ([Expr], String)
parseCSep :: Char -> String -> ([[Expr]], String)

-- | Parse string literals until a trailing double quote.
--   
--   <pre>
--   &gt;&gt;&gt; parseStringLit "foobar\" baz"
--   ("foobar"," baz")
--   </pre>
--   
--   Keep literal back slashes:
--   
--   <pre>
--   &gt;&gt;&gt; parseStringLit "foobar\\\" baz\" after"
--   ("foobar\\\" baz"," after")
--   </pre>
parseStringLit :: String -> (String, String)

-- | Parse character literals until a trailing single quote.
--   
--   <pre>
--   &gt;&gt;&gt; parseCharLit "a' foobar"
--   ("a"," foobar")
--   </pre>
--   
--   Keep literal back slashes:
--   
--   <pre>
--   &gt;&gt;&gt; parseCharLit "\\'' hello"
--   ("\\'"," hello")
--   </pre>
parseCharLit :: String -> (String, String)

-- | Parses integers and reals, like <tt>123</tt> and <tt>45.67</tt>.
--   
--   To be more precise, any numbers matching the regex
--   <tt>\d+(\.\d+)?</tt> should get parsed by this function.
--   
--   <pre>
--   &gt;&gt;&gt; parseNumberLit '3' "456hello world []"
--   ("3456","hello world []")
--   
--   &gt;&gt;&gt; parseNumberLit '0' ".12399880 foobar"
--   ("0.12399880"," foobar")
--   </pre>
parseNumberLit :: Char -> String -> (String, String)

-- | This function consumes input, stopping only when it hits a special
--   character or a digit. However, if the digit is in the middle of a
--   Haskell-style identifier (e.g. <tt>foo123</tt>), then keep going
--   anyway.
--   
--   This is almost the same as the function
--   
--   <pre>
--   parseOtherSimple = span $ \c -&gt;
--     notElem c ("{[()]}\"," :: String) &amp;&amp; not (isDigit c) &amp;&amp; (c /= '\'')
--   </pre>
--   
--   except <a>parseOther</a> ignores digits and single quotes that appear
--   in Haskell-like identifiers.
--   
--   <pre>
--   &gt;&gt;&gt; parseOther "hello world []"
--   ("hello world ","[]")
--   
--   &gt;&gt;&gt; parseOther "hello234 world"
--   ("hello234 world","")
--   
--   &gt;&gt;&gt; parseOther "hello 234 world"
--   ("hello ","234 world")
--   
--   &gt;&gt;&gt; parseOther "hello{[ 234 world"
--   ("hello","{[ 234 world")
--   
--   &gt;&gt;&gt; parseOther "H3110 World"
--   ("H3110 World","")
--   
--   &gt;&gt;&gt; parseOther "Node' (Leaf' 1) (Leaf' 2)"
--   ("Node' ","(Leaf' 1) (Leaf' 2)")
--   
--   &gt;&gt;&gt; parseOther "I'm One"
--   ("I'm One","")
--   
--   &gt;&gt;&gt; parseOther "I'm 2"
--   ("I'm ","2")
--   </pre>
parseOther :: String -> (String, String)


module Text.Pretty.Simple.Internal.Output

-- | Datatype representing how much something is nested.
--   
--   For example, a <a>NestLevel</a> of 0 would mean an <a>Output</a> token
--   is at the very highest level, not in any braces.
--   
--   A <a>NestLevel</a> of 1 would mean that an <a>Output</a> token is in
--   one single pair of <tt>{</tt> and <tt>}</tt>, or <tt>[</tt> and <tt>],
--   or </tt>&lt;math&gt;@.
--   
--   A <a>NestLevel</a> of 2 would mean that an <a>Output</a> token is two
--   levels of brackets, etc.
newtype NestLevel
NestLevel :: Int -> NestLevel
[unNestLevel] :: NestLevel -> Int

-- | These are the output tokens that we will be printing to the screen.
data OutputType

-- | This represents the <tt>}</tt> character.
OutputCloseBrace :: OutputType

-- | This represents the <tt>]</tt> character.
OutputCloseBracket :: OutputType

-- | This represents the <tt>)</tt> character.
OutputCloseParen :: OutputType

-- | This represents the <tt>,</tt> character.
OutputComma :: OutputType

-- | This represents an indentation.
OutputIndent :: OutputType

-- | This represents the <tt>\n</tt> character.
OutputNewLine :: OutputType

-- | This represents the <tt>{</tt> character.
OutputOpenBrace :: OutputType

-- | This represents the <tt>[</tt> character.
OutputOpenBracket :: OutputType

-- | This represents the <tt>(</tt> character.
OutputOpenParen :: OutputType

-- | This represents some collection of characters that don't fit into any
--   of the other tokens.
OutputOther :: !String -> OutputType

-- | This represents a string literal. For instance, <tt>"foobar"</tt>.
OutputStringLit :: !String -> OutputType

-- | This represents a char literal. For example, <tt><tt>x</tt></tt> or
--   <tt>'b'</tt>
OutputCharLit :: !String -> OutputType

-- | This represents a numeric literal. For example, <tt>12345</tt> or
--   <tt>3.14159</tt>.
OutputNumberLit :: !String -> OutputType

-- | An <a>OutputType</a> token together with a <a>NestLevel</a>.
--   Basically, each <a>OutputType</a> keeps track of its own
--   <a>NestLevel</a>.
data Output
Output :: {-# UNPACK #-} !NestLevel -> !OutputType -> Output
[outputNestLevel] :: Output -> {-# UNPACK #-} !NestLevel
[outputOutputType] :: Output -> !OutputType
instance GHC.Show.Show Text.Pretty.Simple.Internal.Output.Output
instance GHC.Read.Read Text.Pretty.Simple.Internal.Output.Output
instance GHC.Generics.Generic Text.Pretty.Simple.Internal.Output.Output
instance GHC.Classes.Eq Text.Pretty.Simple.Internal.Output.Output
instance Data.Data.Data Text.Pretty.Simple.Internal.Output.Output
instance GHC.Show.Show Text.Pretty.Simple.Internal.Output.OutputType
instance GHC.Read.Read Text.Pretty.Simple.Internal.Output.OutputType
instance GHC.Generics.Generic Text.Pretty.Simple.Internal.Output.OutputType
instance GHC.Classes.Eq Text.Pretty.Simple.Internal.Output.OutputType
instance Data.Data.Data Text.Pretty.Simple.Internal.Output.OutputType
instance GHC.Show.Show Text.Pretty.Simple.Internal.Output.NestLevel
instance GHC.Read.Read Text.Pretty.Simple.Internal.Output.NestLevel
instance GHC.Classes.Ord Text.Pretty.Simple.Internal.Output.NestLevel
instance GHC.Num.Num Text.Pretty.Simple.Internal.Output.NestLevel
instance GHC.Generics.Generic Text.Pretty.Simple.Internal.Output.NestLevel
instance GHC.Classes.Eq Text.Pretty.Simple.Internal.Output.NestLevel
instance Data.Data.Data Text.Pretty.Simple.Internal.Output.NestLevel
instance Data.String.IsString Text.Pretty.Simple.Internal.Output.OutputType


module Text.Pretty.Simple.Internal.ExprToOutput

-- | Newtype around <a>Int</a> to represent a line number. After a newline,
--   the <a>LineNum</a> will increase by 1.
newtype LineNum
LineNum :: Int -> LineNum
[unLineNum] :: LineNum -> Int
data PrinterState
PrinterState :: {-# UNPACK #-} !LineNum -> {-# UNPACK #-} !NestLevel -> PrinterState
[currLine] :: PrinterState -> {-# UNPACK #-} !LineNum
[nestLevel] :: PrinterState -> {-# UNPACK #-} !NestLevel

-- | Smart-constructor for <a>PrinterState</a>.
printerState :: LineNum -> NestLevel -> PrinterState
addOutput :: MonadState PrinterState m => OutputType -> m Output
addOutputs :: MonadState PrinterState m => [OutputType] -> m [Output]
initPrinterState :: PrinterState

-- | Print a surrounding expression (like <tt>[]</tt> or <tt>{}</tt> or
--   <tt>()</tt>).
--   
--   If the <a>CommaSeparated</a> expressions are empty, just print the
--   start and end markers.
--   
--   <pre>
--   &gt;&gt;&gt; testInit $ putSurroundExpr "[" "]" (CommaSeparated [])
--   [Output {outputNestLevel = NestLevel {unNestLevel = 0}, outputOutputType = OutputOpenBracket},Output {outputNestLevel = NestLevel {unNestLevel = 0}, outputOutputType = OutputCloseBracket}]
--   </pre>
--   
--   If there is only one expression, and it will print out on one line,
--   then just print everything all on one line, with spaces around the
--   expressions.
--   
--   <pre>
--   &gt;&gt;&gt; testInit $ putSurroundExpr "{" "}" (CommaSeparated [[Other "hello"]])
--   [Output {outputNestLevel = NestLevel {unNestLevel = 0}, outputOutputType = OutputOpenBrace},Output {outputNestLevel = NestLevel {unNestLevel = 0}, outputOutputType = OutputOther " "},Output {outputNestLevel = NestLevel {unNestLevel = 0}, outputOutputType = OutputOther "hello"},Output {outputNestLevel = NestLevel {unNestLevel = 0}, outputOutputType = OutputOther " "},Output {outputNestLevel = NestLevel {unNestLevel = 0}, outputOutputType = OutputCloseBrace}]
--   </pre>
--   
--   If there is only one expression, but it will print out on multiple
--   lines, then go to newline and print out on multiple lines.
--   
--   <pre>
--   &gt;&gt;&gt; 1 + 1  -- TODO: Example here.
--   2
--   </pre>
--   
--   If there are multiple expressions, then first go to a newline. Print
--   out on multiple lines.
--   
--   <pre>
--   &gt;&gt;&gt; 1 + 1  -- TODO: Example here.
--   2
--   </pre>
putSurroundExpr :: MonadState PrinterState m => OutputType -> OutputType -> CommaSeparated [Expr] -> m [Output]
putCommaSep :: forall m. MonadState PrinterState m => CommaSeparated [Expr] -> m [Output]
putComma :: MonadState PrinterState m => m [Output]
doIndent :: MonadState PrinterState m => m [Output]
newLine :: MonadState PrinterState m => m Output
newLineAndDoIndent :: MonadState PrinterState m => m [Output]
addToNestLevel :: MonadState PrinterState m => NestLevel -> m ()
addToCurrentLine :: MonadState PrinterState m => LineNum -> m ()
putExpression :: MonadState PrinterState m => Expr -> m [Output]
runPrinterState :: PrinterState -> [Expr] -> [Output]
runInitPrinterState :: [Expr] -> [Output]
expressionsToOutputs :: [Expr] -> [Output]

-- | A function that performs optimizations and modifications to a list of
--   input <a>Expr</a>s.
--   
--   An sample of an optimization is
--   <a>removeEmptyInnerCommaSeparatedExprList</a> which removes empty
--   inner lists in a <a>CommaSeparated</a> value.
modificationsExprList :: [Expr] -> [Expr]
removeEmptyInnerCommaSeparatedExprList :: [Expr] -> [Expr]
removeEmptyInnerCommaSeparatedExpr :: Expr -> Expr
removeEmptyInnerCommaSeparated :: CommaSeparated [Expr] -> CommaSeparated [Expr]

-- | Remove empty lists from a list of lists.
--   
--   <pre>
--   &gt;&gt;&gt; removeEmptyList [[1,2,3], [], [4,5]]
--   [[1,2,3],[4,5]]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; removeEmptyList [[]]
--   []
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; removeEmptyList [[1]]
--   [[1]]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; removeEmptyList [[1,2], [10,20], [100,200]]
--   [[1,2],[10,20],[100,200]]
--   </pre>
removeEmptyList :: forall a. [[a]] -> [[a]]
instance GHC.Show.Show Text.Pretty.Simple.Internal.ExprToOutput.PrinterState
instance GHC.Generics.Generic Text.Pretty.Simple.Internal.ExprToOutput.PrinterState
instance Data.Data.Data Text.Pretty.Simple.Internal.ExprToOutput.PrinterState
instance GHC.Classes.Eq Text.Pretty.Simple.Internal.ExprToOutput.PrinterState
instance GHC.Show.Show Text.Pretty.Simple.Internal.ExprToOutput.LineNum
instance GHC.Read.Read Text.Pretty.Simple.Internal.ExprToOutput.LineNum
instance GHC.Classes.Ord Text.Pretty.Simple.Internal.ExprToOutput.LineNum
instance GHC.Num.Num Text.Pretty.Simple.Internal.ExprToOutput.LineNum
instance GHC.Generics.Generic Text.Pretty.Simple.Internal.ExprToOutput.LineNum
instance GHC.Classes.Eq Text.Pretty.Simple.Internal.ExprToOutput.LineNum
instance Data.Data.Data Text.Pretty.Simple.Internal.ExprToOutput.LineNum


module Text.Pretty.Simple.Internal.OutputPrinter

-- | Determines whether pretty-simple should check if the output
--   <a>Handle</a> is a TTY device. Normally, users only want to print in
--   color if the output <a>Handle</a> is a TTY device.
data CheckColorTty

-- | Check if the output <a>Handle</a> is a TTY device. If the output
--   <a>Handle</a> is a TTY device, determine whether to print in color
--   based on <a>outputOptionsColorOptions</a>. If not, then set
--   <a>outputOptionsColorOptions</a> to <a>Nothing</a> so the output does
--   not get colorized.
CheckColorTty :: CheckColorTty

-- | Don't check if the output <a>Handle</a> is a TTY device. Determine
--   whether to colorize the output based solely on the value of
--   <a>outputOptionsColorOptions</a>.
NoCheckColorTty :: CheckColorTty

-- | Data-type wrapping up all the options available when rendering the
--   list of <a>Output</a>s.
data OutputOptions
OutputOptions :: Int -> Maybe ColorOptions -> Bool -> OutputOptions

-- | Number of spaces to use when indenting. It should probably be either 2
--   or 4.
[outputOptionsIndentAmount] :: OutputOptions -> Int

-- | If this is <a>Nothing</a>, then don't colorize the output. If this is
--   <tt><a>Just</a> colorOptions</tt>, then use <tt>colorOptions</tt> to
--   colorize the output.
[outputOptionsColorOptions] :: OutputOptions -> Maybe ColorOptions

-- | Whether to replace non-printable characters with hexadecimal escape
--   sequences.
[outputOptionsEscapeNonPrintable] :: OutputOptions -> Bool

-- | Default values for <a>OutputOptions</a> when printing to a console
--   with a dark background. <a>outputOptionsIndentAmount</a> is 4, and
--   <a>outputOptionsColorOptions</a> is <a>defaultColorOptionsDarkBg</a>.
defaultOutputOptionsDarkBg :: OutputOptions

-- | Default values for <a>OutputOptions</a> when printing to a console
--   with a light background. <a>outputOptionsIndentAmount</a> is 4, and
--   <a>outputOptionsColorOptions</a> is <a>defaultColorOptionsLightBg</a>.
defaultOutputOptionsLightBg :: OutputOptions

-- | Default values for <a>OutputOptions</a> when printing using using ANSI
--   escape sequences for color. <a>outputOptionsIndentAmount</a> is 4, and
--   <a>outputOptionsColorOptions</a> is <a>Nothing</a>.
defaultOutputOptionsNoColor :: OutputOptions

-- | Given <a>OutputOptions</a>, disable colorful output if the given
--   handle is not connected to a TTY.
hCheckTTY :: MonadIO m => Handle -> OutputOptions -> m OutputOptions

-- | Given <a>OutputOptions</a> and a list of <a>Output</a>, turn the
--   <a>Output</a> into a lazy <a>Text</a>.
render :: OutputOptions -> [Output] -> Text

-- | Render a single <a>Output</a> as a <a>Builder</a>, using the options
--   specified in the <a>OutputOptions</a>.
renderOutput :: MonadReader OutputOptions m => Output -> m Builder

-- | Replace non-printable characters with hex escape sequences.
--   
--   <pre>
--   &gt;&gt;&gt; escapeNonPrintable "\x1\x2"
--   "\\x1\\x2"
--   </pre>
--   
--   Newlines will not be escaped.
--   
--   <pre>
--   &gt;&gt;&gt; escapeNonPrintable "hello\nworld"
--   "hello\nworld"
--   </pre>
--   
--   Printable characters will not be escaped.
--   
--   <pre>
--   &gt;&gt;&gt; escapeNonPrintable "h\101llo"
--   "hello"
--   </pre>
escapeNonPrintable :: String -> String
escape :: Char -> ShowS

-- | <pre>
--   &gt;&gt;&gt; indentSubsequentLinesWith "  " "aaa"
--   "aaa"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; indentSubsequentLinesWith "  " "aaa\nbbb\nccc"
--   "aaa\n  bbb\n  ccc"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; indentSubsequentLinesWith "  " ""
--   ""
--   </pre>
indentSubsequentLinesWith :: String -> String -> String

-- | Produce a <a>Builder</a> corresponding to the ANSI escape sequence for
--   the color for the <tt>"</tt>, based on whether or not
--   <a>outputOptionsColorOptions</a> is <a>Just</a> or <a>Nothing</a>, and
--   the value of <a>colorQuote</a>.
useColorQuote :: forall m. MonadReader OutputOptions m => m Builder

-- | Produce a <a>Builder</a> corresponding to the ANSI escape sequence for
--   the color for the characters of a string, based on whether or not
--   <a>outputOptionsColorOptions</a> is <a>Just</a> or <a>Nothing</a>, and
--   the value of <a>colorString</a>.
useColorString :: forall m. MonadReader OutputOptions m => m Builder
useColorError :: forall m. MonadReader OutputOptions m => m Builder
useColorNum :: forall m. MonadReader OutputOptions m => m Builder

-- | Produce a <a>Builder</a> corresponding to the ANSI escape sequence for
--   resetting the console color back to the default. Produces an empty
--   <a>Builder</a> if <a>outputOptionsColorOptions</a> is <a>Nothing</a>.
useColorReset :: forall m. MonadReader OutputOptions m => m Builder

-- | Produce a <a>Builder</a> representing the ANSI escape sequence for the
--   color of the rainbow parenthesis, given an input <a>NestLevel</a> and
--   <a>Builder</a> to use as the input character.
--   
--   If <a>outputOptionsColorOptions</a> is <a>Nothing</a>, then just
--   return the input character. If it is <a>Just</a>, then return the
--   input character colorized.
renderRainbowParenFor :: MonadReader OutputOptions m => NestLevel -> Builder -> m Builder
useColorRainbowParens :: forall m. MonadReader OutputOptions m => NestLevel -> m Builder

-- | This is simply <tt><a>fmap</a> <a>fold</a> <a>.</a>
--   <a>sequence</a></tt>.
sequenceFold :: (Monad f, Monoid a, Traversable t) => t (f a) -> f a

-- | A function that performs optimizations and modifications to a list of
--   input <a>Output</a>s.
--   
--   An sample of an optimization is <a>removeStartingNewLine</a> which
--   just removes a newline if it is the first item in an <a>Output</a>
--   list.
modificationsOutputList :: [Output] -> [Output]

-- | Remove a <a>OutputNewLine</a> if it is the first item in the
--   <a>Output</a> list.
--   
--   <pre>
--   &gt;&gt;&gt; removeStartingNewLine [Output 3 OutputNewLine, Output 3 OutputComma]
--   [Output {outputNestLevel = NestLevel {unNestLevel = 3}, outputOutputType = OutputComma}]
--   </pre>
removeStartingNewLine :: [Output] -> [Output]

-- | Remove trailing spaces from the end of a <a>OutputOther</a> token if
--   it is followed by a <a>OutputNewLine</a>, or if it is the final
--   <a>Output</a> in the list. This function assumes that there is a
--   single <a>OutputOther</a> before any <a>OutputNewLine</a> (and before
--   the end of the list), so it must be run after running
--   <a>compressOthers</a>.
--   
--   <pre>
--   &gt;&gt;&gt; removeTrailingSpacesInOtherBeforeNewLine [Output 2 (OutputOther "foo  "), Output 4 OutputNewLine]
--   [Output {outputNestLevel = NestLevel {unNestLevel = 2}, outputOutputType = OutputOther "foo"},Output {outputNestLevel = NestLevel {unNestLevel = 4}, outputOutputType = OutputNewLine}]
--   </pre>
removeTrailingSpacesInOtherBeforeNewLine :: [Output] -> [Output]

-- | If there are two subsequent <a>OutputOther</a> tokens, combine them
--   into just one <a>OutputOther</a>.
--   
--   <pre>
--   &gt;&gt;&gt; compressOthers [Output 0 (OutputOther "foo"), Output 0 (OutputOther "bar")]
--   [Output {outputNestLevel = NestLevel {unNestLevel = 0}, outputOutputType = OutputOther "foobar"}]
--   </pre>
compressOthers :: [Output] -> [Output]

-- | In each <a>OutputOther</a> token, compress multiple whitespaces to
--   just one whitespace.
--   
--   <pre>
--   &gt;&gt;&gt; shrinkWhitespaceInOthers [Output 0 (OutputOther "  hello  ")]
--   [Output {outputNestLevel = NestLevel {unNestLevel = 0}, outputOutputType = OutputOther " hello "}]
--   </pre>
shrinkWhitespaceInOthers :: [Output] -> [Output]
shrinkWhitespaceInOther :: Output -> Output
shrinkWhitespace :: String -> String
instance GHC.Show.Show Text.Pretty.Simple.Internal.OutputPrinter.OutputOptions
instance GHC.Generics.Generic Text.Pretty.Simple.Internal.OutputPrinter.OutputOptions
instance GHC.Classes.Eq Text.Pretty.Simple.Internal.OutputPrinter.OutputOptions
instance GHC.Show.Show Text.Pretty.Simple.Internal.OutputPrinter.CheckColorTty
instance GHC.Generics.Generic Text.Pretty.Simple.Internal.OutputPrinter.CheckColorTty
instance GHC.Classes.Eq Text.Pretty.Simple.Internal.OutputPrinter.CheckColorTty


module Text.Pretty.Simple.Internal


-- | This module contains the functions <a>pPrint</a>, <a>pShow</a>, and
--   <a>pString</a> for pretty-printing any Haskell data type with a
--   <a>Show</a> instance.
--   
--   <a>pPrint</a> is the main go-to function when debugging Haskell code.
--   <a>pShow</a> and <a>pString</a> are slight variations on
--   <a>pPrint</a>.
--   
--   <a>pPrint</a>, <a>pShow</a>, and <a>pString</a> will pretty-print in
--   color using ANSI escape codes. They look good on a console with a dark
--   (black) background. The variations <a>pPrintLightBg</a>,
--   <a>pShowLightBg</a>, and <a>pStringLightBg</a> are for printing in
--   color to a console with a light (white) background. The variations
--   <a>pPrintNoColor</a>, <a>pShowNoColor</a>, and <a>pStringNoColor</a>
--   are for pretty-printing without using color.
--   
--   <a>pPrint</a> and <a>pPrintLightBg</a> will intelligently decide
--   whether or not to use ANSI escape codes for coloring depending on
--   whether or not the output is a TTY. This works in most cases. If you
--   want to force color output, you can use the <a>pPrintForceColor</a> or
--   <a>pPrintForceColorLightBg</a> functions.
--   
--   The variations <a>pPrintOpt</a>, <a>pShowOpt</a>, and
--   <a>pStringOpt</a> are used when specifying the <a>OutputOptions</a>.
--   Most users can ignore these.
--   
--   There are a few other functions available that are similar to
--   <a>pPrint</a>.
--   
--   See the Examples section at the end of this module for examples of
--   acutally using <a>pPrint</a>. See the <a>README.md</a> for examples of
--   printing in color.
module Text.Pretty.Simple

-- | Pretty-print any data type that has a <a>Show</a> instance.
--   
--   If you've never seen <a>MonadIO</a> before, you can think of this
--   function as having the following type signature:
--   
--   <pre>
--   pPrint :: Show a =&gt; a -&gt; IO ()
--   </pre>
--   
--   This function will only use colors if it detects it's printing to a
--   TTY.
--   
--   This function is for printing to a dark background. Use
--   <a>pPrintLightBg</a> for printing to a terminal with a light
--   background. Different colors are used.
--   
--   Prints to <a>stdout</a>. Use <a>pHPrint</a> to print to a different
--   <a>Handle</a>.
--   
--   <pre>
--   &gt;&gt;&gt; pPrint [Just (1, "hello")]
--   [ Just
--       ( 1
--       , "hello"
--       )
--   ]
--   </pre>
pPrint :: (MonadIO m, Show a) => a -> m ()

-- | Similar to <a>pPrint</a>, but take a <a>Handle</a> to print to.
--   
--   <pre>
--   &gt;&gt;&gt; pHPrint stdout [Just (1, "hello")]
--   [ Just
--       ( 1
--       , "hello"
--       )
--   ]
--   </pre>
pHPrint :: (MonadIO m, Show a) => Handle -> a -> m ()

-- | Similar to <a>pPrint</a>, but the first argument is a <a>String</a>
--   representing a data type that has already been <a>show</a>ed.
--   
--   <pre>
--   &gt;&gt;&gt; pPrintString $ show [ Just (1, "hello"), Nothing ]
--   [ Just
--       ( 1
--       , "hello"
--       )
--   , Nothing
--   ]
--   </pre>
pPrintString :: MonadIO m => String -> m ()

-- | Similar to <a>pHPrintString</a>, but take a <a>Handle</a> to print to.
--   
--   <pre>
--   &gt;&gt;&gt; pHPrintString stdout $ show [ Just (1, "hello"), Nothing ]
--   [ Just
--       ( 1
--       , "hello"
--       )
--   , Nothing
--   ]
--   </pre>
pHPrintString :: MonadIO m => Handle -> String -> m ()

-- | Similar to <a>pPrint</a>, but print in color regardless of whether the
--   output goes to a TTY or not.
--   
--   See <a>pPrint</a> for an example of how to use this function.
pPrintForceColor :: (MonadIO m, Show a) => a -> m ()

-- | Similar to <a>pPrintForceColor</a>, but take a <a>Handle</a> to print
--   to.
--   
--   See <a>pHPrint</a> for an example of how to use this function.
pHPrintForceColor :: (MonadIO m, Show a) => Handle -> a -> m ()

-- | Similar to <a>pPrintString</a>, but print in color regardless of
--   whether the output goes to a TTY or not.
--   
--   See <a>pPrintString</a> for an example of how to use this function.
pPrintStringForceColor :: MonadIO m => String -> m ()

-- | Similar to <a>pHPrintString</a>, but print in color regardless of
--   whether the output goes to a TTY or not.
--   
--   See <a>pHPrintString</a> for an example of how to use this function.
pHPrintStringForceColor :: MonadIO m => Handle -> String -> m ()

-- | Similar to <a>pPrintForceColor</a>, but just return the resulting
--   pretty-printed data type as a <a>Text</a> instead of printing it to
--   the screen.
--   
--   This function is for printing to a dark background.
--   
--   See <a>pShowNoColor</a> for an example of how to use this function.
pShow :: Show a => a -> Text

-- | Similar to <a>pShow</a>, but the first argument is a <a>String</a>
--   representing a data type that has already been <a>show</a>ed.
--   
--   This will work on any <a>String</a> that is similar to a Haskell data
--   type. The only requirement is that the strings are quoted, and braces,
--   parentheses, and brackets are correctly used to represent indentation.
--   For example, <a>pString</a> will correctly pretty-print JSON.
--   
--   This function is for printing to a dark background.
--   
--   See <a>pStringNoColor</a> for an example of how to use this function.
pString :: String -> Text

-- | Alias for <a>pPrint</a>.
pPrintDarkBg :: (MonadIO m, Show a) => a -> m ()

-- | Alias for <a>pHPrint</a>.
pHPrintDarkBg :: (MonadIO m, Show a) => Handle -> a -> m ()

-- | Alias for <a>pPrintString</a>.
pPrintStringDarkBg :: MonadIO m => String -> m ()

-- | Alias for <a>pHPrintString</a>.
pHPrintStringDarkBg :: MonadIO m => Handle -> String -> m ()

-- | Alias for <a>pPrintForceColor</a>.
pPrintForceColorDarkBg :: (MonadIO m, Show a) => a -> m ()

-- | Alias for <a>pHPrintForceColor</a>.
pHPrintForceColorDarkBg :: (MonadIO m, Show a) => Handle -> a -> m ()

-- | Alias for <a>pPrintStringForceColor</a>.
pPrintStringForceColorDarkBg :: MonadIO m => String -> m ()

-- | Alias for <a>pHPrintStringForceColor</a>.
pHPrintStringForceColorDarkBg :: MonadIO m => Handle -> String -> m ()

-- | Alias for <a>pShow</a>.
pShowDarkBg :: Show a => a -> Text

-- | Alias for <a>pString</a>.
pStringDarkBg :: String -> Text

-- | Just like <a>pPrintDarkBg</a>, but for printing to a light background.
pPrintLightBg :: (MonadIO m, Show a) => a -> m ()

-- | Just like <a>pHPrintDarkBg</a>, but for printing to a light
--   background.
pHPrintLightBg :: (MonadIO m, Show a) => Handle -> a -> m ()

-- | Just like <a>pPrintStringDarkBg</a>, but for printing to a light
--   background.
pPrintStringLightBg :: MonadIO m => String -> m ()

-- | Just like <a>pHPrintStringDarkBg</a>, but for printing to a light
--   background.
pHPrintStringLightBg :: MonadIO m => Handle -> String -> m ()

-- | Just like <a>pPrintForceColorDarkBg</a>, but for printing to a light
--   background.
pPrintForceColorLightBg :: (MonadIO m, Show a) => a -> m ()

-- | Just like <a>pHPrintForceColorDarkBg</a>, but for printing to a light
--   background.
pHPrintForceColorLightBg :: (MonadIO m, Show a) => Handle -> a -> m ()

-- | Just like <a>pPrintStringForceColorDarkBg</a>, but for printing to a
--   light background.
pPrintStringForceColorLightBg :: MonadIO m => String -> m ()

-- | Just like <a>pHPrintStringForceColorDarkBg</a>, but for printing to a
--   light background.
pHPrintStringForceColorLightBg :: MonadIO m => Handle -> String -> m ()

-- | Just like <a>pShowDarkBg</a>, but for printing to a light background.
pShowLightBg :: Show a => a -> Text

-- | Just like <a>pStringDarkBg</a>, but for printing to a light
--   background.
pStringLightBg :: String -> Text

-- | Similar to <a>pPrint</a>, but doesn't print in color. However, data
--   types will still be indented nicely.
--   
--   <pre>
--   &gt;&gt;&gt; pPrintNoColor $ Just ["hello", "bye"]
--   Just
--       [ "hello"
--       , "bye"
--       ]
--   </pre>
pPrintNoColor :: (MonadIO m, Show a) => a -> m ()

-- | Like <a>pPrintNoColor</a>, but take a <a>Handle</a> to determine where
--   to print to.
--   
--   <pre>
--   &gt;&gt;&gt; pHPrintNoColor stdout $ Just ["hello", "bye"]
--   Just
--       [ "hello"
--       , "bye"
--       ]
--   </pre>
pHPrintNoColor :: (MonadIO m, Show a) => Handle -> a -> m ()

-- | Similar to <a>pPrintString</a>, but doesn't print in color. However,
--   data types will still be indented nicely.
--   
--   <pre>
--   &gt;&gt;&gt; pPrintStringNoColor $ show $ Just ["hello", "bye"]
--   Just
--       [ "hello"
--       , "bye"
--       ]
--   </pre>
pPrintStringNoColor :: MonadIO m => String -> m ()

-- | Like <a>pPrintStringNoColor</a>, but take a <a>Handle</a> to determine
--   where to print to.
--   
--   <pre>
--   &gt;&gt;&gt; pHPrintStringNoColor stdout $ show $ Just ["hello", "bye"]
--   Just
--       [ "hello"
--       , "bye"
--       ]
--   </pre>
pHPrintStringNoColor :: MonadIO m => Handle -> String -> m ()

-- | Like <a>pShow</a>, but without color.
--   
--   <pre>
--   &gt;&gt;&gt; pShowNoColor [ Nothing, Just (1, "hello") ]
--   "[ Nothing\n, Just\n    ( 1\n    , \"hello\"\n    )\n]"
--   </pre>
pShowNoColor :: Show a => a -> Text

-- | LIke <a>pString</a>, but without color.
--   
--   <pre>
--   &gt;&gt;&gt; pStringNoColor $ show [1, 2, 3]
--   "[ 1\n, 2\n, 3\n]"
--   </pre>
pStringNoColor :: String -> Text

-- | Similar to <a>pPrint</a> but takes <a>OutputOptions</a> to change how
--   the pretty-printing is done.
--   
--   For example, <a>pPrintOpt</a> can be used to make the indentation much
--   smaller than normal.
--   
--   This is what the normal indentation looks like:
--   
--   <pre>
--   &gt;&gt;&gt; pPrintOpt NoCheckColorTty defaultOutputOptionsNoColor $ Just ("hello", "bye")
--   Just
--       ( "hello"
--       , "bye"
--       )
--   </pre>
--   
--   This is what smaller indentation looks like:
--   
--   <pre>
--   &gt;&gt;&gt; let smallIndent = defaultOutputOptionsNoColor {outputOptionsIndentAmount = 1}
--   
--   &gt;&gt;&gt; pPrintOpt CheckColorTty smallIndent $ Just ("hello", "bye")
--   Just
--    ( "hello"
--    , "bye"
--    )
--   </pre>
--   
--   Lines in strings get indented
--   
--   <pre>
--   &gt;&gt;&gt; pPrintOpt NoCheckColorTty defaultOutputOptionsNoColor (1, (2, "foo\nbar\nbaz", 3))
--   ( 1
--   ,
--       ( 2
--       , "foo
--         bar
--         baz"
--       , 3
--       )
--   )
--   </pre>
--   
--   Lines get indented even in custom show instances
--   
--   <pre>
--   &gt;&gt;&gt; data Foo = Foo
--   
--   &gt;&gt;&gt; instance Show Foo where show _ = "foo\nbar\nbaz"
--   
--   &gt;&gt;&gt; pPrintOpt CheckColorTty defaultOutputOptionsNoColor (1, (2, Foo, 3))
--   ( 1
--   ,
--       ( 2
--       , foo
--         bar
--         baz
--       , 3
--       )
--   )
--   </pre>
--   
--   <a>CheckColorTty</a> determines whether to test <a>stdout</a> for
--   whether or not it is connected to a TTY.
--   
--   If set to <a>NoCheckColorTty</a>, then <a>pPrintOpt</a> won't check if
--   <a>stdout</a> is a TTY. It will print in color depending on the value
--   of <a>outputOptionsColorOptions</a>.
--   
--   If set to <a>CheckColorTty</a>, then <a>pPrintOpt</a> will check if
--   <a>stdout</a> is conneted to a TTY. If <a>stdout</a> is determined to
--   be connected to a TTY, then it will print in color depending on the
--   value of <a>outputOptionsColorOptions</a>. If <a>stdout</a> is
--   determined to NOT be connected to a TTY, then it will NOT print in
--   color, regardless of the value of <a>outputOptionsColorOptions</a>.
pPrintOpt :: (MonadIO m, Show a) => CheckColorTty -> OutputOptions -> a -> m ()

-- | Similar to <a>pPrintOpt</a>, but take a <a>Handle</a> to determine
--   where to print to.
pHPrintOpt :: (MonadIO m, Show a) => CheckColorTty -> OutputOptions -> Handle -> a -> m ()

-- | Similar to <a>pPrintOpt</a>, but the last argument is a string
--   representing a data structure that has already been <a>show</a>ed.
--   
--   <pre>
--   &gt;&gt;&gt; let foo = show (1, (2, "hello", 3))
--   
--   &gt;&gt;&gt; pPrintStringOpt CheckColorTty defaultOutputOptionsNoColor foo
--   ( 1
--   ,
--       ( 2
--       , "hello"
--       , 3
--       )
--   )
--   </pre>
pPrintStringOpt :: MonadIO m => CheckColorTty -> OutputOptions -> String -> m ()

-- | Similar to <a>pPrintStringOpt</a>, but take a <a>Handle</a> to
--   determine where to print to.
--   
--   <pre>
--   &gt;&gt;&gt; let foo = show (1, (2, "hello", 3))
--   
--   &gt;&gt;&gt; pHPrintStringOpt CheckColorTty defaultOutputOptionsNoColor stdout foo
--   ( 1
--   ,
--       ( 2
--       , "hello"
--       , 3
--       )
--   )
--   </pre>
pHPrintStringOpt :: MonadIO m => CheckColorTty -> OutputOptions -> Handle -> String -> m ()

-- | Like <a>pShow</a> but takes <a>OutputOptions</a> to change how the
--   pretty-printing is done.
pShowOpt :: Show a => OutputOptions -> a -> Text

-- | Like <a>pString</a> but takes <a>OutputOptions</a> to change how the
--   pretty-printing is done.
pStringOpt :: OutputOptions -> String -> Text

-- | Data-type wrapping up all the options available when rendering the
--   list of <a>Output</a>s.
data OutputOptions
OutputOptions :: Int -> Maybe ColorOptions -> Bool -> OutputOptions

-- | Number of spaces to use when indenting. It should probably be either 2
--   or 4.
[outputOptionsIndentAmount] :: OutputOptions -> Int

-- | If this is <a>Nothing</a>, then don't colorize the output. If this is
--   <tt><a>Just</a> colorOptions</tt>, then use <tt>colorOptions</tt> to
--   colorize the output.
[outputOptionsColorOptions] :: OutputOptions -> Maybe ColorOptions

-- | Whether to replace non-printable characters with hexadecimal escape
--   sequences.
[outputOptionsEscapeNonPrintable] :: OutputOptions -> Bool

-- | Default values for <a>OutputOptions</a> when printing to a console
--   with a dark background. <a>outputOptionsIndentAmount</a> is 4, and
--   <a>outputOptionsColorOptions</a> is <a>defaultColorOptionsDarkBg</a>.
defaultOutputOptionsDarkBg :: OutputOptions

-- | Default values for <a>OutputOptions</a> when printing to a console
--   with a light background. <a>outputOptionsIndentAmount</a> is 4, and
--   <a>outputOptionsColorOptions</a> is <a>defaultColorOptionsLightBg</a>.
defaultOutputOptionsLightBg :: OutputOptions

-- | Default values for <a>OutputOptions</a> when printing using using ANSI
--   escape sequences for color. <a>outputOptionsIndentAmount</a> is 4, and
--   <a>outputOptionsColorOptions</a> is <a>Nothing</a>.
defaultOutputOptionsNoColor :: OutputOptions

-- | Determines whether pretty-simple should check if the output
--   <a>Handle</a> is a TTY device. Normally, users only want to print in
--   color if the output <a>Handle</a> is a TTY device.
data CheckColorTty

-- | Check if the output <a>Handle</a> is a TTY device. If the output
--   <a>Handle</a> is a TTY device, determine whether to print in color
--   based on <a>outputOptionsColorOptions</a>. If not, then set
--   <a>outputOptionsColorOptions</a> to <a>Nothing</a> so the output does
--   not get colorized.
CheckColorTty :: CheckColorTty

-- | Don't check if the output <a>Handle</a> is a TTY device. Determine
--   whether to colorize the output based solely on the value of
--   <a>outputOptionsColorOptions</a>.
NoCheckColorTty :: CheckColorTty

-- | Default color options for use on a dark background.
--   
--   <a>colorQuote</a> is <a>defaultColorQuoteDarkBg</a>.
--   <a>colorString</a> is <a>defaultColorStringDarkBg</a>.
--   <a>colorError</a> is <a>defaultColorErrorDarkBg</a>. <a>colorNum</a>
--   is <a>defaultColorNumDarkBg</a>. <a>colorRainbowParens</a> is
--   <tt>defaultColorRainboxParensDarkBg</tt>.
defaultColorOptionsDarkBg :: ColorOptions

-- | Default color options for use on a light background.
--   
--   <a>colorQuote</a> is <a>defaultColorQuoteLightBg</a>.
--   <a>colorString</a> is <a>defaultColorStringLightBg</a>.
--   <a>colorError</a> is <a>defaultColorErrorLightBg</a>. <a>colorNum</a>
--   is <a>defaultColorNumLightBg</a>. <a>colorRainbowParens</a> is
--   <tt>defaultColorRainboxParensLightBg</tt>.
defaultColorOptionsLightBg :: ColorOptions


-- | This module contains the same functionality with Prelude's
--   <a>Debug.Trace</a> module, with pretty printing the debug strings.
--   
--   Warning: This module also shares the same unsafety of
--   <a>Debug.Trace</a> module.
module Debug.Pretty.Simple

-- | The <a>pTrace</a> function pretty prints the trace message given as
--   its first argument, before returning the second argument as its
--   result.
--   
--   For example, this returns the value of <tt>f x</tt> but first outputs
--   the message.
--   
--   <pre>
--   pTrace ("calling f with x = " ++ show x) (f x)
--   </pre>
--   
--   The <a>pTrace</a> function should <i>only</i> be used for debugging,
--   or for monitoring execution. The function is not referentially
--   transparent: its type indicates that it is a pure function but it has
--   the side effect of outputting the trace message.
pTrace :: String -> a -> a

-- | Like <a>pTrace</a> but returns the message instead of a third value.
pTraceId :: String -> String

-- | Like <a>pTrace</a>, but uses <a>show</a> on the argument to convert it
--   to a <a>String</a>.
--   
--   This makes it convenient for printing the values of interesting
--   variables or expressions inside a function. For example here we print
--   the value of the variables <tt>x</tt> and <tt>z</tt>:
--   
--   <pre>
--   f x y =
--       pTraceShow (x, z) $ result
--     where
--       z = ...
--       ...
--   </pre>
pTraceShow :: Show a => a -> b -> b

-- | Like <a>pTraceShow</a> but returns the shown value instead of a third
--   value.
pTraceShowId :: Show a => a -> a

-- | The <a>pTraceIO</a> function outputs the trace message from the IO
--   monad. This sequences the output with respect to other IO actions.
pTraceIO :: String -> IO ()

-- | Like <a>pTrace</a> but returning unit in an arbitrary
--   <a>Applicative</a> context. Allows for convenient use in do-notation.
--   
--   Note that the application of <a>pTraceM</a> is not an action in the
--   <a>Applicative</a> context, as <a>pTraceIO</a> is in the <a>IO</a>
--   type. While the fresh bindings in the following example will force the
--   <a>traceM</a> expressions to be reduced every time the
--   <tt>do</tt>-block is executed, <tt>traceM "not crashed"</tt> would
--   only be reduced once, and the message would only be printed once. If
--   your monad is in <tt>MonadIO</tt>, <tt>liftIO . pTraceIO</tt> may be a
--   better option.
--   
--   <pre>
--   ... = do
--     x &lt;- ...
--     pTraceM $ "x: " ++ show x
--     y &lt;- ...
--     pTraceM $ "y: " ++ show y
--   </pre>
pTraceM :: Applicative f => String -> f ()

-- | Like <a>pTraceM</a>, but uses <a>show</a> on the argument to convert
--   it to a <a>String</a>.
--   
--   <pre>
--   ... = do
--     x &lt;- ...
--     pTraceShowM $ x
--     y &lt;- ...
--     pTraceShowM $ x + y
--   </pre>
pTraceShowM :: (Show a, Applicative f) => a -> f ()

-- | like <a>pTrace</a>, but additionally prints a call stack if one is
--   available.
--   
--   In the current GHC implementation, the call stack is only available if
--   the program was compiled with <tt>-prof</tt>; otherwise
--   <a>pTraceStack</a> behaves exactly like <a>pTrace</a>. Entries in the
--   call stack correspond to <tt>SCC</tt> annotations, so it is a good
--   idea to use <tt>-fprof-auto</tt> or <tt>-fprof-auto-calls</tt> to add
--   SCC annotations automatically.
pTraceStack :: String -> a -> a

-- | The <a>pTraceEvent</a> function behaves like <a>trace</a> with the
--   difference that the message is emitted to the eventlog, if eventlog
--   profiling is available and enabled at runtime.
--   
--   It is suitable for use in pure code. In an IO context use
--   <a>pTraceEventIO</a> instead.
--   
--   Note that when using GHC's SMP runtime, it is possible (but rare) to
--   get duplicate events emitted if two CPUs simultaneously evaluate the
--   same thunk that uses <a>pTraceEvent</a>.
pTraceEvent :: String -> a -> a

-- | The <a>pTraceEventIO</a> function emits a message to the eventlog, if
--   eventlog profiling is available and enabled at runtime.
--   
--   Compared to <a>pTraceEvent</a>, <a>pTraceEventIO</a> sequences the
--   event with respect to other IO actions.
pTraceEventIO :: String -> IO ()

-- | The <a>pTraceMarker</a> function emits a marker to the eventlog, if
--   eventlog profiling is available and enabled at runtime. The
--   <tt>String</tt> is the name of the marker. The name is just used in
--   the profiling tools to help you keep clear which marker is which.
--   
--   This function is suitable for use in pure code. In an IO context use
--   <a>pTraceMarkerIO</a> instead.
--   
--   Note that when using GHC's SMP runtime, it is possible (but rare) to
--   get duplicate events emitted if two CPUs simultaneously evaluate the
--   same thunk that uses <a>pTraceMarker</a>.
pTraceMarker :: String -> a -> a

-- | The <a>pTraceMarkerIO</a> function emits a marker to the eventlog, if
--   eventlog profiling is available and enabled at runtime.
--   
--   Compared to <a>pTraceMarker</a>, <a>pTraceMarkerIO</a> sequences the
--   event with respect to other IO actions.
pTraceMarkerIO :: String -> IO ()

-- | Similar to <a>pTrace</a>, but forcing color.
pTraceForceColor :: String -> a -> a

-- | Similar to <a>pTraceId</a>, but forcing color.
pTraceIdForceColor :: String -> String

-- | Similar to <a>pTraceShow</a>, but forcing color.
pTraceShowForceColor :: Show a => a -> b -> b

-- | Similar to <a>pTraceShowId</a>, but forcing color.
pTraceShowIdForceColor :: Show a => a -> a

-- | Similar to <a>pTraceM</a>, but forcing color.
pTraceMForceColor :: Applicative f => String -> f ()

-- | Similar to <a>pTraceShowM</a>, but forcing color.
pTraceShowMForceColor :: (Show a, Applicative f) => a -> f ()

-- | Similar to <a>pTraceStack</a>, but forcing color.
pTraceStackForceColor :: String -> a -> a

-- | Similar to <a>pTraceEvent</a>, but forcing color.
pTraceEventForceColor :: String -> a -> a

-- | Similar to <a>pTraceEventIO</a>, but forcing color.
pTraceEventIOForceColor :: String -> IO ()

-- | Similar to <a>pTraceMarker</a>, but forcing color.
pTraceMarkerForceColor :: String -> a -> a

-- | Similar to <a>pTraceMarkerIO</a>, but forcing color.
pTraceMarkerIOForceColor :: String -> IO ()

-- | Similar to <a>pTraceIO</a>, but forcing color.
pTraceIOForceColor :: String -> IO ()

-- | Similar to <a>pTrace</a>, but without color.
--   
--   <pre>
--   &gt;&gt;&gt; pTraceNoColor "wow" ()
--   wow
--   ()
--   </pre>
pTraceNoColor :: String -> a -> a

-- | Similar to <a>pTraceId</a>, but without color.
--   
--   <pre>
--   &gt;&gt;&gt; pTraceIdNoColor "(1, 2, 3)" `seq` ()
--   ( 1
--   , 2
--   , 3
--   )
--   ()
--   </pre>
pTraceIdNoColor :: String -> String

-- | Similar to <a>pTraceShow</a>, but without color.
--   
--   <pre>
--   &gt;&gt;&gt; import qualified Data.Map as M
--   
--   &gt;&gt;&gt; pTraceShowNoColor (M.fromList [(1, True)]) ()
--   fromList
--       [
--           ( 1
--           , True
--           )
--       ]
--   ()
--   </pre>
pTraceShowNoColor :: Show a => a -> b -> b

-- | Similar to <a>pTraceShowId</a>, but without color.
--   
--   <pre>
--   &gt;&gt;&gt; import qualified Data.Map as M
--   
--   &gt;&gt;&gt; pTraceShowIdNoColor (M.fromList [(1, True)]) `seq` ()
--   fromList
--       [
--           ( 1
--           , True
--           )
--       ]
--   ()
--   </pre>
pTraceShowIdNoColor :: Show a => a -> a

-- | Similar to <a>pTraceM</a>, but without color.
--   
--   <pre>
--   &gt;&gt;&gt; pTraceMNoColor "wow"
--   wow
--   </pre>
pTraceMNoColor :: Applicative f => String -> f ()

-- | Similar to <a>pTraceShowM</a>, but without color.
--   
--   <pre>
--   &gt;&gt;&gt; pTraceShowMNoColor [1,2,3]
--   [ 1
--   , 2
--   , 3
--   ]
--   </pre>
pTraceShowMNoColor :: (Show a, Applicative f) => a -> f ()

-- | Similar to <a>pTraceStack</a>, but without color.
--   
--   <pre>
--   &gt;&gt;&gt; pTraceStackNoColor "wow" () `seq` ()
--   wow
--   ()
--   </pre>
pTraceStackNoColor :: String -> a -> a

-- | Similar to <a>pTraceEvent</a>, but without color.
pTraceEventNoColor :: String -> a -> a

-- | Similar to <a>pTraceEventIO</a>, but without color.
pTraceEventIONoColor :: String -> IO ()

-- | Similar to <a>pTraceMarker</a>, but without color.
pTraceMarkerNoColor :: String -> a -> a

-- | Similar to <a>pTraceMarkerIO</a>, but without color.
pTraceMarkerIONoColor :: String -> IO ()

-- | Similar to <a>pTraceIO</a>, but without color.
--   
--   <pre>
--   &gt;&gt;&gt; pTraceIONoColor "(1, 2, 3)"
--   ( 1
--   , 2
--   , 3
--   )
--   </pre>
pTraceIONoColor :: String -> IO ()

-- | Like <a>pTrace</a> but takes OutputOptions.
pTraceOpt :: CheckColorTty -> OutputOptions -> String -> a -> a

-- | Like <a>pTraceId</a> but takes OutputOptions.
pTraceIdOpt :: CheckColorTty -> OutputOptions -> String -> String

-- | Like <a>pTraceShow</a> but takes OutputOptions.
pTraceShowOpt :: Show a => CheckColorTty -> OutputOptions -> a -> b -> b

-- | Like <a>pTraceShowId</a> but takes OutputOptions.
pTraceShowIdOpt :: Show a => CheckColorTty -> OutputOptions -> a -> a

-- | Like <a>pTraceIO</a> but takes OutputOptions.
pTraceOptIO :: CheckColorTty -> OutputOptions -> String -> IO ()

-- | Like <a>pTraceM</a> but takes OutputOptions.
pTraceOptM :: Applicative f => CheckColorTty -> OutputOptions -> String -> f ()

-- | Like <a>pTraceShowM</a> but takes OutputOptions.
pTraceShowOptM :: (Show a, Applicative f) => CheckColorTty -> OutputOptions -> a -> f ()

-- | Like <a>pTraceStack</a> but takes OutputOptions.
pTraceStackOpt :: CheckColorTty -> OutputOptions -> String -> a -> a

-- | Like <a>pTraceEvent</a> but takes OutputOptions.
pTraceEventOpt :: CheckColorTty -> OutputOptions -> String -> a -> a

-- | Like <a>pTraceEventIO</a> but takes OutputOptions.
pTraceEventOptIO :: CheckColorTty -> OutputOptions -> String -> IO ()

-- | Like <a>pTraceMarker</a> but takes OutputOptions.
pTraceMarkerOpt :: CheckColorTty -> OutputOptions -> String -> a -> a

-- | Like <a>pTraceMarkerIO</a> but takes OutputOptions.
pTraceMarkerOptIO :: CheckColorTty -> OutputOptions -> String -> IO ()
