-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | generalize counter-examples of test properties
--   
--   Extrapolate is a tool able to provide generalized counter-examples of
--   test properties where irrelevant sub-expressions are replaces with
--   variables.
--   
--   For the incorrect property <tt>\xs -&gt; nub xs == (xs::[Int])</tt>:
--   
--   <ul>
--   <li><tt>[0,0]</tt> is a counter-example;</li>
--   <li><tt>x:x:_</tt> is a generalized counter-example.</li>
--   </ul>
@package extrapolate
@version 0.3.3


-- | This module is part of Extrapolate, a library for generalization of
--   counter-examples.
--   
--   This module re-exports some functionality from Test.Speculate.Expr,
--   but instead of working on single expressions it works in lists of
--   expressions (the choosen representation for counter-examples).
module Test.Extrapolate.Exprs
type Exprs = [Expr]
canonicalizeWith :: Instances -> [Expr] -> [Expr]
grounds :: Instances -> [Expr] -> [[Expr]]
groundsAndBinds :: Instances -> [Expr] -> [(Binds, [Expr])]
vassignments :: [Expr] -> [[Expr]]
vars :: [Expr] -> [(TypeRep, String)]
fold :: [Expr] -> Expr
unfold :: Expr -> [Expr]
isAssignmentTest :: Instances -> Int -> Expr -> Bool
nameWith :: Typeable a => String -> a -> Instances

-- | A quantified type representation.
type TypeRep = SomeTypeRep
canonicalWith :: Instances -> Expr -> Bool
canonicalize :: Expr -> Expr

-- | Is an expression ALWAYS false? This is *NOT* the same as not true
false :: Instances -> Int -> Expr -> Bool

-- | Under a maximum number of tests, returns the ratio for which an
--   expression holds true.
trueRatio :: Instances -> Int -> Expr -> Ratio Int

-- | List variable bindings for which an expression holds true.
trueBinds :: Instances -> Int -> Expr -> [Binds]

-- | Is a boolean expression true for all variable assignments?
true :: Instances -> Int -> Expr -> Bool

-- | Are two expressions inequal for *all* variable assignments? Note this
--   is different than <tt>not . equal</tt>.
inequal :: Instances -> Int -> Expr -> Expr -> Bool

-- | Are two expressions less-than for a given number of tests?
less :: Instances -> Int -> Expr -> Expr -> Bool

-- | Are two expressions less-than-or-equal for a given number of tests?
lessOrEqual :: Instances -> Int -> Expr -> Expr -> Bool

-- | Are two expressions equal under a given condition for a given number
--   of tests and a minimum amount of tests
condEqualM :: Instances -> Int -> Int -> Expr -> Expr -> Expr -> Bool

-- | Are two expressions equal under a given condition for a given number
--   of tests?
condEqual :: Instances -> Int -> Expr -> Expr -> Expr -> Bool

-- | Are two expressions equal for a given number of tests?
equal :: Instances -> Int -> Expr -> Expr -> Bool

-- | List all possible variable bindings and valuations to an expression
--   
--   <pre>
--   groundAndBinds ti e == zipWith (,) (grounds ti e) (groundBinds ti e)
--   </pre>
groundAndBinds :: Instances -> Expr -> [(Binds, Expr)]

-- | List all possible variable bindings to an expression
--   
--   <pre>
--   take 3 $ groundBinds preludeInstances ((x + x) + y)
--     == [ [("x",0),("y",0)]
--        , [("x",0),("y",1)]
--        , [("x",1),("y",0)] ]
--   </pre>
groundBinds :: Instances -> Expr -> [Binds]
unConditionalComparison :: Expr -> (Expr, Expr, Expr)
conditionalComparisonLT :: Instances -> Expr -> Expr -> Expr -> Maybe Expr
conditionalComparisonLE :: Instances -> Expr -> Expr -> Expr -> Maybe Expr
usefulConditionalEquation :: Expr -> Bool
unConditionalEquation :: Expr -> (Expr, Expr, Expr)
conditionalEquation :: Instances -> Expr -> Expr -> Expr -> Maybe Expr
usefulImplication :: Expr -> Bool
unImplication :: Expr -> (Expr, Expr)
implication :: Expr -> Expr -> Maybe Expr
unComparison :: Expr -> (Expr, Expr)
comparisonLE :: Instances -> Expr -> Expr -> Maybe Expr
comparisonLT :: Instances -> Expr -> Expr -> Maybe Expr
inequality :: Instances -> Expr -> Expr -> Maybe Expr
usefulEquation :: Expr -> Bool

-- | Given an equation encoded as an <a>Expr</a>. Checks if both sides of
--   an equation are the same. If the <a>Expr</a> is not an equation, this
--   raises an error.
uselessEquation :: Expr -> Bool
isEquation :: Expr -> Bool
unEquation :: Expr -> (Expr, Expr)
phonyEquation :: Expr -> Expr -> Expr
equation :: Instances -> Expr -> Expr -> Maybe Expr
defNames :: [String]
preludeInstances :: Instances
leE :: Instances -> TypeRep -> Maybe Expr
ltE :: Instances -> TypeRep -> Maybe Expr
iqE :: Instances -> TypeRep -> Maybe Expr
eqE :: Instances -> TypeRep -> Maybe Expr
tiersE :: Instances -> TypeRep -> [[Expr]]
names :: Instances -> TypeRep -> [String]
findInfo :: () => Instance -> Maybe a -> Instances -> Maybe a
isListable :: Instances -> TypeRep -> Bool
isEqOrdE :: Instances -> Expr -> Bool
isOrdE :: Instances -> Expr -> Bool
isEqE :: Instances -> Expr -> Bool
isEqOrd :: Instances -> TypeRep -> Bool
isOrd :: Instances -> TypeRep -> Bool
isEq :: Instances -> TypeRep -> Bool
listableWith :: (Typeable a, Show a) => [[a]] -> Instances
ordWith :: (Typeable a, Ord a) => a -> a -> Bool -> Instances
eqWith :: (Typeable a, Eq a) => a -> a -> Bool -> Instances
listable :: (Typeable a, Show a, Listable a) => a -> Instances
eqOrd :: (Typeable a, Eq a, Ord a) => a -> Instances
ord :: (Typeable a, Ord a) => a -> Instances
eq :: (Typeable a, Eq a) => a -> Instances
instanceType :: Instance -> TypeRep

-- | Type information needed to Speculate expressions (single type / single
--   class).
data Instance
Instance :: String -> TypeRep -> [Expr] -> Instance

-- | Type information needed to Speculate expressions.
type Instances = [Instance]
hasCanonInstanceOf :: Expr -> Expr -> Bool
isCanonInstanceOf :: Expr -> Expr -> Bool
hasInstanceOf :: Expr -> Expr -> Bool
isInstanceOf :: Expr -> Expr -> Bool
unification :: Expr -> Expr -> Maybe Binds
unify :: Expr -> Expr -> Maybe Expr

-- | List matches with preexisting bindings:
--   
--   <pre>
--   0 + 1 `matchWith [(x,0)]` x + y = Just [x=0, y=1]
--   0 + 1 `matchWith [(x,1)]` x + y = Nothing
--   </pre>
matchWith :: Binds -> Expr -> Expr -> Maybe Binds

-- | List matches of pairs of expressions if possible
--   
--   <pre>
--   (0,1)   `match2` (x,y)   = Just [x=0, y=1]
--   (0,1+2) `match2` (x,y+y) = Nothing
--   </pre>
match2 :: (Expr, Expr) -> (Expr, Expr) -> Maybe Binds

-- | List matches if possible
--   
--   <pre>
--   0 + 1       `match` x + y       = Just [x=0, y=1]
--   0 + (1 + 2) `match` x + y       = Just [x=0, y=1 + 2]
--   0 + (1 + 2) `match` x + (y + y) = Nothing
--   (x + x) + (1 + 2) `match` x + (y + y) = Nothing
--   </pre>
match :: Expr -> Expr -> Maybe Binds

-- | Primeify variable names in an expression.
--   
--   <pre>
--   renameBy (++ "'") (x + y) = (x' + y')
--   renameBy (++ "'") (y + (z + x)) = (y' + (z' + x'))
--   renameBy (++ "1") abs x = abs x1
--   renameBy (++ "2") abs (x + y) = abs (x2 + y2)
--   </pre>
--   
--   Note this will affect holes!
renameBy :: String -> String -> Expr -> Expr

-- | Substitute matching subexpressios.
--   
--   sub (x + y) 0 ((x + y) + z) == (0 + z) sub (x + y) 0 (x + (y + z)) ==
--   (x + (y + z))
sub :: Expr -> Expr -> Expr -> Expr

-- | Assign all occurrences of several variables in an expression.
--   
--   For single variables, this works as assign:
--   
--   <pre>
--   x + y `assigning` [("x",10)] = (10 + y)
--   ((x + y) + (y + z)) `assigning` [("y",y+z)] = (x + (y + z)) + ((y + z) + z)
--   </pre>
--   
--   Note this is <i>not</i> equivalent to <tt>foldr (uncurry assign)</tt>.
--   Variables inside expressions being assigned will not be assigned.
assigning :: Expr -> Binds -> Expr

-- | Assign all occurences of a variable in an expression.
--   
--   Examples in pseudo-Haskell:
--   
--   <pre>
--   assign "x" (10) (x + y) = (10 + y)
--   assign "y" (y + z) ((x + y) + (y + z)) = (x + (y + z)) + ((y + z) + z)
--   </pre>
--   
--   This respects the type (won't change occurrences of a similarly named
--   variable of a different type).
assign :: String -> Expr -> Expr -> Expr

-- | Fill holes in an expression. Silently skips holes that are not of the
--   right type. Silently discard remaining expressions.
fill :: Expr -> [Expr] -> Expr
type Binds = [(String, Expr)]

-- | Unfold function application:
--   
--   <pre>
--   (((f :$ e1) :$ e2) :$ e3) = [f,e1,e2,e3]
--   </pre>
unfoldApp :: Expr -> [Expr]
isConstantNamed :: Expr -> String -> Bool

-- | Is a subexpression of.
isSub :: Expr -> Expr -> Bool

-- | Sub-expressions of an expression including variables and the
--   expression itself.
subexprsV :: Expr -> [Expr]

-- | Non-variable sub-expressions of an expression
--   
--   This includes the expression itself
subexprs :: Expr -> [Expr]
isAssignment :: Expr -> Bool
unrepeatedVars :: Expr -> Bool
countVars :: Expr -> [(TypeRep, String, Int)]

-- | Number of occurrences of a given variable name. In term rewriting
--   terms: |s|_x
countVar :: TypeRep -> String -> Expr -> Int

-- | Number of occurrences of holes with a given type.
countHoles :: TypeRep -> Expr -> Int

-- | Returns the maximum depth of an expression.
depthE :: Expr -> Int

-- | Returns the length of an expression. In term rewriting terms: |s|
lengthE :: Expr -> Int

-- | List terminal constants in an expression. This does not repeat values.
consts :: Expr -> [Expr]
hasVar :: Expr -> Bool
atomicConstants :: Expr -> [Expr]

-- | List types holes (unamed variables) in an expression
holes :: Expr -> [TypeRep]

-- | Type arity of an <a>Expr</a>
arity :: Expr -> Int
typeCorrect :: Expr -> Bool

-- | etyp returns either: the Right type a Left expression with holes with
--   the structure of the I'll typed expression
etyp :: Expr -> Either Expr TypeRep

-- | The type of an expression. This raises errors, but those should not
--   happen if expressions are smart-constructed.
typ :: Expr -> TypeRep

-- | Evaluates an expression when possible (correct type, no holes).
--   Returns a default value otherwise.
eval :: Typeable a => a -> Expr -> a

-- | <a>Just</a> the value of an expression when possible (correct type, no
--   holes), <a>Nothing</a> otherwise.
evaluate :: Typeable a => Expr -> Maybe a
falseE :: Expr

-- | Compares two expressions first by their complexity: 1st length; 2nd
--   number of variables (more variables is less complex); 3nd sum of
--   number of variable occurrences; 4th their depth; 5th lexicompare.
compareComplexity :: Expr -> Expr -> Ordering

-- | Compares two expressions first by their complexity: 1st length; 2nd
--   number of variables (more variables is less complex); 3nd sum of
--   number of variable occurrences; 4th their depth; 5th normal
--   <a>compare</a>.
compareComplexityThen :: Expr -> Expr -> Ordering -> Expr -> Expr -> Ordering

-- | Compare two expressiosn lexicographically
--   
--   1st their type arity; 2nd their type; 3rd var &lt; constants &lt; apps
--   4th lexicographic order on names
lexicompare :: Expr -> Expr -> Ordering
lexicompareBy :: Expr -> Expr -> Ordering -> Expr -> Expr -> Ordering
eqExprCommuting :: [Expr] -> Expr -> Expr -> Bool
showExpr :: Expr -> String
showPrecExpr :: Int -> Expr -> String
showOpExpr :: String -> Expr -> String
showsOpExpr :: String -> Expr -> String -> String
unfoldTuple :: Expr -> [Expr]
isTuple :: Expr -> Bool
showsPrecExpr :: Int -> Expr -> String -> String

-- | <a>Just</a> an <a>Expr</a> application if the types match,
--   <a>Nothing</a> otherwise.
($$) :: Expr -> Expr -> Maybe Expr
holeOfTy :: TypeRep -> Expr

-- | <b>(intended for advanced users)</b>
--   
--   <tt>hole (undefined :: Ty)</tt> returns a hole of type <tt>Ty</tt>
--   
--   By convention, a Hole is a variable named with the empty string.
hole :: (Listable a, Typeable a) => a -> Expr

-- | <tt>var "x" (undefined :: Ty)</tt> returns a variable of type
--   <tt>Ty</tt> named "x"
var :: (Listable a, Typeable a) => String -> a -> Expr

-- | A shorthand for <a>constant</a> to be used on values that are
--   <a>Show</a> instances. Examples:
--   
--   <pre>
--   showConstant 0     =  constant "0" 0
--   showConstant 'a'   =  constant "'a'" 'a' 
--   showConstant True  =  constant "True" True
--   </pre>
showConstant :: (Typeable a, Show a) => a -> Expr

-- | Encode a constant Haskell expression for use by Speculate. It takes a
--   string representation of a value and a value, returning an
--   <a>Expr</a>. Examples:
--   
--   <pre>
--   constant "0" 0
--   constant "'a'" 'a'
--   constant "True" True
--   constant "id" (id :: Int -&gt; Int)
--   constant "(+)" ((+) :: Int -&gt; Int -&gt; Int)
--   constant "sort" (sort :: [Bool] -&gt; [Bool])
--   </pre>
constant :: Typeable a => String -> a -> Expr

-- | An encoded Haskell functional-application expression for use by
--   Speculate.
data Expr
Constant :: String -> Dynamic -> Expr
Var :: String -> TypeRep -> Expr
(:$) :: Expr -> Expr -> Expr
mkEqnTy :: TypeRep -> TypeRep
boolTy :: TypeRep


-- | This module is part of Extrapolate, a library for generalization of
--   counter-examples.
--   
--   Some type binding operators that are useful when defining
--   Generalizable instances.
module Test.Extrapolate.TypeBinding
argTy1of1 :: con a -> a
argTy1of2 :: con a b -> a
argTy2of2 :: con a b -> b
argTy1of3 :: con a b c -> a
argTy2of3 :: con a b c -> b
argTy3of3 :: con a b c -> c
argTy1of4 :: con a b c d -> a
argTy2of4 :: con a b c d -> b
argTy3of4 :: con a b c d -> c
argTy4of4 :: con a b c d -> d
argTy1of5 :: con a b c d e -> a
argTy2of5 :: con a b c d e -> b
argTy3of5 :: con a b c d e -> c
argTy4of5 :: con a b c d e -> d
argTy5of5 :: con a b c d e -> e
argTy1of6 :: con a b c d e f -> a
argTy2of6 :: con a b c d e f -> b
argTy3of6 :: con a b c d e f -> c
argTy4of6 :: con a b c d e f -> d
argTy5of6 :: con a b c d e f -> e
argTy6of6 :: con a b c d e f -> f


-- | This module is part of Extrapolate, a library for generalization of
--   counter-examples.
--   
--   Miscellaneous utility functions.
--   
--   This is not intended to be used by users of Extrapolate, only by
--   modules of Extrapolate itself. Expect symbols exported here to come
--   and go with every minor version.
module Test.Extrapolate.Utils
(+++) :: Ord a => [a] -> [a] -> [a]
infixr 5 +++
nubMerge :: Ord a => [a] -> [a] -> [a]
nubMergeOn :: Ord b => (a -> b) -> [a] -> [a] -> [a]
nubMergeBy :: (a -> a -> Ordering) -> [a] -> [a] -> [a]
foldr0 :: (a -> a -> a) -> a -> [a] -> a
fromLeft :: Either a b -> a
fromRight :: Either a b -> b
elemBy :: (a -> a -> Bool) -> a -> [a] -> Bool
listEq :: (a -> a -> Bool) -> [a] -> [a] -> Bool
listOrd :: (a -> a -> Bool) -> [a] -> [a] -> Bool
maybeEq :: (a -> a -> Bool) -> Maybe a -> Maybe a -> Bool
maybeOrd :: (a -> a -> Bool) -> Maybe a -> Maybe a -> Bool
eitherEq :: (a -> a -> Bool) -> (b -> b -> Bool) -> Either a b -> Either a b -> Bool
eitherOrd :: (a -> a -> Bool) -> (b -> b -> Bool) -> Either a b -> Either a b -> Bool
pairEq :: (a -> a -> Bool) -> (b -> b -> Bool) -> (a, b) -> (a, b) -> Bool
pairOrd :: (a -> a -> Bool) -> (b -> b -> Bool) -> (a, b) -> (a, b) -> Bool
tripleEq :: (a -> a -> Bool) -> (b -> b -> Bool) -> (c -> c -> Bool) -> (a, b, c) -> (a, b, c) -> Bool
tripleOrd :: (a -> a -> Bool) -> (b -> b -> Bool) -> (c -> c -> Bool) -> (a, b, c) -> (a, b, c) -> Bool
quadrupleEq :: (a -> a -> Bool) -> (b -> b -> Bool) -> (c -> c -> Bool) -> (d -> d -> Bool) -> (a, b, c, d) -> (a, b, c, d) -> Bool
quadrupleOrd :: (a -> a -> Bool) -> (b -> b -> Bool) -> (c -> c -> Bool) -> (d -> d -> Bool) -> (a, b, c, d) -> (a, b, c, d) -> Bool
minimumOn :: Ord b => (a -> b) -> [a] -> a
maximumOn :: Ord b => (a -> b) -> [a] -> a
takeBound :: Maybe Int -> [a] -> [a]
nubMergeMap :: Ord b => (a -> [b]) -> [a] -> [b]

-- | For a given type, return all *-kinded types. (all non-function types)
--   
--   <pre>
--   typesIn (typeOf (undefined :: (Int -&gt; Int) -&gt; Int -&gt; Bool))
--     == [Bool,Int]
--   </pre>
typesIn :: TypeRep -> [TypeRep]
argumentTy :: TypeRep -> TypeRep
resultTy :: TypeRep -> TypeRep
discard :: (a -> Bool) -> [a] -> [a]
compareIndex :: Eq a => [a] -> a -> a -> Ordering
(.:) :: (c -> d) -> (a -> b -> c) -> (a -> b -> d)


-- | This module is part of Extrapolate, a library for generalization of
--   counter-examples.
--   
--   This is the core of extrapolate.
module Test.Extrapolate.Core

-- | Takes as argument an integer length and tiers of element values;
--   returns tiers of lists of element values of the given length.
--   
--   <pre>
--   listsOfLength 3 [[0],[1],[2],[3],[4]...] =
--     [ [[0,0,0]]
--     , [[0,0,1],[0,1,0],[1,0,0]]
--     , [[0,0,2],[0,1,1],[0,2,0],[1,0,1],[1,1,0],[2,0,0]]
--     , ...
--     ]
--   </pre>
listsOfLength :: () => Int -> [[a]] -> [[[a]]]

-- | Takes as argument tiers of element values; returns tiers of
--   size-ordered lists of elements without repetition.
--   
--   <pre>
--   setsOf [[0],[1],[2],...] =
--     [ [[]]
--     , [[0]]
--     , [[1]]
--     , [[0,1],[2]]
--     , [[0,2],[3]]
--     , [[0,3],[1,2],[4]]
--     , [[0,1,2],[0,4],[1,3],[5]]
--     , ...
--     ]
--   </pre>
--   
--   Can be used in the constructor of specialized <a>Listable</a>
--   instances. For <a>Set</a> (from <a>Data.Set</a>), we would have:
--   
--   <pre>
--   instance Listable a =&gt; Listable (Set a) where
--     tiers = mapT fromList $ setsOf tiers
--   </pre>
setsOf :: () => [[a]] -> [[[a]]]

-- | Takes as argument tiers of element values; returns tiers of
--   size-ordered lists of elements possibly with repetition.
--   
--   <pre>
--   bagsOf [[0],[1],[2],...] =
--     [ [[]]
--     , [[0]]
--     , [[0,0],[1]]
--     , [[0,0,0],[0,1],[2]]
--     , [[0,0,0,0],[0,0,1],[0,2],[1,1],[3]]
--     , [[0,0,0,0,0],[0,0,0,1],[0,0,2],[0,1,1],[0,3],[1,2],[4]]
--     , ...
--     ]
--   </pre>
bagsOf :: () => [[a]] -> [[[a]]]

-- | Takes as argument tiers of element values; returns tiers of lists with
--   no repeated elements.
--   
--   <pre>
--   noDupListsOf [[0],[1],[2],...] ==
--     [ [[]]
--     , [[0]]
--     , [[1]]
--     , [[0,1],[1,0],[2]]
--     , [[0,2],[2,0],[3]]
--     , ...
--     ]
--   </pre>
noDupListsOf :: () => [[a]] -> [[[a]]]

-- | Normalizes tiers by removing up to 12 empty tiers from the end of a
--   list of tiers.
--   
--   <pre>
--   normalizeT [xs0,xs1,...,xsN,[]]     =  [xs0,xs1,...,xsN]
--   normalizeT [xs0,xs1,...,xsN,[],[]]  =  [xs0,xs1,...,xsN]
--   </pre>
--   
--   The arbitrary limit of 12 tiers is necessary as this function would
--   loop if there is an infinite trail of empty tiers.
normalizeT :: () => [[a]] -> [[a]]

-- | Delete the first occurence of an element in a tier.
--   
--   For normalized lists-of-tiers without repetitions, the following
--   holds:
--   
--   <pre>
--   deleteT x = normalizeT . (`suchThat` (/= x))
--   </pre>
deleteT :: Eq a => a -> [[a]] -> [[a]]

-- | Takes the product of N lists of tiers, producing lists of length N.
--   
--   Alternatively, takes as argument a list of lists of tiers of elements;
--   returns lists combining elements of each list of tiers.
--   
--   <pre>
--   products [xss] = mapT (:[]) xss
--   products [xss,yss] = mapT (\(x,y) -&gt; [x,y]) (xss &gt;&lt; yss)
--   products [xss,yss,zss] = product3With (\x y z -&gt; [x,y,z]) xss yss zss
--   </pre>
products :: () => [[[a]]] -> [[[a]]]

-- | Takes as argument tiers of element values; returns tiers of lists of
--   elements.
--   
--   <pre>
--   listsOf [[]] == [[[]]]
--   </pre>
--   
--   <pre>
--   listsOf [[x]] == [ [[]]
--                    , [[x]]
--                    , [[x,x]]
--                    , [[x,x,x]]
--                    , ...
--                    ]
--   </pre>
--   
--   <pre>
--   listsOf [[x],[y]] == [ [[]]
--                        , [[x]]
--                        , [[x,x],[y]]
--                        , [[x,x,x],[x,y],[y,x]]
--                        , ...
--                        ]
--   </pre>
listsOf :: () => [[a]] -> [[[a]]]

-- | Take the product of lists of tiers by a function returning a
--   <a>Maybe</a> value discarding <a>Nothing</a> values.
productMaybeWith :: () => a -> b -> Maybe c -> [[a]] -> [[b]] -> [[c]]

-- | Like <a>productWith</a>, but over 3 lists of tiers.
product3With :: () => a -> b -> c -> d -> [[a]] -> [[b]] -> [[c]] -> [[d]]

-- | Given a constructor that takes a list with no duplicate elements,
--   return tiers of applications of this constructor.
noDupListCons :: Listable a => [a] -> b -> [[b]]

-- | Given a constructor that takes a map of elements (encoded as a list),
--   lists tiers of applications of this constructor
--   
--   So long as the underlying <a>Listable</a> enumerations have no
--   repetitions, this will generate no repetitions.
--   
--   This allows defining an efficient implementation of <a>tiers</a> that
--   does not repeat maps given by:
--   
--   <pre>
--   tiers = mapCons fromList
--   </pre>
mapCons :: (Listable a, Listable b) => [(a, b)] -> c -> [[c]]

-- | Given a constructor that takes a set of elements (as a list), lists
--   tiers of applications of this constructor.
--   
--   A naive <a>Listable</a> instance for the <a>Set</a> (of
--   <a>Data.Set</a>) would read:
--   
--   <pre>
--   instance Listable a =&gt; Listable (Set a) where
--     tiers = cons0 empty \/ cons2 insert
--   </pre>
--   
--   The above instance has a problem: it generates repeated sets. A more
--   efficient implementation that does not repeat sets is given by:
--   
--   <pre>
--   tiers = setCons fromList
--   </pre>
--   
--   Alternatively, you can use <a>setsOf</a> direclty.
setCons :: Listable a => [a] -> b -> [[b]]

-- | Given a constructor that takes a bag of elements (as a list), lists
--   tiers of applications of this constructor.
--   
--   For example, a <tt>Bag</tt> represented as a list.
--   
--   <pre>
--   bagCons Bag
--   </pre>
bagCons :: Listable a => [a] -> b -> [[b]]

-- | Derives a <a>Listable</a> instance for a given type <a>Name</a>
--   cascading derivation of type arguments as well.
--   
--   Consider the following series of datatypes:
--   
--   <pre>
--   data Position = CEO | Manager | Programmer
--   
--   data Person = Person
--               { name :: String
--               , age :: Int
--               , position :: Position
--               }
--   
--   data Company = Company
--                { name :: String
--                , employees :: [Person]
--                }
--   </pre>
--   
--   Writing
--   
--   <pre>
--   deriveListableCascading ''Company
--   </pre>
--   
--   will automatically derive the following three <a>Listable</a>
--   instances:
--   
--   <pre>
--   instance Listable Position where
--     tiers = cons0 CEO \/ cons0 Manager \/ cons0 Programmer
--   
--   instance Listable Person where
--     tiers = cons3 Person
--   
--   instance Listable Company where
--     tiers = cons2 Company
--   </pre>
deriveListableCascading :: Name -> DecsQ

-- | Derives a <a>Listable</a> instance for a given type <a>Name</a>.
--   
--   Consider the following <tt>Stack</tt> datatype:
--   
--   <pre>
--   data Stack a = Stack a (Stack a) | Empty
--   </pre>
--   
--   Writing
--   
--   <pre>
--   deriveListable ''Stack
--   </pre>
--   
--   will automatically derive the following <a>Listable</a> instance:
--   
--   <pre>
--   instance Listable a =&gt; Listable (Stack a) where
--     tiers = cons2 Stack \/ cons0 Empty
--   </pre>
--   
--   <b>Warning:</b> if the values in your type need to follow a data
--   invariant, the derived instance won't respect it. Use this only on
--   "free" datatypes.
--   
--   Needs the <tt>TemplateHaskell</tt> extension.
deriveListable :: Name -> DecsQ

-- | Adds to the weight of tiers of a constructor
--   
--   <a>addWeight</a> is closely related to <a>delay</a>.
addWeight :: () => [[a]] -> Int -> [[a]]

-- | Resets the weight of a constructor (or tiers) Typically used as an
--   infix constructor when defining Listable instances:
--   
--   <pre>
--   cons&lt;N&gt; `ofWeight` &lt;W&gt;
--   </pre>
--   
--   Be careful: do not apply <tt><a>ofWeight</a> 0</tt> to recursive data
--   structure constructors. In general this will make the list of size 0
--   infinite, breaking the tier invariant (each tier must be finite).
--   
--   <a>ofWeight</a> is closely related to <a>reset</a>.
ofWeight :: () => [[a]] -> Int -> [[a]]
cons12 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f, Listable g, Listable h, Listable i, Listable j, Listable k, Listable l) => a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> [[m]]
cons11 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f, Listable g, Listable h, Listable i, Listable j, Listable k) => a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> [[l]]
cons10 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f, Listable g, Listable h, Listable i, Listable j) => a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> [[k]]
cons9 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f, Listable g, Listable h, Listable i) => a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> [[j]]
cons8 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f, Listable g, Listable h) => a -> b -> c -> d -> e -> f -> g -> h -> i -> [[i]]
cons7 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f, Listable g) => a -> b -> c -> d -> e -> f -> g -> h -> [[h]]
cons6 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f) => a -> b -> c -> d -> e -> f -> g -> [[g]]

-- | Boolean implication operator. Useful for defining conditional
--   properties:
--   
--   <pre>
--   prop_something x y = condition x y ==&gt; something x y
--   </pre>
(==>) :: Bool -> Bool -> Bool
infixr 0 ==>

-- | There <b>exists</b> an assignment of values that satisfies a property
--   up to a number of test values?
--   
--   <pre>
--   exists 1000 $ \x -&gt; x &gt; 10
--   </pre>
exists :: Testable a => Int -> a -> Bool

-- | Does a property <b>fail</b> for a number of test values?
--   
--   <pre>
--   fails 1000 $ \xs -&gt; xs ++ ys == ys ++ xs
--   </pre>
fails :: Testable a => Int -> a -> Bool

-- | Does a property <b>hold</b> up to a number of test values?
--   
--   <pre>
--   holds 1000 $ \xs -&gt; length (sort xs) == length xs
--   </pre>
holds :: Testable a => Int -> a -> Bool

-- | Up to a number of tests to a property, returns <a>Just</a> the first
--   witness or <a>Nothing</a> if there is none.
witness :: Testable a => Int -> a -> Maybe [String]

-- | Lists all witnesses up to a number of tests to a property,
witnesses :: Testable a => Int -> a -> [[String]]

-- | Take a tiered product of lists of tiers.
--   
--   <pre>
--   [t0,t1,t2,...] &gt;&lt; [u0,u1,u2,...] =
--   [ t0**u0
--   , t0**u1 ++ t1**u0
--   , t0**u2 ++ t1**u1 ++ t2**u0
--   , ...       ...       ...       ...
--   ]
--   where xs ** ys = [(x,y) | x &lt;- xs, y &lt;- ys]
--   </pre>
--   
--   Example:
--   
--   <pre>
--   [[0],[1],[2],...] &gt;&lt; [[0],[1],[2],...]
--   == [  [(0,0)]
--      ,  [(1,0),(0,1)]
--      ,  [(2,0),(1,1),(0,2)]
--      ,  [(3,0),(2,1),(1,2),(0,3)]
--      ...
--      ]
--   </pre>
(><) :: () => [[a]] -> [[b]] -> [[(a, b)]]
infixr 8 ><

-- | Interleave tiers --- sum of two tiers enumerations. When in doubt, use
--   <a>\/</a> instead.
--   
--   <pre>
--   [xs,ys,zs,...] \/ [as,bs,cs,...] = [xs+|as,ys+|bs,zs+|cs,...]
--   </pre>
(\\//) :: () => [[a]] -> [[a]] -> [[a]]
infixr 7 \\//

-- | Append tiers --- sum of two tiers enumerations.
--   
--   <pre>
--   [xs,ys,zs,...] \/ [as,bs,cs,...] = [xs++as,ys++bs,zs++cs,...]
--   </pre>
(\/) :: () => [[a]] -> [[a]] -> [[a]]
infixr 7 \/

-- | Lazily interleaves two lists, switching between elements of the two.
--   Union/sum of the elements in the lists.
--   
--   <pre>
--   [x,y,z] +| [a,b,c] == [x,a,y,b,z,c]
--   </pre>
(+|) :: () => [a] -> [a] -> [a]
infixr 5 +|

-- | Tiers of values that follow a property
--   
--   <pre>
--   cons&lt;N&gt; `suchThat` condition
--   </pre>
suchThat :: () => [[a]] -> a -> Bool -> [[a]]

-- | Resets any delays in a list-of <a>tiers</a>. Conceptually this
--   function makes a constructor "weightless", assuring the first tier is
--   non-empty. Typically used when defining Listable instances:
--   
--   <pre>
--   reset (cons&lt;N&gt; &lt;Constr&gt;)
--   </pre>
--   
--   Be careful: do not apply <tt>reset</tt> to recursive data structure
--   constructors. In general this will make the list of size 0 infinite,
--   breaking the <a>tiers</a> invariant (each tier must be finite).
reset :: () => [[a]] -> [[a]]

-- | Delays the enumeration of <a>tiers</a>. Conceptually this function
--   adds to the weight of a constructor. Typically used when defining
--   <a>Listable</a> instances:
--   
--   <pre>
--   delay (cons&lt;N&gt; &lt;Constr&gt;)
--   </pre>
delay :: () => [[a]] -> [[a]]

-- | Returns tiers of applications of a 5-argument constructor.
--   
--   <a>Test.LeanCheck.Basic</a> defines <a>cons6</a> up to <a>cons12</a>.
--   Those are exported by default from <a>Test.LeanCheck</a>, but are
--   hidden from the Haddock documentation.
cons5 :: (Listable a, Listable b, Listable c, Listable d, Listable e) => a -> b -> c -> d -> e -> f -> [[f]]

-- | Returns tiers of applications of a 4-argument constructor.
cons4 :: (Listable a, Listable b, Listable c, Listable d) => a -> b -> c -> d -> e -> [[e]]

-- | Returns tiers of applications of a 3-argument constructor.
cons3 :: (Listable a, Listable b, Listable c) => a -> b -> c -> d -> [[d]]

-- | Given a constructor with two <a>Listable</a> arguments, return
--   <a>tiers</a> of applications of this constructor. By default, returned
--   values will have size/weight of 1.
cons2 :: (Listable a, Listable b) => a -> b -> c -> [[c]]

-- | Given a constructor with one <a>Listable</a> argument, return
--   <a>tiers</a> of applications of this constructor. By default, returned
--   values will have size/weight of 1.
cons1 :: Listable a => a -> b -> [[b]]

-- | Given a constructor with no arguments, returns <a>tiers</a> of all
--   possible applications of this constructor. Since in this case there is
--   only one possible application (to no arguments), only a single value,
--   of size/weight 0, will be present in the resulting list of tiers.
cons0 :: () => a -> [[a]]

-- | <a>concatMap</a> over tiers
concatMapT :: () => a -> [[b]] -> [[a]] -> [[b]]

-- | <a>concat</a> tiers of tiers
concatT :: () => [[[[a]]]] -> [[a]]

-- | <a>filter</a> tiers
filterT :: () => a -> Bool -> [[a]] -> [[a]]

-- | <a>map</a> over tiers
mapT :: () => a -> b -> [[a]] -> [[b]]

-- | Tiers of <a>Fractional</a> values. This can be used as the
--   implementation of <a>tiers</a> for <a>Fractional</a> types.
tiersFractional :: Fractional a => [[a]]

-- | Tiers of <a>Integral</a> values. Can be used as a default
--   implementation of <a>list</a> for <a>Integral</a> types.
listIntegral :: (Enum a, Num a) => [a]

-- | Takes a list of values <tt>xs</tt> and transform it into tiers on
--   which each tier is occupied by a single element from <tt>xs</tt>.
--   
--   To convert back to a list, just <a>concat</a>.
toTiers :: () => [a] -> [[a]]

-- | A type is <a>Listable</a> when there exists a function that is able to
--   list (ideally all of) its values.
--   
--   Ideally, instances should be defined by a <a>tiers</a> function that
--   returns a (potentially infinite) list of finite sub-lists (tiers): the
--   first sub-list contains elements of size 0, the second sub-list
--   contains elements of size 1 and so on. Size here is defined by the
--   implementor of the type-class instance.
--   
--   For algebraic data types, the general form for <a>tiers</a> is
--   
--   <pre>
--   tiers = cons&lt;N&gt; ConstructorA
--        \/ cons&lt;N&gt; ConstructorB
--        \/ ...
--        \/ cons&lt;N&gt; ConstructorZ
--   </pre>
--   
--   where <tt>N</tt> is the number of arguments of each constructor
--   <tt>A...Z</tt>.
--   
--   Instances can be alternatively defined by <a>list</a>. In this case,
--   each sub-list in <a>tiers</a> is a singleton list (each succeeding
--   element of <a>list</a> has +1 size).
--   
--   The function <a>deriveListable</a> from <a>Test.LeanCheck.Derive</a>
--   can automatically derive instances of this typeclass.
--   
--   A <a>Listable</a> instance for functions is also available but is not
--   exported by default. Import <a>Test.LeanCheck.Function</a> if you need
--   to test higher-order properties.
class Listable a
tiers :: Listable a => [[a]]
list :: Listable a => [a]

-- | Extrapolate can generalize counter-examples of any types that are
--   <a>Generalizable</a>.
--   
--   The core (and only required functions) of the generalizable typeclass
--   are the <a>expr</a> and <a>instances</a> functions.
--   
--   The following example shows a datatype and its instance:
--   
--   <pre>
--   data Stack a = Stack a (Stack a) | Empty
--   </pre>
--   
--   <pre>
--   instance Generalizable a =&gt; Generalizable (Stack a) where
--   name _ = "s"
--   expr s@(Stack x y) = constant "Stack" (Stack -&gt;&gt;: s) :$ expr x :$ expr y
--   expr s@Empty       = constant "Empty" (Empty   -: s)
--   instances s = this s $ instances (argTy1of1 s)
--   </pre>
--   
--   To declare <a>instances</a> and <a>expr</a> it may be useful to use:
--   
--   <ul>
--   <li>LeanCheck's <a>Test.LeanCheck.Utils.TypeBinding</a> operators:
--   <a>-:</a>, <a>-&gt;:</a>, <a>-&gt;&gt;:</a>, ...;</li>
--   <li>Extrapolate's <a>Test.Extrapolate.TypeBinding</a> operators:
--   <a>argTy1of1</a>, <a>argTy1of2</a>, <a>argTy2of2</a>, ....</li>
--   </ul>
class (Listable a, Typeable a, Show a) => Generalizable a

-- | Transforms a value into an manipulable expression tree. See
--   <a>constant</a> and <a>:$</a>.
expr :: Generalizable a => a -> Expr

-- | Common name for a variable, defaults to <tt>"x"</tt>.
name :: Generalizable a => a -> String

-- | List of symbols allowed to appear in side-conditions. Defaults to
--   <tt>[]</tt>. See <a>constant</a>.
background :: Generalizable a => a -> [Expr]

-- | Computes a list of reified instances. See <a>this</a>.
instances :: Generalizable a => a -> Instances -> Instances
this :: Generalizable a => a -> (Instances -> Instances) -> Instances -> Instances
backgroundWith :: Typeable a => [Expr] -> a -> Instances
(+++) :: Ord a => [a] -> [a] -> [a]
infixr 5 +++
backgroundOf :: Generalizable a => a -> [Expr]
bgEq :: (Eq a, Generalizable a) => a -> [Expr]
bgOrd :: (Ord a, Generalizable a) => a -> [Expr]
bgEqWith1 :: (Generalizable a, Generalizable b) => ((b -> b -> Bool) -> a -> a -> Bool) -> [Expr]
bgEqWith2 :: (Generalizable a, Generalizable b, Generalizable c) => ((b -> b -> Bool) -> (c -> c -> Bool) -> a -> a -> Bool) -> [Expr]
data Option
MaxTests :: Int -> Option
ExtraInstances :: Instances -> Option
MaxConditionSize :: Int -> Option
MinFailures :: (Ratio Int) -> Option
MaxSpeculateSize :: (Maybe Int) -> Option
ConditionBound :: (Maybe Int) -> Option
ConstantBound :: (Maybe Int) -> Option
DepthBound :: (Maybe Int) -> Option
data WithOption a
With :: a -> Option -> WithOption a
[property] :: WithOption a -> a
[option] :: WithOption a -> Option
maxTests :: Testable a => a -> Int
extraInstances :: Testable a => a -> Instances
maxConditionSize :: Testable a => a -> Int
hasEq :: Generalizable a => a -> Bool
(*==*) :: Generalizable a => a -> a -> Bool
(*/=*) :: Generalizable a => a -> a -> Bool
(*<=*) :: Generalizable a => a -> a -> Bool
(*<*) :: Generalizable a => a -> a -> Bool
tBackground :: Testable a => a -> [Expr]
counterExamples :: Testable a => Int -> a -> [[Expr]]
counterExampleGen :: Testable a => Int -> a -> Maybe ([Expr], Maybe [Expr])
counterExampleGens :: Testable a => Int -> a -> Maybe ([Expr], [[Expr]])
generalizations :: Instances -> [Expr] -> [[Expr]]
generalizationsCE :: Testable a => Int -> a -> [Expr] -> [[Expr]]
generalizationsCEC :: Testable a => a -> [Expr] -> [(Expr, [Expr])]
generalizationsCounts :: Testable a => Int -> a -> [Expr] -> [([Expr], Int)]
atoms :: Testable a => a -> [[Expr]]
theoryAndReprExprs :: Testable a => a -> (Thy, [Expr])
theoryAndReprConds :: Testable a => a -> (Thy, [Expr])
candidateConditions :: Testable a => (Thy, [Expr]) -> a -> [Expr] -> [Expr]
validConditions :: Testable a => (Thy, [Expr]) -> a -> [Expr] -> [(Expr, Int)]
weakestCondition :: Testable a => (Thy, [Expr]) -> a -> [Expr] -> Expr
getBackground :: Instances -> [Expr]
fullInstances :: Testable a => a -> Instances

-- | List matches of lists of expressions if possible
--   
--   <pre>
--   [0,1]   `matchList` [x,y]   = Just [x=0, y=1]
--   [0,1+2] `matchList` [x,y+y] = Nothing
--   </pre>
matchList :: [Expr] -> [Expr] -> Maybe Binds
newMatches :: [Expr] -> [Expr] -> Maybe Binds
class Testable a
resultiers :: Testable a => a -> [[([Expr], Bool)]]
($-|) :: Testable a => a -> [Expr] -> Bool
tinstances :: Testable a => a -> Instances
options :: Testable a => a -> Options
results :: Testable a => a -> [([Expr], Bool)]
areInstancesOf :: [Expr] -> [Expr] -> Bool
instance GHC.Show.Show Test.Extrapolate.Core.Option
instance Test.Extrapolate.Core.Testable a => Test.Extrapolate.Core.Testable (Test.Extrapolate.Core.WithOption a)
instance Test.Extrapolate.Core.Testable GHC.Types.Bool
instance (Test.Extrapolate.Core.Testable b, Test.Extrapolate.Core.Generalizable a, Test.LeanCheck.Core.Listable a) => Test.Extrapolate.Core.Testable (a -> b)
instance Test.Extrapolate.Core.Generalizable ()
instance Test.Extrapolate.Core.Generalizable GHC.Types.Bool
instance Test.Extrapolate.Core.Generalizable GHC.Types.Int
instance Test.Extrapolate.Core.Generalizable GHC.Integer.Type.Integer
instance Test.Extrapolate.Core.Generalizable GHC.Types.Char
instance Test.Extrapolate.Core.Generalizable a => Test.Extrapolate.Core.Generalizable (GHC.Base.Maybe a)
instance (Test.Extrapolate.Core.Generalizable a, Test.Extrapolate.Core.Generalizable b) => Test.Extrapolate.Core.Generalizable (Data.Either.Either a b)
instance (Test.Extrapolate.Core.Generalizable a, Test.Extrapolate.Core.Generalizable b) => Test.Extrapolate.Core.Generalizable (a, b)
instance (Test.Extrapolate.Core.Generalizable a, Test.Extrapolate.Core.Generalizable b, Test.Extrapolate.Core.Generalizable c) => Test.Extrapolate.Core.Generalizable (a, b, c)
instance (Test.Extrapolate.Core.Generalizable a, Test.Extrapolate.Core.Generalizable b, Test.Extrapolate.Core.Generalizable c, Test.Extrapolate.Core.Generalizable d) => Test.Extrapolate.Core.Generalizable (a, b, c, d)
instance Test.Extrapolate.Core.Generalizable a => Test.Extrapolate.Core.Generalizable [a]
instance Test.Extrapolate.Core.Generalizable GHC.Types.Ordering


-- | This module is otherwise unused in the code.
--   
--   This is a stub of a new algorithm that is smarter and generalizes from
--   several initial counter-examples rather than just one.
--   
--   When this gets finished, it should be moved into
--   <a>Test.Extrapolate.Core</a>.
module Test.Extrapolate.New
generalizedCounterExamples :: Testable a => Int -> a -> [Exprs]
lgg :: Exprs -> Exprs -> Exprs

-- | Computes the least general generalization of two expressions
--   
--   <pre>
--   lgg1 (expr [0,0]) (expr [1,1])
--   </pre>
--   
--   <ul>
--   <li><i>_,_</i> :: [Int] (holes: Int, Int) &gt; lgg1 (expr [1,1::Int])
--   (expr [2,2,2::Int]) _:_:_ :: [Int] (holes: Int, Int, [Int])</li>
--   </ul>
lgg1 :: Expr -> Expr -> Expr


-- | This module is part of Extrapolate, a library for generalization of
--   counter-examples.
--   
--   QuickCheck-like interface.
module Test.Extrapolate.IO

-- | Checks a property printing results on <tt>stdout</tt>
--   
--   <pre>
--   &gt; check $ \xs -&gt; sort (sort xs) == sort (xs::[Int])
--   +++ OK, passed 360 tests.
--   
--   &gt; check $ \xs ys -&gt; xs `union` ys == ys `union` (xs::[Int])
--   *** Failed! Falsifiable (after 4 tests):
--   [] [0,0]
--   
--   Generalization:
--   [] (x:x:_)
--   </pre>
check :: Testable a => a -> IO ()

-- | Check a property printing results on <tt>stdout</tt> and returning
--   <a>True</a> on success.
--   
--   There is no option to silence this function: for silence, you should
--   use <a>holds</a>.
checkResult :: Testable a => a -> IO Bool

-- | Use <tt><a>for</a></tt> to configure the number of tests performed by
--   <tt>check</tt>.
--   
--   <pre>
--   &gt; check `for` 10080 $ \xs -&gt; sort (sort xs) == sort (xs :: [Int])
--   +++ OK, passed 10080 tests.
--   </pre>
--   
--   Don't forget the dollar (<tt>$</tt>)!
for :: Testable a => (WithOption a -> b) -> Int -> a -> b

-- | Allows the user to customize instance information available when
--   generalized. (For advanced users.)
withInstances :: Testable a => (WithOption a -> b) -> Instances -> a -> b

-- | Use <tt><a>withBackground</a></tt> to provide additional functions to
--   appear in side-conditions.
--   
--   <pre>
--   check `withBackground` [constant "isSpace" isSpace] $ \xs -&gt; unwords (words xs) == xs
--   *** Failed! Falsifiable (after 4 tests):
--   " "
--   
--   Generalization:
--   ' ':_
--   
--   Conditional Generalization:
--   c:_  when  isSpace c
--   </pre>
withBackground :: Testable a => (WithOption a -> b) -> [Expr] -> a -> b

-- | Use <tt><a>withConditionSize</a></tt> to configure the maximum
--   condition size allowed.
withConditionSize :: Testable a => (WithOption a -> b) -> Int -> a -> b

-- | Use <tt><a>minFailures</a></tt> to configure the minimum number of
--   failures for a conditional generalization in function of the maximum
--   number of tests.
--   
--   To set that conditional generalizations should fail for 10% of cases:
--   &gt; check <a>minFailures</a> (<a>div</a> 10) $ prop
--   
--   To set that conditional generalizations should fail for 5% of cases:
--   &gt; check <a>minFailures</a> (<a>div</a> 20) $ prop
minFailures :: Testable a => (WithOption a -> b) -> Ratio Int -> a -> b
maxSpeculateSize :: Testable a => (WithOption a -> b) -> Maybe Int -> a -> b
conditionBound :: Testable a => (WithOption a -> b) -> Maybe Int -> a -> b

-- | Configures a bound on the number of constants allowed in expressions
--   that are considered when testing for equality in Speculate.
--   
--   Defaults to 2.
constantBound :: Testable a => (WithOption a -> b) -> Maybe Int -> a -> b

-- | Configures a bound on the depth of expressions that are considered
--   when testing for equality in Speculate.
--   
--   Default to 3.
depthBound :: Testable a => (WithOption a -> b) -> Maybe Int -> a -> b
instance GHC.Show.Show Test.Extrapolate.IO.Result
instance GHC.Classes.Eq Test.Extrapolate.IO.Result


-- | This module is part of Extrapolate, a library for generalization of
--   counter-examples.
--   
--   This is a module for deriving <a>Generalizable</a> instances.
--   
--   Needs GHC and Template Haskell (tested on GHC 8.0).
--   
--   If Extrapolate does not compile under later GHCs, this module is the
--   probable culprit.
module Test.Extrapolate.Derive

-- | Derives a <a>Generalizable</a> instance for a given type <a>Name</a>.
--   
--   Consider the following <tt>Stack</tt> datatype:
--   
--   <pre>
--   data Stack a = Stack a (Stack a) | Empty
--   </pre>
--   
--   Writing
--   
--   <pre>
--   deriveGeneralizable ''Stack
--   </pre>
--   
--   will automatically derive the following <a>Generalizable</a> instance:
--   
--   <pre>
--   instance Generalizable a =&gt; Generalizable (Stack a) where
--     expr s@(Stack x y) = constant "Stack" (Stack -&gt;&gt;: s) :$ expr x :$ expr y
--     expr s@Empty       = constant "Empty" (Empty   -: s)
--     instances s = this "s" s
--                 $ let Stack x y = Stack undefined undefined `asTypeOf` s
--                   in instances x
--                    . instances y
--   </pre>
--   
--   This function needs the <tt>TemplateHaskell</tt> extension.
deriveGeneralizable :: Name -> DecsQ

-- | Same as <a>deriveGeneralizable</a> but does not warn when instance
--   already exists (<a>deriveGeneralizable</a> is preferable).
deriveGeneralizableIfNeeded :: Name -> DecsQ

-- | Derives a <a>Generalizable</a> instance for a given type <a>Name</a>
--   cascading derivation of type arguments as well.
deriveGeneralizableCascading :: Name -> DecsQ
instance GHC.Show.Show Test.Extrapolate.Derive.Bla
instance GHC.Classes.Ord Test.Extrapolate.Derive.Bla
instance GHC.Classes.Eq Test.Extrapolate.Derive.Bla


-- | This module is part of Extrapolate, a library for generalization of
--   counter-examples.
--   
--   This provides the basic functionality of extrapolate. You will have
--   better luck importing <a>Test.Extrapolate</a> directly.
module Test.Extrapolate.Basic
instance (GHC.Real.Integral a, Test.Extrapolate.Core.Generalizable a) => Test.Extrapolate.Core.Generalizable (GHC.Real.Ratio a)
instance (Test.Extrapolate.Core.Generalizable a, Test.Extrapolate.Core.Generalizable b, Test.Extrapolate.Core.Generalizable c, Test.Extrapolate.Core.Generalizable d, Test.Extrapolate.Core.Generalizable e) => Test.Extrapolate.Core.Generalizable (a, b, c, d, e)
instance (Test.Extrapolate.Core.Generalizable a, Test.Extrapolate.Core.Generalizable b, Test.Extrapolate.Core.Generalizable c, Test.Extrapolate.Core.Generalizable d, Test.Extrapolate.Core.Generalizable e, Test.Extrapolate.Core.Generalizable f) => Test.Extrapolate.Core.Generalizable (a, b, c, d, e, f)
instance (Test.Extrapolate.Core.Generalizable a, Test.Extrapolate.Core.Generalizable b, Test.Extrapolate.Core.Generalizable c, Test.Extrapolate.Core.Generalizable d, Test.Extrapolate.Core.Generalizable e, Test.Extrapolate.Core.Generalizable f, Test.Extrapolate.Core.Generalizable g) => Test.Extrapolate.Core.Generalizable (a, b, c, d, e, f, g)
instance (Test.Extrapolate.Core.Generalizable a, Test.Extrapolate.Core.Generalizable b, Test.Extrapolate.Core.Generalizable c, Test.Extrapolate.Core.Generalizable d, Test.Extrapolate.Core.Generalizable e, Test.Extrapolate.Core.Generalizable f, Test.Extrapolate.Core.Generalizable g, Test.Extrapolate.Core.Generalizable h) => Test.Extrapolate.Core.Generalizable (a, b, c, d, e, f, g, h)


-- | Extrapolate is a property-based testing library capable of reporting
--   generalized counter-examples.
--   
--   Consider the following faulty implementation of sort:
--   
--   <pre>
--   sort :: Ord a =&gt; [a] -&gt; [a]
--   sort []      =  []
--   sort (x:xs)  =  sort (filter (&lt; x) xs)
--                ++ [x]
--                ++ sort (filter (&gt; x) xs)
--   </pre>
--   
--   When tests pass, Extrapolate works like a regular property-based
--   testing library. See:
--   
--   <pre>
--   &gt; check $ \xs -&gt; sort (sort xs :: [Int]) == sort xs
--   +++ OK, passed 360 tests.
--   </pre>
--   
--   When tests fail, Extrapolate reports a fully defined counter-example
--   and a generalization of failing inputs. See:
--   
--   <pre>
--   &gt; &gt; check $ \xs -&gt; length (sort xs :: [Int]) == length xs
--   *** Failed! Falsifiable (after 3 tests):
--   [0,0]
--   
--   Generalization:
--   x:x:_
--   </pre>
--   
--   The property fails for any integer <tt>x</tt> and for any list
--   <tt>_</tt> at the tail.
module Test.Extrapolate

-- | Checks a property printing results on <tt>stdout</tt>
--   
--   <pre>
--   &gt; check $ \xs -&gt; sort (sort xs) == sort (xs::[Int])
--   +++ OK, passed 360 tests.
--   
--   &gt; check $ \xs ys -&gt; xs `union` ys == ys `union` (xs::[Int])
--   *** Failed! Falsifiable (after 4 tests):
--   [] [0,0]
--   
--   Generalization:
--   [] (x:x:_)
--   </pre>
check :: Testable a => a -> IO ()

-- | Check a property printing results on <tt>stdout</tt> and returning
--   <a>True</a> on success.
--   
--   There is no option to silence this function: for silence, you should
--   use <a>holds</a>.
checkResult :: Testable a => a -> IO Bool

-- | Use <tt><a>for</a></tt> to configure the number of tests performed by
--   <tt>check</tt>.
--   
--   <pre>
--   &gt; check `for` 10080 $ \xs -&gt; sort (sort xs) == sort (xs :: [Int])
--   +++ OK, passed 10080 tests.
--   </pre>
--   
--   Don't forget the dollar (<tt>$</tt>)!
for :: Testable a => (WithOption a -> b) -> Int -> a -> b

-- | Use <tt><a>withBackground</a></tt> to provide additional functions to
--   appear in side-conditions.
--   
--   <pre>
--   check `withBackground` [constant "isSpace" isSpace] $ \xs -&gt; unwords (words xs) == xs
--   *** Failed! Falsifiable (after 4 tests):
--   " "
--   
--   Generalization:
--   ' ':_
--   
--   Conditional Generalization:
--   c:_  when  isSpace c
--   </pre>
withBackground :: Testable a => (WithOption a -> b) -> [Expr] -> a -> b

-- | Use <tt><a>withConditionSize</a></tt> to configure the maximum
--   condition size allowed.
withConditionSize :: Testable a => (WithOption a -> b) -> Int -> a -> b

-- | Use <tt><a>minFailures</a></tt> to configure the minimum number of
--   failures for a conditional generalization in function of the maximum
--   number of tests.
--   
--   To set that conditional generalizations should fail for 10% of cases:
--   &gt; check <a>minFailures</a> (<a>div</a> 10) $ prop
--   
--   To set that conditional generalizations should fail for 5% of cases:
--   &gt; check <a>minFailures</a> (<a>div</a> 20) $ prop
minFailures :: Testable a => (WithOption a -> b) -> Ratio Int -> a -> b

-- | Extrapolate can generalize counter-examples of any types that are
--   <a>Generalizable</a>.
--   
--   The core (and only required functions) of the generalizable typeclass
--   are the <a>expr</a> and <a>instances</a> functions.
--   
--   The following example shows a datatype and its instance:
--   
--   <pre>
--   data Stack a = Stack a (Stack a) | Empty
--   </pre>
--   
--   <pre>
--   instance Generalizable a =&gt; Generalizable (Stack a) where
--   name _ = "s"
--   expr s@(Stack x y) = constant "Stack" (Stack -&gt;&gt;: s) :$ expr x :$ expr y
--   expr s@Empty       = constant "Empty" (Empty   -: s)
--   instances s = this s $ instances (argTy1of1 s)
--   </pre>
--   
--   To declare <a>instances</a> and <a>expr</a> it may be useful to use:
--   
--   <ul>
--   <li>LeanCheck's <a>Test.LeanCheck.Utils.TypeBinding</a> operators:
--   <a>-:</a>, <a>-&gt;:</a>, <a>-&gt;&gt;:</a>, ...;</li>
--   <li>Extrapolate's <a>Test.Extrapolate.TypeBinding</a> operators:
--   <a>argTy1of1</a>, <a>argTy1of2</a>, <a>argTy2of2</a>, ....</li>
--   </ul>
class (Listable a, Typeable a, Show a) => Generalizable a

-- | Transforms a value into an manipulable expression tree. See
--   <a>constant</a> and <a>:$</a>.
expr :: Generalizable a => a -> Expr

-- | Common name for a variable, defaults to <tt>"x"</tt>.
name :: Generalizable a => a -> String

-- | List of symbols allowed to appear in side-conditions. Defaults to
--   <tt>[]</tt>. See <a>constant</a>.
background :: Generalizable a => a -> [Expr]

-- | Computes a list of reified instances. See <a>this</a>.
instances :: Generalizable a => a -> Instances -> Instances
this :: Generalizable a => a -> (Instances -> Instances) -> Instances -> Instances

-- | An encoded Haskell functional-application expression for use by
--   Speculate.
data Expr
Constant :: String -> Dynamic -> Expr
Var :: String -> TypeRep -> Expr
(:$) :: Expr -> Expr -> Expr

-- | Encode a constant Haskell expression for use by Speculate. It takes a
--   string representation of a value and a value, returning an
--   <a>Expr</a>. Examples:
--   
--   <pre>
--   constant "0" 0
--   constant "'a'" 'a'
--   constant "True" True
--   constant "id" (id :: Int -&gt; Int)
--   constant "(+)" ((+) :: Int -&gt; Int -&gt; Int)
--   constant "sort" (sort :: [Bool] -&gt; [Bool])
--   </pre>
constant :: Typeable a => String -> a -> Expr

-- | A shorthand for <a>constant</a> to be used on values that are
--   <a>Show</a> instances. Examples:
--   
--   <pre>
--   showConstant 0     =  constant "0" 0
--   showConstant 'a'   =  constant "'a'" 'a' 
--   showConstant True  =  constant "True" True
--   </pre>
showConstant :: (Typeable a, Show a) => a -> Expr
bgEq :: (Eq a, Generalizable a) => a -> [Expr]
bgOrd :: (Ord a, Generalizable a) => a -> [Expr]
class Testable a

-- | Derives a <a>Generalizable</a> instance for a given type <a>Name</a>.
--   
--   Consider the following <tt>Stack</tt> datatype:
--   
--   <pre>
--   data Stack a = Stack a (Stack a) | Empty
--   </pre>
--   
--   Writing
--   
--   <pre>
--   deriveGeneralizable ''Stack
--   </pre>
--   
--   will automatically derive the following <a>Generalizable</a> instance:
--   
--   <pre>
--   instance Generalizable a =&gt; Generalizable (Stack a) where
--     expr s@(Stack x y) = constant "Stack" (Stack -&gt;&gt;: s) :$ expr x :$ expr y
--     expr s@Empty       = constant "Empty" (Empty   -: s)
--     instances s = this "s" s
--                 $ let Stack x y = Stack undefined undefined `asTypeOf` s
--                   in instances x
--                    . instances y
--   </pre>
--   
--   This function needs the <tt>TemplateHaskell</tt> extension.
deriveGeneralizable :: Name -> DecsQ

-- | Same as <a>deriveGeneralizable</a> but does not warn when instance
--   already exists (<a>deriveGeneralizable</a> is preferable).
deriveGeneralizableIfNeeded :: Name -> DecsQ

-- | Derives a <a>Generalizable</a> instance for a given type <a>Name</a>
--   cascading derivation of type arguments as well.
deriveGeneralizableCascading :: Name -> DecsQ

-- | Takes as argument an integer length and tiers of element values;
--   returns tiers of lists of element values of the given length.
--   
--   <pre>
--   listsOfLength 3 [[0],[1],[2],[3],[4]...] =
--     [ [[0,0,0]]
--     , [[0,0,1],[0,1,0],[1,0,0]]
--     , [[0,0,2],[0,1,1],[0,2,0],[1,0,1],[1,1,0],[2,0,0]]
--     , ...
--     ]
--   </pre>
listsOfLength :: () => Int -> [[a]] -> [[[a]]]

-- | Takes as argument tiers of element values; returns tiers of
--   size-ordered lists of elements without repetition.
--   
--   <pre>
--   setsOf [[0],[1],[2],...] =
--     [ [[]]
--     , [[0]]
--     , [[1]]
--     , [[0,1],[2]]
--     , [[0,2],[3]]
--     , [[0,3],[1,2],[4]]
--     , [[0,1,2],[0,4],[1,3],[5]]
--     , ...
--     ]
--   </pre>
--   
--   Can be used in the constructor of specialized <a>Listable</a>
--   instances. For <a>Set</a> (from <a>Data.Set</a>), we would have:
--   
--   <pre>
--   instance Listable a =&gt; Listable (Set a) where
--     tiers = mapT fromList $ setsOf tiers
--   </pre>
setsOf :: () => [[a]] -> [[[a]]]

-- | Takes as argument tiers of element values; returns tiers of
--   size-ordered lists of elements possibly with repetition.
--   
--   <pre>
--   bagsOf [[0],[1],[2],...] =
--     [ [[]]
--     , [[0]]
--     , [[0,0],[1]]
--     , [[0,0,0],[0,1],[2]]
--     , [[0,0,0,0],[0,0,1],[0,2],[1,1],[3]]
--     , [[0,0,0,0,0],[0,0,0,1],[0,0,2],[0,1,1],[0,3],[1,2],[4]]
--     , ...
--     ]
--   </pre>
bagsOf :: () => [[a]] -> [[[a]]]

-- | Takes as argument tiers of element values; returns tiers of lists with
--   no repeated elements.
--   
--   <pre>
--   noDupListsOf [[0],[1],[2],...] ==
--     [ [[]]
--     , [[0]]
--     , [[1]]
--     , [[0,1],[1,0],[2]]
--     , [[0,2],[2,0],[3]]
--     , ...
--     ]
--   </pre>
noDupListsOf :: () => [[a]] -> [[[a]]]

-- | Normalizes tiers by removing up to 12 empty tiers from the end of a
--   list of tiers.
--   
--   <pre>
--   normalizeT [xs0,xs1,...,xsN,[]]     =  [xs0,xs1,...,xsN]
--   normalizeT [xs0,xs1,...,xsN,[],[]]  =  [xs0,xs1,...,xsN]
--   </pre>
--   
--   The arbitrary limit of 12 tiers is necessary as this function would
--   loop if there is an infinite trail of empty tiers.
normalizeT :: () => [[a]] -> [[a]]

-- | Delete the first occurence of an element in a tier.
--   
--   For normalized lists-of-tiers without repetitions, the following
--   holds:
--   
--   <pre>
--   deleteT x = normalizeT . (`suchThat` (/= x))
--   </pre>
deleteT :: Eq a => a -> [[a]] -> [[a]]

-- | Takes the product of N lists of tiers, producing lists of length N.
--   
--   Alternatively, takes as argument a list of lists of tiers of elements;
--   returns lists combining elements of each list of tiers.
--   
--   <pre>
--   products [xss] = mapT (:[]) xss
--   products [xss,yss] = mapT (\(x,y) -&gt; [x,y]) (xss &gt;&lt; yss)
--   products [xss,yss,zss] = product3With (\x y z -&gt; [x,y,z]) xss yss zss
--   </pre>
products :: () => [[[a]]] -> [[[a]]]

-- | Takes as argument tiers of element values; returns tiers of lists of
--   elements.
--   
--   <pre>
--   listsOf [[]] == [[[]]]
--   </pre>
--   
--   <pre>
--   listsOf [[x]] == [ [[]]
--                    , [[x]]
--                    , [[x,x]]
--                    , [[x,x,x]]
--                    , ...
--                    ]
--   </pre>
--   
--   <pre>
--   listsOf [[x],[y]] == [ [[]]
--                        , [[x]]
--                        , [[x,x],[y]]
--                        , [[x,x,x],[x,y],[y,x]]
--                        , ...
--                        ]
--   </pre>
listsOf :: () => [[a]] -> [[[a]]]

-- | Take the product of lists of tiers by a function returning a
--   <a>Maybe</a> value discarding <a>Nothing</a> values.
productMaybeWith :: () => a -> b -> Maybe c -> [[a]] -> [[b]] -> [[c]]

-- | Like <a>productWith</a>, but over 3 lists of tiers.
product3With :: () => a -> b -> c -> d -> [[a]] -> [[b]] -> [[c]] -> [[d]]

-- | Given a constructor that takes a list with no duplicate elements,
--   return tiers of applications of this constructor.
noDupListCons :: Listable a => [a] -> b -> [[b]]

-- | Given a constructor that takes a map of elements (encoded as a list),
--   lists tiers of applications of this constructor
--   
--   So long as the underlying <a>Listable</a> enumerations have no
--   repetitions, this will generate no repetitions.
--   
--   This allows defining an efficient implementation of <a>tiers</a> that
--   does not repeat maps given by:
--   
--   <pre>
--   tiers = mapCons fromList
--   </pre>
mapCons :: (Listable a, Listable b) => [(a, b)] -> c -> [[c]]

-- | Given a constructor that takes a set of elements (as a list), lists
--   tiers of applications of this constructor.
--   
--   A naive <a>Listable</a> instance for the <a>Set</a> (of
--   <a>Data.Set</a>) would read:
--   
--   <pre>
--   instance Listable a =&gt; Listable (Set a) where
--     tiers = cons0 empty \/ cons2 insert
--   </pre>
--   
--   The above instance has a problem: it generates repeated sets. A more
--   efficient implementation that does not repeat sets is given by:
--   
--   <pre>
--   tiers = setCons fromList
--   </pre>
--   
--   Alternatively, you can use <a>setsOf</a> direclty.
setCons :: Listable a => [a] -> b -> [[b]]

-- | Given a constructor that takes a bag of elements (as a list), lists
--   tiers of applications of this constructor.
--   
--   For example, a <tt>Bag</tt> represented as a list.
--   
--   <pre>
--   bagCons Bag
--   </pre>
bagCons :: Listable a => [a] -> b -> [[b]]

-- | Derives a <a>Listable</a> instance for a given type <a>Name</a>
--   cascading derivation of type arguments as well.
--   
--   Consider the following series of datatypes:
--   
--   <pre>
--   data Position = CEO | Manager | Programmer
--   
--   data Person = Person
--               { name :: String
--               , age :: Int
--               , position :: Position
--               }
--   
--   data Company = Company
--                { name :: String
--                , employees :: [Person]
--                }
--   </pre>
--   
--   Writing
--   
--   <pre>
--   deriveListableCascading ''Company
--   </pre>
--   
--   will automatically derive the following three <a>Listable</a>
--   instances:
--   
--   <pre>
--   instance Listable Position where
--     tiers = cons0 CEO \/ cons0 Manager \/ cons0 Programmer
--   
--   instance Listable Person where
--     tiers = cons3 Person
--   
--   instance Listable Company where
--     tiers = cons2 Company
--   </pre>
deriveListableCascading :: Name -> DecsQ

-- | Derives a <a>Listable</a> instance for a given type <a>Name</a>.
--   
--   Consider the following <tt>Stack</tt> datatype:
--   
--   <pre>
--   data Stack a = Stack a (Stack a) | Empty
--   </pre>
--   
--   Writing
--   
--   <pre>
--   deriveListable ''Stack
--   </pre>
--   
--   will automatically derive the following <a>Listable</a> instance:
--   
--   <pre>
--   instance Listable a =&gt; Listable (Stack a) where
--     tiers = cons2 Stack \/ cons0 Empty
--   </pre>
--   
--   <b>Warning:</b> if the values in your type need to follow a data
--   invariant, the derived instance won't respect it. Use this only on
--   "free" datatypes.
--   
--   Needs the <tt>TemplateHaskell</tt> extension.
deriveListable :: Name -> DecsQ

-- | Adds to the weight of tiers of a constructor
--   
--   <a>addWeight</a> is closely related to <a>delay</a>.
addWeight :: () => [[a]] -> Int -> [[a]]

-- | Resets the weight of a constructor (or tiers) Typically used as an
--   infix constructor when defining Listable instances:
--   
--   <pre>
--   cons&lt;N&gt; `ofWeight` &lt;W&gt;
--   </pre>
--   
--   Be careful: do not apply <tt><a>ofWeight</a> 0</tt> to recursive data
--   structure constructors. In general this will make the list of size 0
--   infinite, breaking the tier invariant (each tier must be finite).
--   
--   <a>ofWeight</a> is closely related to <a>reset</a>.
ofWeight :: () => [[a]] -> Int -> [[a]]
cons12 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f, Listable g, Listable h, Listable i, Listable j, Listable k, Listable l) => a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> [[m]]
cons11 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f, Listable g, Listable h, Listable i, Listable j, Listable k) => a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> [[l]]
cons10 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f, Listable g, Listable h, Listable i, Listable j) => a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> [[k]]
cons9 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f, Listable g, Listable h, Listable i) => a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> [[j]]
cons8 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f, Listable g, Listable h) => a -> b -> c -> d -> e -> f -> g -> h -> i -> [[i]]
cons7 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f, Listable g) => a -> b -> c -> d -> e -> f -> g -> h -> [[h]]
cons6 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f) => a -> b -> c -> d -> e -> f -> g -> [[g]]

-- | Boolean implication operator. Useful for defining conditional
--   properties:
--   
--   <pre>
--   prop_something x y = condition x y ==&gt; something x y
--   </pre>
(==>) :: Bool -> Bool -> Bool
infixr 0 ==>

-- | There <b>exists</b> an assignment of values that satisfies a property
--   up to a number of test values?
--   
--   <pre>
--   exists 1000 $ \x -&gt; x &gt; 10
--   </pre>
exists :: Testable a => Int -> a -> Bool

-- | Does a property <b>fail</b> for a number of test values?
--   
--   <pre>
--   fails 1000 $ \xs -&gt; xs ++ ys == ys ++ xs
--   </pre>
fails :: Testable a => Int -> a -> Bool

-- | Does a property <b>hold</b> up to a number of test values?
--   
--   <pre>
--   holds 1000 $ \xs -&gt; length (sort xs) == length xs
--   </pre>
holds :: Testable a => Int -> a -> Bool

-- | Up to a number of tests to a property, returns <a>Just</a> the first
--   witness or <a>Nothing</a> if there is none.
witness :: Testable a => Int -> a -> Maybe [String]

-- | Lists all witnesses up to a number of tests to a property,
witnesses :: Testable a => Int -> a -> [[String]]

-- | Take a tiered product of lists of tiers.
--   
--   <pre>
--   [t0,t1,t2,...] &gt;&lt; [u0,u1,u2,...] =
--   [ t0**u0
--   , t0**u1 ++ t1**u0
--   , t0**u2 ++ t1**u1 ++ t2**u0
--   , ...       ...       ...       ...
--   ]
--   where xs ** ys = [(x,y) | x &lt;- xs, y &lt;- ys]
--   </pre>
--   
--   Example:
--   
--   <pre>
--   [[0],[1],[2],...] &gt;&lt; [[0],[1],[2],...]
--   == [  [(0,0)]
--      ,  [(1,0),(0,1)]
--      ,  [(2,0),(1,1),(0,2)]
--      ,  [(3,0),(2,1),(1,2),(0,3)]
--      ...
--      ]
--   </pre>
(><) :: () => [[a]] -> [[b]] -> [[(a, b)]]
infixr 8 ><

-- | Interleave tiers --- sum of two tiers enumerations. When in doubt, use
--   <a>\/</a> instead.
--   
--   <pre>
--   [xs,ys,zs,...] \/ [as,bs,cs,...] = [xs+|as,ys+|bs,zs+|cs,...]
--   </pre>
(\\//) :: () => [[a]] -> [[a]] -> [[a]]
infixr 7 \\//

-- | Append tiers --- sum of two tiers enumerations.
--   
--   <pre>
--   [xs,ys,zs,...] \/ [as,bs,cs,...] = [xs++as,ys++bs,zs++cs,...]
--   </pre>
(\/) :: () => [[a]] -> [[a]] -> [[a]]
infixr 7 \/

-- | Lazily interleaves two lists, switching between elements of the two.
--   Union/sum of the elements in the lists.
--   
--   <pre>
--   [x,y,z] +| [a,b,c] == [x,a,y,b,z,c]
--   </pre>
(+|) :: () => [a] -> [a] -> [a]
infixr 5 +|

-- | Tiers of values that follow a property
--   
--   <pre>
--   cons&lt;N&gt; `suchThat` condition
--   </pre>
suchThat :: () => [[a]] -> a -> Bool -> [[a]]

-- | Resets any delays in a list-of <a>tiers</a>. Conceptually this
--   function makes a constructor "weightless", assuring the first tier is
--   non-empty. Typically used when defining Listable instances:
--   
--   <pre>
--   reset (cons&lt;N&gt; &lt;Constr&gt;)
--   </pre>
--   
--   Be careful: do not apply <tt>reset</tt> to recursive data structure
--   constructors. In general this will make the list of size 0 infinite,
--   breaking the <a>tiers</a> invariant (each tier must be finite).
reset :: () => [[a]] -> [[a]]

-- | Delays the enumeration of <a>tiers</a>. Conceptually this function
--   adds to the weight of a constructor. Typically used when defining
--   <a>Listable</a> instances:
--   
--   <pre>
--   delay (cons&lt;N&gt; &lt;Constr&gt;)
--   </pre>
delay :: () => [[a]] -> [[a]]

-- | Returns tiers of applications of a 5-argument constructor.
--   
--   <a>Test.LeanCheck.Basic</a> defines <a>cons6</a> up to <a>cons12</a>.
--   Those are exported by default from <a>Test.LeanCheck</a>, but are
--   hidden from the Haddock documentation.
cons5 :: (Listable a, Listable b, Listable c, Listable d, Listable e) => a -> b -> c -> d -> e -> f -> [[f]]

-- | Returns tiers of applications of a 4-argument constructor.
cons4 :: (Listable a, Listable b, Listable c, Listable d) => a -> b -> c -> d -> e -> [[e]]

-- | Returns tiers of applications of a 3-argument constructor.
cons3 :: (Listable a, Listable b, Listable c) => a -> b -> c -> d -> [[d]]

-- | Given a constructor with two <a>Listable</a> arguments, return
--   <a>tiers</a> of applications of this constructor. By default, returned
--   values will have size/weight of 1.
cons2 :: (Listable a, Listable b) => a -> b -> c -> [[c]]

-- | Given a constructor with one <a>Listable</a> argument, return
--   <a>tiers</a> of applications of this constructor. By default, returned
--   values will have size/weight of 1.
cons1 :: Listable a => a -> b -> [[b]]

-- | Given a constructor with no arguments, returns <a>tiers</a> of all
--   possible applications of this constructor. Since in this case there is
--   only one possible application (to no arguments), only a single value,
--   of size/weight 0, will be present in the resulting list of tiers.
cons0 :: () => a -> [[a]]

-- | <a>concatMap</a> over tiers
concatMapT :: () => a -> [[b]] -> [[a]] -> [[b]]

-- | <a>concat</a> tiers of tiers
concatT :: () => [[[[a]]]] -> [[a]]

-- | <a>filter</a> tiers
filterT :: () => a -> Bool -> [[a]] -> [[a]]

-- | <a>map</a> over tiers
mapT :: () => a -> b -> [[a]] -> [[b]]

-- | Tiers of <a>Fractional</a> values. This can be used as the
--   implementation of <a>tiers</a> for <a>Fractional</a> types.
tiersFractional :: Fractional a => [[a]]

-- | Tiers of <a>Integral</a> values. Can be used as a default
--   implementation of <a>list</a> for <a>Integral</a> types.
listIntegral :: (Enum a, Num a) => [a]

-- | Takes a list of values <tt>xs</tt> and transform it into tiers on
--   which each tier is occupied by a single element from <tt>xs</tt>.
--   
--   To convert back to a list, just <a>concat</a>.
toTiers :: () => [a] -> [[a]]

-- | A type is <a>Listable</a> when there exists a function that is able to
--   list (ideally all of) its values.
--   
--   Ideally, instances should be defined by a <a>tiers</a> function that
--   returns a (potentially infinite) list of finite sub-lists (tiers): the
--   first sub-list contains elements of size 0, the second sub-list
--   contains elements of size 1 and so on. Size here is defined by the
--   implementor of the type-class instance.
--   
--   For algebraic data types, the general form for <a>tiers</a> is
--   
--   <pre>
--   tiers = cons&lt;N&gt; ConstructorA
--        \/ cons&lt;N&gt; ConstructorB
--        \/ ...
--        \/ cons&lt;N&gt; ConstructorZ
--   </pre>
--   
--   where <tt>N</tt> is the number of arguments of each constructor
--   <tt>A...Z</tt>.
--   
--   Instances can be alternatively defined by <a>list</a>. In this case,
--   each sub-list in <a>tiers</a> is a singleton list (each succeeding
--   element of <a>list</a> has +1 size).
--   
--   The function <a>deriveListable</a> from <a>Test.LeanCheck.Derive</a>
--   can automatically derive instances of this typeclass.
--   
--   A <a>Listable</a> instance for functions is also available but is not
--   exported by default. Import <a>Test.LeanCheck.Function</a> if you need
--   to test higher-order properties.
class Listable a
tiers :: Listable a => [[a]]
list :: Listable a => [a]
