-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A generic, derivable, haskell pretty printer. -- -- GenericPretty is a Haskell library that supports automatic derivation -- of pretty printing functions on user defined data types. -- -- The form of geenrics used is based on that introduced in the paper: -- Magalhaes, Dijkstra, Jeuring, and Loh, A Generic Deriving Mechanism -- for Haskell, 3'rd ACM Symposium on Haskell, pp. 37-48, September 2010, -- http://dx.doi.org/10.1145/1863523.1863529. Changes from the -- original paper in the GHC implementation are described here: -- http://www.haskell.org/haskellwiki/GHC.Generics#Changes_from_the_paper. -- -- This package requires the use of the new GHC.Generics features -- http://www.haskell.org/haskellwiki/GHC.Generics, present from -- GHC 7.2. Use of these features is indicated by the DeriveGeneric -- pragma. or the flag -XDeriveGeneric. -- -- Pretty printing produces values of type Text.PrettyPrint.Doc, using -- the Text.PrettyPrint library -- http://www.haskell.org/ghc/docs/latest/html/libraries/pretty-1.1.1.0/Text-PrettyPrint.html. -- -- The output provided is a pretty printed version of that provided by -- Prelude.show. That is, rendering the document provided by this pretty -- printer yields an output identical to that of Prelude.show, except for -- extra whitespace. -- -- For information about the functions exported by the package please see -- the API linked further down this page. For examples of usage, both -- basic and more complex see the README file and the haskell source code -- files in the TestSuite folder, both included in the package. Finally -- for installation instructions also see the README file or this page: -- http://www.haskell.org/haskellwiki/Cabal/How_to_install_a_Cabal_package @package GenericPretty @version 1.2.2 -- | GenericPretty is a Haskell library that supports automatic derivation -- of pretty printing functions on user defined data types. -- -- The output provided is a pretty printed version of that provided by -- show. That is, rendering the document provided by this pretty -- printer yields an output identical to that of show, except for -- extra whitespace. -- -- For examples of usage please see the README file included in the -- package. -- -- For more information see the HackageDB project page: -- http://hackage.haskell.org/package/GenericPretty module Text.PrettyPrint.GenericPretty -- | The class Out is the equivalent of Show -- -- It provides conversion of values to pretty printable Pretty.Doc's. -- -- Minimal complete definition: docPrec or doc. -- -- Derived instances of Out have the following properties -- -- -- -- For example, given the declarations -- --
--   data Tree a =  Leaf a  |  Node (Tree a) (Tree a) deriving (Generic)
--   
-- -- The derived instance of Out is equivalent to: -- --
--   instance (Out a) => Out (Tree a) where
--    
--           docPrec d (Leaf m) = Pretty.sep $ wrapParens (d > appPrec) $
--                text "Leaf" : [nest (constrLen + parenLen) (docPrec (appPrec+1) m)]
--             where appPrec = 10
--                   constrLen = 5;
--                   parenLen = if(d > appPrec) then 1 else 0
--   
--           docPrec d (Node u v) = Pretty.sep $ wrapParens (d > appPrec) $
--                text "Node" : 
--                nest (constrLen + parenLen) (docPrec (appPrec+1) u) : 
--                [nest (constrLen + parenLen) (docPrec (appPrec+1) v)]
--             where appPrec = 10
--                   constrLen = 5
--                   parenLen = if(d > appPrec) then 1 else 0
--   
class Out a -- | docPrec is the equivalent of showsPrec. -- -- Convert a value to a pretty printable Doc. docPrec :: Out a => Int -> a -> Doc -- | docPrec is the equivalent of showsPrec. -- -- Convert a value to a pretty printable Doc. docPrec :: (Out a, Generic a, GOut (Rep a)) => Int -> a -> Doc -- | doc is the equivalent of show -- -- This is a specialised variant of docPrec, using precedence -- context zero. doc :: Out a => a -> Doc -- | doc is the equivalent of show -- -- This is a specialised variant of docPrec, using precedence -- context zero. doc :: (Out a, Generic a, GOut (Rep a)) => a -> Doc -- | docList is the equivalent of showList. -- -- The method docList is provided to allow the programmer to give -- a specialised way of showing lists of values. For example, this is -- used by the predefined Out instance of the Char type, -- where values of type String should be shown in double quotes, -- rather than between square brackets. docList :: Out a => [a] -> Doc -- | The default Pretty Printer, -- -- Equivalent to: -- --
--   ppStyle defaultStyle
--   
-- -- Where defaultStyle = (mode=PageMode, lineLength=80, -- ribbonsPerLine=1.5) pp :: (Out a) => a -> IO () -- | Semi-customizable pretty printer. -- -- Equivalent to: -- --
--   ppStyle customStyle
--   
-- -- Where customStyle uses the specified line length, mode = PageMode and -- ribbonsPerLine = 1. ppLen :: (Out a) => Int -> a -> IO () -- | Customizable pretty printer. -- -- Takes a user defined Style as a parameter and uses -- outputIO to obtain the result Equivalent to: -- --
--   fullPP outputIO (putChar '\n')
--   
ppStyle :: (Out a) => Style -> a -> IO () -- | The default pretty printer returning Strings -- -- Equivalent to -- --
--   prettyStyle defaultStyle
--   
-- -- Where defaultStyle = (mode=PageMode, lineLength=80, -- ribbonsPerLine=1.5) pretty :: (Out a) => a -> String -- | Semi-customizable pretty printer. -- -- Equivalent to: -- --
--   prettyStyle customStyle
--   
-- -- Where customStyle uses the specified line length, mode = PageMode and -- ribbonsPerLine = 1. prettyLen :: (Out a) => Int -> a -> String -- | Customizable pretty printer -- -- Takes a user defined Style as a parameter and uses -- outputStr to obtain the result Equivalent to: -- --
--   fullPP outputStr ""
--   
prettyStyle :: (Out a) => Style -> a -> String -- | fullPP is a fully customizable Pretty Printer -- -- Every other pretty printer just gives some default values to -- fullPP fullPP :: (Out a) => (TextDetails -> b -> b) -> b -> Style -> a -> b -- | Representable types of kind *. This class is derivable in GHC with the -- DeriveGeneric flag on. class Generic a -- | Utility function that handles the text conversion for fullPP. -- -- outputIO transforms the text into Strings and outputs it -- directly. outputIO :: TextDetails -> IO () -> IO () -- | Utility function that handles the text conversion for fullPP. -- -- outputStr just leaves the text as a String which is -- usefull if you want to further process the pretty printed result. outputStr :: TextDetails -> String -> String instance Text.PrettyPrint.GenericPretty.Out f => Text.PrettyPrint.GenericPretty.GOut (GHC.Generics.K1 t f) instance Text.PrettyPrint.GenericPretty.Out () instance Text.PrettyPrint.GenericPretty.Out GHC.Types.Char instance Text.PrettyPrint.GenericPretty.Out GHC.Types.Int instance Text.PrettyPrint.GenericPretty.Out GHC.Integer.Type.Integer instance Text.PrettyPrint.GenericPretty.Out GHC.Types.Float instance Text.PrettyPrint.GenericPretty.Out GHC.Types.Double instance Text.PrettyPrint.GenericPretty.Out GHC.Real.Rational instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out [a] instance Text.PrettyPrint.GenericPretty.Out GHC.Types.Bool instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (GHC.Base.Maybe a) instance (Text.PrettyPrint.GenericPretty.Out a, Text.PrettyPrint.GenericPretty.Out b) => Text.PrettyPrint.GenericPretty.Out (Data.Either.Either a b) instance (Text.PrettyPrint.GenericPretty.Out a, Text.PrettyPrint.GenericPretty.Out b) => Text.PrettyPrint.GenericPretty.Out (a, b) instance (Text.PrettyPrint.GenericPretty.Out a, Text.PrettyPrint.GenericPretty.Out b, Text.PrettyPrint.GenericPretty.Out c) => Text.PrettyPrint.GenericPretty.Out (a, b, c) instance (Text.PrettyPrint.GenericPretty.Out a, Text.PrettyPrint.GenericPretty.Out b, Text.PrettyPrint.GenericPretty.Out c, Text.PrettyPrint.GenericPretty.Out d) => Text.PrettyPrint.GenericPretty.Out (a, b, c, d) instance (Text.PrettyPrint.GenericPretty.Out a, Text.PrettyPrint.GenericPretty.Out b, Text.PrettyPrint.GenericPretty.Out c, Text.PrettyPrint.GenericPretty.Out d, Text.PrettyPrint.GenericPretty.Out e) => Text.PrettyPrint.GenericPretty.Out (a, b, c, d, e) instance (Text.PrettyPrint.GenericPretty.Out a, Text.PrettyPrint.GenericPretty.Out b, Text.PrettyPrint.GenericPretty.Out c, Text.PrettyPrint.GenericPretty.Out d, Text.PrettyPrint.GenericPretty.Out e, Text.PrettyPrint.GenericPretty.Out f) => Text.PrettyPrint.GenericPretty.Out (a, b, c, d, e, f) instance (Text.PrettyPrint.GenericPretty.Out a, Text.PrettyPrint.GenericPretty.Out b, Text.PrettyPrint.GenericPretty.Out c, Text.PrettyPrint.GenericPretty.Out d, Text.PrettyPrint.GenericPretty.Out e, Text.PrettyPrint.GenericPretty.Out f, Text.PrettyPrint.GenericPretty.Out g) => Text.PrettyPrint.GenericPretty.Out (a, b, c, d, e, f, g) instance Text.PrettyPrint.GenericPretty.GOut GHC.Generics.U1 instance (Text.PrettyPrint.GenericPretty.GOut f, GHC.Generics.Datatype c) => Text.PrettyPrint.GenericPretty.GOut (GHC.Generics.M1 GHC.Generics.D c f) instance (Text.PrettyPrint.GenericPretty.GOut f, GHC.Generics.Selector c) => Text.PrettyPrint.GenericPretty.GOut (GHC.Generics.M1 GHC.Generics.S c f) instance (Text.PrettyPrint.GenericPretty.GOut f, GHC.Generics.Constructor c) => Text.PrettyPrint.GenericPretty.GOut (GHC.Generics.M1 GHC.Generics.C c f) instance (Text.PrettyPrint.GenericPretty.GOut f, Text.PrettyPrint.GenericPretty.GOut g) => Text.PrettyPrint.GenericPretty.GOut (f GHC.Generics.:+: g) instance (Text.PrettyPrint.GenericPretty.GOut f, Text.PrettyPrint.GenericPretty.GOut g) => Text.PrettyPrint.GenericPretty.GOut (f GHC.Generics.:*: g)