Text.PrettyPrint.HughesPJClass

prettyclass-1.0.0.0: Pretty printing class similar to Show.

Safe Haskell | Safe-Inferred
Language | Haskell98

Text.PrettyPrint.HughesPJClass

Description

Pretty printing class, simlar to `Show` but nicer looking. Note that the precedence level is a `Rational` so there is an unlimited number of levels. Based on Text.PrettyPrint.HughesPJ, which is re-exported.

Synopsis

- class Pretty a where
  - pPrintPrec :: PrettyLevel -> Rational -> a -> Doc
  - pPrint :: a -> Doc
  - pPrintList :: PrettyLevel -> [a] -> Doc
- newtype PrettyLevel = PrettyLevel Int
- prettyNormal :: PrettyLevel
- prettyShow :: Pretty a => a -> String
- prettyParen :: Bool -> Doc -> Doc
- module Text.PrettyPrint.HughesPJ

# Documentation

class Pretty a where #

Pretty printing class. The precedence level is used in a similar way as in the `Show` class. Minimal complete definition is either `pPrintPrec` or `pPrint`.

Minimal complete definition

Nothing

Methods

pPrintPrec :: PrettyLevel -> Rational -> a -> Doc #

pPrint :: a -> Doc #

pPrintList :: PrettyLevel -> [a] -> Doc #

#### Instances

Instances details

Pretty Ordering # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods pPrintPrec :: PrettyLevel -> Rational -> Ordering -> Doc # pPrint :: Ordering -> Doc # pPrintList :: PrettyLevel -> [Ordering] -> Doc #
Pretty Integer # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods pPrintPrec :: PrettyLevel -> Rational -> Integer -> Doc # pPrint :: Integer -> Doc # pPrintList :: PrettyLevel -> [Integer] -> Doc #
Pretty () # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods pPrintPrec :: PrettyLevel -> Rational -> () -> Doc # pPrint :: () -> Doc # pPrintList :: PrettyLevel -> [()] -> Doc #
Pretty Bool # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods pPrintPrec :: PrettyLevel -> Rational -> Bool -> Doc # pPrint :: Bool -> Doc # pPrintList :: PrettyLevel -> [Bool] -> Doc #
Pretty Char # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods pPrintPrec :: PrettyLevel -> Rational -> Char -> Doc # pPrint :: Char -> Doc # pPrintList :: PrettyLevel -> [Char] -> Doc #
Pretty Double # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods pPrintPrec :: PrettyLevel -> Rational -> Double -> Doc # pPrint :: Double -> Doc # pPrintList :: PrettyLevel -> [Double] -> Doc #
Pretty Float # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods pPrintPrec :: PrettyLevel -> Rational -> Float -> Doc # pPrint :: Float -> Doc # pPrintList :: PrettyLevel -> [Float] -> Doc #
Pretty Int # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods pPrintPrec :: PrettyLevel -> Rational -> Int -> Doc # pPrint :: Int -> Doc # pPrintList :: PrettyLevel -> [Int] -> Doc #
Pretty a => Pretty (Maybe a) # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods pPrintPrec :: PrettyLevel -> Rational -> Maybe a -> Doc # pPrint :: Maybe a -> Doc # pPrintList :: PrettyLevel -> [Maybe a] -> Doc #
Pretty a => Pretty [a] # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods pPrintPrec :: PrettyLevel -> Rational -> [a] -> Doc # pPrint :: [a] -> Doc # pPrintList :: PrettyLevel -> [[a]] -> Doc #
(Pretty a, Pretty b) => Pretty (Either a b) # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods pPrintPrec :: PrettyLevel -> Rational -> Either a b -> Doc # pPrint :: Either a b -> Doc # pPrintList :: PrettyLevel -> [Either a b] -> Doc #
(Pretty a, Pretty b) => Pretty (a, b) # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods pPrintPrec :: PrettyLevel -> Rational -> (a, b) -> Doc # pPrint :: (a, b) -> Doc # pPrintList :: PrettyLevel -> [(a, b)] -> Doc #
(Pretty a, Pretty b, Pretty c) => Pretty (a, b, c) # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods pPrintPrec :: PrettyLevel -> Rational -> (a, b, c) -> Doc # pPrint :: (a, b, c) -> Doc # pPrintList :: PrettyLevel -> [(a, b, c)] -> Doc #
(Pretty a, Pretty b, Pretty c, Pretty d) => Pretty (a, b, c, d) # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods pPrintPrec :: PrettyLevel -> Rational -> (a, b, c, d) -> Doc # pPrint :: (a, b, c, d) -> Doc # pPrintList :: PrettyLevel -> [(a, b, c, d)] -> Doc #
(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e) => Pretty (a, b, c, d, e) # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods pPrintPrec :: PrettyLevel -> Rational -> (a, b, c, d, e) -> Doc # pPrint :: (a, b, c, d, e) -> Doc # pPrintList :: PrettyLevel -> [(a, b, c, d, e)] -> Doc #
(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f) => Pretty (a, b, c, d, e, f) # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods pPrintPrec :: PrettyLevel -> Rational -> (a, b, c, d, e, f) -> Doc # pPrint :: (a, b, c, d, e, f) -> Doc # pPrintList :: PrettyLevel -> [(a, b, c, d, e, f)] -> Doc #
(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g) => Pretty (a, b, c, d, e, f, g) # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods pPrintPrec :: PrettyLevel -> Rational -> (a, b, c, d, e, f, g) -> Doc # pPrint :: (a, b, c, d, e, f, g) -> Doc # pPrintList :: PrettyLevel -> [(a, b, c, d, e, f, g)] -> Doc #
(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g, Pretty h) => Pretty (a, b, c, d, e, f, g, h) # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods pPrintPrec :: PrettyLevel -> Rational -> (a, b, c, d, e, f, g, h) -> Doc # pPrint :: (a, b, c, d, e, f, g, h) -> Doc # pPrintList :: PrettyLevel -> [(a, b, c, d, e, f, g, h)] -> Doc #

newtype PrettyLevel #

Level of detail in the pretty printed output. Level 0 is the least detail.

Constructors

PrettyLevel Int |

#### Instances

Instances details

Show PrettyLevel # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods showsPrec :: Int -> PrettyLevel -> ShowS # show :: PrettyLevel -> String # showList :: [PrettyLevel] -> ShowS #
Eq PrettyLevel # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods (==) :: PrettyLevel -> PrettyLevel -> Bool # (/=) :: PrettyLevel -> PrettyLevel -> Bool #
Ord PrettyLevel # |
Instance details Defined in Text.PrettyPrint.HughesPJClass Methods compare :: PrettyLevel -> PrettyLevel -> Ordering # (<) :: PrettyLevel -> PrettyLevel -> Bool # (<=) :: PrettyLevel -> PrettyLevel -> Bool # (>) :: PrettyLevel -> PrettyLevel -> Bool # (>=) :: PrettyLevel -> PrettyLevel -> Bool # max :: PrettyLevel -> PrettyLevel -> PrettyLevel # min :: PrettyLevel -> PrettyLevel -> PrettyLevel #

prettyNormal :: PrettyLevel #

prettyShow :: Pretty a => a -> String #

Pretty print a value with the `prettyNormal` level.

prettyParen :: Bool -> Doc -> Doc #

Parenthesize an value if the boolean is true.

module Text.PrettyPrint.HughesPJ