Instead of manually case-ing on the Either contents, let's just use
either with const functions (not really readable, but…).
---
 htools/Ganeti/HTools/Cluster.hs |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/htools/Ganeti/HTools/Cluster.hs b/htools/Ganeti/HTools/Cluster.hs
index 11b7cae..a8acd2c 100644
--- a/htools/Ganeti/HTools/Cluster.hs
+++ b/htools/Ganeti/HTools/Cluster.hs
@@ -999,11 +999,8 @@ evacOneNodeInner :: Node.List         -- ^ Cluster node 
list
                  -> EvacInnerState    -- ^ New best solution
 evacOneNodeInner nl inst gdx op_fn accu ndx =
   case applyMove nl inst (op_fn ndx) of
-    OpFail fm ->
-      case accu of
-        Right _ -> accu
-        Left _ -> Left $ "Node " ++ Container.nameOf nl ndx ++
-                  " failed: " ++ show fm
+    OpFail fm -> either (const $ Left $ "Node " ++ Container.nameOf nl ndx ++
+                         " failed: " ++ show fm) (const accu) accu
     OpGood (nl', inst', _, _) ->
       let nodes = Container.elems nl'
           -- The fromJust below is ugly (it can fail nastily), but
-- 
1.7.9.1

Reply via email to