-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Configurable text rendering of trees. -- -- Configurable text rendering of trees. @package tree-render-text @version 0.1.1.0 -- | Configurable text rendering of trees. -- -- Example renderings for: -- --
-- import Data.Tree -- -- tree :: Tree String -- tree = -- Node "Add" -- [ Node "Add" -- [ Node "0" [] -- , Node "Mul" -- [ Node "1" [] -- , Node "2" [] -- ] -- ] -- , Node "Neg" -- [ Node "Max" -- [ Node "3" [] -- , Node "4" [] -- , Node "5" [] -- , Node "Var" -- [ Node "x" [] -- ] -- , Node "6" [] -- ] -- ] -- ] -- -- renderTree (tracedRenderOptions id) tree -- -- ● Add -- ├─● Add -- │ ├─● 0 -- │ ╰─● Mul -- │ ├─● 1 -- │ ╰─● 2 -- ╰─● Neg -- ╰─● Max -- ├─● 3 -- ├─● 4 -- ├─● 5 -- ├─● Var -- │ ╰─● x -- ╰─● 6 -- -- Other renderings by setting 'ParentLocation' and 'ChildOrder' in the options: -- -- ╭─● 0 ╭─● 0 ● Add ╭─● 6 ╭─● 6 -- │ ╭─● 1 ╭─● Add ├─● Neg │ ╭─● x │ ╭─● x -- │ ├─● 2 │ │ ╭─● 1 │ ╰─● Max ├─● Var ├─● Var -- ├─● Mul │ ╰─● Mul │ ├─● 6 ├─● 5 ├─● 5 -- ╭─● Add │ ╰─● 2 │ ├─● Var ├─● 4 ╭─● Max -- │ ╭─● 3 ● Add │ │ ╰─● x ├─● 3 │ ├─● 4 -- │ ├─● 4 ╰─● Neg │ ├─● 5 ╭─● Max │ ╰─● 3 -- │ ├─● 5 │ ╭─● 3 │ ├─● 4 ╭─● Neg ╭─● Neg -- │ │ ╭─● x │ ├─● 4 │ ╰─● 3 │ ╭─● 2 ● Add -- │ ├─● Var ╰─● Max ╰─● Add │ ├─● 1 │ ╭─● 2 -- │ ├─● 6 ├─● 5 ├─● Mul │ ╭─● Mul │ ╭─● Mul -- │ ╭─● Max ├─● Var │ ├─● 2 │ ├─● 0 │ │ ╰─● 1 -- ├─● Neg │ ╰─● x │ ╰─● 1 ├─● Add ╰─● Add -- ● Add ╰─● 6 ╰─● 0 ● Add ╰─● 0 --module Data.Tree.Render.Text -- | Describes where a parent node is rendered, relative to its children. data ParentLocation ParentBeforeChildren :: ParentLocation ParentAfterChildren :: ParentLocation ParentBetweenChildren :: ParentLocation -- | Describes the render order of a node's children. data ChildOrder FirstToLast :: ChildOrder LastToFirst :: ChildOrder -- | A part of a path along a rendered tree. data BranchPath -- | Describes a turn going up toward the left. -- -- e.g. "╭─" BranchUp :: BranchPath -- | Describes a turn going down toward the left. -- -- e.g. "╰─" BranchDown :: BranchPath -- | Describes a T-join of a path going up and down toward the left. -- -- e.g. "├─" BranchJoin :: BranchPath -- | Describes a path going up and down. -- -- e.g. "│ " BranchContinue :: BranchPath -- | Describes a part that does NOT contain a path piece. -- -- e.g. " " BranchEmpty :: BranchPath -- | Renders a pretty printed Tree within a monadic context. renderTreeM :: Monad m => RenderOptionsM m string label -> Tree label -> m () -- | Renders a pretty printed Forest within a monadic context. renderForestM :: Monad m => RenderOptionsM m string label -> Forest label -> m () -- | Options used for rendering a 'Tree label'. data RenderOptionsM m string label RenderOptions :: ParentLocation -> ChildOrder -> Int -> Bool -> (String -> string) -> (string -> m ()) -> (label -> string) -> (label -> string) -> string -> (BranchPath -> string) -> RenderOptionsM m string label -- | Controls where parent nodes are rendered. [oParentLocation] :: RenderOptionsM m string label -> ParentLocation -- | Controls the order a node's children are rendered. [oChildOrder] :: RenderOptionsM m string label -> ChildOrder -- | The amount of vertical spacing between nodes. [oVerticalPad] :: RenderOptionsM m string label -> Int -- | If True, a newline is prepended to the rendered output. [oPrependNewLine] :: RenderOptionsM m string label -> Bool -- | Promotes a String to a string. [oFromString] :: RenderOptionsM m string label -> String -> string -- | Writes a string. [oWrite] :: RenderOptionsM m string label -> string -> m () -- | Shows a rootLabel. [oShowNodeLabel] :: RenderOptionsM m string label -> label -> string -- | Get the marker for a node. Although this takes as input a node's -- label, this should not render the label itself. -- -- The label is passed as an argument to allow things such as: -- --
-- BranchUp -> "╭─" -- BranchDown -> "╰─" -- BranchJoin -> "├─" -- BranchContinue -> "│ " -- BranchEmpty -> " " --tracedRenderOptionsM :: (String -> string) -> (string -> m ()) -> (label -> string) -> RenderOptionsM m string label -- | Options for producing a line-traced tree using ASCII characters. -- -- This uses: -- --
-- BranchUp -> ",-" -- BranchDown -> "`-" -- BranchJoin -> "|-" -- BranchContinue -> "| " -- BranchEmpty -> " " --tracedRenderOptionsAsciiM :: (String -> string) -> (string -> m ()) -> (label -> string) -> RenderOptionsM m string label -- | Renders a Tree a pretty printed tree as a String. renderTree :: RenderOptions String label -> Tree label -> String -- | Renders a Forest a pretty printed tree as a String. renderForest :: RenderOptions String label -> Forest label -> String -- | An alias of RenderOptionsM for producing pure String -- renders. type RenderOptions = RenderOptionsM (Writer (DList Char)) -- | Simplified tracedRenderOptionsM when using -- RenderOptionsM. tracedRenderOptions :: (label -> String) -> RenderOptions String label -- | Simplified tracedRenderOptionsAsciiM when using -- RenderOptionsM. tracedRenderOptionsAscii :: (label -> String) -> RenderOptions String label instance GHC.Classes.Ord Data.Tree.Render.Text.BranchPath instance GHC.Classes.Eq Data.Tree.Render.Text.BranchPath instance GHC.Show.Show Data.Tree.Render.Text.BranchPath instance GHC.Classes.Ord Data.Tree.Render.Text.ChildOrder instance GHC.Classes.Eq Data.Tree.Render.Text.ChildOrder instance GHC.Show.Show Data.Tree.Render.Text.ChildOrder instance GHC.Classes.Ord Data.Tree.Render.Text.ParentLocation instance GHC.Classes.Eq Data.Tree.Render.Text.ParentLocation instance GHC.Show.Show Data.Tree.Render.Text.ParentLocation