System.Console.Terminfo.PrettyPrint

wl-pprint-terminfo-3.7.1.4: A color pretty printer with terminfo support

Safe Haskell | Safe
Language | Haskell98

System.Console.Terminfo.PrettyPrint

Contents

- Raw Effect (requires the effect be present)
  - Graceful degradation
  - Effects (built with soft)
  - Colors (built with soft)
  - Ringing bells
- A Color Pretty Printer
  - Progressively less magical formatting
  - A Classy Interface
  - Evaluation

Synopsis

- data ScopedEffect
  - = Bold
  - | Standout
  - | Underline
  - | Reverse
  - | Blink
  - | Dim
  - | Invisible
  - | Protected
  - | Foreground Color
  - | Background Color
  - | Else ScopedEffect ScopedEffect
  - | Nop
- with :: ScopedEffect -> TermDoc -> TermDoc
- data Effect
  - = Push ScopedEffect
  - | Pop
  - | Ring Bell
- soft :: ScopedEffect -> ScopedEffect
- blink :: TermDoc -> TermDoc
- bold :: TermDoc -> TermDoc
- underline :: TermDoc -> TermDoc
- standout :: TermDoc -> TermDoc
- reversed :: TermDoc -> TermDoc
- protected :: TermDoc -> TermDoc
- invisible :: TermDoc -> TermDoc
- dim :: TermDoc -> TermDoc
- red :: TermDoc -> TermDoc
- black :: TermDoc -> TermDoc
- green :: TermDoc -> TermDoc
- blue :: TermDoc -> TermDoc
- yellow :: TermDoc -> TermDoc
- magenta :: TermDoc -> TermDoc
- cyan :: TermDoc -> TermDoc
- white :: TermDoc -> TermDoc
- foreground :: Color -> TermDoc -> TermDoc
- background :: Color -> TermDoc -> TermDoc
- data Bell
  - = VisibleBellOnly
  - | AudibleBellOnly
  - | VisibleBellPreferred
  - | AudibleBellPreferred
- ring :: Bell -> TermDoc
- type TermDoc = Doc Effect
- display :: (MonadIO m, PrettyTerm t) => t -> m ()
- displayLn :: MonadIO m => PrettyTerm t => t -> m ()
- displayDoc :: (MonadIO m, PrettyTerm t) => Float -> t -> m ()
- displayDoc' :: (MonadIO m, PrettyTerm t) => Terminal -> Float -> t -> m ()
- displayDoc'' :: (MonadIO m, PrettyTerm t) => Terminal -> Float -> Int -> t -> m ()
- class Pretty t => PrettyTerm t where
- type SimpleTermDoc = SimpleDoc Effect
- evalTermState :: Monad m => StateT TermState m a -> m a
- displayCap :: SimpleTermDoc -> StateT TermState Capability TermOutput

# Raw Effect (requires the effect be present)

data ScopedEffect #

Constructors

Bold |
Standout |
Underline |
Reverse |
Blink |
Dim |
Invisible |
Protected |
Foreground Color |
Background Color |
Else ScopedEffect ScopedEffect |
Nop |

Instances

Eq ScopedEffect # |
Methods (==) :: ScopedEffect -> ScopedEffect -> Bool # (/=) :: ScopedEffect -> ScopedEffect -> Bool #

with :: ScopedEffect -> TermDoc -> TermDoc #

data Effect #

Constructors

Push ScopedEffect |
Pop |
Ring Bell |

Instances

Eq Effect # |
Methods (==) :: Effect -> Effect -> Bool # (/=) :: Effect -> Effect -> Bool #

## Graceful degradation

soft :: ScopedEffect -> ScopedEffect #

## Effects (built with soft)

blink :: TermDoc -> TermDoc #

bold :: TermDoc -> TermDoc #

underline :: TermDoc -> TermDoc #

standout :: TermDoc -> TermDoc #

reversed :: TermDoc -> TermDoc #

protected :: TermDoc -> TermDoc #

invisible :: TermDoc -> TermDoc #

dim :: TermDoc -> TermDoc #

## Colors (built with soft)

red :: TermDoc -> TermDoc #

black :: TermDoc -> TermDoc #

green :: TermDoc -> TermDoc #

blue :: TermDoc -> TermDoc #

yellow :: TermDoc -> TermDoc #

magenta :: TermDoc -> TermDoc #

cyan :: TermDoc -> TermDoc #

white :: TermDoc -> TermDoc #

foreground :: Color -> TermDoc -> TermDoc #

background :: Color -> TermDoc -> TermDoc #

## Ringing bells

data Bell #

Constructors

VisibleBellOnly |
AudibleBellOnly |
VisibleBellPreferred |
AudibleBellPreferred |

Instances

Enum Bell # |
Methods succ :: Bell -> Bell # pred :: Bell -> Bell # toEnum :: Int -> Bell # fromEnum :: Bell -> Int # enumFrom :: Bell -> [Bell] # enumFromThen :: Bell -> Bell -> [Bell] # enumFromTo :: Bell -> Bell -> [Bell] # enumFromThenTo :: Bell -> Bell -> Bell -> [Bell] #
Eq Bell # |
Methods (==) :: Bell -> Bell -> Bool # (/=) :: Bell -> Bell -> Bool #
Ord Bell # |
Methods compare :: Bell -> Bell -> Ordering # (<) :: Bell -> Bell -> Bool # (<=) :: Bell -> Bell -> Bool # (>) :: Bell -> Bell -> Bool # (>=) :: Bell -> Bell -> Bool # max :: Bell -> Bell -> Bell # min :: Bell -> Bell -> Bell #
Show Bell # |
Methods showsPrec :: Int -> Bell -> ShowS # show :: Bell -> String # showList :: [Bell] -> ShowS #

ring :: Bell -> TermDoc #

# A Color Pretty Printer

type TermDoc = Doc Effect #

display :: (MonadIO m, PrettyTerm t) => t -> m () #

displayLn :: MonadIO m => PrettyTerm t => t -> m () #

## Progressively less magical formatting

displayDoc :: (MonadIO m, PrettyTerm t) => Float -> t -> m () #

displayDoc' :: (MonadIO m, PrettyTerm t) => Terminal -> Float -> t -> m () #

displayDoc'' :: (MonadIO m, PrettyTerm t) => Terminal -> Float -> Int -> t -> m () #

## A Classy Interface

class Pretty t => PrettyTerm t where #

Methods

prettyTerm :: t -> TermDoc #

prettyTermList :: [t] -> TermDoc #

Instances

PrettyTerm Bool # |
Methods prettyTerm :: Bool -> TermDoc # prettyTermList :: [Bool] -> TermDoc #
PrettyTerm Char # |
Methods prettyTerm :: Char -> TermDoc # prettyTermList :: [Char] -> TermDoc #
PrettyTerm Double # |
Methods prettyTerm :: Double -> TermDoc # prettyTermList :: [Double] -> TermDoc #
PrettyTerm Float # |
Methods prettyTerm :: Float -> TermDoc # prettyTermList :: [Float] -> TermDoc #
PrettyTerm Int # |
Methods prettyTerm :: Int -> TermDoc # prettyTermList :: [Int] -> TermDoc #
PrettyTerm Int8 # |
Methods prettyTerm :: Int8 -> TermDoc # prettyTermList :: [Int8] -> TermDoc #
PrettyTerm Int16 # |
Methods prettyTerm :: Int16 -> TermDoc # prettyTermList :: [Int16] -> TermDoc #
PrettyTerm Int32 # |
Methods prettyTerm :: Int32 -> TermDoc # prettyTermList :: [Int32] -> TermDoc #
PrettyTerm Int64 # |
Methods prettyTerm :: Int64 -> TermDoc # prettyTermList :: [Int64] -> TermDoc #
PrettyTerm Integer # |
Methods prettyTerm :: Integer -> TermDoc # prettyTermList :: [Integer] -> TermDoc #
PrettyTerm Word # |
Methods prettyTerm :: Word -> TermDoc # prettyTermList :: [Word] -> TermDoc #
PrettyTerm Word8 # |
Methods prettyTerm :: Word8 -> TermDoc # prettyTermList :: [Word8] -> TermDoc #
PrettyTerm Word16 # |
Methods prettyTerm :: Word16 -> TermDoc # prettyTermList :: [Word16] -> TermDoc #
PrettyTerm Word32 # |
Methods prettyTerm :: Word32 -> TermDoc # prettyTermList :: [Word32] -> TermDoc #
PrettyTerm Word64 # |
Methods prettyTerm :: Word64 -> TermDoc # prettyTermList :: [Word64] -> TermDoc #
PrettyTerm () # |
Methods prettyTerm :: () -> TermDoc # prettyTermList :: [()] -> TermDoc #
PrettyTerm Natural # |
Methods prettyTerm :: Natural -> TermDoc # prettyTermList :: [Natural] -> TermDoc #
PrettyTerm ByteString # |
Methods prettyTerm :: ByteString -> TermDoc # prettyTermList :: [ByteString] -> TermDoc #
PrettyTerm ByteString # |
Methods prettyTerm :: ByteString -> TermDoc # prettyTermList :: [ByteString] -> TermDoc #
PrettyTerm Text # |
Methods prettyTerm :: Text -> TermDoc # prettyTermList :: [Text] -> TermDoc #
PrettyTerm Text # |
Methods prettyTerm :: Text -> TermDoc # prettyTermList :: [Text] -> TermDoc #
PrettyTerm t => PrettyTerm [t] # |
Methods prettyTerm :: [t] -> TermDoc # prettyTermList :: [[t]] -> TermDoc #
PrettyTerm a => PrettyTerm (Maybe a) # |
Methods prettyTerm :: Maybe a -> TermDoc # prettyTermList :: [Maybe a] -> TermDoc #
PrettyTerm a => PrettyTerm (NonEmpty a) # |
Methods prettyTerm :: NonEmpty a -> TermDoc # prettyTermList :: [NonEmpty a] -> TermDoc #
PrettyTerm a => PrettyTerm (Seq a) # |
Methods prettyTerm :: Seq a -> TermDoc # prettyTermList :: [Seq a] -> TermDoc #
(~) * e Effect => PrettyTerm (Doc e) # |
Methods prettyTerm :: Doc e -> TermDoc # prettyTermList :: [Doc e] -> TermDoc #
(PrettyTerm a, PrettyTerm b) => PrettyTerm (a, b) # |
Methods prettyTerm :: (a, b) -> TermDoc # prettyTermList :: [(a, b)] -> TermDoc #
(PrettyTerm a, PrettyTerm b, PrettyTerm c) => PrettyTerm (a, b, c) # |
Methods prettyTerm :: (a, b, c) -> TermDoc # prettyTermList :: [(a, b, c)] -> TermDoc #

## Evaluation

type SimpleTermDoc = SimpleDoc Effect #

evalTermState :: Monad m => StateT TermState m a -> m a #

displayCap :: SimpleTermDoc -> StateT TermState Capability TermOutput #