raft-0.3.7.0: Miscellaneous Haskell utilities for data structures and data manipulation.

Safe HaskellSafe
LanguageHaskell2010

Data.Tabular

Contents

Description

Deprecated: This module will be replaced in a future release.

Formatting and parsing data in tabular format.

Synopsis

Types

newtype Rows Source #

Rows of data.

Constructors

Rows 

Fields

newtype Row Source #

A row of data.

Constructors

Row 

Fields

Instances

class Cell a where Source #

Class for formatting and parsing cells in a table.

Minimal complete definition

toCell, fromCell

Methods

toCell :: a -> String Source #

Encode a data cell.

fromCell :: String -> a Source #

Decode a data cell.

Instances

(Read a, Show a) => Cell a Source # 

Methods

toCell :: a -> String Source #

fromCell :: String -> a Source #

class Tabular a where Source #

Class for data in tabular format.

Minimal complete definition

toRow, fromRow

Methods

toRow :: a -> Row Source #

Encode a row of data.

fromRow :: Row -> a Source #

Decode a row of data.

withHeader :: [a] -> Rows Source #

Encode rows, prefixing with header.

checkHeader :: Rows -> [a] Source #

Decode rows, stripping a prefixed header.

Instances

(Cell a, Monad ((->) [[a]])) => Tabular [a] Source # 

Methods

toRow :: [a] -> Row Source #

fromRow :: Row -> [a] Source #

withHeader :: [[a]] -> Rows Source #

checkHeader :: Rows -> [[a]] Source #

(Cell a, Cell b) => Tabular (a, b) Source # 

Methods

toRow :: (a, b) -> Row Source #

fromRow :: Row -> (a, b) Source #

withHeader :: [(a, b)] -> Rows Source #

checkHeader :: Rows -> [(a, b)] Source #

(Cell a, Cell b, Cell c) => Tabular (a, b, c) Source # 

Methods

toRow :: (a, b, c) -> Row Source #

fromRow :: Row -> (a, b, c) Source #

withHeader :: [(a, b, c)] -> Rows Source #

checkHeader :: Rows -> [(a, b, c)] Source #

(Cell a, Cell b, Cell c, Cell d) => Tabular (a, b, c, d) Source # 

Methods

toRow :: (a, b, c, d) -> Row Source #

fromRow :: Row -> (a, b, c, d) Source #

withHeader :: [(a, b, c, d)] -> Rows Source #

checkHeader :: Rows -> [(a, b, c, d)] Source #

Input/Output Functions

readTabular Source #

Arguments

:: Tabular a 
=> FilePath

The filename.

-> IO [a]

Action to read the data.

Read tabular data.

writeTabular Source #

Arguments

:: Tabular a 
=> FilePath

The filename.

-> [a]

The data.

-> IO ()

The action to write the data.

Write tabular data.