Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- showTree :: (Show Key, Show a) => Map a -> String
- showTreeWith :: (Key -> a -> String) -> Bool -> Bool -> Map a -> String
- showsTree :: (Key -> a -> String) -> Bool -> [String] -> [String] -> Map a -> ShowS
- showsTreeHang :: (Key -> a -> String) -> Bool -> [String] -> Map a -> ShowS
- showWide :: Bool -> [String] -> String -> String
- showsBars :: [String] -> ShowS
- node :: String
- withBar :: [String] -> [String]
- withEmpty :: [String] -> [String]
- valid :: Map a -> Bool
- ordered :: Map b -> Bool
- balanced :: Map a -> Bool
- validsize :: Map b -> Bool
Documentation
showTree :: (Show Key, Show a) => Map a -> String #
O(n). Show the tree that implements the map. The tree is shown
in a compressed, hanging format. See showTreeWith
.
showTreeWith :: (Key -> a -> String) -> Bool -> Bool -> Map a -> String #
O(n). The expression (
) shows
the tree that implements the map. Elements are shown using the showTreeWith
showelem hang wide mapshowElem
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,())
O(n). Test if the internal map structure is valid.
valid (fromAscList [(3,"b"), (5,"a")]) == True valid (fromAscList [(5,"a"), (3,"b")]) == False