Text.PrettyPrint.Annotated.HughesPJClass

pretty-1.1.3.6: Pretty-printing library

Copyright | (c) Trevor Elliott <revor@galois.com> 2015
License | BSD-style (see the file LICENSE)
Maintainer | David Terei <code@davidterei.com>
Stability | stable
Portability | portable
Safe Haskell | Safe
Language | Haskell98

Text.PrettyPrint.Annotated.HughesPJClass

Contents

- Pretty typeclass

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. This module re-exports `HughesPJ`.

Synopsis

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

# Pretty typeclass

class Pretty a where Source #

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

pPrintPrec | pPrint

Methods

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

pPrint :: a -> Doc ann Source #

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

#### Instances

Instances details

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

newtype PrettyLevel Source #

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

prettyNormal :: PrettyLevel Source #

The "normal" (Level 0) of detail.

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

Pretty print a value with the `prettyNormal` level.

prettyParen :: Bool -> Doc ann -> Doc ann Source #

Deprecated: Please use `maybeParens` instead

Parenthesize an value if the boolean is true.

module Text.PrettyPrint.Annotated.HughesPJ