I need to check if any element of a set satisfies a predicate. So far I've been using lists, so I just used
any myPredicate sx
but using a set in my case is semantically more correct (and probably more efficient). However there's no any
for sets, and I end up with lots of lines like this (Data.Set as S
):
any myPredicate $ S.toList mySet
Is there a way not to litter my code with all those conversions, like with monoids or the like...?
(I mean, there must be a way besides defining anyS p s = any p $ S.toList s
, otherwise why isn't it in Data.Set
...?)