Revision 497e30a1 Ganeti/HTools/Types.hs

b/Ganeti/HTools/Types.hs
39 39
    (>>=) (Ok x) fn = fn x
40 40
    return = Ok
41 41
    fail = Bad
42

  
43
-- | A generic class for nodes and instances
44
class Element a where
45
    name    :: a -> String
46
    idx     :: a -> Int
47
    setName :: a -> String -> a
48
    setIdx  :: a -> Int -> a
49

  
50
-- Let's make nodes elements of the cluster
51
instance Element Node.Node where
52
    name = Node.name
53
    idx = Node.idx
54
    setName = Node.setName
55
    setIdx = Node.setIdx
56

  
57
-- And instances too
58
instance Element Instance.Instance where
59
    name = Instance.name
60
    idx = Instance.idx
61
    setName = Instance.setName
62
    setIdx = Instance.setIdx

Also available in: Unified diff