Safe Haskell | Safe |
---|---|

Language | Haskell98 |

## Synopsis

- showTree :: (Show k, Show a) => Map k a -> String
- showTreeWith :: (k -> a -> String) -> Bool -> Bool -> Map k a -> String
- showsTree :: (k -> a -> String) -> Bool -> [String] -> [String] -> Map k a -> ShowS
- showsTreeHang :: (k -> a -> String) -> Bool -> [String] -> Map k a -> ShowS
- showWide :: Bool -> [String] -> String -> String
- showsBars :: [String] -> ShowS
- node :: String
- withBar :: [String] -> [String]
- withEmpty :: [String] -> [String]
- valid :: Ord k => Map k a -> Bool
- ordered :: Ord a => Map a b -> Bool
- balanced :: Map k a -> Bool
- validsize :: Map a b -> Bool

# Documentation

showTree :: (Show k, Show a) => Map k a -> String Source #

*O(n)*. Show the tree that implements the map. The tree is shown
in a compressed, hanging format. See `showTreeWith`

.

showTreeWith :: (k -> a -> String) -> Bool -> Bool -> Map k a -> String Source #

*O(n)*. The expression (

) shows
the tree that implements the map. Elements are shown using the `showTreeWith`

showelem hang wide map`showElem`

function. If `hang`

is
`True`

, a *hanging* tree is shown otherwise a rotated tree is shown. If
`wide`

is `True`

, an extra wide version is shown.

Map> let t = fromDistinctAscList [(x,()) | x <- [1..5]] Map> putStrLn $ showTreeWith (\k x -> show (k,x)) True False t (4,()) +--(2,()) | +--(1,()) | +--(3,()) +--(5,()) Map> putStrLn $ showTreeWith (\k x -> show (k,x)) True True t (4,()) | +--(2,()) | | | +--(1,()) | | | +--(3,()) | +--(5,()) Map> putStrLn $ showTreeWith (\k x -> show (k,x)) False True t +--(5,()) | (4,()) | | +--(3,()) | | +--(2,()) | +--(1,())