fourmolu-0.18.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 () Source #

data ColorMode Source #

Whether to use colors and other features of ANSI terminals.

Constructors

Never |
Always |
Auto |

#### Instances

Instances details

Bounded ColorMode Source # |
Instance details Defined in Ormolu.Terminal Methods minBound :: ColorMode Source # maxBound :: ColorMode Source #
Enum ColorMode Source # |

Instance details

Defined in Ormolu.Terminal

Methods

succ :: ColorMode -> ColorMode Source #

pred :: ColorMode -> ColorMode Source #

toEnum :: Int -> ColorMode Source #

fromEnum :: ColorMode -> Int Source #

enumFrom :: ColorMode -> [ColorMode] Source #

enumFromThen :: ColorMode -> ColorMode -> [ColorMode] Source #

enumFromTo :: ColorMode -> ColorMode -> [ColorMode] Source #

enumFromThenTo :: ColorMode -> ColorMode -> ColorMode -> [ColorMode] Source #

Show ColorMode Source # |
Instance details Defined in Ormolu.Terminal Methods showsPrec :: Int -> ColorMode -> ShowS Source # show :: ColorMode -> String Source # showList :: [ColorMode] -> ShowS Source #
Eq ColorMode Source # |
Instance details Defined in Ormolu.Terminal Methods (==) :: ColorMode -> ColorMode -> Bool Source # (/=) :: ColorMode -> ColorMode -> Bool Source #

runTerm Source #

Arguments

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

Run `Term` monad.

runTermPure :: Term -> Text Source #

# Styling

bold :: Term -> Term Source #

Make the output bold text.

cyan :: Term -> Term Source #

Make the output cyan text.

green :: Term -> Term Source #

Make the output green text.

red :: Term -> Term Source #

Make the output red text.

# Printing

put :: Text -> Term Source #

Output `Text`.

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

Output a `Show` value.

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

Output an `Outputable` value.

newline :: Term Source #

Output a newline.