-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Clean up the formatting of 'show' output -- -- Clean up the formatting of show output @package shower @version 0.2 -- | This module defines the representation of data that the parser -- produces and the pretty-printer consumes. module Shower.Class -- | A tagless final encoding for a result builder (ShowS, -- Doc, Html, etc). -- -- Note that showerStringLit and showerCharLit take exact -- uninterpreted strings to avoid losing information (e.g. "\n" -- vs. "\10"). class Shower a -- | A record, { x = 24, y = 42 } or { "a": null, "b": 13 -- }. showerRecord :: Shower a => [ShowerComma (a, ShowerFieldSep, a)] -> a -- | A list, [1, 2, 3]. showerList :: Shower a => [ShowerComma a] -> a -- | A tuple, (1, 2, 3). showerTuple :: Shower a => [ShowerComma a] -> a -- | A string literal, "hello, (world)". showerStringLit :: Shower a => String -> a -- | A character literal, '('. showerCharLit :: Shower a => String -> a -- | Variable names, numeric literals, and so on. showerAtom :: Shower a => String -> a -- | Whitespace-separated elements. showerSpace :: Shower a => [a] -> a -- | A field separator used in records, either '=' for Haskell -- records or ':' for JSON. data ShowerFieldSep -- | An equality sign, '=' ShowerFieldSepEquals :: ShowerFieldSep -- | A colon, ':' ShowerFieldSepColon :: ShowerFieldSep -- | Either a comma or an element. -- -- For example, the tuple section (,a,,b) is represented like -- this: -- --
--   [ ShowerCommaSep,
--     ShowerCommaElement "a",
--     ShowerCommaSep,
--     ShowerCommaSep,
--     ShowerCommaElement "b" ]
--   
data ShowerComma a -- | A comma, ',' ShowerCommaSep :: ShowerComma a -- | An element ShowerCommaElement :: a -> ShowerComma a -- | A megaparsec implementation of a parser for Shower. module Shower.Parser -- | Parser for Shower expressions. pShower :: Shower a => Parsec Void String a -- | A pretty implementation of a pretty-printer for -- Shower. module Shower.Printer -- | A pretty document, with a Shower instance. newtype ShowerDoc SD :: Doc -> ShowerDoc -- | Render a ShowerDoc with the default style. showerRender :: ShowerDoc -> String instance Shower.Class.Shower Shower.Printer.ShowerDoc -- | Pretty-print Show output and JSON. module Shower -- | A drop-in replacement for show that has nice layout. NB: does -- not handle infinite data structures at the moment. shower :: Show a => a -> String -- | A drop-in replacement for print that has nice layout. Use it -- in GHCi with -interactive-print=Shower.printer: -- --
--   ghci> :set -interactive-print=Shower.printer
--   ghci> ([1..15], ['a'..'z'])
--   ([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
--    "abcdefghijklmnopqrstuvwxyz")
--   
-- -- NB: does not handle infinite data structures at the moment. printer :: Show a => a -> IO () -- | Parse and pretty-print show output or JSON. showerString :: String -> Either String String