testing-feat-0.2: Functional enumeration for systematic and random testing

Safe HaskellNone

Test.Feat.Enumerate

Contents

Description

Basic combinators for building enumerations most users will want to use the type class based combinators in Test.Feat.Class instead.

Synopsis

Documentation

data Enumerate a Source

A functional enumeration of type t is a partition of t into finite numbered sets called Parts. The number that identifies each part is called the cost of the values in that part.

Constructors

Enumerate 

Fields

card :: Part -> Index

Computes the cardinality of a given part.

select :: Part -> Index -> a

Selects a value from the enumeration For select e p i, the index i should be less than card e p

optimal :: Sharing Tag (Enumerate a)

A self-optimising function (mainly for internal use).

Instances

Functor Enumerate

Only use fmap with bijective functions (e.g. data constructors)

Typeable1 Enumerate 
Applicative Enumerate

Pure is singleton and <*> corresponds to cartesian product (as with lists)

Monoid (Enumerate a)

The mappend is (disjoint) union

Combinators for building enumerations

union :: Enumerate a -> Enumerate a -> Enumerate aSource

Disjoint union

singleton :: a -> Enumerate aSource

The definition of pure for the applicative instance.

pay :: Enumerate a -> Enumerate aSource

Increases the cost of all values in an enumeration by one.

Memoisation

mempay :: Enumerate a -> Enumerate aSource

A convenient combination of memoisation and guarded recursion.

Polymorphic memoisation

data Tag Source

Constructors

Source String String Int Int 

Instances