chr-pretty-0.1.0.0: Pretty printing for chr library

Safe HaskellSafe
LanguageHaskell2010

CHR.Pretty

Contents

Synopsis

Documentation

class Show a => PP a where Source #

Interface for PP

Methods

pp :: a -> PP_Doc Source #

ppList :: [a] -> PP_Doc Source #

Instances

PP Char Source # 

Methods

pp :: Char -> PP_Doc Source #

ppList :: [Char] -> PP_Doc Source #

PP Float Source # 
PP Int Source # 

Methods

pp :: Int -> PP_Doc Source #

ppList :: [Int] -> PP_Doc Source #

PP Integer Source # 
PP PP_Doc Source # 
PP a => PP [a] Source # 

Methods

pp :: [a] -> PP_Doc Source #

ppList :: [[a]] -> PP_Doc Source #

disp :: PP_Doc -> Int -> ShowS Source #

Display to string

hPut :: Handle -> PP_Doc -> Int -> IO () Source #

Display to Handle

data Doc Source #

Doc structure

Constructors

Emp 
Str !String 
Hor !Cached !Doc !Doc 
Ver !Cached !Doc !Doc 
Ind !Int !Doc 

(>|<) :: (PP a, PP b) => a -> b -> PP_Doc infixr 3 Source #

PP horizontally aside

(>-<) :: (PP a, PP b) => a -> b -> PP_Doc infixr 2 Source #

PP vertically above

(>#<) :: (PP a, PP b) => a -> b -> PP_Doc infixr 3 Source #

PP horizontally aside with 1 blank in between

hlist :: PP a => [a] -> PP_Doc Source #

PP list vertically

hlistReverse :: PP a => [a] -> PP_Doc Source #

PP list vertically reverse

vlist :: PP a => [a] -> PP_Doc Source #

PP list horizontally

hv :: PP a => [a] -> PP_Doc Source #

PP list vertically, alias for vlist

fill :: PP a => [a] -> PP_Doc Source #

PP list horizontally, alias for hlist

indent :: PP a => Int -> a -> PP_Doc Source #

Indent

empty :: PP_Doc Source #

empty PP

text :: String -> PP_Doc Source #

basic string

Internal use only

isSingleLine :: PP_Doc -> Bool Source #

Is single line doc?

Choice combinators

(>-|-<) :: (PP a, PP b) => a -> b -> PP_Doc infixr 2 Source #

As (>|but doing (-<) when does not fit on single line

(>-#-<) :: (PP a, PP b) => a -> b -> PP_Doc infixr 2 Source #

As (>#but doing (-<) when does not fit on single line

General PP for list

ppListSep :: (PP s, PP c, PP o, PP a) => o -> c -> s -> [a] -> PP_Doc Source #

PP list with open, separator, and close

ppListSepV :: (PP s, PP c, PP o, PP a) => o -> c -> s -> [a] -> PP_Doc Source #

Deprecated: Use pp...Block variants

ppListSepVV :: (PP s, PP c, PP o, PP a) => o -> c -> s -> [a] -> PP_Doc Source #

Deprecated: Use pp...Block variants

Pack PP around

ppCurlys :: PP p => p -> PP_Doc Source #

ppPacked :: (PP o, PP c, PP p) => o -> c -> p -> PP_Doc Source #

ppParens :: PP p => p -> PP_Doc Source #

ppCurly :: PP p => p -> PP_Doc Source #

ppBrackets :: PP p => p -> PP_Doc Source #

ppVBar :: PP p => p -> PP_Doc Source #

Block, horizontal/vertical as required

ppBlock :: (PP ocs, PP a) => ocs -> ocs -> ocs -> [a] -> PP_Doc Source #

PP list with open, separator, and close in a possibly multiline block structure

ppBlockH :: (PP ocs, PP a) => ocs -> ocs -> ocs -> [a] -> PP_Doc Source #

PP list with open, separator, and close in a possibly multiline block structure

ppBlock' :: (PP ocs, PP a) => ocs -> ocs -> ocs -> ocs -> [a] -> [PP_Doc] Source #

PP in a blocklike fashion, vertically

ppBlockWithStrings :: PP a => String -> String -> String -> [a] -> PP_Doc Source #

See ppBlock, but with string delimiters aligned properly

ppBlockWithStrings' :: PP a => String -> String -> String -> [a] -> [PP_Doc] Source #

See ppBlock, but with string delimiters aligned properly, yielding a list of elements

ppBlockWithStringsH :: PP a => String -> String -> String -> [a] -> PP_Doc Source #

See ppBlock, but with string delimiters aligned properly, preferring single line horizontal placement

ppParensCommasBlock :: PP a => [a] -> PP_Doc Source #

PP horizontally or vertically with "(", ",", and ")" in a possibly multiline block structure

ppCurlysBlock :: PP a => [a] -> PP_Doc Source #

PP horizontally or vertically with "{", " ", and "}" in a possibly multiline block structure

ppCurlysSemisBlock :: PP a => [a] -> PP_Doc Source #

PP horizontally or vertically with "{", ";", and "}" in a possibly multiline block structure

ppCurlysCommasBlock :: PP a => [a] -> PP_Doc Source #

PP horizontally or vertically with "{", ",", and "}" in a possibly multiline block structure

ppParensSemisBlock :: PP a => [a] -> PP_Doc Source #

PP horizontally or vertically with "(", ";", and ")" in a possibly multiline block structure

ppBracketsCommasBlock :: PP a => [a] -> PP_Doc Source #

PP horizontally or vertically with "[", ",", and "]" in a possibly multiline block structure

ppParensCommasBlockH :: PP a => [a] -> PP_Doc Source #

PP horizontally or vertically with "(", ",", and ")" in a possibly multiline block structure, preferring single line horizontal placement

ppCurlysBlockH :: PP a => [a] -> PP_Doc Source #

PP horizontally or vertically with "{", " ", and "}" in a possibly multiline block structure, preferring single line horizontal placement

ppCurlysSemisBlockH :: PP a => [a] -> PP_Doc Source #

PP horizontally or vertically with "{", ";", and "}" in a possibly multiline block structure, preferring single line horizontal placement

ppCurlysCommasBlockH :: PP a => [a] -> PP_Doc Source #

PP horizontally or vertically with "{", ",", and "}" in a possibly multiline block structure, preferring single line horizontal placement

ppParensSemisBlockH :: PP a => [a] -> PP_Doc Source #

PP horizontally or vertically with "(", ";", and ")" in a possibly multiline block structure, preferring single line horizontal placement

ppBracketsCommasBlockH :: PP a => [a] -> PP_Doc Source #

PP horizontally or vertically with "[", ",", and "]" in a possibly multiline block structure

ppBracketsCommasV :: PP a => [a] -> PP_Doc Source #

Deprecated: Use ppBracketsCommasBlock

PP horizontally or vertically with "[", ",", and "]" in a possibly multiline block structure

Vertical PP of list only

Horizontal PP of list only

ppCommas :: PP a => [a] -> PP_Doc Source #

PP horizontally: list separated by comma

ppCommas' :: PP a => [a] -> PP_Doc Source #

PP horizontally: list separated by comma + single blank

ppSemis :: PP a => [a] -> PP_Doc Source #

PP horizontally: list separated by semicolon

ppSemis' :: PP a => [a] -> PP_Doc Source #

PP horizontally: list separated by semicolon + single blank

ppSpaces :: PP a => [a] -> PP_Doc Source #

PP horizontally: list separated by single blank

ppCurlysCommas :: PP a => [a] -> PP_Doc Source #

PP horizontally with "{", ",", and "}"

ppCurlysCommas' :: PP a => [a] -> PP_Doc Source #

PP horizontally with "{", ", ", and "}"

ppCurlysCommasWith :: PP a => (a -> PP_Doc) -> [a] -> PP_Doc Source #

ppCurlysSemis :: PP a => [a] -> PP_Doc Source #

PP horizontally with "{", ";", and "}"

ppCurlysSemis' :: PP a => [a] -> PP_Doc Source #

PP horizontally with "{", "; ", and "}"

ppParensSpaces :: PP a => [a] -> PP_Doc Source #

PP horizontally with "(", " ", and ")"

ppParensCommas :: PP a => [a] -> PP_Doc Source #

PP horizontally with "(", ",", and ")"

ppParensCommas' :: PP a => [a] -> PP_Doc Source #

PP horizontally with "(", ", ", and ")"

ppBracketsCommas :: PP a => [a] -> PP_Doc Source #

PP horizontally with "[", ",", and "]"

ppBracketsCommas' :: PP a => [a] -> PP_Doc Source #

PP horizontally with "[", ", ", and "]"

ppListSepFill :: (PP s, PP c, PP o, PP a) => o -> c -> s -> [a] -> PP_Doc Source #

Deprecated: Use ppListSep

Conditional

ppMbPre :: (PP x, PP r) => (a -> x) -> Maybe a -> r -> PP_Doc Source #

Only prefix with a Maybe and extra space when Just

ppMbPost :: (PP x, PP r) => (a -> x) -> Maybe a -> r -> PP_Doc Source #

Only suffix with a Maybe and extra space when Just

ppListPre :: (PP x, PP r) => ([a] -> x) -> [a] -> r -> PP_Doc Source #

Only prefix with a list and extra space when non-empty

ppListPost :: (PP x, PP r) => ([a] -> x) -> [a] -> r -> PP_Doc Source #

Only suffix with a list and extra space when non-empty

Misc

ppDots :: PP a => [a] -> PP_Doc Source #

ppMb :: PP a => Maybe a -> PP_Doc Source #

ppUnless :: PP x => Bool -> x -> PP_Doc Source #

Guard around PP: if False pass through

ppWhen :: PP x => Bool -> x -> PP_Doc Source #

Guard around PP: if True pass through

Render

showPP :: PP a => a -> String Source #

IO

Orphan instances

PP Bool Source # 

Methods

pp :: Bool -> PP_Doc Source #

ppList :: [Bool] -> PP_Doc Source #

PP Word32 Source # 
PP () Source # 

Methods

pp :: () -> PP_Doc Source #

ppList :: [()] -> PP_Doc Source #

PP a => PP (Maybe a) Source # 

Methods

pp :: Maybe a -> PP_Doc Source #

ppList :: [Maybe a] -> PP_Doc Source #

PP a => PP (Set a) Source # 

Methods

pp :: Set a -> PP_Doc Source #

ppList :: [Set a] -> PP_Doc Source #

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

Methods

pp :: (a, b) -> PP_Doc Source #

ppList :: [(a, b)] -> PP_Doc Source #

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

Methods

pp :: (a, b, c) -> PP_Doc Source #

ppList :: [(a, b, c)] -> PP_Doc Source #