-- Contruction Functions:
single,
+ empty,
above,
beside,
-- to show boxes aka the above ascii renditions.
instance (Show a) => Show (BlockTable a) where
- showsPrec p = showsTable
+ showsPrec _ = showsTable
type TableI a = [[(a,(Int,Int))]] -> [[(a,(Int,Int))]]
-- You can create a (1x1) table entry
single :: a -> BlockTable a
-single a = Table (\ x y z -> [(a,(x+1,y+1))] : z) 1 1
+single a = Table (\ x y r -> [(a,(x+1,y+1))] : r) 1 1
+
+empty :: BlockTable a
+empty = Table (\ _ _ r -> r) 0 0
-- You can compose tables, horizonally and vertically
-- but is always true for these combinators.
-- I should assert this!
-- I should even prove this.
- beside (x:xs) (y:ys) = (x ++ y) : beside xs ys
- beside (x:xs) [] = x : xs ++ r
- beside [] (y:ys) = y : ys ++ r
- beside [] [] = r
+ beside' (x:xs) (y:ys) = (x ++ y) : beside' xs ys
+ beside' (x:xs) [] = x : xs ++ r
+ beside' [] (y:ys) = y : ys ++ r
+ beside' [] [] = r
in
- beside (lst1 []) (lst2 []))
+ beside' (lst1 []) (lst2 []))
-- trans flips (transposes) over the x and y axis of
-- the table. It is only used internally, and typically