Module Text.PrettyImpl

Implementation of the Pretty library using linear-time, bounded implementation by Olaf Chitil.

Author: Sebastian Fischer, Bjoern Peemoeller, Jan Tikovsky

Version: December 2018

Summary of exported operations:

deDoc :: Doc -> Tokens -> Tokens   
resetFormat :: [FormatStm] -> (FormatStm,[FormatStm])   
prevFGColor :: [FormatStm] -> Color   
prevBGColor :: [FormatStm] -> Color   
prevIntensity :: [FormatStm] -> Intensity   
prevBlinkMode :: [FormatStm] -> BlinkMode   
applyFormat :: FormatStm -> String   
txtMode :: Int -> String   
colorMode :: Color -> Int   
intensityMode :: Intensity -> Int   
blinkMode :: BlinkMode -> Int   
applyNesting :: Nesting -> Int -> Int -> [Int] -> [Int]   
unApplyNesting :: [Int] -> [Int]   
addSpaces :: Int -> Tokens -> String   
normalise :: Tokens -> Tokens   
doc2Tokens :: Doc -> Tokens   
showWidth :: Int -> Doc -> String   
(showWidth w d) pretty prints document d with a page width of w characters
lengthVis :: String -> Int   
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   
inspect :: Doc -> Tokens   

Exported datatypes:


Doc

Constructors:


Horizontal

Type synonym: Horizontal = Bool


Remaining

Type synonym: Remaining = Int


Width

Type synonym: Width = Int


Position

Type synonym: Position = Int


StartPosition

Type synonym: StartPosition = Position


EndPosition

Type synonym: EndPosition = Position


Out

Type synonym: Out = Remaining -> Margins -> FormatHistory -> String


OutGroupPrefix

Type synonym: OutGroupPrefix = Horizontal -> Out -> Out


Margins

Type synonym: Margins = [Int]


Nesting

Constructors:

  • Align :: Nesting
  • Inc :: Int -> Nesting

Color

Constructors:

  • Black :: Color
  • Red :: Color
  • Green :: Color
  • Yellow :: Color
  • Blue :: Color
  • Magenta :: Color
  • Cyan :: Color
  • White :: Color
  • Default :: Color

Intensity

Constructors:

  • Faint :: Intensity
  • Normal :: Intensity
  • Bold :: Intensity

BlinkMode

Constructors:

  • Off :: BlinkMode
  • Slow :: BlinkMode
  • Rapid :: BlinkMode

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

FormatHistory

Type synonym: FormatHistory = [FormatStm]


Tokens

Constructors:


Exported operations:

deDoc :: Doc -> Tokens -> Tokens   

Further infos:
  • solution complete, i.e., able to compute all solutions

prevFGColor :: [FormatStm] -> Color   

prevBGColor :: [FormatStm] -> Color   

applyFormat :: FormatStm -> String   

txtMode :: Int -> String   

colorMode :: Color -> Int   

intensityMode :: Intensity -> Int   

blinkMode :: BlinkMode -> Int   

applyNesting :: Nesting -> Int -> Int -> [Int] -> [Int]   

unApplyNesting :: [Int] -> [Int]   

addSpaces :: Int -> Tokens -> String   

normalise :: Tokens -> Tokens   

doc2Tokens :: Doc -> Tokens   

showWidth :: Int -> Doc -> String   

(showWidth w d) pretty prints document d with a page width of w characters

Example call:
(showWidth w d)
Parameters:
  • w : width of page
  • d : a document
Returns:
pretty printed document

lengthVis :: String -> Int   

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   

inspect :: Doc -> Tokens