SimpleTableGenerator-0.2.0.0: Simple table generator

Safe HaskellSafe
LanguageHaskell2010

Text.SimpleTableGenerator

Description

This library is for drawing text tables.

Pass a 2D-list of strings and get a single string with table contents.

makeDefaultSimpleTable :: [[String]] -> String

Synopsis

Documentation

makeSimpleTable :: SimpleTableConfig -> [[String]] -> String Source #

Example usage:

putStrLn $ makeSimpleTable simpleTableConfig {
  tableBorders = "+++++++++-|",
  colMinWidths  = [3, 4],
  rowMinHeights = [2],
  padFunction   = simpleTableLeftPad,
  cellPadFunction = simpleTableBottomPad,
  horizontalPadding = 0,
  verticalPadding = 1,
  paddingStr = ".,`"
} [["a"], ["b", "c"]]

makeDefaultSimpleTable :: [[String]] -> String Source #

Create table using simpleTableConfig. Example usage:

putStrLn $ makeDefaultSimpleTable [["1","2","3"], ["One","Two","Three"], ["First", "Second"]]

data SimpleTableConfig Source #

Data type that represents table configuration.

Constructors

SimpleTableConfig 

Fields

simpleTableLeftPad :: String -> Int -> String -> String Source #

Horizontal padding function. Appends padding string (first argument) to the left of the given string to make it's length equal to the second argument.

simpleTableCenterPad :: String -> Int -> String -> String Source #

Horizontal padding function. Appends padding string (first argument) both to the right and left of the given string to make it's length equal to the second argument.

simpleTableRightPad :: String -> Int -> String -> String Source #

Horizontal padding function. Appends padding string (first argument) to the right of the given string to make it's length equal to the second argument.

simpleTableBottomPad :: String -> Int -> Cell -> [String] Source #

Vertical padding function. Appends padding to the bottom of given Cell

simpleTableMiddlePad :: String -> Int -> Cell -> [String] Source #

Vertical padding function. Appends padding both to top and bottom of given Cell

simpleTableTopPad :: String -> Int -> Cell -> [String] Source #

Vertical padding function. Appends padding to the top of given Cell