futhark-0.25.32: An optimising compiler for a functional, array-oriented language.

Safe Haskell | Safe-Inferred
Language | GHC2021

Futhark.Util.Table

Description

Basic table building for prettier futhark-test output.

Synopsis

- hPutTable :: Handle -> [[Entry]] -> Int -> IO ()
- mkEntry :: String -> AnsiStyle -> Entry
- data Entry
- data AnsiStyle
- data Color
  - = Black
  - | Red
  - | Green
  - | Yellow
  - | Blue
  - | Magenta
  - | Cyan
  - | White
- color :: Color -> AnsiStyle

# Documentation

hPutTable :: Handle -> [[Entry]] -> Int -> IO () Source #

Produce a table from a list of entries and a padding amount that determines padding from the right side of the widest entry in each column.

mkEntry :: String -> AnsiStyle -> Entry Source #

Makes a table entry.

data Entry Source #

A table entry. Consists of the content as well as how it should be styled..

data AnsiStyle Source #

Render the annotated document in a certain style. Styles not set in the annotation will use the style of the surrounding document, or the terminal’s default if none has been set yet.

    style = color Green <> bold
    styledDoc = annotate style "hello world"

#### Instances

Instances details

IsString Fmt Source # |
Instance details Defined in Futhark.Fmt.Monad Methods fromString :: String -> Fmt Source #
Monoid Fmt Source # |
Instance details Defined in Futhark.Fmt.Monad Methods mempty :: Fmt Source # mappend :: Fmt -> Fmt -> Fmt Source # mconcat :: [Fmt] -> Fmt Source #
Monoid AnsiStyle | `mempty` does nothing, which is equivalent to inheriting the style of the surrounding doc, or the terminal’s default if no style has been set yet.
Instance details Defined in Prettyprinter.Render.Terminal.Internal Methods mempty :: AnsiStyle Source # mappend :: AnsiStyle -> AnsiStyle -> AnsiStyle Source # mconcat :: [AnsiStyle] -> AnsiStyle Source #
Semigroup Fmt Source # |
Instance details Defined in Futhark.Fmt.Monad Methods (<>) :: Fmt -> Fmt -> Fmt Source # sconcat :: NonEmpty Fmt -> Fmt Source # stimes :: Integral b => b -> Fmt -> Fmt Source #

Semigroup AnsiStyle

Keep the first decision for each of foreground color, background color, boldness, italication, and underlining. If a certain style is not set, the terminal’s default will be used.

Example:

    color Red <> color Green

is red because the first color wins, and not bold because (or if) that’s the terminal’s default.

Instance details Defined in Prettyprinter.Render.Terminal.Internal Methods (<>) :: AnsiStyle -> AnsiStyle -> AnsiStyle Source # sconcat :: NonEmpty AnsiStyle -> AnsiStyle Source # stimes :: Integral b => b -> AnsiStyle -> AnsiStyle Source #
Show AnsiStyle |
Instance details Defined in Prettyprinter.Render.Terminal.Internal Methods showsPrec :: Int -> AnsiStyle -> ShowS Source # show :: AnsiStyle -> String Source # showList :: [AnsiStyle] -> ShowS Source #
Eq AnsiStyle |
Instance details Defined in Prettyprinter.Render.Terminal.Internal Methods (==) :: AnsiStyle -> AnsiStyle -> Bool Source # (/=) :: AnsiStyle -> AnsiStyle -> Bool Source #
Ord AnsiStyle |

Instance details

Defined in Prettyprinter.Render.Terminal.Internal

Methods

compare :: AnsiStyle -> AnsiStyle -> Ordering Source #

(<) :: AnsiStyle -> AnsiStyle -> Bool Source #

(<=) :: AnsiStyle -> AnsiStyle -> Bool Source #

(>) :: AnsiStyle -> AnsiStyle -> Bool Source #

(>=) :: AnsiStyle -> AnsiStyle -> Bool Source #

max :: AnsiStyle -> AnsiStyle -> AnsiStyle Source #

min :: AnsiStyle -> AnsiStyle -> AnsiStyle Source #

data Color Source #

The 8 ANSI terminal colors.

Constructors

Black |
Red |
Green |
Yellow |
Blue |
Magenta |
Cyan |
White |

#### Instances

Instances details

Show Color |
Instance details Defined in Prettyprinter.Render.Terminal.Internal Methods showsPrec :: Int -> Color -> ShowS Source # show :: Color -> String Source # showList :: [Color] -> ShowS Source #
Eq Color |
Instance details Defined in Prettyprinter.Render.Terminal.Internal Methods (==) :: Color -> Color -> Bool Source # (/=) :: Color -> Color -> Bool Source #
Ord Color |
Instance details Defined in Prettyprinter.Render.Terminal.Internal Methods compare :: Color -> Color -> Ordering Source # (<) :: Color -> Color -> Bool Source # (<=) :: Color -> Color -> Bool Source # (>) :: Color -> Color -> Bool Source # (>=) :: Color -> Color -> Bool Source # max :: Color -> Color -> Color Source # min :: Color -> Color -> Color Source #

color :: Color -> AnsiStyle Source #

Style the foreground with a vivid color.