Commit 1b0a6356 authored by Iustin Pop's avatar Iustin Pop
Browse files

htools: a few more hlint fixes



Tested only on GHC 7.x, will test on 6.1x too before commit.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 179c0828
......@@ -250,7 +250,7 @@ oGroup = Option "G" ["group"]
oIDisk :: OptType
oIDisk = Option "" ["disk"]
(ReqArg (\ d opts -> do
dsk <- annotateResult ("--disk option") (parseUnit d)
dsk <- annotateResult "--disk option" (parseUnit d)
let ospec = optISpec opts
nspec = ospec { rspecDsk = dsk }
return $ opts { optISpec = nspec }) "DISK")
......@@ -259,7 +259,7 @@ oIDisk = Option "" ["disk"]
oIMem :: OptType
oIMem = Option "" ["memory"]
(ReqArg (\ m opts -> do
mem <- annotateResult ("--memory option") (parseUnit m)
mem <- annotateResult "--memory option" (parseUnit m)
let ospec = optISpec opts
nspec = ospec { rspecMem = mem }
return $ opts { optISpec = nspec }) "MEMORY")
......
......@@ -994,7 +994,7 @@ evacDrbdSecondaryInner nl inst gdx accu ndx =
-- The fromJust below is ugly (it can fail nastily), but
-- at this point we should have any internal mismatches,
-- and adding a monad here would be quite involved
grpnodes = fromJust (gdx `lookup` (Node.computeGroups nodes))
grpnodes = fromJust (gdx `lookup` Node.computeGroups nodes)
new_cv = compCVNodes grpnodes
new_accu = Right (nl', inst', new_cv, ndx)
in case accu of
......
......@@ -188,7 +188,7 @@ parseData body = do
return $ NodeEvacuate rl_idx rl_mode
| otherwise -> fail ("Invalid request type '" ++ optype ++ "'")
return $ (msgs, Request rqtype cdata)
return (msgs, Request rqtype cdata)
-- | Formats the result into a valid IAllocator response message.
formatResponse :: Bool -- ^ Whether the request was successful
......@@ -215,7 +215,7 @@ formatAllocate il as = do
(nl, inst, nodes, _):[] ->
do
let il' = Container.add (Instance.idx inst) inst il
return (info, showJSON $ map (Node.name) nodes, nl, il')
return (info, showJSON $ map Node.name nodes, nl, il')
_ -> fail "Internal error: multiple allocation solutions"
-- | Convert a node-evacuation/change group result.
......
......@@ -288,7 +288,7 @@ mergeData um extags selinsts exinsts cdata@(ClusterData _ nl il2 tags) =
il4 = Container.map (filterExTags allextags .
updateMovable selinst_names exinst_names) il3
nl2 = foldl' fixNodes nl (Container.elems il4)
nl3 = Container.map (flip Node.buildPeers il4) nl2
nl3 = Container.map (`Node.buildPeers` il4) nl2
node_names = map Node.name (Container.elems nl)
common_suffix = longestDomain (node_names ++ inst_names)
snl = Container.map (computeAlias common_suffix) nl3
......
......@@ -273,7 +273,7 @@ main = do
exitWith ExitSuccess
let split_insts = Cluster.findSplitInstances nlf ilf
when (not . null $ split_insts) $ do
unless (null split_insts) $ do
hPutStrLn stderr "Found instances belonging to multiple node groups:"
mapM_ (\i -> hPutStrLn stderr $ " " ++ Instance.name i) split_insts
hPutStrLn stderr "Aborting."
......
......@@ -95,7 +95,7 @@ specDescription SpecTiered = "Tiered (initial size)"
-- | Efficiency generic function.
effFn :: (Cluster.CStats -> Integer)
-> (Cluster.CStats -> Double)
-> (Cluster.CStats -> Double)
-> Cluster.CStats -> Double
effFn fi ft cs = fromIntegral (fi cs) / ft cs
-- | Memory efficiency.
......@@ -271,7 +271,7 @@ printAllocationMap verbose msg nl ixes =
[False, False, False, True, True, True]
-- | Formats nicely a list of resources.
formatResources :: a -> [(String, (a->String))] -> String
formatResources :: a -> [(String, a->String)] -> String
formatResources res =
intercalate ", " . map (\(a, fn) -> a ++ " " ++ fn res)
......@@ -298,7 +298,7 @@ printISpec True ispec spec disk_template = do
where req_nodes = Instance.requiredNodes disk_template
prefix = specPrefix spec
printISpec False ispec spec disk_template = do
printISpec False ispec spec disk_template =
printf "%s instance spec is:\n %s, using disk\
\ template '%s'.\n"
(specDescription spec)
......
......@@ -350,7 +350,7 @@ prop_Utils_parseUnit (NonNegative n) =
Utils.parseUnit (show n ++ "g") == Types.Ok (n*1024) &&
Utils.parseUnit (show n ++ "t") == Types.Ok (n*1048576) &&
Types.isBad (Utils.parseUnit (show n ++ "x")::Types.Result Int)
where _types = (n::Int)
where _types = n::Int
-- | Test list for the Utils module.
testUtils =
......@@ -591,8 +591,8 @@ prop_Text_Load_Instance name mem dsk vcpus status
case inst of
Types.Bad msg -> printTestCase ("Failed to load instance: " ++ msg)
False
Types.Ok (_, i) -> printTestCase ("Mismatch in some field while\
\ loading the instance") $
Types.Ok (_, i) -> printTestCase "Mismatch in some field while\
\ loading the instance" $
Instance.name i == name &&
Instance.vcpus i == vcpus &&
Instance.mem i == mem &&
......@@ -734,8 +734,8 @@ prop_Node_rMem inst =
inst_idx = Instance.idx inst_ab
node_add_ab = Node.addSec node inst_ab (-1)
node_add_nb = Node.addSec node inst_nb (-1)
node_del_ab = liftM (flip Node.removeSec inst_ab) node_add_ab
node_del_nb = liftM (flip Node.removeSec inst_nb) node_add_nb
node_del_ab = liftM (`Node.removeSec` inst_ab) node_add_ab
node_del_nb = liftM (`Node.removeSec` inst_nb) node_add_nb
in case (node_add_ab, node_add_nb, node_del_ab, node_del_nb) of
(Types.OpGood a_ab, Types.OpGood a_nb,
Types.OpGood d_ab, Types.OpGood d_nb) ->
......
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