@hackage binary-search0.9
Binary and exponential searches
Categories
License
BSD-3-Clause
Maintainer
Takayuki Muranushi <muranushi@gmail.com>
Links
Versions
Installation
Dependencies (2)
- base >=4.8 && <5
- containers >=0.4 && <0.6 Show all…
Dependents (8)
@hackage/constructible, @cardano/ouroboros-consensus-cardano, @hackage/acme-everything, @hackage/xlsx, @hackage/citation-resolve, @cardano/ouroboros-consensus, Show all…
Introduction
This package provides varieties of binary search functions.
These search function can search for predicates of the type
pred :: (Integral a, Eq b) => a -> b, or monadic predicates
pred :: (Integral a, Eq b, Monad m) => a -> m b.
The predicates must satisfy that the domain range for any codomain value
is continuous; that is, ∀x≦y≦z. pred x == pred z ⇒ pred y == pred x .
For example, we can address the problem of finding the boundary of an upward-closed set of integers, using a combination of exponential and binary searches.
Variants are provided
for searching within bounded and unbounded intervals of
both Integer and bounded integral types.
The package was created by Ross Paterson, and extended by Takayuki Muranushi, to be used together with SMT solvers.
The Module Structure
Numeric.Search.Combinator.Monadicprovides the most generic combinators.Numeric.Search.Combinator.Pureprovides the pure version of them.Numeric.Searchexports both pure and monadic version.Numeric.Search.Bounded,Numeric.Search.Integer,Numeric.Search.Rangeprovides the various specialized searchers, which means less number of function arguments, and easier to use.