Ormolu.Terminal

fourmolu-0.17.0.0: A formatter for Haskell source code

Safe Haskell | None
Language | GHC2021

Ormolu.Terminal

Contents

- The `Term` abstraction
- Styling
- Printing

Description

An abstraction for colorful output in terminal.

Synopsis

- type Term = TermOutput ()
- data ColorMode
  - = Never
  - | Always
  - | Auto
- runTerm :: Term -> ColorMode -> Handle -> IO ()
- runTermPure :: Term -> Text
- bold :: Term -> Term
- cyan :: Term -> Term
- green :: Term -> Term
- red :: Term -> Term
- put :: Text -> Term
- putShow :: Show a => a -> Term
- putOutputable :: Outputable a => a -> Term
- newline :: Term

# The `Term` abstraction

type Term = TermOutput () #

data ColorMode #

Whether to use colors and other features of ANSI terminals.

Constructors

Never |
Always |
Auto |

#### Instances

Instances details

Bounded ColorMode # |
Instance details Defined in Ormolu.Terminal Methods minBound :: ColorMode # maxBound :: ColorMode #
Enum ColorMode # |
Instance details Defined in Ormolu.Terminal Methods succ :: ColorMode -> ColorMode # pred :: ColorMode -> ColorMode # toEnum :: Int -> ColorMode # fromEnum :: ColorMode -> Int # enumFrom :: ColorMode -> [ColorMode] # enumFromThen :: ColorMode -> ColorMode -> [ColorMode] # enumFromTo :: ColorMode -> ColorMode -> [ColorMode] # enumFromThenTo :: ColorMode -> ColorMode -> ColorMode -> [ColorMode] #
Show ColorMode # |
Instance details Defined in Ormolu.Terminal Methods showsPrec :: Int -> ColorMode -> ShowS # show :: ColorMode -> String # showList :: [ColorMode] -> ShowS #
Eq ColorMode # |
Instance details Defined in Ormolu.Terminal Methods (==) :: ColorMode -> ColorMode -> Bool # (/=) :: ColorMode -> ColorMode -> Bool #

runTerm #

Arguments

:: Term |
-> ColorMode | Color mode
-> Handle | Handle to print to
-> IO () |

Run `Term` monad.

runTermPure :: Term -> Text #

# Styling

bold :: Term -> Term #

Make the output bold text.

cyan :: Term -> Term #

Make the output cyan text.

green :: Term -> Term #

Make the output green text.

red :: Term -> Term #

Make the output red text.

# Printing

put :: Text -> Term #

Output `Text`.

putShow :: Show a => a -> Term #

Output a `Show` value.

putOutputable :: Outputable a => a -> Term #

Output an `Outputable` value.

newline :: Term #

Output a newline.