mainland-pretty-0.7: Pretty printing designed for printing source code.

Copyright(c) 2006-2011 Harvard University
(c) 2011-2012 Geoffrey Mainland
(c) 2015-2017 Drexel University
LicenseBSD-style
Maintainermainland@drexel.edu
Stabilityprovisional
Portabilityportable
Safe HaskellNone
LanguageHaskell98

Text.PrettyPrint.Mainland.Class

Contents

Description

This module is based on A Prettier Printer by Phil Wadler in The Fun of Programming, Jeremy Gibbons and Oege de Moor (eds) http://homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf

At the time it was originally written I didn't know about Daan Leijen's pretty printing module based on the same paper. I have since incorporated many of his improvements. This module is geared towards pretty printing source code; its main advantages over other libraries are the ability to automatically track the source locations associated with pretty printed values and output appropriate #line pragmas and the use of Text for output.

Synopsis

The Pretty type class for pretty printing

class Pretty a where #

Minimal complete definition

pprPrec | ppr

Methods

ppr :: a -> Doc #

pprPrec :: Int -> a -> Doc #

pprList :: [a] -> Doc #

Instances
Pretty Bool # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Bool -> Doc #

pprPrec :: Int -> Bool -> Doc #

pprList :: [Bool] -> Doc #

Pretty Char # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Char -> Doc #

pprPrec :: Int -> Char -> Doc #

pprList :: [Char] -> Doc #

Pretty Double # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Double -> Doc #

pprPrec :: Int -> Double -> Doc #

pprList :: [Double] -> Doc #

Pretty Float # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Float -> Doc #

pprPrec :: Int -> Float -> Doc #

pprList :: [Float] -> Doc #

Pretty Int # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Int -> Doc #

pprPrec :: Int -> Int -> Doc #

pprList :: [Int] -> Doc #

Pretty Int8 # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Int8 -> Doc #

pprPrec :: Int -> Int8 -> Doc #

pprList :: [Int8] -> Doc #

Pretty Int16 # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Int16 -> Doc #

pprPrec :: Int -> Int16 -> Doc #

pprList :: [Int16] -> Doc #

Pretty Int32 # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Int32 -> Doc #

pprPrec :: Int -> Int32 -> Doc #

pprList :: [Int32] -> Doc #

Pretty Int64 # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Int64 -> Doc #

pprPrec :: Int -> Int64 -> Doc #

pprList :: [Int64] -> Doc #

Pretty Integer # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Integer -> Doc #

pprPrec :: Int -> Integer -> Doc #

pprList :: [Integer] -> Doc #

Pretty Word8 # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Word8 -> Doc #

pprPrec :: Int -> Word8 -> Doc #

pprList :: [Word8] -> Doc #

Pretty Word16 # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Word16 -> Doc #

pprPrec :: Int -> Word16 -> Doc #

pprList :: [Word16] -> Doc #

Pretty Word32 # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Word32 -> Doc #

pprPrec :: Int -> Word32 -> Doc #

pprList :: [Word32] -> Doc #

Pretty Word64 # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Word64 -> Doc #

pprPrec :: Int -> Word64 -> Doc #

pprList :: [Word64] -> Doc #

Pretty () # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: () -> Doc #

pprPrec :: Int -> () -> Doc #

pprList :: [()] -> Doc #

Pretty Pos # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Pos -> Doc #

pprPrec :: Int -> Pos -> Doc #

pprList :: [Pos] -> Doc #

Pretty Loc # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Loc -> Doc #

pprPrec :: Int -> Loc -> Doc #

pprList :: [Loc] -> Doc #

Pretty Text # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Text -> Doc #

pprPrec :: Int -> Text -> Doc #

pprList :: [Text] -> Doc #

Pretty Text # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Text -> Doc #

pprPrec :: Int -> Text -> Doc #

pprList :: [Text] -> Doc #

Pretty Doc # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Doc -> Doc #

pprPrec :: Int -> Doc -> Doc #

pprList :: [Doc] -> Doc #

Pretty a => Pretty [a] # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: [a] -> Doc #

pprPrec :: Int -> [a] -> Doc #

pprList :: [[a]] -> Doc #

Pretty a => Pretty (Maybe a) # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Maybe a -> Doc #

pprPrec :: Int -> Maybe a -> Doc #

pprList :: [Maybe a] -> Doc #

(Integral a, Pretty a) => Pretty (Ratio a) # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Ratio a -> Doc #

pprPrec :: Int -> Ratio a -> Doc #

pprList :: [Ratio a] -> Doc #

(RealFloat a, Pretty a) => Pretty (Complex a) # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Complex a -> Doc #

pprPrec :: Int -> Complex a -> Doc #

pprList :: [Complex a] -> Doc #

Pretty a => Pretty (Set a) # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Set a -> Doc #

pprPrec :: Int -> Set a -> Doc #

pprList :: [Set a] -> Doc #

Pretty x => Pretty (L x) # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: L x -> Doc #

pprPrec :: Int -> L x -> Doc #

pprList :: [L x] -> Doc #

(Pretty a, Pretty b) => Pretty (a, b) # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: (a, b) -> Doc #

pprPrec :: Int -> (a, b) -> Doc #

pprList :: [(a, b)] -> Doc #

(Pretty k, Pretty v) => Pretty (Map k v) # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: Map k v -> Doc #

pprPrec :: Int -> Map k v -> Doc #

pprList :: [Map k v] -> Doc #

(Pretty a, Pretty b, Pretty c) => Pretty (a, b, c) # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: (a, b, c) -> Doc #

pprPrec :: Int -> (a, b, c) -> Doc #

pprList :: [(a, b, c)] -> Doc #

(Pretty a, Pretty b, Pretty c, Pretty d) => Pretty (a, b, c, d) # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: (a, b, c, d) -> Doc #

pprPrec :: Int -> (a, b, c, d) -> Doc #

pprList :: [(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.Mainland.Class

Methods

ppr :: (a, b, c, d, e) -> Doc #

pprPrec :: Int -> (a, b, c, d, e) -> Doc #

pprList :: [(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.Mainland.Class

Methods

ppr :: (a, b, c, d, e, f) -> Doc #

pprPrec :: Int -> (a, b, c, d, e, f) -> Doc #

pprList :: [(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.Mainland.Class

Methods

ppr :: (a, b, c, d, e, f, g) -> Doc #

pprPrec :: Int -> (a, b, c, d, e, f, g) -> Doc #

pprList :: [(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.Mainland.Class

Methods

ppr :: (a, b, c, d, e, f, g, h) -> Doc #

pprPrec :: Int -> (a, b, c, d, e, f, g, h) -> Doc #

pprList :: [(a, b, c, d, e, f, g, h)] -> Doc #

(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g, Pretty h, Pretty i) => Pretty (a, b, c, d, e, f, g, h, i) # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: (a, b, c, d, e, f, g, h, i) -> Doc #

pprPrec :: Int -> (a, b, c, d, e, f, g, h, i) -> Doc #

pprList :: [(a, b, c, d, e, f, g, h, i)] -> Doc #

(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g, Pretty h, Pretty i, Pretty j) => Pretty (a, b, c, d, e, f, g, h, i, j) # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: (a, b, c, d, e, f, g, h, i, j) -> Doc #

pprPrec :: Int -> (a, b, c, d, e, f, g, h, i, j) -> Doc #

pprList :: [(a, b, c, d, e, f, g, h, i, j)] -> Doc #

(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g, Pretty h, Pretty i, Pretty j, Pretty k) => Pretty (a, b, c, d, e, f, g, h, i, j, k) # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: (a, b, c, d, e, f, g, h, i, j, k) -> Doc #

pprPrec :: Int -> (a, b, c, d, e, f, g, h, i, j, k) -> Doc #

pprList :: [(a, b, c, d, e, f, g, h, i, j, k)] -> Doc #

(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g, Pretty h, Pretty i, Pretty j, Pretty k, Pretty l) => Pretty (a, b, c, d, e, f, g, h, i, j, k, l) # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: (a, b, c, d, e, f, g, h, i, j, k, l) -> Doc #

pprPrec :: Int -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Doc #

pprList :: [(a, b, c, d, e, f, g, h, i, j, k, l)] -> Doc #

(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g, Pretty h, Pretty i, Pretty j, Pretty k, Pretty l, Pretty m) => Pretty (a, b, c, d, e, f, g, h, i, j, k, l, m) # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Doc #

pprPrec :: Int -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Doc #

pprList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m)] -> Doc #

(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g, Pretty h, Pretty i, Pretty j, Pretty k, Pretty l, Pretty m, Pretty n) => Pretty (a, b, c, d, e, f, g, h, i, j, k, l, m, n) # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Doc #

pprPrec :: Int -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Doc #

pprList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m, n)] -> Doc #

(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g, Pretty h, Pretty i, Pretty j, Pretty k, Pretty l, Pretty m, Pretty n, Pretty o) => Pretty (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) # 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Doc #

pprPrec :: Int -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Doc #

pprList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)] -> Doc #

pprint :: (Pretty a, MonadIO m) => a -> m () #

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.