There are a few main classes involved here:
There are a few main classes involved here:
- PPrint: an all-encompassing typeclass that contains all you need to pretty-print a value T => Iter[String]
- PPrinter: a typeclass that takes a configuration object and pretty-prints a value (T, Config) => Iter[String]
- Config: controls various metadata about the pprint, e.g. how wide to go before we start wrapping, or what colors to use
- Chunker: (T, Config) => Iter[ Iter[String] ]. Implements the very common comma-separated-values pattern, where each sub-iter is one of the comma separated blocks, but it's up to the caller to decide what to do with them
Configuration options to control how prettyprinting occurs, passed recursively into each prettyprinting callsite.
Configuration options to control how prettyprinting occurs, passed recursively into each prettyprinting callsite.
Controls how far to the right a line will go before it tries to wrap
Controls how many lines can be printed at once. Will print all lines if set to 0
How much the current item being printed should be indented
A map used to rename things to more common names, e.g.
renamig WrappedArray
to Array
or getting rid of
TupleN *
Helpers to help inject behavior into the generated code without having any circular dependencies
Helpers to help inject behavior into the generated code without having any circular dependencies
A typeclass necessary to prettyprint something.
A typeclass necessary to prettyprint something. Separate from PPrinter in order to make contravariant implicit resolution behave right.
A typeclass you define to prettyprint values of type A
Prettyprint a strongly-typed value, falling back to toString if you don't know what to do with it.
Prettyprint a strongly-typed value, falling back to toString if you don't know what to do with it. Generally used for human-facing output