ormolu-0.7.4.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

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.