Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
This library is for drawing text tables.
Pass a 2D-list of strings and get a single string with table contents.
makeDefaultSimpleTable :: [[String]] -> String
- makeSimpleTable :: SimpleTableConfig -> [[String]] -> String
- makeDefaultSimpleTable :: [[String]] -> String
- data SimpleTableConfig = SimpleTableConfig {
- tableBorders :: String
- colMinWidths :: [Int]
- rowMinHeights :: [Int]
- padFunction :: String -> Int -> String -> String
- cellPadFunction :: String -> Int -> [String] -> [String]
- horizontalPadding :: Int
- verticalPadding :: Int
- paddingStr :: String
- emptyCellStr :: String
- simpleTableConfig :: SimpleTableConfig
- simpleTableLeftPad :: String -> Int -> String -> String
- simpleTableCenterPad :: String -> Int -> String -> String
- simpleTableRightPad :: String -> Int -> String -> String
- simpleTableBottomPad :: String -> Int -> Cell -> [String]
- simpleTableMiddlePad :: String -> Int -> Cell -> [String]
- simpleTableTopPad :: String -> Int -> Cell -> [String]
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.
SimpleTableConfig | |
|
simpleTableConfig :: SimpleTableConfig Source #
Default table config.
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