Revision c6484f0b

b/Ganeti/HTools/Container.hs
71 71
find :: Key -> Container a -> a
72 72
find k c = c IntMap.! k
73 73

  
74
-- | Locate a keyin the map returning a default value if not existing.
75
findWithDefault :: a -> Key -> Container a -> a
76
findWithDefault = IntMap.findWithDefault
77

  
78 74
-- | Add or update one element to the map.
79 75
add :: Key -> a -> Container a -> Container a
80 76
add k v c = IntMap.insert k v c
......
95 91
fromAssocList :: [(Key, a)] -> Container a
96 92
fromAssocList = IntMap.fromList
97 93

  
98
-- | Create a map from an association list with a combining function.
99
fromListWith :: (a -> a -> a) -> [(Key, a)] -> Container a
100
fromListWith = IntMap.fromListWith
101

  
102
-- | Fold over the values of the map.
103
fold :: (a -> b -> b) -> b -> Container a -> b
104
fold = IntMap.fold
105

  
106 94
-- | Add or update two elements of the map.
107 95
addTwo :: Key -> a -> Key -> a -> Container a -> Container a
108 96
addTwo k1 v1 k2 v2 c = add k1 v1 $ add k2 v2 c
b/Ganeti/HTools/Utils.hs
38 38

  
39 39
import Data.List
40 40
import Control.Monad
41
import System
42
import System.IO
43 41
import qualified Text.JSON as J
44 42
import Text.Printf (printf)
45 43

  
46
import Ganeti.HTools.Types
47

  
48 44
import Debug.Trace
49 45

  
50 46
-- * Debug functions
......
69 65
    where (x, xs) = break (== sep) s
70 66
          ys = drop 1 xs
71 67

  
72
-- | Partial application of sepSplit to @'.'@
73
commaSplit :: String -> [String]
74
commaSplit = sepSplit ','
75

  
76 68
-- | Simple version of 'fst' for a triple
77 69
fst3 :: (a, b, c) -> a
78 70
fst3 (a, _, _) = a
b/hail.hs
36 36

  
37 37
import Text.Printf (printf)
38 38

  
39
import qualified Ganeti.HTools.Container as Container
40 39
import qualified Ganeti.HTools.Cluster as Cluster
41 40
import qualified Ganeti.HTools.Node as Node
42 41
import qualified Ganeti.HTools.Instance as Instance
b/hspace.hs
27 27

  
28 28
import Data.List
29 29
import Data.Function
30
import Data.Maybe (isJust, fromJust, fromMaybe, isNothing)
30
import Data.Maybe (isJust, fromJust, isNothing)
31 31
import Monad
32 32
import System
33 33
import System.IO

Also available in: Unified diff