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


-- | discovery of properties about Haskell functions
--   
--   Speculate automatically discovers laws about Haskell functions. Give
--   Speculate a bunch of Haskell functions and it will discover laws like:
--   
--   <ul>
--   <li>equations, such as <tt> id x == x </tt>;</li>
--   <li>inequalities, such as <tt> 0 &lt;= x * x </tt>;</li>
--   <li>conditional equations, such as <tt> x &lt;= 0 ==&gt; x + abs x ==
--   0 </tt>.</li>
--   </ul>
@package speculate
@version 0.3.5


-- | This module is part of Speculate.
--   
--   Exports utility functions of all utils sub-modules.
--   
--   This is not intended to be used by users of Speculate, only by modules
--   of Speculate itself. Expect symbols exported here to come and go with
--   every minor version.
module Test.Speculate.Utils
undefined1 :: a
undefined2 :: a
iss :: Int -> Int -> [[Int]]
thn :: Ordering -> Ordering -> Ordering
infixr 8 `thn`
reportCountsBy :: (Eq b, Show b) => (a -> b) -> [a] -> IO ()
bell :: Int -> Int
maybesToMaybe :: [Maybe a] -> Maybe a
maybe2 :: c -> (a -> b -> c) -> Maybe a -> Maybe b -> c
iterateUntil :: (a -> a -> Bool) -> (a -> a) -> a -> a
iterateUntilLimit :: Int -> (a -> a -> Bool) -> (a -> a) -> a -> a
showRatio :: (Integral a, Show a) => Ratio a -> String
percent :: Integral a => Ratio a -> a
putLines :: [String] -> IO ()
(.:) :: (c -> d) -> (a -> b -> c) -> a -> b -> d
(..:) :: (d -> e) -> (a -> b -> c -> d) -> a -> b -> c -> e

-- | Appends two Strings side by side, line by line
--   
--   <pre>
--   beside ["asdf\nqw\n","zxvc\nas"] ==
--    "asdfzxvc\n\
--    \qw  as\n"
--   </pre>
beside :: String -> String -> String

-- | Append two Strings on top of each other, adding line breaks *when
--   needed*.
above :: String -> String -> String

-- | Formats a table. Examples:
--   
--   <pre>
--   table "l  l  l" [ ["asdf", "qwer",     "zxvc\nzxvc"]
--                   , ["0",    "1",        "2"]
--                   , ["123",  "456\n789", "3"] ] ==
--     "asdf  qwer  zxvc\n\
--     \            zxvc\n\
--     \0     1     2\n\
--     \123   456   3\n\
--     \      789\n"
--   </pre>
--   
--   <pre>
--   table "r  l  l" [ ["asdf", "qwer",     "zxvc\nzxvc"]
--                   , ["0",    "1",        "2"]
--                   , ["123",  "456\n789", "3"] ] ==
--     "asdf  qwer  zxvc\n\
--     \            zxvc\n\
--     \   0  1     2\n\
--     \ 123  456   3\n\
--     \      789\n"
--   </pre>
--   
--   <pre>
--   table "r  r  l" [ ["asdf", "qwer",     "zxvc\nzxvc"]
--                   , ["0",    "1",        "2"]
--                   , ["123",  "456\n789", "3"] ] ==
--     "asdf  qwer  zxvc\n\
--     \            zxvc\n\
--     \   0     1  2\n\
--     \ 123   456  3\n\
--     \       789\n"
--   </pre>
table :: String -> [[String]] -> String
spaces :: String -> [String]
fst3 :: (a, b, c) -> a
fst4 :: (a, b, c, d) -> a
snd3 :: (a, b, c) -> b
snd4 :: (a, b, c, d) -> b
trd3 :: (a, b, c) -> c
trd4 :: (a, b, c, d) -> c
fth4 :: (a, b, c, d) -> d
curry3 :: ((a, b, c) -> d) -> a -> b -> c -> d
curry4 :: ((a, b, c, d) -> e) -> a -> b -> c -> d -> e
uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d
uncurry4 :: (a -> b -> c -> d -> e) -> (a, b, c, d) -> e
uncurry5 :: (a -> b -> c -> d -> e -> f) -> (a, b, c, d, e) -> f
uncurry6 :: (a -> b -> c -> d -> e -> f -> g) -> (a, b, c, d, e, f) -> g
uncurry7 :: (a -> b -> c -> d -> e -> f -> g -> h) -> (a, b, c, d, e, f, g) -> h
uncurry8 :: (a -> b -> c -> d -> e -> f -> g -> h -> i) -> (a, b, c, d, e, f, g, h) -> i
uncurry9 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j) -> (a, b, c, d, e, f, g, h, i) -> j
uncurry10 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k) -> (a, b, c, d, e, f, g, h, i, j) -> k
uncurry11 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l) -> (a, b, c, d, e, f, g, h, i, j, k) -> l
uncurry12 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> m
(***) :: (a -> b) -> (c -> d) -> (a, c) -> (b, d)
catPairs :: [(a, a)] -> [a]
unquote :: String -> String
atomic :: String -> Bool
outernmostPrec :: String -> Maybe Int
isNegativeLiteral :: String -> Bool

-- | Check if a function / operator is infix
--   
--   <pre>
--   isInfix "foo"   == False
--   isInfix "(+)"   == False
--   isInfix "`foo`" == True
--   isInfix "+"     == True
--   </pre>
isInfix :: String -> Bool
isPrefix :: String -> Bool

-- | Is the string of the form <tt><tt>string</tt></tt>
isInfixedPrefix :: String -> Bool

-- | Transform an infix operator into an infix function:
--   
--   <pre>
--   toPrefix "`foo`" == "foo"
--   toPrefix "+"     == "(+)"
--   </pre>
toPrefix :: String -> String

-- | Returns the precedence of default Haskell operators
prec :: String -> Int
prime :: String -> String
primeCycle :: [String] -> [String]
namesFromTemplate :: String -> [String]
indent :: Int -> String -> String
alignRight :: Int -> String -> String
alignLeft :: Int -> String -> String
splitAtCommas :: String -> [String]
pairsThat :: (a -> a -> Bool) -> [a] -> [(a, a)]
count :: Eq a => a -> [a] -> Int
counts :: Eq a => [a] -> [(a, Int)]
countsOn :: Eq b => (a -> b) -> [a] -> [(b, Int)]
countsBy :: () => (a -> a -> Bool) -> [a] -> [(a, Int)]
firsts :: Eq a => [a] -> [a]
nubSort :: Ord a => [a] -> [a]
nubSortBy :: (a -> a -> Ordering) -> [a] -> [a]
(+++) :: Ord a => [a] -> [a] -> [a]
infixr 5 +++
nubMerge :: Ord a => [a] -> [a] -> [a]
nubMergeBy :: (a -> a -> Ordering) -> [a] -> [a] -> [a]
nubMergeOn :: Ord b => (a -> b) -> [a] -> [a] -> [a]
nubMerges :: Ord a => [[a]] -> [a]
nubMergesBy :: Ord a => (a -> a -> Ordering) -> [[a]] -> [a]
nubMergeMap :: Ord b => (a -> [b]) -> [a] -> [b]
ordIntersect :: Ord a => [a] -> [a] -> [a]
ordIntersectBy :: (a -> a -> Ordering) -> [a] -> [a] -> [a]
ordered :: Ord a => [a] -> Bool
orderedBy :: (a -> a -> Bool) -> [a] -> Bool
orderedOn :: Ord b => (a -> b) -> [a] -> Bool
strictlyOrdered :: Ord a => [a] -> Bool
strictlyOrderedOn :: Ord b => (a -> b) -> [a] -> Bool
areAll :: [a] -> (a -> Bool) -> Bool
areAny :: [a] -> (a -> Bool) -> Bool
allLater :: (a -> a -> Bool) -> [a] -> Bool

-- | <tt>xs +- ys</tt> superimposes <tt>xs</tt> over <tt>ys</tt>.
--   
--   <ul>
--   <li><i>1,2,3</i> +- [0,0,0,0,0,0,0] == [1,2,3,0,0,0,0]</li>
--   <li><i>x,y,z</i> +- [a,b,c,d,e,f,g] == [x,y,z,d,e,f,g] "asdf" +- "this
--   is a test" == "asdf is a test"</li>
--   </ul>
(+-) :: Eq a => [a] -> [a] -> [a]

-- | Sort a list by comparing the results of a key function applied to each
--   element. <tt>sortOn f</tt> is equivalent to <tt>sortBy (comparing
--   f)</tt>, but has the performance advantage of only evaluating
--   <tt>f</tt> once for each element in the input list. This is called the
--   decorate-sort-undecorate paradigm, or Schwartzian transform.
--   
--   Elements are arranged from from lowest to highest, keeping duplicates
--   in the order they appeared in the input.
--   
--   <pre>
--   &gt;&gt;&gt; sortOn fst [(2, "world"), (4, "!"), (1, "Hello")]
--   [(1,"Hello"),(2,"world"),(4,"!")]
--   </pre>
sortOn :: Ord b => (a -> b) -> [a] -> [a]
groupOn :: Eq b => (a -> b) -> [a] -> [[a]]
collectOn :: Ord b => (a -> b) -> [a] -> [[a]]
collectBy :: (a -> a -> Ordering) -> [a] -> [[a]]
collectWith :: Ord b => (a -> b) -> (a -> c) -> (b -> [c] -> d) -> [a] -> [d]
collectSndByFst :: Ord a => [(a, b)] -> [(a, [b])]
discard :: (a -> Bool) -> [a] -> [a]
discardLater :: (a -> a -> Bool) -> [a] -> [a]
discardEarlier :: (a -> a -> Bool) -> [a] -> [a]
discardOthers :: (a -> a -> Bool) -> [a] -> [a]
discardByOthers :: (a -> [a] -> Bool) -> [a] -> [a]
allUnique :: Ord a => [a] -> Bool
chain :: [a -> a] -> a -> a
zipWithReverse :: (a -> a -> b) -> [a] -> [b]
medianate :: (a -> a -> b) -> [a] -> [b]
takeGreaterHalf :: [a] -> [a]
accum :: Num a => [a] -> [a]
partitionByMarkers :: Eq a => a -> a -> [a] -> ([a], [a])
(!) :: [[a]] -> Int -> [a]
halve :: [a] -> ([a], [a])
productsList :: [[a]] -> [[a]]
mapTMaybe :: (a -> Maybe b) -> [[a]] -> [[b]]
uptoT :: Int -> [[a]] -> [a]
filterTS :: (Int -> a -> Bool) -> [[a]] -> [[a]]
discardTS :: (Int -> a -> Bool) -> [[a]] -> [[a]]
tyArity :: TypeRep -> Int

-- | 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]
unFunTy :: TypeRep -> (TypeRep, TypeRep)
isFunTy :: TypeRep -> Bool
argumentTy :: TypeRep -> TypeRep
resultTy :: TypeRep -> TypeRep
finalResultTy :: TypeRep -> TypeRep
boolTy :: TypeRep
mkEqnTy :: TypeRep -> TypeRep
funTyCon :: TyCon
compareTy :: TypeRep -> TypeRep -> Ordering

-- | Returns Nothing if value cannot be evaluated to WHNF in a given number
--   of seconds
timeoutToNothing :: RealFrac s => s -> a -> Maybe a
fromTimeout :: RealFrac s => s -> a -> a -> a
timeoutToFalse :: RealFrac s => s -> Bool -> Bool
timeoutToTrue :: RealFrac s => s -> Bool -> Bool
timeoutToError :: RealFrac s => s -> a -> a
compareIndex :: Eq a => [a] -> a -> a -> Ordering
memory :: (Listable a, Ord a) => (a -> b) -> Map a b
memory2 :: (Listable a, Listable b, Ord a, Ord b) => (a -> b -> c) -> Map (a, b) c
memoryFor :: (Listable a, Ord a) => Int -> (a -> b) -> Map a b
memory2For :: (Listable a, Listable b, Ord a, Ord b) => Int -> (a -> b -> c) -> Map (a, b) c
withMemory :: Ord a => (a -> b) -> Map a b -> a -> b
withMemory2 :: (Ord a, Ord b) => (a -> b -> c) -> Map (a, b) c -> a -> b -> c


-- | This module is part of Speculate.
--   
--   Defines the <a>Expr</a> type and basic operations on it.
module Test.Speculate.Expr.Core

-- | 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

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

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

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

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

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

-- | 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
typeCorrect :: Expr -> Bool

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

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

-- | List all variables in an expression.
vars :: Expr -> [(TypeRep, String)]

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

-- | Non-variable sub-expressions of an expression
--   
--   This includes the expression itself
subexprs :: Expr -> [Expr]

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

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

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

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

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

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

-- | Number of occurrences of a given variable name. In term rewriting
--   terms: |s|_x
countVar :: TypeRep -> String -> Expr -> Int
countVars :: Expr -> [(TypeRep, String, Int)]
unrepeatedVars :: Expr -> Bool
isAssignment :: Expr -> Bool

-- | 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

-- | 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
falseE :: Expr
showExpr :: Expr -> String
showPrecExpr :: Int -> Expr -> String
showsPrecExpr :: Int -> Expr -> String -> String
showOpExpr :: String -> Expr -> String
showsOpExpr :: String -> Expr -> String -> String
eqExprCommuting :: [Expr] -> Expr -> Expr -> Bool
instance GHC.Show.Show Test.Speculate.Expr.Core.Expr
instance GHC.Classes.Eq Test.Speculate.Expr.Core.Expr
instance GHC.Classes.Ord Test.Speculate.Expr.Core.Expr


-- | This module is part of Speculate.
--   
--   Matching expressions.
module Test.Speculate.Expr.Match
type Binds = [(String, Expr)]

-- | Fill holes in an expression. Silently skips holes that are not of the
--   right type. Silently discard remaining expressions.
fill :: Expr -> [Expr] -> 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

-- | 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

-- | 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

-- | 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

-- | 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

-- | 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 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
unify :: Expr -> Expr -> Maybe Expr
unification :: Expr -> Expr -> Maybe Binds
isInstanceOf :: Expr -> Expr -> Bool
hasInstanceOf :: Expr -> Expr -> Bool
isCanonInstanceOf :: Expr -> Expr -> Bool
hasCanonInstanceOf :: Expr -> Expr -> Bool


-- | This module is part of Speculate.
--   
--   Typeclass instance information.
module Test.Speculate.Expr.Instance

-- | Type information needed to Speculate expressions.
type Instances = [Instance]

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

-- | A quantified type representation.
type TypeRep = SomeTypeRep
ins :: (Typeable a, Listable a, Show a, Eq a, Ord a) => String -> a -> Instances
eq :: (Typeable a, Eq a) => a -> Instances
eqWith :: (Typeable a, Eq a) => (a -> a -> Bool) -> Instances
ord :: (Typeable a, Ord a) => a -> Instances
ordWith :: (Typeable a, Ord a) => (a -> a -> Bool) -> Instances
eqOrd :: (Typeable a, Eq a, Ord a) => a -> Instances
listable :: (Typeable a, Show a, Listable a) => a -> Instances
listableWith :: (Typeable a, Show a) => [[a]] -> Instances
name :: Typeable a => String -> a -> Instances
instanceType :: Instance -> TypeRep
findInfo :: (Instance -> Maybe a) -> Instances -> Maybe a
names :: Instances -> TypeRep -> [String]
eqE :: Instances -> TypeRep -> Maybe Expr
iqE :: Instances -> TypeRep -> Maybe Expr
isEq :: Instances -> TypeRep -> Bool
isEqE :: Instances -> Expr -> Bool
leE :: Instances -> TypeRep -> Maybe Expr
ltE :: Instances -> TypeRep -> Maybe Expr
isOrd :: Instances -> TypeRep -> Bool
isOrdE :: Instances -> Expr -> Bool
isEqOrd :: Instances -> TypeRep -> Bool
isEqOrdE :: Instances -> Expr -> Bool
tiersE :: Instances -> TypeRep -> [[Expr]]
isListable :: Instances -> TypeRep -> Bool
preludeInstances :: Instances
defNames :: [String]
boolTy :: TypeRep
mkEqnTy :: TypeRep -> TypeRep
instance GHC.Show.Show Test.Speculate.Expr.Instance.Instance
instance GHC.Classes.Eq Test.Speculate.Expr.Instance.Instance
instance GHC.Classes.Ord Test.Speculate.Expr.Instance.Instance


-- | This module is part of Speculate.
--   
--   This module exports smart constructors, smart destructors and queries
--   over equations, inequations and conditional equations.
module Test.Speculate.Expr.Equate
equation :: Instances -> Expr -> Expr -> Maybe Expr
unEquation :: Expr -> (Expr, Expr)
isEquation :: 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
usefulEquation :: Expr -> Bool
phonyEquation :: Expr -> Expr -> Expr
inequality :: Instances -> Expr -> Expr -> Maybe Expr
comparisonLT :: Instances -> Expr -> Expr -> Maybe Expr
comparisonLE :: Instances -> Expr -> Expr -> Maybe Expr
unComparison :: Expr -> (Expr, Expr)
implication :: Expr -> Expr -> Maybe Expr
unImplication :: Expr -> (Expr, Expr)
usefulImplication :: Expr -> Bool
conditionalEquation :: Instances -> Expr -> Expr -> Expr -> Maybe Expr
unConditionalEquation :: Expr -> (Expr, Expr, Expr)
usefulConditionalEquation :: Expr -> Bool
conditionalComparisonLT :: Instances -> Expr -> Expr -> Expr -> Maybe Expr
conditionalComparisonLE :: Instances -> Expr -> Expr -> Expr -> Maybe Expr
unConditionalComparison :: Expr -> (Expr, Expr, Expr)


-- | This module is part of Speculate.
--   
--   Generate and evaluate ground values of expressions.
module Test.Speculate.Expr.Ground

-- | List all possible valuations of an expression (potentially infinite).
--   In pseudo-Haskell:
--   
--   <pre>
--   take 3 $ grounds preludeInstances ((x + x) + y)
--     == [(0 + 0) + 0, (0 + 0) + 1, (1 + 1) + 0]
--   </pre>
grounds :: Instances -> Expr -> [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]

-- | 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)]

-- | Are two expressions equal for a given number of tests?
equal :: 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 less-than for a given number of tests?
less :: Instances -> Int -> Expr -> 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

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

-- | Is an expression ALWAYS false? This is *NOT* the same as not true
false :: Instances -> Int -> 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 under a given condition for a given number
--   of tests and a minimum amount of tests
condEqualM :: Instances -> Int -> Int -> Expr -> Expr -> Expr -> Bool

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

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


-- | This module is part of Speculate.
--   
--   Canonicalize and check canonicity of expressions.
module Test.Speculate.Expr.Canon
canonicalize :: Expr -> Expr

-- | Canonicalize variable names in an expression.
--   
--   <pre>
--   canonicalize (x + y) = (x + y)
--   canonicalize (y + x) = (x + y)
--   canonicalize (y + (z + x)) = (x + (y + z))
--   canonicalize ((w + z) + (z + x)) = ((x + y) + (y + z))
--   canonicalize (y + abs y) = (x + abs x)
--   canonicalize ((y + x) == (x + y)) = ((x + y) == (y + x))
--   </pre>
canonicalizeWith :: Instances -> Expr -> Expr
canonicalWith :: Instances -> Expr -> Bool


-- | This module is part of Speculate.
--   
--   Utilities for manipulating expressions.
module Test.Speculate.Expr


-- | This module is part of Speculate.
--   
--   Sanity checks for before running the Speculate algorithm.
module Test.Speculate.Sanity
instanceErrors :: Instances -> Int -> [TypeRep] -> [String]
eqOrdErrors :: Instances -> Int -> TypeRep -> [String]
eqErrors :: Instances -> Int -> TypeRep -> [String]
ordErrors :: Instances -> Int -> TypeRep -> [String]


-- | This module is part o Speculate.
--   
--   Orders for term rewriting and completion.
module Test.Speculate.Reason.Order

-- | Strict order between expressions as defined in TRAAT p103.
--   
--   <pre>
--   s &gt; t iff |s| &gt; |t| and , for all x in V, |s|_x &gt; |t|_x
--   </pre>
--   
--   This is perhaps the simplest order that can be used with KBC.
(|>|) :: Expr -> Expr -> Bool
infix 4 |>|

-- | Strict order between expressions loosely as defined in TRAAT p124
--   (KBO)
--   
--   Reversed K <tt>&gt;|</tt> for Knuth, sorry Bendix.
(>|) :: Expr -> Expr -> Bool
infix 4 >|
(|>) :: Expr -> Expr -> Bool
infix 4 |>
kboBy :: (Expr -> Int) -> (Expr -> Expr -> Bool) -> Expr -> Expr -> Bool

-- | Dershowitz reduction order as defined in TRAAT
--   
--   <tt>|&gt;</tt> a <a>D</a> for Dershowitz
dwoBy :: (Expr -> Expr -> Bool) -> Expr -> Expr -> Bool

-- | Weight function for kboBy:
--   
--   <ul>
--   <li>Variables weigh 1</li>
--   <li>Nullary functions weigh 1 (a.k.a. constants)</li>
--   <li>N-ary functions weigh 0</li>
--   <li>Unary functions weigh 1</li>
--   </ul>
--   
--   This is the weight when using <a>&gt;|</a>.
weight :: Expr -> Int

-- | Weight function for kboBy:
--   
--   <ul>
--   <li>Variables weigh 1</li>
--   <li>Nullary functions weigh 1 (a.k.a. constants)</li>
--   <li>N-ary functions weigh 0</li>
--   <li>Unary functions weigh 1 except for the one given as argument</li>
--   </ul>
weightExcept :: Expr -> Expr -> Int

-- | To be used alongside weightExcept
gtExcept :: (Expr -> Expr -> Bool) -> Expr -> Expr -> Expr -> Bool


-- | This module is part of Speculate.
--   
--   Equational reasoning for <a>Expr</a>s based on term rewriting.
module Test.Speculate.Reason
data Thy
Thy :: [Rule] -> [Equation] -> (Expr -> Expr -> Bool) -> (Expr -> Expr -> Ordering) -> Int -> (Expr -> Bool) -> Thy
[rules] :: Thy -> [Rule]
[equations] :: Thy -> [Equation]

-- | should be compatible with compareE
[canReduceTo] :: Thy -> Expr -> Expr -> Bool

-- | total order used to "sort" equations
[compareE] :: Thy -> Expr -> Expr -> Ordering
[closureLimit] :: Thy -> Int
[keepE] :: Thy -> Expr -> Bool
emptyThy :: Thy
normalize :: Thy -> Expr -> Expr
normalizeE :: Thy -> Expr -> Expr
isNormal :: Thy -> Expr -> Bool
complete :: Thy -> Thy
equivalent :: Thy -> Expr -> Expr -> Bool
equivalentInstance :: Thy -> Expr -> Expr -> Bool
insert :: Equation -> Thy -> Thy
showThy :: Thy -> String
printThy :: Thy -> IO ()
keepUpToLength :: Int -> Expr -> Bool
keepMaxOf :: [Equation] -> Expr -> Bool
(|==|) :: Thy -> Thy -> Bool
infix 4 |==|
theorize :: [Equation] -> Thy
theorizeBy :: (Expr -> Expr -> Bool) -> [Equation] -> Thy
finalEquations :: (Equation -> Bool) -> Instances -> Thy -> [Equation]
criticalPairs :: Thy -> [(Expr, Expr)]
normalizedCriticalPairs :: Thy -> [(Expr, Expr)]
append :: Thy -> [Equation] -> Thy
difference :: Thy -> Thy -> Thy
okThy :: Thy -> Bool
canonicalEqn :: Thy -> Equation -> Bool
canonicalRule :: Rule -> Bool
canonicalizeEqn :: Thy -> Equation -> Equation
deduce :: Thy -> Thy
simplify :: Thy -> Thy
delete :: Thy -> Thy
orient :: Thy -> Thy
compose :: Thy -> Thy
collapse :: Thy -> Thy
updateRulesBy :: ([Rule] -> [Rule]) -> Thy -> Thy
updateEquationsBy :: ([Equation] -> [Equation]) -> Thy -> Thy
discardRedundantEquations :: Thy -> Thy

-- | Finalize a theory by discarding redundant equations. If after
--   finalizing you <a>complete</a>, redundant equations might pop-up
--   again.
finalize :: Thy -> Thy
initialize :: Int -> (Expr -> Expr -> Bool) -> [Equation] -> Thy
defaultKeep :: Thy -> Thy
reductions1 :: Expr -> Rule -> [Expr]

-- | Dershowitz reduction order as defined in TRAAT
--   
--   <tt>|&gt;</tt> a <a>D</a> for Dershowitz
dwoBy :: (Expr -> Expr -> Bool) -> Expr -> Expr -> Bool
(|>) :: Expr -> Expr -> Bool
infix 4 |>
instance GHC.Classes.Eq Test.Speculate.Reason.Thy


-- | This module is part o Speculate.
--   
--   Inequational (or semi-equational) reasoning.
module Test.Speculate.SemiReason
type Equation = (Expr, Expr)
data Shy
Shy :: [Equation] -> Thy -> Shy
[sequations] :: Shy -> [Equation]
[sthy] :: Shy -> Thy
emptyShy :: Shy
updateSemiEquationsBy :: ([Equation] -> [Equation]) -> Shy -> Shy
mapSemiEquations :: (Equation -> Equation) -> Shy -> Shy
scompareE :: Shy -> Expr -> Expr -> Ordering
lesser :: Shy -> Expr -> [Expr]
greater :: Shy -> Expr -> [Expr]

-- | given a semi-equation (inequality), simplerThan restricts the Shy
--   (SemiTheory) into only equations simpler than the given semi-equation
--   or that are instances of simpler equations.
--   
--   half-baked example:
--   
--   <tt>x + 1</tt> is simpler than <tt>x + y</tt> and it is returned.
--   <tt>(1 + 1) + 1</tt> is more complex than <tt>x + y</tt> but it is
--   returned as well as it is an instance of <tt>x + 1</tt>.
simplerThan :: Equation -> Shy -> Shy
transConsequence :: Shy -> Equation -> Bool
updateSEquationsBy :: ([Equation] -> [Equation]) -> Shy -> Shy
stheorize :: Thy -> [Equation] -> Shy
sides :: Shy -> [Expr]
finalSemiEquations :: (Equation -> Bool) -> Instances -> (Expr -> Expr -> Bool) -> Shy -> [Equation]
canonicalizeShyWith :: Instances -> Shy -> Shy
canonicalizeSemiEquationWith :: Instances -> Equation -> Equation


-- | This module is part o Speculate.
--   
--   Conditional equational reasoning.
module Test.Speculate.CondReason
data Chy
Chy :: [(Expr, Expr, Expr)] -> Digraph Expr -> [(Expr, [Expr])] -> Thy -> Chy
[cequations] :: Chy -> [(Expr, Expr, Expr)]
[cimplications] :: Chy -> Digraph Expr
[cclasses] :: Chy -> [(Expr, [Expr])]
[unThy] :: Chy -> Thy
emptyChy :: Chy
updateCEquationsBy :: ([(Expr, Expr, Expr)] -> [(Expr, Expr, Expr)]) -> Chy -> Chy
listImplied :: Chy -> Expr -> [Expr]
listImplies :: Chy -> Expr -> [Expr]
listEquivalent :: Chy -> Expr -> [Expr]
reduceRootWith :: Binds -> Expr -> (Expr, Expr) -> Maybe Expr
reductions1With :: Binds -> Expr -> (Expr, Expr) -> [Expr]
creductions1 :: Expr -> Expr -> (Expr, Expr, Expr) -> [Expr]
cnormalize :: Chy -> Expr -> Expr -> Expr
cequivalent :: Chy -> Expr -> Expr -> Expr -> Bool
cIsInstanceOf :: Chy -> (Expr, Expr, Expr) -> (Expr, Expr, Expr) -> Bool
cinsert :: (Expr, Expr, Expr) -> Chy -> Chy
cfilter :: ((Expr, Expr, Expr) -> Bool) -> Chy -> Chy
cdiscard :: ((Expr, Expr, Expr) -> Bool) -> Chy -> Chy
cdelete :: Chy -> Chy
cfinalize :: Chy -> Chy
canonicalizeCEqn :: (Expr -> Expr -> Ordering) -> (Expr, Expr, Expr) -> (Expr, Expr, Expr)
canonicalizeCEqnWith :: (Expr -> Expr -> Ordering) -> Instances -> (Expr, Expr, Expr) -> (Expr, Expr, Expr)
canonicalCEqnBy :: (Expr -> Expr -> Ordering) -> Instances -> (Expr, Expr, Expr) -> Bool
canonicalCEqn :: (Expr -> Expr -> Ordering) -> (Expr, Expr, Expr) -> Bool
finalCondEquations :: ((Expr, Expr, Expr) -> Bool) -> Chy -> [(Expr, Expr, Expr)]


-- | This module is part of Speculate.
--   
--   Pretty printing of Equations, Inequalities and Conditional Equations
module Test.Speculate.Pretty
prettyThy :: (Equation -> Bool) -> Instances -> Thy -> String
prettyEquations :: [Equation] -> String
prettyShy :: (Equation -> Bool) -> Instances -> (Expr -> Expr -> Bool) -> Shy -> String
prettySemiEquations :: [Equation] -> String
prettyChy :: (CondEquation -> Bool) -> Chy -> String
prettyCondEquations :: [CondEquation] -> String


-- | This module is part of Speculate.
--   
--   Main engine to process data.
module Test.Speculate.Engine

-- | List all relevant variable assignments in an expresssion. In
--   pseudo-Haskell:
--   
--   <pre>
--   vassignments (0 + x) == [0 + x]
--   vassignments (0 + 0) == [0 + 0]
--   vassignments (0 + _) == [0 + x]
--   vassignments (_ + _) == [x + x, x + y]
--   vassignments (_ + (_ + ord _)) == [x + (x + ord c), x + (y + ord c)]
--   </pre>
--   
--   You should not use this on expression with already assinged variables
--   (undefined, but currently defined behavior):
--   
--   <pre>
--   vassignments (ii -+- i_) == [ii -+- ii]
--   </pre>
vassignments :: Expr -> [Expr]

-- | List all variable assignments for a given number of variables. It only
--   assign variables to holes (variables with "" as its name).
--   
--   <pre>
--   &gt; expansions preludeInstances 2 '(_ + _ + ord _)
--   [ (x + x) + ord c :: Int
--   , (x + x) + ord d :: Int
--   , (x + y) + ord c :: Int
--   , (x + y) + ord d :: Int
--   , (y + x) + ord c :: Int
--   , (y + x) + ord d :: Int
--   , (y + y) + ord c :: Int
--   , (y + y) + ord d :: Int ]
--   </pre>
expansions :: Instances -> Int -> Expr -> [Expr]

-- | List all variable assignments for a given type and list of variables.
expansionsOfType :: TypeRep -> [String] -> Expr -> [Expr]
expansionsWith :: [Expr] -> Expr -> [Expr]

-- | List the most general assignment of holes in an expression
mostGeneral :: Expr -> Expr

-- | List the most specific assignment of holes in an expression
mostSpecific :: Expr -> Expr

-- | Given atomic expressions, compute theory and representative schema
--   expressions.
theoryAndRepresentativesFromAtoms :: Int -> (Expr -> Expr -> Ordering) -> (Expr -> Bool) -> (Expr -> Expr -> Bool) -> [[Expr]] -> (Thy, [[Expr]])
representativesFromAtoms :: Int -> (Expr -> Expr -> Ordering) -> (Expr -> Bool) -> (Expr -> Expr -> Bool) -> [[Expr]] -> [[Expr]]

-- | Computes a theory from atomic expressions. Example:
--   
--   <pre>
--   &gt; theoryFromAtoms 5 compare (const True) (equal preludeInstances 100)
--   &gt;   [hole (undefined :: Int),constant "+" ((+) :: Int -&gt; Int -&gt; Int)]
--   Thy { rules = [ (x + y) + z == x + (y + z) ]
--       , equations = [ y + x == x + y
--                     , y + (x + z) == x + (y + z)
--                     , z + (x + y) == x + (y + z)
--                     , z + (y + x) == x + (y + z) ]
--       , canReduceTo = (|&gt;)
--       , closureLimit = 2
--       , keepE = keepUpToLength 5
--       }
--   </pre>
theoryFromAtoms :: Int -> (Expr -> Expr -> Ordering) -> (Expr -> Bool) -> (Expr -> Expr -> Bool) -> [[Expr]] -> Thy
equivalencesBetween :: (Expr -> Expr -> Bool) -> Expr -> Expr -> [(Expr, Expr)]
consider :: (Expr -> Expr -> Bool) -> Int -> Expr -> (Thy, [[Expr]]) -> (Thy, [[Expr]])
distinctFromSchemas :: Instances -> Int -> Int -> Thy -> [Expr] -> [Expr]
classesFromSchemas :: Instances -> Int -> Int -> Thy -> [Expr] -> [Class Expr]
classesFromSchemasAndVariables :: Thy -> [Expr] -> [Expr] -> [Class Expr]
semiTheoryFromThyAndReps :: Instances -> Int -> Int -> Thy -> [Expr] -> Shy
conditionalTheoryFromThyAndReps :: Instances -> (Expr -> Expr -> Ordering) -> Int -> Int -> Int -> Thy -> [Expr] -> Chy
conditionalEquivalences :: (Expr -> Expr -> Ordering) -> ((Expr, Expr, Expr) -> Bool) -> (Expr -> Expr -> Expr -> Bool) -> (Expr -> Expr -> Bool) -> Int -> Thy -> [Class Expr] -> [Class Expr] -> Chy

-- | Is the equation a consequence of substitution? &gt; subConsequence (x
--   == y) (x + y) (x + x) == True &gt; subConsequence (x &lt;= y) (x + y)
--   (x + x) == False -- not sub &gt; subConsequence (abs x == abs y) (abs
--   x) (abs y) == True &gt; subConsequence (abs x == 1) (x + abs x) (20)
--   == False (artificial)
subConsequence :: Thy -> [Class Expr] -> Expr -> Expr -> Expr -> Bool
psortBy :: (a -> a -> Bool) -> [a] -> [(a, a)]


-- | This module is part o Speculate.
--   
--   Arguments to the <tt>speculate</tt> function and parsing of command
--   line arguments.
module Test.Speculate.Args

-- | Arguments to Speculate
data Args
Args :: Int -> Int -> [Expr] -> [Instances] -> Int -> Int -> Int -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> (Int -> Int) -> Maybe Int -> Maybe Int -> Bool -> Bool -> Bool -> Bool -> Maybe Double -> Bool -> [String] -> [String] -> [String] -> [Int] -> Bool -> Bool -> Args

-- | maximum size of considered expressions
[maxSize] :: Args -> Int

-- | maximum number of test for each law
[maxTests] :: Args -> Int

-- | constants considered when generating expressions
[constants] :: Args -> [Expr]

-- | typeclass instance information for <tt>Eq</tt>, <tt>Ord</tt> and
--   <tt>Listable</tt>
[instances] :: Args -> [Instances]

-- | maximum size of inqualities RHS/LHS
[maxSemiSize] :: Args -> Int

-- | maximum size of considered condition
[maxCondSize] :: Args -> Int

-- | maximum number of variables allowed in inequalities and conditional
--   equations
[maxVars] :: Args -> Int

-- | repeat constants on output
[showConstants] :: Args -> Bool

-- | whether to show equations
[showEquations] :: Args -> Bool

-- | whether to show inequalties
[showSemiequations] :: Args -> Bool

-- | whether to show conditional equations
[showConditions] :: Args -> Bool

-- | whether to show laws with no variables
[showConstantLaws] :: Args -> Bool

-- | automatically include constants taken from tiers of values
[autoConstants] :: Args -> Bool

-- | <b>(intermediary)</b> minimum number of tests for passing
--   postconditions in function of maximum number of tests
[minTests] :: Args -> Int -> Int

-- | <b>(intermediary)</b> maximum nubmer of constants allowed when
--   considering expressions
[maxConstants] :: Args -> Maybe Int

-- | <b>(intermediary)</b> maximum depth of considered expressions
[maxDepth] :: Args -> Maybe Int

-- | <b>(intermediary)</b> show counts of equations, inequalities and
--   conditional equations
[showCounts] :: Args -> Bool

-- | <b>(debug)</b> whether to show raw theory
[showTheory] :: Args -> Bool

-- | <b>(debug)</b> show _this_ args before running
[showArgs] :: Args -> Bool

-- | <b>(advanced)</b> whether to show the command line help
[showHelp] :: Args -> Bool

-- | <b>(advanced)</b> timeout when evaluating ground expressions
[evalTimeout] :: Args -> Maybe Double

-- | <b>(advanced)</b> ignore errors
[force] :: Args -> Bool

-- | <b>(advanced)</b> unused, user-defined meaning
[extra] :: Args -> [String]

-- | <b>(advanced)</b> exclude this symbols from signature before running
[exclude] :: Args -> [String]

-- | <b>(advanced)</b> only allow those types at top-level equations /
--   semi-equations
[onlyTypes] :: Args -> [String]

-- | <b>(advanced)</b> show equivalence classes of expressions
[showClassesFor] :: Args -> [Int]

-- | <b>(advanced)</b> whether to show a Graphviz dotfile with an Ord
--   lattice
[showDot] :: Args -> Bool

-- | <b>(advanced)</b> whether to show a Graphviz dotfiel with an Ord
--   lattice (less verbose)
[quietDot] :: Args -> Bool

-- | Default arguments to Speculate
args :: Args

-- | A special <a>Expr</a> value. When provided on the <a>constants</a>
--   list, makes all the following constants <a>foreground</a> constants.
foreground :: Expr

-- | A special <a>Expr</a> value. When provided on the <a>constants</a>
--   list, makes all the following constants <a>background</a> constants.
--   Background constants can appear in laws about other constants, but not
--   by themselves.
background :: Expr
getArgs :: Args -> IO Args
computeMaxSemiSize :: Args -> Int
computeMaxCondSize :: Args -> Int
computeInstances :: Args -> Instances
types :: Args -> [TypeRep]
atoms :: Args -> [[Expr]]
compareExpr :: Args -> Expr -> Expr -> Ordering
keepExpr :: Args -> Expr -> Bool
timeout :: Args -> Bool -> Bool
shouldShowEquation :: Args -> (Expr, Expr) -> Bool
shouldShowConditionalEquation :: Args -> (Expr, Expr, Expr) -> Bool
reallyShowConditions :: Args -> Bool
prepareArgs :: Args -> Mode Args


-- | This module is part of Speculate.
--   
--   Report Speculate results.
module Test.Speculate.Report
report :: Args -> IO ()


-- | <b> Speculate: discovery of properties by reasoning from test results
--   </b>
--   
--   Speculate automatically discovers laws about Haskell functions. Those
--   laws involve:
--   
--   <ul>
--   <li>equations, such as <tt> id x == x </tt>;</li>
--   <li>inequalities, such as <tt> 0 &lt;= x * x </tt>;</li>
--   <li>conditional equations, such as <tt> x &lt;= 0 ==&gt; x + abs x ==
--   0 </tt>.</li>
--   </ul>
--   
--   _Example:_ the following program prints laws about <tt>0</tt>,
--   <tt>1</tt>, <tt>+</tt> and <tt>abs</tt>.
--   
--   <pre>
--   import Test.Speculate
--   
--   main :: IO ()
--   main = speculate args
--     { constants =
--         [ showConstant (0::Int)
--         , showConstant (1::Int)
--         , constant "+"   ((+)  :: Int -&gt; Int -&gt; Int)
--         , constant "abs" (abs  :: Int -&gt; Int)
--         , background
--         , constant "&lt;="  ((&lt;=) :: Int -&gt; Int -&gt; Bool)
--         ]
--     }
--   </pre>
module Test.Speculate

-- | Calls Speculate. See the example above (at the top of the file). Its
--   only argument is an <a>Args</a> structure.
speculate :: Args -> IO ()

-- | Arguments to Speculate
data Args
Args :: Int -> Int -> [Expr] -> [Instances] -> Int -> Int -> Int -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> (Int -> Int) -> Maybe Int -> Maybe Int -> Bool -> Bool -> Bool -> Bool -> Maybe Double -> Bool -> [String] -> [String] -> [String] -> [Int] -> Bool -> Bool -> Args

-- | maximum size of considered expressions
[maxSize] :: Args -> Int

-- | maximum number of test for each law
[maxTests] :: Args -> Int

-- | constants considered when generating expressions
[constants] :: Args -> [Expr]

-- | typeclass instance information for <tt>Eq</tt>, <tt>Ord</tt> and
--   <tt>Listable</tt>
[instances] :: Args -> [Instances]

-- | maximum size of inqualities RHS/LHS
[maxSemiSize] :: Args -> Int

-- | maximum size of considered condition
[maxCondSize] :: Args -> Int

-- | maximum number of variables allowed in inequalities and conditional
--   equations
[maxVars] :: Args -> Int

-- | repeat constants on output
[showConstants] :: Args -> Bool

-- | whether to show equations
[showEquations] :: Args -> Bool

-- | whether to show inequalties
[showSemiequations] :: Args -> Bool

-- | whether to show conditional equations
[showConditions] :: Args -> Bool

-- | whether to show laws with no variables
[showConstantLaws] :: Args -> Bool

-- | automatically include constants taken from tiers of values
[autoConstants] :: Args -> Bool

-- | <b>(intermediary)</b> minimum number of tests for passing
--   postconditions in function of maximum number of tests
[minTests] :: Args -> Int -> Int

-- | <b>(intermediary)</b> maximum nubmer of constants allowed when
--   considering expressions
[maxConstants] :: Args -> Maybe Int

-- | <b>(intermediary)</b> maximum depth of considered expressions
[maxDepth] :: Args -> Maybe Int

-- | <b>(intermediary)</b> show counts of equations, inequalities and
--   conditional equations
[showCounts] :: Args -> Bool

-- | <b>(debug)</b> whether to show raw theory
[showTheory] :: Args -> Bool

-- | <b>(debug)</b> show _this_ args before running
[showArgs] :: Args -> Bool

-- | <b>(advanced)</b> whether to show the command line help
[showHelp] :: Args -> Bool

-- | <b>(advanced)</b> timeout when evaluating ground expressions
[evalTimeout] :: Args -> Maybe Double

-- | <b>(advanced)</b> ignore errors
[force] :: Args -> Bool

-- | <b>(advanced)</b> unused, user-defined meaning
[extra] :: Args -> [String]

-- | <b>(advanced)</b> exclude this symbols from signature before running
[exclude] :: Args -> [String]

-- | <b>(advanced)</b> only allow those types at top-level equations /
--   semi-equations
[onlyTypes] :: Args -> [String]

-- | <b>(advanced)</b> show equivalence classes of expressions
[showClassesFor] :: Args -> [Int]

-- | <b>(advanced)</b> whether to show a Graphviz dotfile with an Ord
--   lattice
[showDot] :: Args -> Bool

-- | <b>(advanced)</b> whether to show a Graphviz dotfiel with an Ord
--   lattice (less verbose)
[quietDot] :: Args -> Bool

-- | Default arguments to Speculate
args :: Args

-- | An encoded Haskell functional-application expression for use by
--   Speculate.
data 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

-- | <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

-- | A special <a>Expr</a> value. When provided on the <a>constants</a>
--   list, makes all the following constants <a>foreground</a> constants.
foreground :: Expr

-- | A special <a>Expr</a> value. When provided on the <a>constants</a>
--   list, makes all the following constants <a>background</a> constants.
--   Background constants can appear in laws about other constants, but not
--   by themselves.
background :: Expr

-- | Type information needed to Speculate expressions.
type Instances = [Instance]
ins :: (Typeable a, Listable a, Show a, Eq a, Ord a) => String -> a -> Instances
eq :: (Typeable a, Eq a) => a -> Instances
ord :: (Typeable a, Ord a) => a -> Instances
eqWith :: (Typeable a, Eq a) => (a -> a -> Bool) -> Instances
ordWith :: (Typeable a, Ord a) => (a -> a -> Bool) -> Instances
names :: Instances -> TypeRep -> [String]
report :: Args -> IO ()
getArgs :: Args -> IO Args

-- | Deprecated. Use <a>word4</a>.
uint4 :: UInt4

-- | Deprecated. Use <a>word3</a>.
uint3 :: UInt3

-- | Deprecated. Use <a>word2</a>.
uint2 :: UInt2

-- | Deprecated. Use <a>word1</a>.
uint1 :: UInt1

-- | Undefined <a>Word4</a> value.
word4 :: Word4

-- | Undefined <a>Word3</a> value.
word3 :: Word3

-- | Undefined <a>Word2</a> value.
word2 :: Word2

-- | Undefined <a>Word1</a> value.
word1 :: Word1

-- | Undefined <a>Int4</a> value.
int4 :: Int4

-- | Undefined <a>Int3</a> value.
int3 :: Int3

-- | Undefined <a>Int2</a> value.
int2 :: Int2

-- | Undefined <a>Int1</a> value.
int1 :: Int1

-- | Undefined <a>Nat</a> value.
nat :: Nat

-- | Undefined <a>Natural</a> value.
natural :: Natural

-- | Undefined <a>Either</a> value. Uses the types of the given values as
--   the argument types. For use with type binding operators.
eith :: () => a -> b -> Either a b

-- | Undefined <a>Maybe</a> value. Uses the type of the given value as the
--   argument type. For use with type binding operators.
--   
--   To check a property with the first argument bound to <a>Maybe</a>
--   <a>Int</a>, do:
--   
--   <pre>
--   check $ prop -:&gt; mayb int
--   </pre>
mayb :: () => a -> Maybe a

-- | Undefined <a>Ordering</a> value.
ordering :: Ordering

-- | Undefined <a>String</a> value.
string :: String

-- | Undefined <a>Char</a> value.
char :: Char

-- | Undefined <a>Bool</a> value.
bool :: Bool

-- | Undefined <a>Rational</a> value for use with type binding operators.
rational :: Rational

-- | Undefined <a>Double</a> value for use with type binding operators.
double :: Double

-- | Undefined <a>Float</a> value for use with type binding operators.
float :: Float

-- | Undefined <a>Integer</a> value for use with type binding operators.
--   
--   <pre>
--   check $ (\x y -&gt; x + y == y + x) -&gt;:&gt; integer
--   </pre>
integer :: Integer

-- | Undefined <a>Int</a> value for use with type binding operators.
--   
--   <pre>
--   check $ (\x y -&gt; x + y == y + x) -&gt;:&gt; int
--   </pre>
int :: Int

-- | Shorthand for undefined
und :: () => a

-- | Returns an undefined functional value that takes an argument of the
--   type of its first argument and return a value of the type of its
--   second argument.
--   
--   <pre>
--   ty &gt;- ty  =  (undefined :: Ty -&gt; Ty)
--   </pre>
--   
--   Examples:
--   
--   <pre>
--   'a' &gt;- 'b'  =  char &gt;- char  =  (undefined :: Char -&gt; Char)
--   int &gt;- bool &gt;- int  =  undefined :: Int -&gt; Bool -&gt; Int
--   </pre>
(>-) :: () => a -> b -> a -> b
infixr 9 >-

-- | Forces the result type of a 12-argument function.
(->>>>>>>>>>>>:) :: () => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m) -> m -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m
infixl 1 ->>>>>>>>>>>>:

-- | Forces the type of the 12th argument.
(->>>>>>>>>>>:>) :: () => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m) -> m -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m
infixl 1 ->>>>>>>>>>>:>

-- | Forces the result type of a 11-argument function.
(->>>>>>>>>>>:) :: () => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l) -> l -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l
infixl 1 ->>>>>>>>>>>:

-- | Forces the type of the 11th argument.
(->>>>>>>>>>:>) :: () => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l) -> k -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l
infixl 1 ->>>>>>>>>>:>

-- | Forces the result type of a 10-argument function.
(->>>>>>>>>>:) :: () => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k) -> k -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k
infixl 1 ->>>>>>>>>>:

-- | Forces the type of the 10th argument.
(->>>>>>>>>:>) :: () => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k) -> j -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k
infixl 1 ->>>>>>>>>:>

-- | Forces the result type of a 9-argument function.
(->>>>>>>>>:) :: () => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j) -> j -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j
infixl 1 ->>>>>>>>>:

-- | Forces the 9th argument type.
(->>>>>>>>:>) :: () => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j) -> i -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j
infixl 1 ->>>>>>>>:>

-- | Forces the result type of a 8-argument function.
(->>>>>>>>:) :: () => (a -> b -> c -> d -> e -> f -> g -> h -> i) -> i -> a -> b -> c -> d -> e -> f -> g -> h -> i
infixl 1 ->>>>>>>>:

-- | Forces the 8th argument type.
(->>>>>>>:>) :: () => (a -> b -> c -> d -> e -> f -> g -> h -> i) -> h -> a -> b -> c -> d -> e -> f -> g -> h -> i
infixl 1 ->>>>>>>:>

-- | Forces the result type of a 7-argument function.
(->>>>>>>:) :: () => (a -> b -> c -> d -> e -> f -> g -> h) -> h -> a -> b -> c -> d -> e -> f -> g -> h
infixl 1 ->>>>>>>:

-- | Forces the 7th argument type.
(->>>>>>:>) :: () => (a -> b -> c -> d -> e -> f -> g -> h) -> g -> a -> b -> c -> d -> e -> f -> g -> h
infixl 1 ->>>>>>:>

-- | Forces the result type of a 6-argument function.
(->>>>>>:) :: () => (a -> b -> c -> d -> e -> f -> g) -> g -> a -> b -> c -> d -> e -> f -> g
infixl 1 ->>>>>>:

-- | Forces the 6th argument type.
(->>>>>:>) :: () => (a -> b -> c -> d -> e -> f -> g) -> f -> a -> b -> c -> d -> e -> f -> g
infixl 1 ->>>>>:>

-- | Forces the result type of a 5-argument function.
(->>>>>:) :: () => (a -> b -> c -> d -> e -> f) -> f -> a -> b -> c -> d -> e -> f
infixl 1 ->>>>>:

-- | Forces the 5th argument type.
(->>>>:>) :: () => (a -> b -> c -> d -> e -> f) -> e -> a -> b -> c -> d -> e -> f
infixl 1 ->>>>:>

-- | Forces the result type of a 4-argument function.
(->>>>:) :: () => (a -> b -> c -> d -> e) -> e -> a -> b -> c -> d -> e
infixl 1 ->>>>:

-- | Forces the 4th argument type.
(->>>:>) :: () => (a -> b -> c -> d -> e) -> d -> a -> b -> c -> d -> e
infixl 1 ->>>:>

-- | Type restricted version of const that forces the result of the result
--   of the result of its first argument to have the same type as the
--   second.
(->>>:) :: () => (a -> b -> c -> d) -> d -> a -> b -> c -> d
infixl 1 ->>>:

-- | Type restricted version of const that forces the third argument of its
--   first argument to have the same type as the second.
(->>:>) :: () => (a -> b -> c -> d) -> c -> a -> b -> c -> d
infixl 1 ->>:>

-- | Type restricted version of const that forces the result of the result
--   of its first argument to have the same type as the second.
--   
--   <pre>
--   f -&gt;&gt;: ty   =  f -: und -&gt; und -&gt; ty  =  f :: a -&gt; b -&gt; Ty
--   </pre>
(->>:) :: () => (a -> b -> c) -> c -> a -> b -> c
infixl 1 ->>:

-- | Type restricted version of const that forces the second argument of
--   its first argument to have the same type as the second.
--   
--   <pre>
--   f -&gt;:&gt; ty   =  f -: und -&gt; ty -&gt; und  =  f :: a -&gt; Ty -&gt; b
--   </pre>
(->:>) :: () => (a -> b -> c) -> b -> a -> b -> c
infixl 1 ->:>

-- | Type restricted version of const that forces the result of its first
--   argument to have the same type as the second.
--   
--   <pre>
--   f -&gt;: ty  =  f -: und &gt;- ty  =  f :: a -&gt; Ty
--   </pre>
(->:) :: () => (a -> b) -> b -> a -> b
infixl 1 ->:

-- | Type restricted version of const that forces the argument of its first
--   argument to have the same type as the second:
--   
--   <pre>
--   f -:&gt; ty  =  f -: ty &gt;- und  =  f :: Ty -&gt; a
--   </pre>
--   
--   Example:
--   
--   <pre>
--   abs -:&gt; int   =  abs -: int &gt;- und  =  abs :: Int -&gt; Int
--   </pre>
(-:>) :: () => (a -> b) -> a -> a -> b
infixl 1 -:>

-- | Type restricted version of const that forces its first argument to
--   have the same type as the second. A symnonym to <a>asTypeOf</a>:
--   
--   <pre>
--   value -: ty  =  value :: Ty
--   </pre>
--   
--   Examples:
--   
--   <pre>
--   10 -: int   =  10 :: Int
--   undefined -: 'a' &gt;- 'b'  =  undefined :: Char -&gt; Char
--   </pre>
(-:) :: () => a -> a -> a
infixl 1 -:

-- | Single-bit signed integers: -1, 0
newtype Int1
Int1 :: Int -> Int1
[unInt1] :: Int1 -> Int

-- | Two-bit signed integers: -2, -1, 0, 1
newtype Int2
Int2 :: Int -> Int2
[unInt2] :: Int2 -> Int

-- | Three-bit signed integers: -4, -3, -2, -1, 0, 1, 2, 3
newtype Int3
Int3 :: Int -> Int3
[unInt3] :: Int3 -> Int

-- | Four-bit signed integers: -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3,
--   4, 5, 6, 7
newtype Int4
Int4 :: Int -> Int4
[unInt4] :: Int4 -> Int

-- | Single-bit unsigned integer: 0, 1
newtype Word1
Word1 :: Int -> Word1
[unWord1] :: Word1 -> Int

-- | Two-bit unsigned integers: 0, 1, 2, 3
newtype Word2
Word2 :: Int -> Word2
[unWord2] :: Word2 -> Int

-- | Three-bit unsigned integers: 0, 1, 2, 3, 4, 5, 6, 7
newtype Word3
Word3 :: Int -> Word3
[unWord3] :: Word3 -> Int

-- | Four-bit unsigned integers: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
--   13, 14, 15
newtype Word4
Word4 :: Int -> Word4
[unWord4] :: Word4 -> Int

-- | Natural numbers (including 0): 0, 1, 2, 3, 4, 5, 6, 7, ...
--   
--   Internally, this type is represented as an <a>Integer</a> allowing for
--   an infinity of possible values.
--   
--   Its <a>Enum</a>, <a>Listable</a> and <a>Num</a> instances only produce
--   non-negative values. When <tt>x &lt; y</tt> then <tt>x - y = 0</tt>.
newtype Natural
Natural :: Integer -> Natural
[unNatural] :: Natural -> Integer

-- | Natural numbers (including 0): 0, 1, 2, 3, 4, 5, 6, 7, ...
--   
--   Internally, this type is represented as an <a>Int</a>. So, it is
--   limited by the <a>maxBound</a> of <a>Int</a>.
--   
--   Its <a>Enum</a>, <a>Listable</a> and <a>Num</a> instances only produce
--   non-negative values. When <tt>x &lt; y</tt> then <tt>x - y = 0</tt>.
newtype Nat
Nat :: Int -> Nat
[unNat] :: Nat -> Int

-- | Natural numbers modulo 1: 0
newtype Nat1
Nat1 :: Int -> Nat1
[unNat1] :: Nat1 -> Int

-- | Natural numbers modulo 2: 0, 1
newtype Nat2
Nat2 :: Int -> Nat2
[unNat2] :: Nat2 -> Int

-- | Natural numbers modulo 3: 0, 1, 2
newtype Nat3
Nat3 :: Int -> Nat3
[unNat3] :: Nat3 -> Int

-- | Natural numbers modulo 4: 0, 1, 2, 3
newtype Nat4
Nat4 :: Int -> Nat4
[unNat4] :: Nat4 -> Int

-- | Natural numbers modulo 5: 0, 1, 2, 3, 4
newtype Nat5
Nat5 :: Int -> Nat5
[unNat5] :: Nat5 -> Int

-- | Natural numbers modulo 6: 0, 1, 2, 3, 4, 5
newtype Nat6
Nat6 :: Int -> Nat6
[unNat6] :: Nat6 -> Int

-- | Natural numbers modulo 7: 0, 1, 2, 3, 4, 5, 6
newtype Nat7
Nat7 :: Int -> Nat7
[unNat7] :: Nat7 -> Int

-- | Deprecated. Use <a>Word1</a>.
type UInt1 = Word1

-- | Deprecated. Use <a>Word2</a>.
type UInt2 = Word2

-- | Deprecated. Use <a>Word3</a>.
type UInt3 = Word3

-- | Deprecated. Use <a>Word4</a>.
type UInt4 = Word4

-- | Lists without repeated elements.
--   
--   <pre>
--   &gt; take 6 $ list :: [NoDup Nat]
--   [NoDup [],NoDup [0],NoDup [1],NoDup [0,1],NoDup [1,0],NoDup [2]]
--   </pre>
--   
--   Example, checking the property that <tt>nub</tt> is an identity:
--   
--   <pre>
--   import Data.List (nub)
--   &gt; check $ \xs -&gt; nub xs == (xs :: [Int])
--   *** Failed! Falsifiable (after 3 tests):
--   [0,0]
--   &gt; check $ \(NoDup xs) -&gt; nub xs == (xs :: [Int])
--   +++ OK, passed 200 tests.
--   </pre>
newtype NoDup a
NoDup :: [a] -> NoDup a

-- | Lists representing bags (multisets). The <a>Listable</a> <a>tiers</a>
--   enumeration will not have repeated bags.
--   
--   <pre>
--   &gt; take 6 (list :: [Bag Nat])
--   [Bag [],Bag [0],Bag [0,0],Bag [1],Bag [0,0,0],Bag [0,1]]
--   </pre>
--   
--   See also: <tt>bagsOf</tt> and <a>bagCons</a>.
newtype Bag a
Bag :: [a] -> Bag a

-- | Lists representing sets. The <a>Listable</a> <a>tiers</a> enumeration
--   will not have repeated sets.
--   
--   <pre>
--   &gt; take 6 (list :: [Set Nat])
--   [Set [],Set [0],Set [1],Set [0,1],Set [2],Set [0,2]]
--   </pre>
newtype Set a
Set :: [a] -> Set a

-- | Lists of pairs representing maps. The <a>Listable</a> <a>tiers</a>
--   enumeration will not have repeated maps.
--   
--   <pre>
--   &gt; take 6 (list :: [Map Nat Nat])
--   [Map [],Map [(0,0)],Map [(0,1)],Map [(1,0)],Map [(0,2)],Map [(1,1)]]
--   </pre>
newtype Map a b
Map :: [(a, b)] -> Map a b

-- | <a>X</a> type to be wrapped around integer types for an
--   e-<a>X</a>-treme integer enumeration. See the <a>Listable</a> instance
--   for <a>X</a>. Use <a>X</a> when testing properties about overflows and
--   the like:
--   
--   <pre>
--   &gt; check $ \x -&gt; x + 1 &gt; (x :: Int)
--   +++ OK, passed 200 tests.
--   </pre>
--   
--   <pre>
--   &gt; check $ \(X x) -&gt; x + 1 &gt; (x :: Int)
--   +++ Failed! Falsifiable (after 4 tests):
--   9223372036854775807
--   </pre>
newtype X a
X :: a -> X a
[unX] :: X a -> a

-- | Wrap around lists of integers for an enumeration containing
--   e-<a>X</a>-treme integer values.
--   
--   <pre>
--   &gt; check $ \xs -&gt; all (&gt;=0) xs ==&gt; sum (take 1 xs :: [Int]) &lt;= sum xs
--   +++ OK, passed 200 tests.
--   </pre>
--   
--   <pre>
--   &gt; check $ \(Xs xs) -&gt; all (&gt;=0) xs ==&gt; sum (take 1 xs :: [Int]) &lt;= sum xs
--   *** Failed! Falsifiable (after 56 tests):
--   [1,9223372036854775807]
--   </pre>
newtype Xs a
Xs :: [a] -> Xs a
data Space
Space :: Char -> Space
[unSpace] :: Space -> Char
data Lower
Lower :: Char -> Lower
[unLower] :: Lower -> Char
data Upper
Upper :: Char -> Upper
[unUpper] :: Upper -> Char
data Alpha
Alpha :: Char -> Alpha
[unAlpha] :: Alpha -> Char
data Digit
Digit :: Char -> Digit
[unDigit] :: Digit -> Char
data AlphaNum
AlphaNum :: Char -> AlphaNum
[unAlphaNum] :: AlphaNum -> Char
data Letter
Letter :: Char -> Letter
[unLetter] :: Letter -> Char
data Spaces
Spaces :: String -> Spaces
[unSpaces] :: Spaces -> String
data Lowers
Lowers :: String -> Lowers
[unLowers] :: Lowers -> String
data Uppers
Uppers :: String -> Uppers
[unUppers] :: Uppers -> String
data Alphas
Alphas :: String -> Alphas
[unAlphas] :: Alphas -> String
data Digits
Digits :: String -> Digits
[unDigits] :: Digits -> String
data AlphaNums
AlphaNums :: String -> AlphaNums
[unAlphaNums] :: AlphaNums -> String
data Letters
Letters :: String -> Letters
[unLetters] :: Letters -> String

-- | See <a>=|</a>
(|=) :: () => (a -> Bool) -> a -> Bool
infixl 4 |=

-- | Check if two lists are equal for <tt>n</tt> values. This operator has
--   the same fixity of <a>==</a>.
--   
--   <pre>
--   xs =| n |= ys  =  take n xs == take n ys
--   </pre>
--   
--   <pre>
--   [1,2,3,4,5] =| 2 |= [1,2,4,8,16] -- &gt; True
--   [1,2,3,4,5] =| 3 |= [1,2,4,8,16] -- &gt; False
--   </pre>
(=|) :: Eq a => [a] -> Int -> [a] -> Bool
infixl 4 =|

-- | See <a>=$</a>
($=) :: () => (a -> Bool) -> a -> Bool
infixl 4 $=

-- | Equal under, a ternary operator with the same fixity as <a>==</a>.
--   
--   <pre>
--   x =$ f $= y  =  f x = f y
--   </pre>
--   
--   <pre>
--   [1,2,3,4,5] =$  take 2    $= [1,2,4,8,16] -- &gt; True
--   [1,2,3,4,5] =$  take 3    $= [1,2,4,8,16] -- &gt; False
--       [1,2,3] =$    sort    $= [3,2,1]      -- &gt; True
--            42 =$ (`mod` 10) $= 16842        -- &gt; True
--            42 =$ (`mod`  9) $= 16842        -- &gt; False
--           'a' =$  isLetter  $= 'b'          -- &gt; True
--           'a' =$  isLetter  $= '1'          -- &gt; False
--   </pre>
(=$) :: Eq b => a -> (a -> b) -> a -> Bool
infixl 4 =$
okNum :: (Eq a, Num a) => a -> a -> a -> Bool
okNumNonNegative :: (Eq a, Num a) => a -> a -> a -> Bool
okEqOrd :: (Eq a, Ord a) => a -> a -> a -> Bool
okOrd :: Ord a => a -> a -> a -> Bool
okEq :: Eq a => a -> a -> a -> Bool

-- | Is the given function never an identity? <tt>f x /= x</tt>
--   
--   <pre>
--   holds n $ neverIdentity not
--   </pre>
--   
--   <pre>
--   fails n $ neverIdentity negate   -- yes, fails: negate 0 == 0, hah!
--   </pre>
--   
--   Note: this is not the same as not being an identity.
neverIdentity :: Eq a => (a -> a) -> a -> Bool

-- | Is the given function an identity? <tt>f x == x</tt>
--   
--   <pre>
--   holds n $ identity (+0)
--   holds n $ identity (sort :: [()])
--   holds n $ identity (not . not)
--   </pre>
identity :: Eq a => (a -> a) -> a -> Bool

-- | Is the given function idempotent? <tt>f (f x) == x</tt>
--   
--   <pre>
--   holds n $ idempotent abs
--   holds n $ idempotent sort
--   </pre>
--   
--   <pre>
--   fails n $ idempotent negate
--   </pre>
idempotent :: Eq a => (a -> a) -> a -> Bool

-- | Is the given binary relation a strict total order?
strictTotalOrder :: Eq a => (a -> a -> Bool) -> a -> a -> a -> Bool

-- | Is the given binary relation a total order?
totalOrder :: Eq a => (a -> a -> Bool) -> a -> a -> a -> Bool

-- | Is the given binary relation a strict partial order? Is the given
--   relation irreflexive, asymmetric and transitive?
strictPartialOrder :: () => (a -> a -> Bool) -> a -> a -> a -> Bool

-- | Is the given binary relation a partial order? Is the given relation
--   reflexive, antisymmetric and transitive?
partialOrder :: Eq a => (a -> a -> Bool) -> a -> a -> a -> Bool

-- | Is the given binary relation an equivalence? Is the given relation
--   reflexive, symmetric and transitive?
--   
--   <pre>
--   &gt; check (equivalence (==) :: Int -&gt; Int -&gt; Int -&gt; Bool)
--   +++ OK, passed 200 tests.
--   &gt; check (equivalence (&lt;=) :: Int -&gt; Int -&gt; Int -&gt; Bool)
--   *** Failed! Falsifiable (after 3 tests):
--   0 1 0
--   </pre>
--   
--   Or, using <a>Test.LeanCheck.Utils.TypeBinding</a>:
--   
--   <pre>
--   &gt; check $ equivalence (&lt;=) -:&gt; int
--   *** Failed! Falsifiable (after 3 tests):
--   0 1 0
--   </pre>
equivalence :: () => (a -> a -> Bool) -> a -> a -> a -> Bool

-- | Is a given relation asymmetric? Not to be confused with "not
--   symmetric" and "antissymetric".
asymmetric :: () => (a -> a -> Bool) -> a -> a -> Bool

-- | Is a given relation antisymmetric? Not to be confused with "not
--   symmetric" and "assymetric".
antisymmetric :: Eq a => (a -> a -> Bool) -> a -> a -> Bool

-- | Is a given relation symmetric? This is a type-restricted version of
--   <a>commutative</a>.
symmetric :: () => (a -> a -> Bool) -> a -> a -> Bool

-- | An element is <b>never</b> related to itself.
irreflexive :: () => (a -> a -> Bool) -> a -> Bool

-- | An element is always related to itself.
reflexive :: () => (a -> a -> Bool) -> a -> Bool

-- | Is a given relation transitive?
transitive :: () => (a -> a -> Bool) -> a -> a -> a -> Bool

-- | Are two operators flipped versions of each other?
--   
--   <pre>
--   holds n $ (&lt;)  `symmetric2` (&gt;)  -:&gt; int
--   holds n $ (&lt;=) `symmetric2` (&gt;=) -:&gt; int
--   </pre>
--   
--   <pre>
--   fails n $ (&lt;)  `symmetric2` (&gt;=) -:&gt; int
--   fails n $ (&lt;=) `symmetric2` (&gt;)  -:&gt; int
--   </pre>
symmetric2 :: Eq b => (a -> a -> b) -> (a -> a -> b) -> a -> a -> Bool

-- | Does the first operator, distributes over the second?
distributive :: Eq a => (a -> a -> a) -> (a -> a -> a) -> a -> a -> a -> Bool

-- | Is a given operator associative? <tt>x + (y + z) = (x + y) + z</tt>
associative :: Eq a => (a -> a -> a) -> a -> a -> a -> Bool

-- | Is a given operator commutative? <tt>x + y = y + x</tt>
--   
--   <pre>
--   holds n $ commutative (+)
--   </pre>
--   
--   <pre>
--   fails n $ commutative union  -- union [] [0,0] = [0]
--   </pre>
commutative :: Eq b => (a -> a -> b) -> a -> a -> Bool
(||||) :: () => (a -> b -> Bool) -> (a -> b -> Bool) -> a -> b -> Bool
infixr 2 ||||
(|||) :: () => (a -> Bool) -> (a -> Bool) -> a -> Bool
infixr 2 |||
(&&&&) :: () => (a -> b -> Bool) -> (a -> b -> Bool) -> a -> b -> Bool
infixr 3 &&&&
(&&&) :: () => (a -> Bool) -> (a -> Bool) -> a -> Bool
infixr 3 &&&
(====) :: Eq c => (a -> b -> c) -> (a -> b -> c) -> a -> b -> Bool
infix 4 ====
(===) :: Eq b => (a -> b) -> (a -> b) -> a -> Bool
infix 4 ===
countsOn :: Eq b => (a -> b) -> [a] -> [(b, Int)]
countsBy :: () => (a -> a -> Bool) -> [a] -> [(a, Int)]
counts :: Eq a => [a] -> [(a, Int)]
classifyOn :: Eq b => (a -> b) -> [a] -> [[a]]
classifyBy :: () => (a -> a -> Bool) -> [a] -> [[a]]
classify :: Eq a => [a] -> [[a]]
conditionStatsT :: Listable a => Int -> [(String, a -> Bool)] -> IO ()
conditionStats :: Listable a => Int -> [(String, a -> Bool)] -> IO ()
classStatsT :: (Listable a, Show b) => Int -> (a -> b) -> IO ()
classStats :: (Listable a, Show b) => Int -> (a -> b) -> IO ()


-- | This module is part o Speculate.
--   
--   Miscellaneous functions I still did not find a reasonable place to put
--   them in.
module Test.Speculate.Misc
functions1 :: (Typeable a, Typeable b) => Expr -> [(Expr, a -> b)]
functions2 :: (Typeable a, Typeable b, Typeable c) => Expr -> [(Expr, a -> b -> c)]
functions3 :: (Typeable a, Typeable b, Typeable c, Typeable d) => Expr -> [(Expr, a -> b -> c -> d)]
functions4 :: (Typeable a, Typeable b, Typeable c, Typeable d, Typeable e) => Expr -> [(Expr, a -> b -> c -> d -> e)]
fillings :: Expr -> [Expr] -> [Expr]

-- | Given a list of atomic expressions, enumerate experssions by
--   application
--   
--   NOTE: for now, very inneficient
--   
--   This function exists solely for documentation and will never actually
--   be useful, as:
--   
--   <pre>
--   mapT fst $ classes
--   </pre>
--   
--   Will return as expressions that are semantially different (and is more
--   efficient)
--   
--   Eventually this function will be removed from Speculate
expressionsOf :: [Expr] -> [[Expr]]

-- | Given a list of atomic expressinos, enumerated expressions of a given
--   type by application.
--   
--   Never will be actually useful, see <a>expressionsOf</a>.
--   
--   Eventually this functino will be removed from Speculate
valuedExpressionsOf :: Typeable a => [Expr] -> [[(Expr, a)]]


-- | This module is part of Speculate.
--   
--   If should import this if you want Speculate to treat functions as data
--   values. This exports a Listable instance for functions an a facility
--   to define Eq and Ord instances for functions.
--   
--   Please see the <tt>fun</tt> and <tt>monad</tt> examples from
--   Speculate's source repository for more details.
module Test.Speculate.Function
funToList :: Listable a => (a -> b) -> [Maybe b]

-- | This function can be used to define an Eq instance for functions based
--   on testing and equality of returned values, like so:
--   
--   <pre>
--   instance (Listable a, Eq b) =&gt; Eq (a -&gt; b) where
--     (==) = areEqualFor 100
--   </pre>
areEqualFor :: (Listable a, Eq b) => Int -> (a -> b) -> (a -> b) -> Bool

-- | This function can be used to define an Ord instance for functions
--   based on testing and ordering of returned values, like so:
--   
--   <pre>
--   instance (Listable a, Ord b) =&gt; Ord (a -&gt; b) where
--     compare = compareFor 100
--   </pre>
compareFor :: (Listable a, Ord b) => Int -> (a -> b) -> (a -> b) -> Ordering


-- | This module is part of Speculate.
--   
--   This module exports a Listable instance for functions along with two
--   toy Eq and Ord instances for functions based on 1000 sample return
--   values.
module Test.Speculate.Function.A1000
instance (Test.LeanCheck.Core.Listable a, GHC.Classes.Eq b) => GHC.Classes.Eq (a -> b)
instance (Test.LeanCheck.Core.Listable a, GHC.Classes.Ord b) => GHC.Classes.Ord (a -> b)


-- | This module is part of Speculate.
--   
--   This module exports a Listable instance for functions along with two
--   toy Eq and Ord instances for functions based on 100 sample return
--   values.
module Test.Speculate.Function.A100
instance (Test.LeanCheck.Core.Listable a, GHC.Classes.Eq b) => GHC.Classes.Eq (a -> b)
instance (Test.LeanCheck.Core.Listable a, GHC.Classes.Ord b) => GHC.Classes.Ord (a -> b)
