testing-feat-0.4.0.3: Functional Enumeration of Algebraic Types

Safe HaskellNone
LanguageHaskell98

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

type Index = Integer #

data Enumerate a #

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)

Methods

fmap :: (a -> b) -> Enumerate a -> Enumerate b #

(<$) :: a -> Enumerate b -> Enumerate a #

Applicative Enumerate #

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

Methods

pure :: a -> Enumerate a #

(<*>) :: Enumerate (a -> b) -> Enumerate a -> Enumerate b #

(*>) :: Enumerate a -> Enumerate b -> Enumerate b #

(<*) :: Enumerate a -> Enumerate b -> Enumerate a #

Monoid (Enumerate a) #

The mappend is (disjoint) union

parts :: Enumerate a -> [Finite a] #

Reversed lists

data RevList a #

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

Instances

Functor RevList # 

Methods

fmap :: (a -> b) -> RevList a -> RevList b #

(<$) :: a -> RevList b -> RevList a #

Show a => Show (RevList a) # 

Methods

showsPrec :: Int -> RevList a -> ShowS #

show :: RevList a -> String #

showList :: [RevList a] -> ShowS #

Monoid a => Monoid (RevList a) #

Padded zip

Methods

mempty :: RevList a #

mappend :: RevList a -> RevList a -> RevList a #

mconcat :: [RevList a] -> RevList a #

toRev :: [a] -> RevList a #

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 #

Constructors

Finite 

Fields

Instances

Functor Finite # 

Methods

fmap :: (a -> b) -> Finite a -> Finite b #

(<$) :: a -> Finite b -> Finite a #

Applicative Finite # 

Methods

pure :: a -> Finite a #

(<*>) :: Finite (a -> b) -> Finite a -> Finite b #

(*>) :: Finite a -> Finite b -> Finite b #

(<*) :: Finite a -> Finite b -> Finite a #

Show a => Show (Finite a) # 

Methods

showsPrec :: Int -> Finite a -> ShowS #

show :: Finite a -> String #

showList :: [Finite a] -> ShowS #

Monoid (Finite a) # 

Methods

mempty :: Finite a #

mappend :: Finite a -> Finite a -> Finite a #

mconcat :: [Finite a] -> Finite a #

fromFinite :: Finite a -> (Index, [a]) #

Combinators for building enumerations

singleton :: a -> Enumerate a #

The definition of pure for the applicative instance.

pay :: Enumerate a -> Enumerate a #

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

Polymorphic sharing

data Tag #

Constructors

Source String String Int Int 

Instances

Eq Tag # 

Methods

(==) :: Tag -> Tag -> Bool #

(/=) :: Tag -> Tag -> Bool #

Ord Tag # 

Methods

compare :: Tag -> Tag -> Ordering #

(<) :: Tag -> Tag -> Bool #

(<=) :: Tag -> Tag -> Bool #

(>) :: Tag -> Tag -> Bool #

(>=) :: Tag -> Tag -> Bool #

max :: Tag -> Tag -> Tag #

min :: Tag -> Tag -> Tag #

Show Tag # 

Methods

showsPrec :: Int -> Tag -> ShowS #

show :: Tag -> String #

showList :: [Tag] -> ShowS #

tag :: Q Exp #

irregular :: Enumerate a -> Enumerate a #

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