dawg-0.8.2: Directed acyclic word graphs

Safe HaskellNone
LanguageHaskell2010

Data.DAWG.Util

Description

Utility functions.

Synopsis

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.

findLastLE :: Unbox a => (a -> Ordering) -> Vector a -> Maybe (Int, a) Source #

Given a vector sorted with respect to some underlying comparison function, find last element which is not GT with respect to the comparison function.

combine :: Int -> Int -> Int Source #

Combine two given hash values. combine has zero as a left identity.