LGTM

Thanks,

Guido

(maybe abstracting the generation of the error message would help
making it more readable?)

On Tue, Mar 6, 2012 at 11:59 PM, Iustin Pop <[email protected]> wrote:
> 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
>



-- 
Guido Trotter
Google - Corporate Computing Services SRE

Google Ireland Ltd. : Registered in Ireland with company number 368047.
Gordon House, Barrow Street, Dublin 4, Ireland.

Reply via email to