On Tue, Sep 27, 2011 at 4:16 PM, Iustin Pop <[email protected]> wrote: > On Tue, Sep 27, 2011 at 04:14:00PM +0200, Agata Murawska wrote: >> On Mon, Sep 26, 2011 at 12:08 PM, Iustin Pop <[email protected]> wrote: >> > This is moved outside of the concatAllocs as it will be needed in >> > another place in the future. >> > --- >> > htools/Ganeti/HTools/Cluster.hs | 18 +++++++++++------- >> > 1 files changed, 11 insertions(+), 7 deletions(-) >> > >> > diff --git a/htools/Ganeti/HTools/Cluster.hs >> > b/htools/Ganeti/HTools/Cluster.hs >> > index bb00ce1..6bf6de7 100644 >> > --- a/htools/Ganeti/HTools/Cluster.hs >> > +++ b/htools/Ganeti/HTools/Cluster.hs >> > @@ -600,21 +600,25 @@ collapseFailures flst = >> > map (\k -> (k, foldl' (\a e -> if e == k then a + 1 else a) 0 flst)) >> > [minBound..maxBound] >> > >> > +-- | Compares two Maybe AllocElement and chooses the besst score. >> s/besst/best > > ack, will fix. > >> > +compareAE :: Maybe Node.AllocElement >> > + -> Maybe Node.AllocElement >> > + -> Maybe Node.AllocElement >> > +compareAE a Nothing = a >> > +compareAE Nothing b = b >> > +compareAE a@(Just (_, _, _, ascore)) b@(Just (_, _, _, bscore)) = >> > + if ascore < bscore then a else b >> I'm not convinced that in half a year the name compareAE will be >> meaningful and obviously decipherable. Also, compare is usually a >> function that returns boolean value or LT/EQ/GT (in haskell), not the >> maximal value (for a given metric) > > Indeed, good points (both). How about bestAllocElement?
Much better. With that change LGTM > > thanks, > iustin >
