W3cubDocs

/Haskell 8

Data.Map.Internal.Debug

Safe Haskell Safe
Language Haskell98

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 (showTreeWith showelem hang wide map) shows the tree that implements the map. Elements are shown using the 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,())

showsTree :: (k -> a -> String) -> Bool -> [String] -> [String] -> Map k a -> ShowS Source

showsTreeHang :: (k -> a -> String) -> Bool -> [String] -> Map k a -> ShowS Source

showWide :: Bool -> [String] -> String -> String Source

showsBars :: [String] -> ShowS Source

node :: String Source

withBar :: [String] -> [String] Source

withEmpty :: [String] -> [String] Source

valid :: Ord k => Map k a -> Bool Source

O(n). Test if the internal map structure is valid.

valid (fromAscList [(3,"b"), (5,"a")]) == True
valid (fromAscList [(5,"a"), (3,"b")]) == False

ordered :: Ord a => Map a b -> Bool Source

Test if the keys are ordered correctly.

balanced :: Map k a -> Bool Source

Test if a map obeys the balance invariants.

validsize :: Map a b -> Bool Source

Test if each node of a map reports its size correctly.

© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/8.6.1/docs/html/libraries/containers-0.6.0.1/Data-Map-Internal-Debug.html