/**
* @tsplus static List.Aspects find
* @tsplus pipeable List find
*/
export function find(p: Refinement): (self: List) => Maybe
export function find(p: Predicate): (self: List) => Maybe
export function find(p: Predicate) {
return (self: List): Maybe => {
let these = self
while (!these.isNil()) {
if (p(these.head)) {
return Maybe.some(these.head)
}
these = these.tail
}
return Maybe.none
}
}