find -package:protolude

The find function takes a predicate and a structure and returns the leftmost element of the structure matching the predicate, or Nothing if there is no such element.

Examples

Basic usage:
>>> find (> 42) [0, 5..]
Just 45
>>> find (> 12) [1..7]
Nothing
O(n) The find function takes a predicate and a ByteString, and returns the first element in matching the predicate, or Nothing if there is no such element.
find f p = case findIndex f p of Just n -> Just (p ! n) ; _ -> Nothing
O(n) The find function takes a predicate and a ByteString, and returns the first element in matching the predicate, or Nothing if there is no such element.
O(n) The find function takes a predicate and a ShortByteString, and returns the first element in matching the predicate, or Nothing if there is no such element.
find f p = case findIndex f p of Just n -> Just (p ! n) ; _ -> Nothing
O(n) The find function takes a predicate and a Text, and returns the first element matching the predicate, or Nothing if there is no such element.
O(n) The find function takes a predicate and a Text, and returns the first element in matching the predicate, or Nothing if there is no such element.
O(n) Yield Just the first element matching the predicate or Nothing if no such element exists.
Yield Just the first element matching the predicate or Nothing if no such element exists.
Yield Just the first element that satisfies the predicate or Nothing if no such element exists.
O(n) Yield Just the first element matching the predicate or Nothing if no such element exists.
O(n) Yield Just the first element matching the predicate or Nothing if no such element exists.
O(n) Yield Just the first element matching the predicate or Nothing if no such element exists.
O(n) Yield Just the first element matching the predicate or Nothing if no such element exists.
Find the first matching value. Subject to fusion
Return the canonical element of an equivalence class Point.
Find the first element of a Producer that satisfies the predicate
(find predicate) returns the first element that satisfies the predicate or Nothing if no element satisfies the predicate
(find predicate) returns the first byte that satisfies the predicate or Nothing if no byte satisfies the predicate
(find predicate) returns the first character that satisfies the predicate or Nothing if no character satisfies the predicate
Find index of elements which satisfy a predicate
>>> find (>0) (ident 3 :: Matrix Double)
[(0,0),(1,1),(2,2)]
The find function takes a predicate and a structure and returns the leftmost element of the structure matching the predicate, or Nothing if there is no such element.
O(n) Yield Just the first element matching the predicate or Nothing if no such element exists.
O(n) Yield Just the first element matching the predicate or Nothing if no such element exists.
O(n) Yield Just the first element matching the predicate or Nothing if no such element exists.