testing-feat-0.4.0.2: Functional Enumeration of Algebraic Types

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. Each parts contains values of a certain cost (typically the size of the value).

Constructors

Enumerate 

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

Reversed lists

data RevList a Source

A data structure that contains a list and the reversals of all initial segments of the list. Intuitively

reversals xs !! n = reverse (take (n+1) (fromRev xs))

Any operation on a RevList typically discards the reversals and constructs new reversals on demand.

Constructors

RevList 

Fields

fromRev :: [a]
 
reversals :: [[a]]
 

Instances

Functor RevList 
Show a => Show (RevList a) 
Monoid a => Monoid (RevList a)

Padded zip

toRev :: [a] -> RevList aSource

Constructs a Reverse list variant of a given list. In a sensible Haskell implementation evaluating any inital segment of reversals (toRev xs) uses linear memory in the size of the segment.

Finite ordered sets

data Finite a Source

Constructors

Finite 

Fields

fCard :: Index
 
fIndex :: Index -> a
 

Combinators for building enumerations

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.

Polymorphic sharing

data Tag Source

Constructors

Source String String Int Int 

Instances

irregular :: Enumerate a -> Enumerate aSource

Used to avoid non-termination of optimise in the presence of irregular data types. irregular should be applied to the enumeration for the constructor that introduces the irregularity. Excessive use may impact performance