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 Source #

Minimal complete definition

pprPrec | ppr

Methods

ppr :: a -> Doc Source #

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

pprList :: [a] -> Doc Source #

Instances

Pretty Bool Source # 

Methods

ppr :: Bool -> Doc Source #

pprPrec :: Int -> Bool -> Doc Source #

pprList :: [Bool] -> Doc Source #

Pretty Char Source # 

Methods

ppr :: Char -> Doc Source #

pprPrec :: Int -> Char -> Doc Source #

pprList :: [Char] -> Doc Source #

Pretty Double Source # 
Pretty Float Source # 
Pretty Int Source # 

Methods

ppr :: Int -> Doc Source #

pprPrec :: Int -> Int -> Doc Source #

pprList :: [Int] -> Doc Source #

Pretty Int8 Source # 

Methods

ppr :: Int8 -> Doc Source #

pprPrec :: Int -> Int8 -> Doc Source #

pprList :: [Int8] -> Doc Source #

Pretty Int16 Source # 
Pretty Int32 Source # 
Pretty Int64 Source # 
Pretty Integer Source # 
Pretty Word8 Source # 
Pretty Word16 Source # 
Pretty Word32 Source # 
Pretty Word64 Source # 
Pretty () Source # 

Methods

ppr :: () -> Doc Source #

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

pprList :: [()] -> Doc Source #

Pretty Pos Source # 

Methods

ppr :: Pos -> Doc Source #

pprPrec :: Int -> Pos -> Doc Source #

pprList :: [Pos] -> Doc Source #

Pretty Loc Source # 

Methods

ppr :: Loc -> Doc Source #

pprPrec :: Int -> Loc -> Doc Source #

pprList :: [Loc] -> Doc Source #

Pretty Text Source # 

Methods

ppr :: Text -> Doc Source #

pprPrec :: Int -> Text -> Doc Source #

pprList :: [Text] -> Doc Source #

Pretty Text Source # 

Methods

ppr :: Text -> Doc Source #

pprPrec :: Int -> Text -> Doc Source #

pprList :: [Text] -> Doc Source #

Pretty Doc Source # 

Methods

ppr :: Doc -> Doc Source #

pprPrec :: Int -> Doc -> Doc Source #

pprList :: [Doc] -> Doc Source #

Pretty a => Pretty [a] Source # 

Methods

ppr :: [a] -> Doc Source #

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

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

Pretty a => Pretty (Maybe a) Source # 

Methods

ppr :: Maybe a -> Doc Source #

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

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

(Integral a, Pretty a) => Pretty (Ratio a) Source # 

Methods

ppr :: Ratio a -> Doc Source #

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

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

(RealFloat a, Pretty a) => Pretty (Complex a) Source # 

Methods

ppr :: Complex a -> Doc Source #

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

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

Pretty a => Pretty (Set a) Source # 

Methods

ppr :: Set a -> Doc Source #

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

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

Pretty x => Pretty (L x) Source # 

Methods

ppr :: L x -> Doc Source #

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

pprList :: [L x] -> Doc Source #

(Pretty a, Pretty b) => Pretty (a, b) Source # 

Methods

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

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

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

(Pretty k, Pretty v) => Pretty (Map k v) Source # 

Methods

ppr :: Map k v -> Doc Source #

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

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

(Pretty a, Pretty b, Pretty c) => Pretty (a, b, c) Source # 

Methods

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

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

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

(Pretty a, Pretty b, Pretty c, Pretty d) => Pretty (a, b, c, d) Source # 

Methods

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

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

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

(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e) => Pretty (a, b, c, d, e) Source # 

Methods

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

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

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

(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f) => Pretty (a, b, c, d, e, f) Source # 

Methods

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

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

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

(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g) => Pretty (a, b, c, d, e, f, g) Source # 

Methods

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

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

pprList :: [(a, b, c, d, e, f, g)] -> Doc 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) Source # 

Methods

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

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

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

(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) Source # 

Methods

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

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

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

(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) Source # 

Methods

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

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

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

(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) Source # 

Methods

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

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

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

(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) Source # 

Methods

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

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

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

(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) Source # 

Methods

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

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

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

(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) Source # 

Methods

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

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

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

(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) Source # 

Methods

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

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

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

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

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.