Implementation of the Pretty library using linear-time, bounded implementation by Olaf Chitil.
data Doc
Constructors:
type Horizontal
= Bool
type Remaining
= Int
type Width
= Int
type Position
= Int
type StartPosition
= Position
type EndPosition
= Position
type Out
= Remaining -> Margins -> FormatHistory -> String
type OutGroupPrefix
= Horizontal -> Out -> Out
type Margins
= [Int]
data Nesting
Constructors:
Align
:: Nesting
Inc
:: Int -> Nesting
data Color
Constructors:
Black
:: Color
Red
:: Color
Green
:: Color
Yellow
:: Color
Blue
:: Color
Magenta
:: Color
Cyan
:: Color
White
:: Color
Default
:: Color
data Intensity
Constructors:
Faint
:: Intensity
Normal
:: Intensity
Bold
:: Intensity
data BlinkMode
Constructors:
Off
:: BlinkMode
Slow
:: BlinkMode
Rapid
:: BlinkMode
data FormatStm
Constructors:
SetForeground
:: Color -> FormatStm
SetBackground
:: Color -> FormatStm
SetIntensity
:: Intensity -> FormatStm
SetBlinkMode
:: BlinkMode -> FormatStm
SetItalicized
:: Bool -> FormatStm
SetUnderlined
:: Bool -> FormatStm
SetCrossedout
:: Bool -> FormatStm
InverseColoring
:: Bool -> FormatStm
type FormatHistory
= [FormatStm]
data Tokens
Constructors:
EOD
:: Tokens
Empty
:: Tokens -> Tokens
Text
:: String -> Tokens -> Tokens
LineBreak
:: (Maybe String) -> Tokens -> Tokens
OpenGroup
:: Tokens -> Tokens
CloseGroup
:: Tokens -> Tokens
OpenNest
:: Nesting -> Tokens -> Tokens
CloseNest
:: Tokens -> Tokens
OpenFormat
:: FormatStm -> Tokens -> Tokens
CloseFormat
:: Tokens -> Tokens
deDoc
:: Doc -> Tokens -> Tokens
resetFormat
:: [FormatStm] -> (FormatStm, [FormatStm])
prevFGColor
:: [FormatStm] -> Color
prevBGColor
:: [FormatStm] -> Color
prevIntensity
:: [FormatStm] -> Intensity
prevBlinkMode
:: [FormatStm] -> BlinkMode
applyFormat
:: FormatStm -> String
intensityMode
:: Intensity -> Int
applyNesting
:: Nesting -> Int -> Int -> [Int] -> [Int]
unApplyNesting
:: [Int] -> [Int]
addSpaces
:: Int -> Tokens -> String
doc2Tokens
:: Doc -> Tokens
showWidth
:: Int -> Doc -> String
(showWidth w d)
pretty prints document d
with a page width of w
characters
:: Width
|
width of page |
-> Doc
|
a document |
-> String
|
pretty printed document |
noGroup
:: Tokens -> Int -> Int -> Int -> [Int] -> [FormatStm] -> String
oneGroup
:: Tokens -> Int -> Int -> Int -> (Bool -> (Int -> [Int] -> [FormatStm] -> String) -> Int -> [Int] -> [FormatStm] -> String) -> Int -> [Int] -> [FormatStm] -> String
multiGroup
:: Tokens -> Int -> Int -> Int -> (Bool -> (Int -> [Int] -> [FormatStm] -> String) -> Int -> [Int] -> [FormatStm] -> String) -> Queue (Int, Bool -> (Int -> [Int] -> [FormatStm] -> String) -> Int -> [Int] -> [FormatStm] -> String) -> Int -> (Bool -> (Int -> [Int] -> [FormatStm] -> String) -> Int -> [Int] -> [FormatStm] -> String) -> Int -> [Int] -> [FormatStm] -> String
pruneOne
:: Tokens -> Int -> Int -> Int -> (Bool -> (Int -> [Int] -> [FormatStm] -> String) -> Int -> [Int] -> [FormatStm] -> String) -> Int -> [Int] -> [FormatStm] -> String
pruneMulti
:: Tokens -> Int -> Int -> Int -> (Bool -> (Int -> [Int] -> [FormatStm] -> String) -> Int -> [Int] -> [FormatStm] -> String) -> Queue (Int, Bool -> (Int -> [Int] -> [FormatStm] -> String) -> Int -> [Int] -> [FormatStm] -> String) -> Int -> (Bool -> (Int -> [Int] -> [FormatStm] -> String) -> Int -> [Int] -> [FormatStm] -> String) -> Int -> [Int] -> [FormatStm] -> String