prettyprinter-0.1: A modern, extensible and well-documented prettyprinter.

Safe HaskellSafe
LanguageHaskell2010

Data.Text.Prettyprint.Doc.Render.Util.SimpleDocTree

Description

Conversion of the linked-list-like SimpleDoc to a tree-like SimpleDocTree.

Synopsis

Documentation

data SimpleDocTree ann Source #

A SimpleDoc is a linked list of different annotated cons cells (SText and then some further SimpleDoc, SLine and then some further SimpleDoc, …). This format is very suitable as a target for a layout engine, but not very useful for rendering to a structured format such as HTML, where we don’t want to do a lookahead until the end of some markup. These formats benefit from a tree-like structure that explicitly marks its contents as annotated. SimpleDocTree is that format.

Instances

treeForm :: SimpleDoc ann -> SimpleDocTree ann Source #

Convert a SimpleDoc to its SimpleDocTree representation.

unAnnotateST :: SimpleDocTree ann -> SimpleDocTree xxx Source #

Remove all annotations. unAnnotate for SimpleDocTree.

reAnnotateST :: (ann -> ann') -> SimpleDocTree ann -> SimpleDocTree ann' Source #

Change the annotation of a document. reAnnotate for SimpleDocTree.