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

Safe HaskellSafe-Infered

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 -> StringSource

Creates a string representation which can be printed with putStrLn.

graphvizTree :: (Traversable f, ShowF f) => Mu f -> StringSource

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 -> StringSource