HORIZON HASKELLDocslts/ghc-10.0.x8c2f8e82026-10-19Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8c2f8e8 · 2026-10-19

Modulehledger-lib-1.52.4GHC2021

Text.Tabular.AsciiWide

Text.Tabular.AsciiArt from tabular-0.2.2.7, modified to treat wide characters as double width.

  • 7 types
  • 29 values
  • Packagehledger-lib-1.52.4
  • Exports36
  • LanguageGHC2021
  • LicenceGPL-3.0-or-later
  • SourceAsciiWide.hs
valuesquish :: (Properties -> b -> b) -> (h -> b) -> Header h -> [b]
#

The idea is to deal with the fact that Properties (e.g. borders) are not standalone cells but attributes of a cell. A border is just a CSS decoration of a TD element.

squish decorator f h applies f to every item in the list represented by h (see flattenHeader), additionally applying decorator if the item is followed by some kind of boundary

So o o o | o o o | o o gets converted into O O X O O X O O

valuezipHeader :: h -> [h] -> Header a -> Header (h, a)
#

zipHeader e ss h returns the same structure as h except with all the text replaced by the contents of ss.

If ss has too many cells, the excess is ignored. If it has too few cells, the missing ones (at the end) and replaced with the empty contents e

datadata SemiTable h a
#

Convenience type for just one row (or column). To be used with combinators as follows:

example2 =
  empty ^..^ col "memtest 1" [] ^|^ col "memtest 2"   []
        ^||^ col "time test "[] ^|^ col "time test 2" []
  +.+ row "A 1" ["hog", "terrible", "slow", "slower"]
  +.+ row "A 2" ["pig", "not bad", "fast", "slowest"]
  +----+
      row "B 1" ["good", "awful", "intolerable", "bearable"]
  +.+ row "B 2" ["better", "no chance", "crawling", "amazing"]
  +.+ row "B 3" ["meh",  "well...", "worst ever", "ok"]

Constructors

Instances1Show
datadata Table rh ch a
#
example = Table
  (Group SingleLine
     [ Group NoLine [Header "A 1", Header "A 2"]
     , Group NoLine [Header "B 1", Header "B 2", Header "B 3"]
     ])
  (Group DoubleLine
     [ Group SingleLine [Header "memtest 1", Header "memtest 2"]
     , Group SingleLine [Header "time test 1", Header "time test 2"]
     ])
  [ ["hog", "terrible", "slow", "slower"]
  , ["pig", "not bad",  "fast", "slowest"]
  , ["good", "awful" ,  "intolerable", "bearable"]
  , ["better", "no chance", "crawling", "amazing"]
  , ["meh",  "well...", "worst ever", "ok"]
  ]
-- Text.Tabular.AsciiArt.render id id id example
--
--     || memtest 1 | memtest 2 ||  time test  | time test 2
-- ====++===========+===========++=============+============
-- A 1 ||       hog |  terrible ||        slow |      slower
-- A 2 ||       pig |   not bad ||        fast |     slowest
-- ----++-----------+-----------++-------------+------------
-- B 1 ||      good |     awful || intolerable |    bearable
-- B 2 ||    better | no chance ||    crawling |     amazing
-- B 3 ||       meh |   well... ||  worst ever |          ok

Constructors

Instances1Show
valuerenderTable
  1. :: Show a
  2. => TableOpts

    Options controlling Table rendering

  3. -> (rh -> Cell)

    Rendering function for row headers

  4. -> (ch -> Cell)

    Rendering function for column headers

  5. -> (a -> Cell)

    Function determining the string and width of a cell

  6. -> Table rh ch a
  7. -> Text
#

Render a table according to various cell specifications>

valuerenderTableB
  1. :: Show a
  2. => TableOpts

    Options controlling Table rendering

  3. -> (rh -> Cell)

    Rendering function for row headers

  4. -> (ch -> Cell)

    Rendering function for column headers

  5. -> (a -> Cell)

    Function determining the string and width of a cell

  6. -> Table rh ch a
  7. -> Builder
#

A version of renderTable which returns the underlying Builder.

valuerenderTableByRowsB
  1. :: Show a
  2. => TableOpts

    Options controlling Table rendering

  3. -> ([ch] -> [Cell])

    Rendering function for column headers

  4. -> ((rh, [a]) -> (Cell, [Cell]))

    Rendering function for row and row header

  5. -> Table rh ch a
  6. -> Builder
#

A version of renderTable that operates on rows (including the row of column headers) and returns the underlying Builder.

valuetextCell :: Align -> Text -> Cell
#

Create a single-line cell from the given contents with its natural width.

valuetextsCell :: Align -> [Text] -> Cell
#

Create a multi-line cell from the given contents with its natural width.