![]() ![]() | nostrud exercitation ullamco laboris nisi ut | | | elit, sed eiusmod tempor incidunt ut labore et | | | Lorem ipsum dolor sit amet, consectetur adipisici | | In putStrLn $ tableString ĬolsAllG will merge the given columns into a row group with the given positioning: - - The following piece of code will display a left-justified text alongside the length of the text: let txt = "Lorem ipsum. ┌────────────┬────────────┐īecause a row group consists of multiple lines, we may also want to align the content of cells vertically, especially when we don't know how many lines there will be. A maximum column width is respected, otherwise a header may acquire additional space. Headers are always displayed with a different style than the other columns (centered by default). titlesH will center titles, whereas fullH allows more control: putStrLn $ tableString In addition we specify the style and an optional header. ![]() putStrLn $ tableString Ī row group is a group of rows which are not visually separated from each other. tableLines and tableString are used to create a table. Sometimes we want to explicitly display a table, for example, as output in a database application. Table layoutįor more complex data, grids do not offer as much visibility. This way the color can depend on the cell content. > let red s = formatted "\ESC[31m" s "\ESC[0m" Another way to introduce color into cells is the Formatted type: > :set -XOverloadedStrings checkeredCells will checker cells with 2 different functions.Ī good way to use this would be the ansi-terminal package, provided you are using a terminal to output your text.altLines will apply the given function in an alternating pattern.To improve their readability, two functions are provided: This will display the given numbers as a dot-aligned single column: 1.2īig grids are usually not that readable. A particularly useful one is numCol: > import Numeric Number columnsĪdditionally some common types are provided. We could have used just def for the first column. There are sensible default values for all column specification types, even for columns. The result is not spectacular but does look as expected: top left top right GridString will join cells with a whitespace and rows with a newline character. Render some text rows as grid: > putStrLn $ gridString Multi-line content can be aligned vertically, with respect to the other horizontally adjacent cells, and text can be rendered justified. Such tables can use optional headers and multiple lines per cell. Typically cells are rendered as a grid, but it is also possible to render tables with simulated lines, including styling support. A cell is a type that implements the Cell type class. ![]() Those specifications are then applied to a list of rows. One such purpose is to display floating point numbers.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |