fixplate-0.1.7: Uniplate-style generic traversals for optionally annotated fixed-point types.

Safe HaskellSafe
LanguageHaskell2010

Data.Generics.Fixplate.Draw

Contents

Description

Generic ascii art / graphviz drawing of trees.

Suggestions for drawing styles are welcome.

TODO:

  • make the style customizable
  • the same for graphviz

Synopsis

Default tree drawing, using Show instancess

drawTree :: (Functor f, Foldable f, ShowF f) => Mu f -> IO () Source #

Prints a tree. It is defined simply as

drawTree = putStrLn . showTree

showTree :: (Functor f, Foldable f, ShowF f) => Mu f -> String Source #

Creates a string representation which can be printed with putStrLn.

graphvizTree :: (Traversable f, ShowF f) => Mu f -> String Source #

Generate a graphviz .dot file

Customizable tree drawing

drawTreeWith :: (Functor f, Foldable f) => (f Hole -> String) -> Mu f -> IO () Source #

showTreeWith :: (Functor f, Foldable f) => (f Hole -> String) -> Mu f -> String Source #