any package:relude

Determines whether any element of the structure satisfies the predicate.

Examples

Basic usage:
>>> any (> 3) []
False
>>> any (> 3) [1,2]
False
>>> any (> 3) [1,2,3,4,5]
True
>>> any (> 3) [1..]
True
>>> any (> 3) [0, -1..]
* Hangs forever *
Boolean monoid under disjunction (||).
Any x <> Any y = Any (x || y)

Examples

>>> Any True <> mempty <> Any False
Any {getAny = True}
>>> mconcat (map (\x -> Any (even x)) [2,4,6,7,8])
Any {getAny = True}
>>> Any False <> mempty
Any {getAny = False}
Monadic version of any.
>>> anyM (readMaybe >=> pure . even) ["5", "10"]
Just True

>>> anyM (readMaybe >=> pure . even) ["10", "aba"]
Just True

>>> anyM (readMaybe >=> pure . even) ["aba", "10"]
Nothing
Zero or more.
Determines whether any element of the structure satisfies its appropriate predicate argument. Empty structures yield False.

Examples

Basic usage:
>>> biany even isDigit (27, 't')
False
>>> biany even isDigit (27, '8')
True
>>> biany even isDigit (26, 't')
True
>>> biany even isDigit (Left 27)
False
>>> biany even isDigit (Left 26)
True
>>> biany even isDigit (BiList [27, 53] ['t', '8'])
True
Empty structures yield False:
>>> biany even isDigit (BiList [] [])
False