table-layout-1.0.0.0: Format tabular data as grid or table.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Text.Layout.Table.Style

Description

This module provides predefined styles, combinators to modify them, abstract style descriptions, and combinators for quickly turning them into styles.

The following resource may be useful for constructing your own primitive styles: https://en.wikipedia.org/wiki/Box-drawing_character.

Synopsis

Pre-Constructed Table Styles

ASCII

asciiS :: TableStyle LineStyle LineStyle Source #

Uses lines and plus for joints.

asciiRoundS :: TableStyle LineStyle LineStyle Source #

My usual ASCII table style.

asciiDoubleS :: TableStyle LineStyle LineStyle Source #

Like asciiS, but uses double lines and double pluses for borders.

Unicode

unicodeS :: TableStyle LineStyle LineStyle Source #

Uses special unicode characters to draw clean thin boxes.

unicodeBoldStripedS :: TableStyle LineStyle LineStyle Source #

Uses bold lines with the exception of group separators, which are striped.

unicodeDoubleFrameS :: TableStyle LineStyle LineStyle Source #

Draw every line with a double frame.

Combinators

withoutBorders :: TableStyle a b -> TableStyle a b Source #

Remove the top, bottom, left, and right borders from a TableStyle.

withoutTopBorder :: TableStyle a b -> TableStyle a b Source #

Remove the top border from a TableStyle.

withoutBottomBorder :: TableStyle a b -> TableStyle a b Source #

Remove the bottom border from a TableStyle.

withoutLeftBorder :: TableStyle a b -> TableStyle a b Source #

Remove the left border from a TableStyle.

withoutRightBorder :: TableStyle a b -> TableStyle a b Source #

Remove the right border from a TableStyle.

withRoundCorners :: TableStyle a b -> TableStyle a b Source #

Modify a TableStyle to use Unicode rounded corners.

inheritStyle Source #

Arguments

:: (c -> a)

The function to transform the row labels.

-> (d -> b)

The function to transform the column labels.

-> TableStyle a b

The TableStyle to inherit from.

-> TableStyle c d 

Inherit from a TableStyle through a pair of functions.

inheritStyleHeaderGroup Source #

Arguments

:: (c -> a)

The function to transform the row labels in the header.

-> (c -> a)

The function to transform the row labels in the body.

-> (d -> b)

The function to transform the column labels in the header.

-> (d -> b)

The function to transform the column labels in the body.

-> TableStyle a b

The TableStyle to inherit from.

-> TableStyle c d 

Inherit from a TableStyle using a triple of functions, specifying the correspondence for row separators, column heading separators, and column separators.

Construct Table Styles from an Abstract Specification

tableStyleFromSpec :: (LineStyle -> String) -> (LineStyle -> String) -> (LineStyle -> LineStyle -> LineStyle -> LineStyle -> String) -> TableStyleSpec -> TableStyle LineStyle LineStyle Source #

Generate a 'TableStyle from a given TableStyleSpec, along with functions to construct horizontal and vertical lines and joins. The function for constructing join strings takes its arguments in the order west, east, north, south.

Construct an Abstract Specifiction

simpleTableStyleSpec :: LineStyle -> LineStyle -> TableStyleSpec Source #

Constructs a simple TableStyleSpec which uses the given LineStyles in the headers and group, respectively.

setTableStyleSpecSeparator :: LineStyle -> TableStyleSpec -> TableStyleSpec Source #

Modify a TableStyleSpec to use the given LineStyle for header separators.

Low-Level Styling Facility

data TableStyle rowSep colSep Source #

Specifies the different letters to construct the non-content structure of a table.

This is quite low-level and difficult to construct by hand. If you want to construct your own, you may wish to use the higher-level interface provided by (in increasing order of detail):

  1. simpleTableStyleSpec
  2. TableStyleSpec
  3. unicodeTableStyleFromSpec
  4. asciiTableStyleFromSpec
  5. tableStyleFromSpec

Constructors

TableStyle 

Fields