4 #if __GLASGOW_HASKELL__ <= 606
5 intercalate xs xss = concat (intersperse xs xss)
8 padWith :: a -> Int -> [a] -> [a]
10 padWith e n [] = replicate n e
11 -- http://hackage.haskell.org/trac/haskell-prime/wiki/RemoveNPlusK
12 -- Ugg... GHC could at least give a meaningful error message. ~ Matt 2011-08-27
14 if n == 0 then error "padWith: list is already longer than the requested length"
15 else h:(padWith e (n-1) t)
17 formatTable :: [[String]] -> String
19 let columnWidths = map (\col -> maximum $ map length col)
23 let rowCells = zipWith (padWith ' ') columnWidths row in
24 intercalate " " rowCells