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

Exported Datatypes


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:


Exported Functions


deDoc :: Doc -> Tokens -> Tokens  Deterministic 

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

resetFormat :: [FormatStm] -> (FormatStm, [FormatStm])  Deterministic 


prevFGColor :: [FormatStm] -> Color  Deterministic 


prevBGColor :: [FormatStm] -> Color  Deterministic 


prevIntensity :: [FormatStm] -> Intensity  Deterministic 


prevBlinkMode :: [FormatStm] -> BlinkMode  Deterministic 


applyFormat :: FormatStm -> String  Deterministic 


txtMode :: Int -> String  Deterministic 


colorMode :: Color -> Int  Deterministic 


intensityMode :: Intensity -> Int  Deterministic 


blinkMode :: BlinkMode -> Int  Deterministic 


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


unApplyNesting :: [Int] -> [Int]  Deterministic 


addSpaces :: Int -> Tokens -> String  Deterministic 


normalise :: Tokens -> Tokens  Deterministic 


doc2Tokens :: Doc -> Tokens  Deterministic 


showWidth :: Int -> Doc -> String  Deterministic 

(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

lengthVis :: String -> Int  Deterministic 


noGroup :: Tokens -> Int -> Int -> Int -> [Int] -> [FormatStm] -> String  Deterministic 


oneGroup :: Tokens -> Int -> Int -> Int -> (Bool -> (Int -> [Int] -> [FormatStm] -> String) -> Int -> [Int] -> [FormatStm] -> String) -> Int -> [Int] -> [FormatStm] -> String  Deterministic 


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  Deterministic 


pruneOne :: Tokens -> Int -> Int -> Int -> (Bool -> (Int -> [Int] -> [FormatStm] -> String) -> Int -> [Int] -> [FormatStm] -> String) -> Int -> [Int] -> [FormatStm] -> String  Deterministic 

Further infos:
  • partially defined

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  Deterministic 

Further infos:
  • partially defined

inspect :: Doc -> Tokens  Deterministic