| Copyright | (c) 2020 Arnau Abella Dmitrii Kovanikov |
|---|---|
| License | MIT (see the file LECENSE) |
| Maintainer | Arnau Abella arnauabell@gmail.com |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
RBST.Pretty
Description
RBST visualization.
prettyPrint was copied from treap package wrote by Dmitrii Kovanikov.
Printing
Pretty printing
pretty :: (Show k, Show a) => RBST k a -> String Source #
Pretty 2-dimensional ASCII drawing of a RBST.
See prettyPrint for an example.
prettyPrint :: (Show k, Show a) => RBST k a -> IO () Source #
Call pretty function and output the result directly to stdout.
>>>let tree = (fromList $ zip ['a'..'e'] [1..5]) :: RBST Char Int>>>prettyPrint tree('d',4) [5] ╱╲ ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ('b',2) [3] ('e',5) [1] ╱╲ ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲ ('a',1) [1] ('c',3) [1]