data-tree-print-0.1.0.2: Print Data instances as a nested tree

Safe HaskellSafe
LanguageHaskell2010

DataTreePrint

Synopsis

Documentation

simplePrintTree :: Data a => a -> Doc Source #

The "simple" printer does not try to fit more than one node into the same line, even if it would fit.

simplePrintTreeWithCustom :: Data a => ToDocF -> a -> Doc Source #

Allows to specialize the transformation for specific types. Use syb's extQ function(s). See the source of defaultLayouterF for an example of how to do this.

printTree :: forall a. Data a => Int -> a -> Doc Source #

Somewhat more intelligent printer that tries to fit multiple nodes into the same line there is space given the specified number of total columns. For example, `(1,2,3)` will be printed as "(,,) (1) (2) (3)" instead of "(,,)n 1n 2n 3". Parentheses are added in these cases to prevent syntactic ambiguities.

showTree :: Data a => a -> String Source #

newtype DataToLayouter Source #

This newtype is necessary so fix can be used in combination with the constrained forall-quantification.

Constructors

DataToLayouter 

Fields

data NodeLayouter Source #

Constructors

NodeLayouter 

Fields

  • _lay_llength :: Int

    the length of this node, if printed on a single line

  • _lay_needsParens :: Bool
     
  • _lay_func :: Either Bool Int -> Doc

    Left: one-line output, the boolean indicates if parentheses are advisable given the context. (They can be omitted in cases like when there is only one constructor). Right: The Int is the remaining vertical space left for this node.