Portability | portable |
---|---|

Stability | experimental |

Maintainer | ross@soi.city.ac.uk |

Safe Haskell | Safe-Inferred |

Searching unbounded intervals within bounded integral types for the boundary of an upward-closed set, using a combination of exponential and binary search.

# Documentation

search :: (Bounded a, Integral a) => (a -> Bool) -> Maybe aSource

*O(log(abs n))*.
Search a bounded integral type.

If `p`

is an upward-closed predicate, `search p`

returns
`Just n`

if and only if `n`

is the least such satisfying `p`

.