[Haskell-cafe] [ANN] show-combinators: a minimal pretty-printing library for Show instances

Li-yao Xia lysxia at gmail.com
Sun Feb 25 20:28:44 UTC 2018


Sometimes it is necessary to handwrite instances for Show, Show1, Show2, 
or some other simple pretty-printer for ADT-like structures (because 
they might not be easily derived via existing means).

base has a few combinators in Prelude, Text.Show, and 
Data.Functor.Classes. But they require explicit handling of spacing and 
precedence levels, which is generally error-prone and repetitive, since 
ADTs all look the same.

This new library, show-combinators, contains just a dozen of functions 
to encapsulate all of those details, so the code left to write can more 
closely match the structure of the type to show.


I hope you will also find it useful.


More information about the Haskell-Cafe mailing list