liveBook · Manning

Pretty printing

As explained in Learn Haskell by Example

Pretty printing is the rendering of structured information in a human-readable textual format.

Pretty printing renders structured information in a human-readable form. For CSV data, the design must handle arbitrary cell types while supporting readable column summaries. section 8.3

A practical pretty-printing design separates ordinary CSV data from display-ready data:

  • Restrict printable values to types that can be transformed into Text. section 8.3

How Learn Haskell by Example covers it

How deep it goes
Defines a PrettyCsv model and rendering interface, but leaves conversion, summaries, and formatting algorithms as exercises.
Examples
Uses PrettyCsv fields and fromCsv, withSummaries, pretty, and prettyText as concrete design examples.
What it assumes
Assumes a Csv representation and basic Haskell types while motivating a separate printable representation for arbitrary values.
What you can do after
Build it from scratch by converting Csv to PrettyCsv, adding summaries, and implementing textual rendering.
How it connects
Connects CSV, Text, parametric types, type constraints, and function composition.

Also explained in

Compare how 3 books explain pretty printing →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Haskell by Example. The section links point to the parts of the book it draws on.