Maintainer | bastiaan.heeren@ou.nl |
---|---|
Stability | provisional |
Portability | portable (depends on ghc) |
Safe Haskell | None |
Language | Haskell98 |
This module produces tabular data in HTML or CSV format.
Synopsis
- newtype Table row col cell = Table (Map (row, col) cell)
- fromList :: (Ord row, Ord col) => [((row, col), cell)] -> Table row col cell
- toTable :: (Foldable t, Ord row, Ord col) => (a -> row) -> (a -> col) -> (a -> cell) -> t a -> Table row col cell
- toTableFromRows :: (Foldable t, Foldable t', Ord row, Ord col) => (a -> row) -> (a -> t' (col, cell)) -> t a -> Table row col cell
- toTableFromCols :: (Foldable t, Foldable t', Ord row, Ord col) => (a -> col) -> (a -> t' (row, cell)) -> t a -> Table row col cell
- empty :: Table row col cell
- get :: (Ord row, Ord col) => row -> col -> Table row col cell -> Maybe cell
- colHeaders :: Eq col => Table row col cell -> [col]
- rowHeaders :: Eq row => Table row col cell -> [row]
- addRow :: (Foldable t, Ord row, Ord col) => row -> t (col, cell) -> Table row col cell -> Table row col cell
- addCol :: (Foldable t, Ord row, Ord col) => col -> t (row, cell) -> Table row col cell -> Table row col cell
- addCell :: (Ord row, Ord col) => cell -> row -> col -> Table row col cell -> Table row col cell
- htmlTable :: (Ord row, Ord col) => (row -> HTMLBuilder) -> (col -> HTMLBuilder) -> (cell -> HTMLBuilder) -> Table row col cell -> HTMLBuilder
- csvTable :: (Ord row, Ord col) => (row -> String) -> (col -> String) -> (cell -> String) -> Table row col cell -> String
Documentation
fromList :: (Ord row, Ord col) => [((row, col), cell)] -> Table row col cell Source #
Create a Table
from a list.
toTable :: (Foldable t, Ord row, Ord col) => (a -> row) -> (a -> col) -> (a -> cell) -> t a -> Table row col cell Source #
Turn a foldable collection of data into a tabular structure.
toTableFromRows :: (Foldable t, Foldable t', Ord row, Ord col) => (a -> row) -> (a -> t' (col, cell)) -> t a -> Table row col cell Source #
Turn a foldable collection of data into a tabular structure, where every element of the collection contains multiple columns.
toTableFromCols :: (Foldable t, Foldable t', Ord row, Ord col) => (a -> col) -> (a -> t' (row, cell)) -> t a -> Table row col cell Source #
Turn a foldable collection of data into a tabular structure, where every element of the collection contains multiple rows.
get :: (Ord row, Ord col) => row -> col -> Table row col cell -> Maybe cell Source #
Obtain the cell at (row, col).
colHeaders :: Eq col => Table row col cell -> [col] Source #
Get a list of all column headers.
rowHeaders :: Eq row => Table row col cell -> [row] Source #
Get a list of all row headers.
addRow :: (Foldable t, Ord row, Ord col) => row -> t (col, cell) -> Table row col cell -> Table row col cell Source #
Add a row to a Table
.
addCol :: (Foldable t, Ord row, Ord col) => col -> t (row, cell) -> Table row col cell -> Table row col cell Source #
Add a column to a Table
.
addCell :: (Ord row, Ord col) => cell -> row -> col -> Table row col cell -> Table row col cell Source #
Add a cell to a Table
.
htmlTable :: (Ord row, Ord col) => (row -> HTMLBuilder) -> (col -> HTMLBuilder) -> (cell -> HTMLBuilder) -> Table row col cell -> HTMLBuilder Source #
Format a Table
as HTML.