gridtables-0.1.1.0: Parser for reStructuredText-style grid tables.

Copyright | © 2022-2023 Posit Software PBC
License | MIT
Maintainer | Albert Krewinkel <albert@zeitkraut.de>
Safe Haskell | None
Language | Haskell2010

Text.GridTable.ArrayTable

Description

Grid table representation based on arrays.

Synopsis

- data ArrayTable a = ArrayTable {
  - arrayTableCells :: Array CellIndex (GridCell a)
  - arrayTableHead :: Maybe RowIndex
  - arrayTableFoot :: Maybe RowIndex
  - arrayTableColSpecs :: Array ColIndex (Alignment, Int)
  }
- data GridCell a
  - = ContentCell RowSpan ColSpan a
  - | ContinuationCell CellIndex
- newtype RowSpan = RowSpan Int
- newtype ColSpan = ColSpan Int
- type CellIndex = (RowIndex, ColIndex)
- newtype RowIndex = RowIndex {
  - fromRowIndex :: Int
  }
- newtype ColIndex = ColIndex {
  - fromColIndex :: Int
  }
- data Alignment
  - = AlignDefault
  - | AlignLeft
  - | AlignCenter
  - | AlignRight
- mapCells :: (a -> b) -> ArrayTable a -> ArrayTable b

# Documentation

data ArrayTable a Source #

Table representation based on an array; cells are placed on a grid, with indices spanned by other cells containing placeholder cells that point to the spanning cell.

Constructors

ArrayTable |

Fields

- arrayTableCells :: Array CellIndex (GridCell a)
- arrayTableHead :: Maybe RowIndex
- arrayTableFoot :: Maybe RowIndex
- arrayTableColSpecs :: Array ColIndex (Alignment, Int)

#### Instances

Instances details

Show a => Show (ArrayTable a) Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods showsPrec :: Int -> ArrayTable a -> ShowS Source # show :: ArrayTable a -> String Source # showList :: [ArrayTable a] -> ShowS Source #
Eq a => Eq (ArrayTable a) Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods (==) :: ArrayTable a -> ArrayTable a -> Bool Source # (/=) :: ArrayTable a -> ArrayTable a -> Bool Source #

data GridCell a Source #

A grid cell contains either a real table cell, or is the continuation of a column or row-spanning cell. In the latter case, the index of the continued cell is provided.

Constructors

ContentCell RowSpan ColSpan a |
ContinuationCell CellIndex |

#### Instances

Instances details

Show a => Show (GridCell a) Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods showsPrec :: Int -> GridCell a -> ShowS Source # show :: GridCell a -> String Source # showList :: [GridCell a] -> ShowS Source #
Eq a => Eq (GridCell a) Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods (==) :: GridCell a -> GridCell a -> Bool Source # (/=) :: GridCell a -> GridCell a -> Bool Source #

newtype RowSpan Source #

The number of rows spanned by a cell.

Constructors

RowSpan Int |

#### Instances

Instances details

Enum RowSpan Source # |

Instance details

Defined in Text.GridTable.ArrayTable

Methods

succ :: RowSpan -> RowSpan Source #

pred :: RowSpan -> RowSpan Source #

toEnum :: Int -> RowSpan Source #

fromEnum :: RowSpan -> Int Source #

enumFrom :: RowSpan -> [RowSpan] Source #

enumFromThen :: RowSpan -> RowSpan -> [RowSpan] Source #

enumFromTo :: RowSpan -> RowSpan -> [RowSpan] Source #

enumFromThenTo :: RowSpan -> RowSpan -> RowSpan -> [RowSpan] Source #

Num RowSpan Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods (+) :: RowSpan -> RowSpan -> RowSpan Source # (-) :: RowSpan -> RowSpan -> RowSpan Source # (*) :: RowSpan -> RowSpan -> RowSpan Source # negate :: RowSpan -> RowSpan Source # abs :: RowSpan -> RowSpan Source # signum :: RowSpan -> RowSpan Source # fromInteger :: Integer -> RowSpan Source #
Read RowSpan Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods readsPrec :: Int -> ReadS RowSpan Source # readList :: ReadS [RowSpan] Source # readPrec :: ReadPrec RowSpan Source # readListPrec :: ReadPrec [RowSpan] Source #
Show RowSpan Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods showsPrec :: Int -> RowSpan -> ShowS Source # show :: RowSpan -> String Source # showList :: [RowSpan] -> ShowS Source #
Eq RowSpan Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods (==) :: RowSpan -> RowSpan -> Bool Source # (/=) :: RowSpan -> RowSpan -> Bool Source #
Ord RowSpan Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods compare :: RowSpan -> RowSpan -> Ordering Source # (<) :: RowSpan -> RowSpan -> Bool Source # (<=) :: RowSpan -> RowSpan -> Bool Source # (>) :: RowSpan -> RowSpan -> Bool Source # (>=) :: RowSpan -> RowSpan -> Bool Source # max :: RowSpan -> RowSpan -> RowSpan Source # min :: RowSpan -> RowSpan -> RowSpan Source #

newtype ColSpan Source #

The number of columns spanned by a cell.

Constructors

ColSpan Int |

#### Instances

Instances details

Enum ColSpan Source # |

Instance details

Defined in Text.GridTable.ArrayTable

Methods

succ :: ColSpan -> ColSpan Source #

pred :: ColSpan -> ColSpan Source #

toEnum :: Int -> ColSpan Source #

fromEnum :: ColSpan -> Int Source #

enumFrom :: ColSpan -> [ColSpan] Source #

enumFromThen :: ColSpan -> ColSpan -> [ColSpan] Source #

enumFromTo :: ColSpan -> ColSpan -> [ColSpan] Source #

enumFromThenTo :: ColSpan -> ColSpan -> ColSpan -> [ColSpan] Source #

Num ColSpan Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods (+) :: ColSpan -> ColSpan -> ColSpan Source # (-) :: ColSpan -> ColSpan -> ColSpan Source # (*) :: ColSpan -> ColSpan -> ColSpan Source # negate :: ColSpan -> ColSpan Source # abs :: ColSpan -> ColSpan Source # signum :: ColSpan -> ColSpan Source # fromInteger :: Integer -> ColSpan Source #
Read ColSpan Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods readsPrec :: Int -> ReadS ColSpan Source # readList :: ReadS [ColSpan] Source # readPrec :: ReadPrec ColSpan Source # readListPrec :: ReadPrec [ColSpan] Source #
Show ColSpan Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods showsPrec :: Int -> ColSpan -> ShowS Source # show :: ColSpan -> String Source # showList :: [ColSpan] -> ShowS Source #
Eq ColSpan Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods (==) :: ColSpan -> ColSpan -> Bool Source # (/=) :: ColSpan -> ColSpan -> Bool Source #
Ord ColSpan Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods compare :: ColSpan -> ColSpan -> Ordering Source # (<) :: ColSpan -> ColSpan -> Bool Source # (<=) :: ColSpan -> ColSpan -> Bool Source # (>) :: ColSpan -> ColSpan -> Bool Source # (>=) :: ColSpan -> ColSpan -> Bool Source # max :: ColSpan -> ColSpan -> ColSpan Source # min :: ColSpan -> ColSpan -> ColSpan Source #

type CellIndex = (RowIndex, ColIndex) Source #

Index to a cell in a table part.

newtype RowIndex Source #

Row index in a table array.

Constructors

RowIndex |

Fields

- fromRowIndex :: Int

#### Instances

Instances details

Enum RowIndex Source # |

Instance details

Defined in Text.GridTable.ArrayTable

Methods

succ :: RowIndex -> RowIndex Source #

pred :: RowIndex -> RowIndex Source #

toEnum :: Int -> RowIndex Source #

fromEnum :: RowIndex -> Int Source #

enumFrom :: RowIndex -> [RowIndex] Source #

enumFromThen :: RowIndex -> RowIndex -> [RowIndex] Source #

enumFromTo :: RowIndex -> RowIndex -> [RowIndex] Source #

enumFromThenTo :: RowIndex -> RowIndex -> RowIndex -> [RowIndex] Source #

Ix RowIndex Source # |

Instance details

Defined in Text.GridTable.ArrayTable

Methods

range :: (RowIndex, RowIndex) -> [RowIndex] Source #

index :: (RowIndex, RowIndex) -> RowIndex -> Int Source #

unsafeIndex :: (RowIndex, RowIndex) -> RowIndex -> Int Source #

inRange :: (RowIndex, RowIndex) -> RowIndex -> Bool Source #

rangeSize :: (RowIndex, RowIndex) -> Int Source #

unsafeRangeSize :: (RowIndex, RowIndex) -> Int Source #

Num RowIndex Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods (+) :: RowIndex -> RowIndex -> RowIndex Source # (-) :: RowIndex -> RowIndex -> RowIndex Source # (*) :: RowIndex -> RowIndex -> RowIndex Source # negate :: RowIndex -> RowIndex Source # abs :: RowIndex -> RowIndex Source # signum :: RowIndex -> RowIndex Source # fromInteger :: Integer -> RowIndex Source #
Show RowIndex Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods showsPrec :: Int -> RowIndex -> ShowS Source # show :: RowIndex -> String Source # showList :: [RowIndex] -> ShowS Source #
Eq RowIndex Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods (==) :: RowIndex -> RowIndex -> Bool Source # (/=) :: RowIndex -> RowIndex -> Bool Source #
Ord RowIndex Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods compare :: RowIndex -> RowIndex -> Ordering Source # (<) :: RowIndex -> RowIndex -> Bool Source # (<=) :: RowIndex -> RowIndex -> Bool Source # (>) :: RowIndex -> RowIndex -> Bool Source # (>=) :: RowIndex -> RowIndex -> Bool Source # max :: RowIndex -> RowIndex -> RowIndex Source # min :: RowIndex -> RowIndex -> RowIndex Source #

newtype ColIndex Source #

Column index in a table array.

Constructors

ColIndex |

Fields

- fromColIndex :: Int

#### Instances

Instances details

Enum ColIndex Source # |

Instance details

Defined in Text.GridTable.ArrayTable

Methods

succ :: ColIndex -> ColIndex Source #

pred :: ColIndex -> ColIndex Source #

toEnum :: Int -> ColIndex Source #

fromEnum :: ColIndex -> Int Source #

enumFrom :: ColIndex -> [ColIndex] Source #

enumFromThen :: ColIndex -> ColIndex -> [ColIndex] Source #

enumFromTo :: ColIndex -> ColIndex -> [ColIndex] Source #

enumFromThenTo :: ColIndex -> ColIndex -> ColIndex -> [ColIndex] Source #

Ix ColIndex Source # |

Instance details

Defined in Text.GridTable.ArrayTable

Methods

range :: (ColIndex, ColIndex) -> [ColIndex] Source #

index :: (ColIndex, ColIndex) -> ColIndex -> Int Source #

unsafeIndex :: (ColIndex, ColIndex) -> ColIndex -> Int Source #

inRange :: (ColIndex, ColIndex) -> ColIndex -> Bool Source #

rangeSize :: (ColIndex, ColIndex) -> Int Source #

unsafeRangeSize :: (ColIndex, ColIndex) -> Int Source #

Num ColIndex Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods (+) :: ColIndex -> ColIndex -> ColIndex Source # (-) :: ColIndex -> ColIndex -> ColIndex Source # (*) :: ColIndex -> ColIndex -> ColIndex Source # negate :: ColIndex -> ColIndex Source # abs :: ColIndex -> ColIndex Source # signum :: ColIndex -> ColIndex Source # fromInteger :: Integer -> ColIndex Source #
Show ColIndex Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods showsPrec :: Int -> ColIndex -> ShowS Source # show :: ColIndex -> String Source # showList :: [ColIndex] -> ShowS Source #
Eq ColIndex Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods (==) :: ColIndex -> ColIndex -> Bool Source # (/=) :: ColIndex -> ColIndex -> Bool Source #
Ord ColIndex Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods compare :: ColIndex -> ColIndex -> Ordering Source # (<) :: ColIndex -> ColIndex -> Bool Source # (<=) :: ColIndex -> ColIndex -> Bool Source # (>) :: ColIndex -> ColIndex -> Bool Source # (>=) :: ColIndex -> ColIndex -> Bool Source # max :: ColIndex -> ColIndex -> ColIndex Source # min :: ColIndex -> ColIndex -> ColIndex Source #

data Alignment Source #

Cell alignment

Constructors

AlignDefault |
AlignLeft |
AlignCenter |
AlignRight |

#### Instances

Instances details

Enum Alignment Source # |

Instance details

Defined in Text.GridTable.ArrayTable

Methods

succ :: Alignment -> Alignment Source #

pred :: Alignment -> Alignment Source #

toEnum :: Int -> Alignment Source #

fromEnum :: Alignment -> Int Source #

enumFrom :: Alignment -> [Alignment] Source #

enumFromThen :: Alignment -> Alignment -> [Alignment] Source #

enumFromTo :: Alignment -> Alignment -> [Alignment] Source #

enumFromThenTo :: Alignment -> Alignment -> Alignment -> [Alignment] Source #

Read Alignment Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods readsPrec :: Int -> ReadS Alignment Source # readList :: ReadS [Alignment] Source # readPrec :: ReadPrec Alignment Source # readListPrec :: ReadPrec [Alignment] Source #
Show Alignment Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods showsPrec :: Int -> Alignment -> ShowS Source # show :: Alignment -> String Source # showList :: [Alignment] -> ShowS Source #
Eq Alignment Source # |
Instance details Defined in Text.GridTable.ArrayTable Methods (==) :: Alignment -> Alignment -> Bool Source # (/=) :: Alignment -> Alignment -> Bool Source #
Ord Alignment Source # |

Instance details

Defined in Text.GridTable.ArrayTable

Methods

compare :: Alignment -> Alignment -> Ordering Source #

(<) :: Alignment -> Alignment -> Bool Source #

(<=) :: Alignment -> Alignment -> Bool Source #

(>) :: Alignment -> Alignment -> Bool Source #

(>=) :: Alignment -> Alignment -> Bool Source #

max :: Alignment -> Alignment -> Alignment Source #

min :: Alignment -> Alignment -> Alignment Source #

mapCells :: (a -> b) -> ArrayTable a -> ArrayTable b Source #

Apply a function to all cell contents in a grid table.