:: Eq a => [a] -> a -> Bool -package:numhask package:Agda

Check membership for the same list often. Use partially applied to create membership predicate hasElem xs :: a -> Bool.
  • First time: O(n log n) in the worst case.
  • Subsequently: O(log n).
Specification: hasElem xs == (elem xs).
A generalised variant of elemIndex. O(n).