Revision d85a0a0f Ganeti/HTools/Utils.hs

b/Ganeti/HTools/Utils.hs
5 5
      debug
6 6
    , sepSplit
7 7
    , varianceCoeff
8
    , readData
9 8
    , commaJoin
10 9
    , readEitherString
11 10
    , loadJSArray
......
73 72
varianceCoeff :: Floating a => [a] -> a
74 73
varianceCoeff lst = (stdDev lst) / (fromIntegral $ length lst)
75 74

  
76
-- | Get an Ok result or print the error and exit.
77
readData :: Result a -> IO a
78
readData nd =
79
    (case nd of
80
       Bad x -> do
81
         putStrLn x
82
         exitWith $ ExitFailure 1
83
       Ok x -> return x)
84

  
85 75
-- * JSON-related functions
86 76

  
87 77
-- | Converts a JSON Result into a monadic value.

Also available in: Unified diff