From 86aa9ba32f810956948ff4e578c828351998a82c Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Tue, 18 Dec 2012 15:49:04 +0100 Subject: [PATCH] Remove two hlint overrides "Use comparing" was not needed, and "Use on" can be solved by actually using on in the single case we have (the patch also reorders imports in that file). Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- Makefile.am | 4 +--- htools/Ganeti/HTools/Node.hs | 11 ++++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Makefile.am b/Makefile.am index 713abd8e8..2f95d16eb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1594,11 +1594,9 @@ hlint: $(HS_BUILT_SRCS) htools/lint-hints.hs if tty -s; then C="-c"; else C=""; fi; \ $(HLINT) --utf8 --report=doc/hs-lint.html --cross $$C \ --ignore "Use first" \ - --ignore "Use comparing" \ - --ignore "Use on" \ - --ignore "Reduce duplication" \ --ignore "Use &&&" \ --ignore "Use void" \ + --ignore "Reduce duplication" \ --hint htools/lint-hints \ $(filter-out $(HLINT_EXCLUDES),$(HS_LIBTEST_SRCS) $(HS_PROG_SRCS)) diff --git a/htools/Ganeti/HTools/Node.hs b/htools/Ganeti/HTools/Node.hs index 24534556d..eff4fb515 100644 --- a/htools/Ganeti/HTools/Node.hs +++ b/htools/Ganeti/HTools/Node.hs @@ -73,14 +73,15 @@ module Ganeti.HTools.Node , mkNodeGraph ) where -import Data.List hiding (group) -import qualified Data.Map as Map +import Control.Monad (liftM, liftM2) import qualified Data.Foldable as Foldable -import qualified Data.IntMap as IntMap +import Data.Function (on) import qualified Data.Graph as Graph +import qualified Data.IntMap as IntMap +import Data.List hiding (group) +import qualified Data.Map as Map import Data.Ord (comparing) import Text.Printf (printf) -import Control.Monad (liftM, liftM2) import qualified Ganeti.HTools.Container as Container import qualified Ganeti.HTools.Instance as Instance @@ -683,5 +684,5 @@ defaultFields = computeGroups :: [Node] -> [(T.Gdx, [Node])] computeGroups nodes = let nodes' = sortBy (comparing group) nodes - nodes'' = groupBy (\a b -> group a == group b) nodes' + nodes'' = groupBy ((==) `on` group) nodes' in map (\nl -> (group (head nl), nl)) nodes'' -- GitLab