Safe Haskell | None |
---|---|
Language | Haskell2010 |
Utility functions.
Documentation
binarySearch :: Unbox a => (a -> Ordering) -> Vector a -> Either Int Int Source #
Given a vector of length n
strictly ascending with respect to a given
comparison function, find an index at which the given element could be
inserted while preserving sortedness.
The Left
result indicates, that the EQ
element has been found,
while the Right
result means otherwise. Value of the Right
result is in the [0,n] range.