ormolu-0.5.3.0: A formatter for Haskell source code

Safe Haskell | Safe-Inferred
Language | Haskell2010

Ormolu.Terminal

Contents

- The `Term` monad
- Styling
- Printing

Description

An abstraction for colorful output in terminal.

Synopsis

- data Term a
- data ColorMode
  - = Never
  - | Always
  - | Auto
- runTerm :: Term a -> ColorMode -> Handle -> IO a
- bold :: Term a -> Term a
- cyan :: Term a -> Term a
- green :: Term a -> Term a
- red :: Term a -> Term a
- put :: Text -> Term ()
- putS :: String -> Term ()
- putSrcSpan :: SrcSpan -> Term ()
- putRealSrcSpan :: RealSrcSpan -> Term ()
- newline :: Term ()

# The `Term` monad

data Term a Source #

Terminal monad.

#### Instances

Instances details

Applicative Term Source # |
Instance details Defined in Ormolu.Terminal Methods pure :: a -> Term a Source # (<*>) :: Term (a -> b) -> Term a -> Term b Source # liftA2 :: (a -> b -> c) -> Term a -> Term b -> Term c Source # (*>) :: Term a -> Term b -> Term b Source # (<*) :: Term a -> Term b -> Term a Source #
Functor Term Source # |
Instance details Defined in Ormolu.Terminal Methods fmap :: (a -> b) -> Term a -> Term b Source # (<$) :: a -> Term b -> Term a Source #
Monad Term Source # |
Instance details Defined in Ormolu.Terminal Methods (>>=) :: Term a -> (a -> Term b) -> Term b Source # (>>) :: Term a -> Term b -> Term b Source # return :: a -> Term a Source #

data ColorMode Source #

Whether to use colors and other features of ANSI terminals.

Constructors

Never |
Always |
Auto |

#### Instances

Instances details

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 a | Monad to run
-> ColorMode | Color mode
-> Handle | Handle to print to
-> IO a |

Run `Term` monad.

# Styling

bold :: Term a -> Term a Source #

Make the inner computation output bold text.

cyan :: Term a -> Term a Source #

Make the inner computation output cyan text.

green :: Term a -> Term a Source #

Make the inner computation output green text.

red :: Term a -> Term a Source #

Make the inner computation output red text.

# Printing

put :: Text -> Term () Source #

Output `Text`.

putS :: String -> Term () Source #

Output `String`.

putSrcSpan :: SrcSpan -> Term () Source #

Output a `SrcSpan`.

putRealSrcSpan :: RealSrcSpan -> Term () Source #

Output a `RealSrcSpan`.

newline :: Term () Source #

Output a newline.