hmt-0.15: Haskell Music Theory

Safe HaskellSafe-Inferred
LanguageHaskell98

Music.Theory.Array.MD

Description

Regular array data as markdown (MD) tables.

Synopsis

Documentation

pad_right :: a -> Int -> [a] -> [a] Source

Append k to the right of l until result has n places.

make_regular :: a -> [[a]] -> [[a]] Source

Append k to each row of tbl as required to be regular (all rows equal length).

delete_trailing_whitespace :: [Char] -> [Char] Source

Delete trailing Char where isSpace holds.

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 -> MD_Table String -> [String] Source

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

md_table_opt False (Nothing,[["a","bc","def"],["ghij","klm","no","p"]])

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]] -> 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 t = md_matrix "" (map return "abc") (map (map show) [[1,2,3],[2,3,1],[3,1,2]])
>>> putStrLn $ unlines $ md_table' t
- - - -
  a b c
a 1 2 3
b 2 3 1
c 3 1 2
- - - -

md_matrix_bold :: [String] -> [[String]] -> MD_Table String Source

Variant for String tables where nil is the empty string and the header cells are in bold.