lazy-search-0.1.0.0: Finds values satisfying a lazy predicate

Safe HaskellNone
LanguageHaskell2010

Control.Search

Contents

Description

Efficient size-based search for values satisfying/falsifying a lazy boolean predicate. See Control.Enumerable for defining enumerations of data types.

Synopsis

Searching

search :: (Enumerable a, Coolean cool) => Int -> (a -> cool) -> IO [a] Source #

Lazily finds all values of or below a given size that satisfies this predicate.

sat :: (Enumerable a, Coolean cool) => Int -> (a -> cool) -> Bool Source #

Is there a value of or below a given size that satisfies this predicate?

searchRaw :: (Enumerable a, Coolean cool) => Int -> (a -> cool) -> IO [(Bool, a)] Source #

Lazily finds all values isomorphic to p (w.r.t. laziness) and returns them along with the result of p.

usearch :: Enumerable a => Int -> (a -> Bool) -> [a] Source #

Unsafe search, the order in which values are found is non-deterministic for some predicates.

Testing properties

test :: (Coolean cool, Enumerable a, Show a) => (a -> cool) -> IO () Source #

SmallCheck-like test driver. Tests a property with gradually increasing sizes until a conunterexample is found.

testTime :: (Coolean cool, Enumerable a, Show a) => Int -> (a -> cool) -> IO () Source #

Stop testing after a given number of seconds

Options for parallel conjunction

data Options Source #

Options for parallel conjunction strategies

Constructors

D

Sequential

O

Optimal Short-circuiting

F

Parallel (fair)

OF

Optimal Short-circuiting and fairness

OS

Optimal Short-circuiting and choice-subset detection

OSF

Subset choice short-circuiting

sat' :: (Enumerable a, Coolean cool) => Options -> Int -> (a -> cool) -> Bool Source #

search' :: (Enumerable a, Coolean cool) => Options -> Int -> (a -> cool) -> IO [a] Source #

searchRaw' :: (Enumerable a, Coolean cool) => Options -> Int -> (a -> cool) -> IO [(Bool, a)] Source #

test' :: (Coolean cool, Enumerable a, Show a) => Options -> (a -> cool) -> IO () Source #

Deep embedded boolean type

data Cool Source #

Concurrent booleans. Writing properties with the Cool data type often yields faster searches compared to Bool.

Constructors

Atom Bool 
Not Cool 
And Cool Cool 
Seq Cool Cool

Sequential conjunction, the second operator is not evaluated unless the first is true.

Instances

class Coolean b Source #

Provides better interoperability between Bool and Cool by overloading operators.

Minimal complete definition

toCool, toBool, isCool

Instances

(&&&) :: (Coolean a, Coolean b) => a -> b -> Cool infixr 2 Source #

(|||) :: (Coolean a, Coolean b) => a -> b -> Cool Source #

(==>) :: (Coolean a, Coolean b) => a -> b -> Cool Source #

nott :: Coolean a => a -> Cool Source #

Re-exported