facebook/duckling

Refactor unreadable use of sequence

Opened this issue · 0 comments

Often in duckling we see

or . sequence $ [somePredicate, someOtherPredicate]

or

and . sequence $ [somePredicate, someOtherPredicate]

I would rather have functions

allOf, atLeastOneOf :: [a -> Bool] -> (a -> Bool)
allOf ps = and . sequence ps
atLeastOneOf ps = or . sequence ps

This is more readable IMO, and would be a trivial find+replace