hmt-0.16: Haskell Music Theory

Safe HaskellSafe
LanguageHaskell98

Music.Theory.Array.MD

Description

Regular array data as markdown (MD) tables.

Synopsis

Documentation

type MD_Table t = (Maybe [String], [[t]]) Source #

Optional header row then data rows.

md_table_join :: MD_Table a -> MD_Table a -> MD_Table a Source #

Join second table to right of initial table.

md_number_rows :: MD_Table String -> MD_Table String Source #

Add a row number column at the front of the table.

md_table_opt :: (Bool, Bool, String) -> MD_Table String -> [String] Source #

Markdown table, perhaps with header. Table is in row order. Options are pad_left and eq_width.

let tbl = [["a","bc","def"],["ghij","klm","no","p"]]
putStrLn$unlines$"": md_table_opt (True,True," · ") (Nothing,tbl)

md_table_show :: Show t => Maybe [String] -> [[t]] -> [String] Source #

Variant relying on Show instances.

md_table_show Nothing [[1..4],[5..8],[9..12]]

md_table_column_order :: Maybe [String] -> [[String]] -> [String] Source #

Variant in column order (ie. transpose).

md_table_column_order [["a","bc","def"],["ghij","klm","no"]]

md_table_p2 :: (Show a, Show b) => Maybe [String] -> ([a], [b]) -> [String] Source #

Two-tuple show variant.

md_table_p3 :: (Show a, Show b, Show c) => Maybe [String] -> ([a], [b], [c]) -> [String] Source #

Three-tuple show variant.

md_matrix :: a -> ([a], [a]) -> [[a]] -> MD_Table a Source #

Matrix form, ie. header in both first row and first column, in each case displaced by one location which is empty.

let h = (map return "abc",map return "efgh")
let t = md_matrix "" h (map (map show) [[1,2,3,4],[2,3,4,1],[3,4,1,2]])
>>> putStrLn $ unlines $ md_table' t
- - - - -
  e f g h
a 1 2 3 4
b 2 3 4 1
c 3 4 1 2
- - - - -

md_matrix_opt :: (a -> String) -> (String -> String) -> ([a], [a]) -> [[a]] -> MD_Table String Source #

Variant that takes a show function and a header decoration function.

md_embolden :: String -> String Source #

MD embolden function.

md_matrix_bold :: Show a => ([a], [a]) -> [[a]] -> MD_Table String Source #

md_matrix_opt with show and markdown bold annotations for header. the header cells are in bold.