Commit 4333a887 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add some utility functions for kt deprecation

These will be used to remove even more uses of ktn/kti in non-critical
paths.
parent dbd6700b
...@@ -9,6 +9,7 @@ module Ganeti.HTools.Container ...@@ -9,6 +9,7 @@ module Ganeti.HTools.Container
( (
-- * Types -- * Types
Container Container
, Key
-- * Creation -- * Creation
, empty , empty
, fromAssocList , fromAssocList
......
...@@ -60,3 +60,11 @@ instance Element Instance.Instance where ...@@ -60,3 +60,11 @@ instance Element Instance.Instance where
idx = Instance.idx idx = Instance.idx
setName = Instance.setName setName = Instance.setName
setIdx = Instance.setIdx setIdx = Instance.setIdx
-- | Compute the name of an element in a container
cNameOf :: (Element a) => Container.Container a -> Container.Key -> String
cNameOf c k = name $ Container.find k c
-- | Compute the maximum name length in an Element Container
cMaxNamelen :: (Element a) => Container.Container a -> Int
cMaxNamelen = maximum . map (length . name) . Container.elems
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment