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
-- | 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
-- | 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
-- | 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
-- | 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 ++ "'"
-- | 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