On 12/01/2014 09:43 PM, Klaus Aehlig wrote:
From: Niklas Hambuechen <[email protected]>
Our current hlint version cannot find them yet.
Signed-off-by: Niklas Hambuechen <[email protected]>
Reviewed-by: Klaus Aehlig <[email protected]>
Cherry-picked from: d05f1c86fcca
Conflicts:
src/Ganeti/Utils.hs (trivial)
Signed-off-by: Klaus Aehlig <[email protected]>
---
src/Ganeti/HTools/Program/Hroller.hs | 2 +-
src/Ganeti/Hypervisor/Xen/Types.hs | 6 +++---
src/Ganeti/Utils.hs | 4 ++--
test/hs/Test/Ganeti/Hypervisor/Xen/XmParser.hs | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/Ganeti/HTools/Program/Hroller.hs
b/src/Ganeti/HTools/Program/Hroller.hs
index b4cdde3..74730ed 100644
--- a/src/Ganeti/HTools/Program/Hroller.hs
+++ b/src/Ganeti/HTools/Program/Hroller.hs
@@ -409,7 +409,7 @@ main opts args = do
sortBy (flip compare `on` length . fst) $
nodesRebootGroups
confToMoveNames =
- map (Instance.name *** (Node.name *** flip (>>=) (return . Node.name)))
+ map (Instance.name *** (Node.name *** (=<<) (return . Node.name)))
. getMoves (nlf, ilf)
namesAndMoves = map (map Node.name *** confToMoveNames)
outputRebootGroups
diff --git a/src/Ganeti/Hypervisor/Xen/Types.hs
b/src/Ganeti/Hypervisor/Xen/Types.hs
index 7026a1d..704eea2 100644
--- a/src/Ganeti/Hypervisor/Xen/Types.hs
+++ b/src/Ganeti/Hypervisor/Xen/Types.hs
@@ -66,7 +66,7 @@ class FromLispConfig a where
-- | Instance of FromLispConfig for Int.
instance FromLispConfig Int where
fromLispConfig (LCDouble d) = Ok $ floor d
- fromLispConfig (LCList (LCString _:LCDouble d:[])) = Ok $ floor d
+ fromLispConfig (LCList [LCString _, LCDouble d]) = Ok $ floor d
fromLispConfig c =
Bad $ "Unable to extract a Int from this configuration: "
++ show c
@@ -74,7 +74,7 @@ instance FromLispConfig Int where
-- | Instance of FromLispConfig for Double.
instance FromLispConfig Double where
fromLispConfig (LCDouble d) = Ok d
- fromLispConfig (LCList (LCString _:LCDouble d:[])) = Ok d
+ fromLispConfig (LCList [LCString _, LCDouble d]) = Ok d
fromLispConfig c =
Bad $ "Unable to extract a Double from this configuration: "
++ show c
@@ -82,7 +82,7 @@ instance FromLispConfig Double where
-- | Instance of FromLispConfig for String
instance FromLispConfig String where
fromLispConfig (LCString s) = Ok s
- fromLispConfig (LCList (LCString _:LCString s:[])) = Ok s
+ fromLispConfig (LCList [LCString _, LCString s]) = Ok s
fromLispConfig c =
Bad $ "Unable to extract a String from this configuration: "
++ show c
diff --git a/src/Ganeti/Utils.hs b/src/Ganeti/Utils.hs
index 31f4906..bf0708e 100644
--- a/src/Ganeti/Utils.hs
+++ b/src/Ganeti/Utils.hs
@@ -221,8 +221,8 @@ if' _ _ y = y
-- | Parse results from readsPrec.
parseChoices :: (Monad m, Read a) => String -> String -> [(a, String)] -> m a
-parseChoices _ _ ((v, ""):[]) = return v
-parseChoices name s ((_, e):[]) =
+parseChoices _ _ [(v, "")] = return v
+parseChoices name s [(_, e)] =
fail $ name ++ ": leftover characters when parsing '"
++ s ++ "': '" ++ e ++ "'"
parseChoices name s _ = fail $ name ++ ": cannot parse string '" ++ s ++ "'"
diff --git a/test/hs/Test/Ganeti/Hypervisor/Xen/XmParser.hs
b/test/hs/Test/Ganeti/Hypervisor/Xen/XmParser.hs
index 602e2da..6eb20cc 100644
--- a/test/hs/Test/Ganeti/Hypervisor/Xen/XmParser.hs
+++ b/test/hs/Test/Ganeti/Hypervisor/Xen/XmParser.hs
@@ -86,7 +86,7 @@ instance Arbitrary LispConfig where
-- | Determines conservatively whether a string could be a number.
canBeNumber :: String -> Bool
canBeNumber [] = False
-canBeNumber (c:[]) = canBeNumberChar c
+canBeNumber [c] = canBeNumberChar c
canBeNumber (c:xs) = canBeNumberChar c && canBeNumber xs
-- | Determines whether a char can be part of the string representation of a
LGTM
--
Niklas Hambüchen
Google Germany GmbH, Dienerstr. 12, 80331 Muenchen
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschaeftsfuehrer: Graham Law, Christine Elizabeth Flores