Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
Functions for drawing grid and table structure common in music theory and in compositions such as Morton Feldman's durational grid music of the 1950's.
- type P = (R, R)
- type C = (R, R, R)
- type L = (Int, Int)
- type Cell = (L, C, String)
- type Grid = [Cell]
- grid :: (Enum a, Num a) => (a, a) -> (a, a) -> (Int, Int) -> [[(a, a)]]
- grid_pt :: (R, R) -> (R, R) -> L -> P
- displace :: (R, R) -> P -> P
- mk_bbox :: (Int, Int) -> (R, R)
- type Table_Cell = ([Attr], [Content])
- type Caption = [Content]
- type HTML_Table = (Caption, [[Table_Cell]])
- simple_table :: Caption -> [[Content]] -> HTML_Table
- simple_table_class :: Caption -> [[(String, Content)]] -> HTML_Table
- type Build_F = (Int, Int) -> Maybe Table_Cell
- build_table_m :: Caption -> (Int, Int) -> Build_F -> HTML_Table
- build_table :: Caption -> (Int, Int) -> ((Int, Int) -> Table_Cell) -> HTML_Table
- table :: HTML_Table -> Content
- type HTML_Table_Set = [HTML_Table]
- table_set :: HTML_Table_Set -> Content
- page :: Maybe FilePath -> [HTML_Table_Set] -> String
- to_html :: FilePath -> Maybe FilePath -> [HTML_Table_Set] -> IO ()
Grid
grid :: (Enum a, Num a) => (a, a) -> (a, a) -> (Int, Int) -> [[(a, a)]] Source
Given (x,y) upper-left co-ordinate of grid, (w,h) cell dimensions, and (r,c) grid dimensions, make array of upper-left co-ordinates of cells.
grid (10,10) (50,10) (2,2) = [[(10,10),(60,10)],[(10,20),(60,20)]]
grid_pt :: (R, R) -> (R, R) -> L -> P Source
Variant on grid
that constructs a single point.
map (grid_pt (10,10) (50,10)) [(0,0),(1,1)] == [(10,10),(60,20)]
Table (HTML)
type HTML_Table = (Caption, [[Table_Cell]]) Source
Table of row order Table_Cell
s.
simple_table :: Caption -> [[Content]] -> HTML_Table Source
Construct a Table
with one Content
per cell.
simple_table_class :: Caption -> [[(String, Content)]] -> HTML_Table Source
Construct a Table
with one Content
per cell, and an
associated class.
type Build_F = (Int, Int) -> Maybe Table_Cell Source
A function from (row,column)
to Maybe
Table_Cell
build_table_m :: Caption -> (Int, Int) -> Build_F -> HTML_Table Source
build_table :: Caption -> (Int, Int) -> ((Int, Int) -> Table_Cell) -> HTML_Table Source
Build a table of (rows,columns)
dimensions given a function
from (row,column)
to Table_Cell
.
table :: HTML_Table -> Content Source
Render Table
as HTML
table.
type HTML_Table_Set = [HTML_Table] Source
A set of related tables.
table_set :: HTML_Table_Set -> Content Source
Render a Table_Set
s in a div
with class table-set
.