Text.GridTable.ArrayTable

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

Copyright | © 2022 RStudio 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 #

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

data GridCell a #

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

newtype RowSpan #

The number of rows spanned by a cell.

Constructors

RowSpan Int |

#### Instances

Instances details

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

newtype ColSpan #

The number of columns spanned by a cell.

Constructors

ColSpan Int |

#### Instances

Instances details

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

type CellIndex = (RowIndex, ColIndex) #

Index to a cell in a table part.

newtype RowIndex #

Row index in a table array.

Constructors

RowIndex |
Fields fromRowIndex :: Int

#### Instances

Instances details

Enum RowIndex # |
Instance details Defined in Text.GridTable.ArrayTable Methods succ :: RowIndex -> RowIndex # pred :: RowIndex -> RowIndex # toEnum :: Int -> RowIndex # fromEnum :: RowIndex -> Int # enumFrom :: RowIndex -> [RowIndex] # enumFromThen :: RowIndex -> RowIndex -> [RowIndex] # enumFromTo :: RowIndex -> RowIndex -> [RowIndex] # enumFromThenTo :: RowIndex -> RowIndex -> RowIndex -> [RowIndex] #
Ix RowIndex # |
Instance details Defined in Text.GridTable.ArrayTable Methods range :: (RowIndex, RowIndex) -> [RowIndex] # index :: (RowIndex, RowIndex) -> RowIndex -> Int # unsafeIndex :: (RowIndex, RowIndex) -> RowIndex -> Int # inRange :: (RowIndex, RowIndex) -> RowIndex -> Bool # rangeSize :: (RowIndex, RowIndex) -> Int # unsafeRangeSize :: (RowIndex, RowIndex) -> Int #
Num RowIndex # |
Instance details Defined in Text.GridTable.ArrayTable Methods (+) :: RowIndex -> RowIndex -> RowIndex # (-) :: RowIndex -> RowIndex -> RowIndex # (*) :: RowIndex -> RowIndex -> RowIndex # negate :: RowIndex -> RowIndex # abs :: RowIndex -> RowIndex # signum :: RowIndex -> RowIndex # fromInteger :: Integer -> RowIndex #
Show RowIndex # |
Instance details Defined in Text.GridTable.ArrayTable Methods showsPrec :: Int -> RowIndex -> ShowS # show :: RowIndex -> String # showList :: [RowIndex] -> ShowS #
Eq RowIndex # |
Instance details Defined in Text.GridTable.ArrayTable Methods (==) :: RowIndex -> RowIndex -> Bool # (/=) :: RowIndex -> RowIndex -> Bool #
Ord RowIndex # |
Instance details Defined in Text.GridTable.ArrayTable Methods compare :: RowIndex -> RowIndex -> Ordering # (<) :: RowIndex -> RowIndex -> Bool # (<=) :: RowIndex -> RowIndex -> Bool # (>) :: RowIndex -> RowIndex -> Bool # (>=) :: RowIndex -> RowIndex -> Bool # max :: RowIndex -> RowIndex -> RowIndex # min :: RowIndex -> RowIndex -> RowIndex #

newtype ColIndex #

Column index in a table array.

Constructors

ColIndex |
Fields fromColIndex :: Int

#### Instances

Instances details

Enum ColIndex # |
Instance details Defined in Text.GridTable.ArrayTable Methods succ :: ColIndex -> ColIndex # pred :: ColIndex -> ColIndex # toEnum :: Int -> ColIndex # fromEnum :: ColIndex -> Int # enumFrom :: ColIndex -> [ColIndex] # enumFromThen :: ColIndex -> ColIndex -> [ColIndex] # enumFromTo :: ColIndex -> ColIndex -> [ColIndex] # enumFromThenTo :: ColIndex -> ColIndex -> ColIndex -> [ColIndex] #
Ix ColIndex # |
Instance details Defined in Text.GridTable.ArrayTable Methods range :: (ColIndex, ColIndex) -> [ColIndex] # index :: (ColIndex, ColIndex) -> ColIndex -> Int # unsafeIndex :: (ColIndex, ColIndex) -> ColIndex -> Int # inRange :: (ColIndex, ColIndex) -> ColIndex -> Bool # rangeSize :: (ColIndex, ColIndex) -> Int # unsafeRangeSize :: (ColIndex, ColIndex) -> Int #
Num ColIndex # |
Instance details Defined in Text.GridTable.ArrayTable Methods (+) :: ColIndex -> ColIndex -> ColIndex # (-) :: ColIndex -> ColIndex -> ColIndex # (*) :: ColIndex -> ColIndex -> ColIndex # negate :: ColIndex -> ColIndex # abs :: ColIndex -> ColIndex # signum :: ColIndex -> ColIndex # fromInteger :: Integer -> ColIndex #
Show ColIndex # |
Instance details Defined in Text.GridTable.ArrayTable Methods showsPrec :: Int -> ColIndex -> ShowS # show :: ColIndex -> String # showList :: [ColIndex] -> ShowS #
Eq ColIndex # |
Instance details Defined in Text.GridTable.ArrayTable Methods (==) :: ColIndex -> ColIndex -> Bool # (/=) :: ColIndex -> ColIndex -> Bool #
Ord ColIndex # |
Instance details Defined in Text.GridTable.ArrayTable Methods compare :: ColIndex -> ColIndex -> Ordering # (<) :: ColIndex -> ColIndex -> Bool # (<=) :: ColIndex -> ColIndex -> Bool # (>) :: ColIndex -> ColIndex -> Bool # (>=) :: ColIndex -> ColIndex -> Bool # max :: ColIndex -> ColIndex -> ColIndex # min :: ColIndex -> ColIndex -> ColIndex #

data Alignment #

Cell alignment

Constructors

AlignDefault |
AlignLeft |
AlignCenter |
AlignRight |

#### Instances

Instances details

Enum Alignment # |
Instance details Defined in Text.GridTable.ArrayTable Methods succ :: Alignment -> Alignment # pred :: Alignment -> Alignment # toEnum :: Int -> Alignment # fromEnum :: Alignment -> Int # enumFrom :: Alignment -> [Alignment] # enumFromThen :: Alignment -> Alignment -> [Alignment] # enumFromTo :: Alignment -> Alignment -> [Alignment] # enumFromThenTo :: Alignment -> Alignment -> Alignment -> [Alignment] #
Read Alignment # |
Instance details Defined in Text.GridTable.ArrayTable Methods readsPrec :: Int -> ReadS Alignment # readList :: ReadS [Alignment] # readPrec :: ReadPrec Alignment # readListPrec :: ReadPrec [Alignment] #
Show Alignment # |
Instance details Defined in Text.GridTable.ArrayTable Methods showsPrec :: Int -> Alignment -> ShowS # show :: Alignment -> String # showList :: [Alignment] -> ShowS #
Eq Alignment # |
Instance details Defined in Text.GridTable.ArrayTable Methods (==) :: Alignment -> Alignment -> Bool # (/=) :: Alignment -> Alignment -> Bool #
Ord Alignment # |
Instance details Defined in Text.GridTable.ArrayTable Methods compare :: Alignment -> Alignment -> Ordering # (<) :: Alignment -> Alignment -> Bool # (<=) :: Alignment -> Alignment -> Bool # (>) :: Alignment -> Alignment -> Bool # (>=) :: Alignment -> Alignment -> Bool # max :: Alignment -> Alignment -> Alignment # min :: Alignment -> Alignment -> Alignment #

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

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