| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Data.Text.Prettyprint.Doc.Render.Util.SimpleDocTree
Description
Conversion of the linked-list-like SimpleDoc to a tree-like
SimpleDocTree.
- data SimpleDocTree ann
- treeForm :: SimpleDoc ann -> SimpleDocTree ann
- unAnnotateST :: SimpleDocTree ann -> SimpleDocTree xxx
- reAnnotateST :: (ann -> ann') -> SimpleDocTree ann -> SimpleDocTree ann'
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.
Constructors
| STEmpty | |
| STChar Char | |
| STText !Int Text | |
| STLine !Int | |
| STAnn ann (SimpleDocTree ann) | |
| STConcat [SimpleDocTree ann] |
Instances
| Eq ann => Eq (SimpleDocTree ann) Source # | |
| Ord ann => Ord (SimpleDocTree ann) Source # | |
| Show ann => Show (SimpleDocTree ann) Source # | |
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.