Advise-me-0.1: Assessment services for the Advise-Me project

Maintainerbastiaan.heeren@ou.nl
Stabilityprovisional
Portabilityportable (depends on ghc)
Safe HaskellNone
LanguageHaskell98

Util.TableData

Description

This module produces tabular data in HTML or CSV format.

Synopsis

Documentation

newtype Table row col cell Source #

A Table is simply a Map representing a tabular structure.

Constructors

Table (Map (row, col) cell) 

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.

empty :: Table row col cell Source #

Obtain an empty Table.

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.

csvTable :: (Ord row, Ord col) => (row -> String) -> (col -> String) -> (cell -> String) -> Table row col cell -> String Source #

Format a Table as CSV.