Revision 885759da
b/src/Ganeti/HTools/Program/Hspace.hs | ||
---|---|---|
385 | 385 |
|
386 | 386 |
-- | Sorts the failure reasons. |
387 | 387 |
sortReasons :: [(FailMode, Int)] -> [(FailMode, Int)] |
388 |
sortReasons = reverse . sortBy (comparing snd)
|
|
388 |
sortReasons = sortBy (flip (comparing snd))
|
|
389 | 389 |
|
390 | 390 |
-- | Runs an allocation algorithm and saves cluster state. |
391 | 391 |
runAllocation :: ClusterData -- ^ Cluster data |
b/src/Ganeti/Monitoring/Server.hs | ||
---|---|---|
211 | 211 |
-- | Return the report of one collector. |
212 | 212 |
oneReport :: MVar CollectorMap -> Snap () |
213 | 213 |
oneReport mvar = do |
214 |
categoryName <- fmap (maybe mzero unpack) $ getParam "category"
|
|
215 |
collectorName <- fmap (maybe mzero unpack) $ getParam "collector"
|
|
214 |
categoryName <- maybe mzero unpack <$> getParam "category"
|
|
215 |
collectorName <- maybe mzero unpack <$> getParam "collector"
|
|
216 | 216 |
category <- |
217 | 217 |
case catFromName categoryName of |
218 | 218 |
BT.Ok cat -> return cat |
b/src/Ganeti/THH/Types.hs | ||
---|---|---|
35 | 35 |
) where |
36 | 36 |
|
37 | 37 |
import Control.Arrow (first) |
38 |
import Control.Monad (liftM) |
|
38 |
import Control.Monad (liftM, replicateM)
|
|
39 | 39 |
import Language.Haskell.TH |
40 | 40 |
import qualified Text.JSON as J |
41 | 41 |
|
... | ... | |
89 | 89 |
uncurryN 1 = [| (. getOneTuple) |] |
90 | 90 |
uncurryN n = do |
91 | 91 |
f <- newName "f" |
92 |
ps <- mapM newName (replicate n "x")
|
|
92 |
ps <- replicateM n (newName "x")
|
|
93 | 93 |
return $ LamE [VarP f, TupP $ map VarP ps] |
94 | 94 |
(foldl AppE (VarE f) $ map VarE ps) |
95 | 95 |
|
b/test/hs/Test/Ganeti/HTools/Instance.hs | ||
---|---|---|
35 | 35 |
, Instance.Instance(..) |
36 | 36 |
) where |
37 | 37 |
|
38 |
import Control.Arrow ((&&&)) |
|
38 | 39 |
import Control.Monad (liftM) |
40 |
import Data.Functor ((<$>)) |
|
39 | 41 |
import Test.QuickCheck hiding (Result) |
40 | 42 |
|
41 | 43 |
import Test.Ganeti.TestHelper |
... | ... | |
112 | 114 |
genInstanceList :: Gen Instance.Instance -> Gen Instance.List |
113 | 115 |
genInstanceList igen = fmap (snd . Loader.assignIndices) names_instances |
114 | 116 |
where names_instances = |
115 |
(fmap . map) (\n -> (Instance.name n, n)) $ listOf igen
|
|
117 |
map (Instance.name &&& id) <$> listOf igen
|
|
116 | 118 |
|
117 | 119 |
-- let's generate a random instance |
118 | 120 |
instance Arbitrary Instance.Instance where |
Also available in: Unified diff