summaryrefslogtreecommitdiff
path: root/src/Utility/Table.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Utility/Table.hs')
-rw-r--r--src/Utility/Table.hs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Utility/Table.hs b/src/Utility/Table.hs
index 3d1a3980..20adf40d 100644
--- a/src/Utility/Table.hs
+++ b/src/Utility/Table.hs
@@ -16,14 +16,14 @@ tableWithHeader header rows = header : map linesep header : rows
where
linesep = map (const '-')
--- | Formats a table to lines, automatically padding rows to the same size.
+-- | Formats a table to lines, automatically padding columns to the same size.
formatTable :: Table -> [String]
-formatTable table = map (\r -> unwords (map pad (zip r rowsizes))) table
+formatTable table = map (\r -> unwords (map pad (zip r colsizes))) table
where
pad (cell, size) = cell ++ take (size - length cell) padding
padding = repeat ' '
- rowsizes = reverse $ (0:) $ drop 1 $ reverse $
- sumrows (map (map length) table)
- sumrows [] = repeat 0
- sumrows [r] = r
- sumrows (r1:r2:rs) = sumrows $ map (uncurry max) (zip r1 r2) : rs
+ colsizes = reverse $ (0:) $ drop 1 $ reverse $
+ sumcols (map (map length) table)
+ sumcols [] = repeat 0
+ sumcols [r] = r
+ sumcols (r1:r2:rs) = sumcols $ map (uncurry max) (zip r1 r2) : rs