summaryrefslogtreecommitdiff
path: root/src/Utility
diff options
context:
space:
mode:
authorJoey Hess2015-01-15 19:57:42 -0400
committerJoey Hess2015-01-15 19:58:03 -0400
commitee7135dbfd87c1be06ce7777e9e21fd6548c420e (patch)
treef6f34618098c71ca353dc2c734ece9e196b092f4 /src/Utility
parent95d1cc62ea655a047333e5224d52c17a70c2d0cb (diff)
typo; columns vs rows
No behavior change
Diffstat (limited to 'src/Utility')
-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