Revision 9188aeef Ganeti/HTools/Container.hs
b/Ganeti/HTools/Container.hs | ||
---|---|---|
86 | 86 |
addTwo :: Key -> a -> Key -> a -> Container a -> Container a |
87 | 87 |
addTwo k1 v1 k2 v2 c = add k1 v1 $ add k2 v2 c |
88 | 88 |
|
89 |
-- | Compute the name of an element in a container |
|
89 |
-- | Compute the name of an element in a container.
|
|
90 | 90 |
nameOf :: (T.Element a) => Container a -> Key -> String |
91 | 91 |
nameOf c k = T.nameOf $ find k c |
92 | 92 |
|
93 |
-- | Compute the maximum name length in an Element Container |
|
93 |
-- | Compute the maximum name length in an Element Container.
|
|
94 | 94 |
maxNameLen :: (T.Element a) => Container a -> Int |
95 | 95 |
maxNameLen = maximum . map (length . T.nameOf) . elems |
96 | 96 |
|
97 |
-- | Find an element by name in a Container; this is a very slow function |
|
97 |
-- | Find an element by name in a Container; this is a very slow function.
|
|
98 | 98 |
findByName :: (T.Element a, Monad m) => |
99 | 99 |
Container a -> String -> m Key |
100 | 100 |
findByName c n = |
Also available in: Unified diff