Align columns: Difference between revisions

Content added Content deleted
Line 2,499:
Or, using '''Text''' and its functions as an alternative to '''[Char]''' strings:
 
<lang haskell>import Data.ListPrelude (transpose,as zip, maximumBy)P
import Data.Text as T
(Text, pack, unpack, splitOn, unlines, unwords, length,
justifyLeft, justifyRight, center)
import Data.List (transpose, zip, maximumBy)
import Data.Ord (comparing)
 
rows :: [[Text]]
rows =
Line 2,515 ⟶ 2,516:
, "justified,$right$justified,$or$center$justified$within$its$column."
]
 
cols :: [[Text]]
cols =
transpose $
((++) <*>
(flip PreludeP.replicate (pack []) .
(-) (maximum (PreludeP.length <$> rows)) . PreludeP.length)) <$>
rows
 
main :: IO ()
main =