pprint -package:grisette

Pretty print a generic value to stdout. This is particularly useful in the GHCi interactive environment.
Pretty-print any data type that has a Show instance. If you've never seen MonadIO before, you can think of this function as having the following type signature:
pPrint :: Show a => a -> IO ()
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 pPrintLightBg for printing to a terminal with a light background. Different colors are used. Prints to stdout. Use pHPrint to print to a different Handle.
>>> pPrint [Just (1, "hello")]
[ Just
( 1
, "hello"
)
]
Pretty print a showable value. An easier alias for pretty-simple's pPrint. This will print in colour if useColorOnStderrUnsafe is true.
The pprint function outputs a value of any type that is an instance of Pretty to the standard output device by calling ppr and adding a newline.
Render document using xml-conduit's pretty-printer.
The :print & friends commands
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.
Alias for pPrint.
Similar to pPrint, but print in color regardless of whether the output goes to a TTY or not. See pPrint for an example of how to use this function.
Alias for pPrintForceColor.
Just like pPrintForceColorDarkBg, but for printing to a light background.
Just like pPrintDarkBg, but for printing to a light background.
Similar to pPrint, but doesn't print in color. However, data types will still be indented nicely.
>>> pPrintNoColor $ Just ["hello", "bye"]
Just
[ "hello"
, "bye"
]
Similar to pPrint but takes OutputOptions to change how the pretty-printing is done. For example, pPrintOpt can be used to make the indentation much smaller than normal. This is what the normal indentation looks like:
>>> pPrintOpt NoCheckColorTty defaultOutputOptionsNoColor $ Just ("hello", "bye")
Just
( "hello"
, "bye"
)
This is what smaller indentation looks like:
>>> let smallIndent = defaultOutputOptionsNoColor {outputOptionsIndentAmount = 1}

>>> pPrintOpt CheckColorTty smallIndent $ Just ("hello", "bye")
Just
( "hello"
, "bye"
)
Lines in strings get indented
>>> pPrintOpt NoCheckColorTty defaultOutputOptionsNoColor (1, (2, "foo\nbar\nbaz", 3))
( 1
,
( 2
, "foo
bar
baz"
, 3
)
)
Lines get indented even in custom show instances
>>> data Foo = Foo

>>> instance Show Foo where show _ = "foo\nbar\nbaz"

>>> pPrintOpt CheckColorTty defaultOutputOptionsNoColor (1, (2, Foo, 3))
( 1
,
( 2
, foo
bar
baz
, 3
)
)
CheckColorTty determines whether to test stdout for whether or not it is connected to a TTY. If set to NoCheckColorTty, then pPrintOpt won't check if stdout is a TTY. It will print in color depending on the value of outputOptionsColorOptions. If set to CheckColorTty, then pPrintOpt will check if stdout is conneted to a TTY. If stdout is determined to be connected to a TTY, then it will print in color depending on the value of outputOptionsColorOptions. If stdout is determined to NOT be connected to a TTY, then it will NOT print in color, regardless of the value of outputOptionsColorOptions.