> >+             then maybe (Just x) Just . monotoneFind heuristics p
> >+                  $ take count xs
> 
> Just nitpicking, (maybe (Just x) Just) might be slightly shortened
> as (Just . fromMaybe x) or (`mplus` Just x). If you like any of
> these ideas, no need to resend, if not, also OK.

Good idea. FYI

commit 3b6d808ea3f28413af983ab0945e3e4dd8f1af20
Author: Klaus Aehlig <[email protected]>
Date:   Fri Sep 25 18:21:55 2015 +0200

    interdiff [PATCH master 2/3] Add efficient find for monotone predicates

diff --git a/src/Ganeti/Utils.hs b/src/Ganeti/Utils.hs
index f66e37d..1365440 100644
--- a/src/Ganeti/Utils.hs
+++ b/src/Ganeti/Utils.hs
@@ -861,7 +861,7 @@ monotoneFind heuristics p xs =
   in case () of
     _ | x:xs' <- drop count xs
         -> if p x
-             then maybe (Just x) Just . monotoneFind heuristics p
+             then (`mplus` Just x) . monotoneFind heuristics p
                   $ take count xs
              else monotoneFind heuristics p xs'
     _ | x:xs' <- xs


> In any case, LGTM, thanks.

Thanks

-- 
Klaus Aehlig
Google Germany GmbH, Dienerstr. 12, 80331 Muenchen
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschaeftsfuehrer: Graham Law, Christine Elizabeth Flores

Reply via email to