-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Equational laws for free
--
-- QuickSpec automatically finds equational properties of your program.
--
-- Give it an API, i.e. a collection of functions, and it will spit out
-- equations about those functions. For example, given reverse,
-- ++ and [], QuickSpec finds six laws:
--
--
-- xs++[] == xs
-- []++xs == xs
-- reverse [] == []
-- (xs++ys)++zs == xs++(ys++zs)
-- reverse (reverse xs) == xs
-- reverse xs++reverse ys == reverse (ys++xs)
--
--
-- All you have to provide is:
--
--
-- - Some functions and constants to test. These are the only
-- functions that will appear in the equations.
-- - A collection of variables that can appear in the equations
-- (xs, ys and zs in the example above).
-- - Test.QuickCheck.Arbitrary and Data.Typeable.Typeable
-- instances for the types you want to test.
--
--
-- Consider this a pre-release. Everything is complete but undocumented
-- :) The best place to start is the examples at
-- http://github.com/nick8325/quickspec/tree/master/examples.
-- There is also a paper at
-- http://www.cse.chalmers.se/~nicsma/quickspec.pdf. Everything
-- you need should be in the module Test.QuickSpec.
--
-- If you want help, email me!
@package quickspec
@version 0.9
-- | A union-find data structure.
module Test.QuickSpec.Reasoning.UnionFind
type UF = State S
data Replacement
(:>) :: Int -> Int -> Replacement
newSym :: UF Int
(=:=) :: Int -> Int -> UF (Maybe Replacement)
rep :: Int -> UF Int
evalUF :: S -> UF a -> a
execUF :: S -> UF a -> S
runUF :: S -> UF a -> (a, S)
data S
isRep :: Int -> UF Bool
initial :: Int -> S
-- | A decision procedure for ground equality, based on the paper
-- Proof-producing Congruence Closure.
module Test.QuickSpec.Reasoning.CongruenceClosure
type CC = State S
newSym :: CC Int
(=:=) :: Int -> Int -> CC Bool
(=?=) :: Int -> Int -> CC Bool
rep :: Int -> CC Int
evalCC :: S -> CC a -> a
execCC :: S -> CC a -> S
runCC :: S -> CC a -> (a, S)
($$) :: Int -> Int -> CC Int
data S
funUse :: S -> (IntMap [(Int, Int)])
argUse :: S -> (IntMap [(Int, Int)])
lookup :: S -> IntMap (IntMap Int)
initial :: Int -> S
frozen :: CC a -> CC a
instance Eq FlatEqn
instance Ord FlatEqn
-- | A wrapper around Typeable, to work around:
--
--
-- - The lack of an Ord instance in older GHCs,
-- - bug #5962 in new GHCs.
--
module Test.QuickSpec.Utils.Typeable
data TypeRep
-- | The class Typeable allows a concrete representation of a type
-- to be calculated.
class Typeable a
-- | Variant for unary type constructors
class Typeable1 (t :: * -> *)
-- | Variant for binary type constructors
class Typeable2 (t :: * -> * -> *)
typeOf :: Typeable a => a -> TypeRep
typeOf1 :: Typeable1 t => t a -> TypeRep
cast :: (Typeable a, Typeable b) => a -> Maybe b
gcast :: (Typeable a, Typeable b) => c a -> Maybe (c b)
mkTyConApp :: TyCon -> [TypeRep] -> TypeRep
typeRepTyCon :: TypeRep -> TyCon
splitTyConApp :: TypeRep -> (TyCon, [TypeRep])
mkFunTy :: TypeRep -> TypeRep -> TypeRep
unTypeRep :: TypeRep -> TypeRep
instance Show TypeRep
instance Ord TypeRep
instance Eq TypeRep
-- | Functions for working with existentially-quantified types and similar.
module Test.QuickSpec.Utils.Typed
data Some f
Some :: (f a) -> Some f
newtype O f g a
O :: f (g a) -> O f g a
unO :: O f g a -> f (g a)
type List = []
newtype Witnessed a
Witness :: a -> Witnessed a
witness :: Witnessed a -> a
type Witness = Some Witnessed
witnessType :: Witness -> TypeRep
data Tagged a
Tagged :: Witness -> a -> Tagged a
tag :: Tagged a -> Witness
erase :: Tagged a -> a
tagged :: Typeable a => (f a -> b) -> f a -> Tagged b
some :: (forall a. Typeable a => f a -> b) -> Some f -> b
some2 :: (forall a. Typeable a => f (g a) -> b) -> Some (f O g) -> b
mapSome :: (forall a. Typeable a => f a -> g a) -> Some f -> Some g
mapSome2 :: (forall a. Typeable a => f (g a) -> h (i a)) -> Some (f O g) -> Some (h O i)
mapSomeM :: Monad m => (forall a. Typeable a => f a -> m (g a)) -> Some f -> m (Some g)
someType :: Some f -> TypeRep
someWitness :: Some f -> Witness
splitArrow :: TypeRep -> Maybe (TypeRep, TypeRep)
rightArrow :: TypeRep -> TypeRep
instance Show Witness
instance Ord Witness
instance Eq Witness
-- | A map from types to values. TypeMap f maps each type
-- a to a value of type f a.
module Test.QuickSpec.Utils.TypeMap
type TypeMap f = Map TypeRep (Some f)
empty :: TypeMap f
singleton :: Typeable a => f a -> TypeMap f
fromList :: [Some f] -> TypeMap f
toList :: TypeMap f -> [Some f]
lookup :: Typeable a => f a -> a -> TypeMap f -> f a
mapValues :: (forall a. Typeable a => f a -> g a) -> TypeMap f -> TypeMap g
mapValues2 :: (forall a. Typeable a => f (g a) -> h (i a)) -> TypeMap (f O g) -> TypeMap (h O i)
-- | Miscellaneous utility functions.
module Test.QuickSpec.Utils
repeatM :: Monad m => m a -> m [a]
partitionBy :: Ord b => (a -> b) -> [a] -> [[a]]
isSorted :: Ord a => [a] -> Bool
isSortedBy :: Ord b => (a -> b) -> [a] -> Bool
usort :: Ord a => [a] -> [a]
merge :: Ord b => (a -> a -> a) -> (a -> b) -> [a] -> [a] -> [a]
orElse :: Ordering -> Ordering -> Ordering
unbuffered :: IO a -> IO a
spoony :: Eq a => a -> Maybe a
-- | Terms and evaluation.
module Test.QuickSpec.Term
data Symbol
Symbol :: Int -> String -> Int -> Bool -> Bool -> TypeRep -> Symbol
index :: Symbol -> Int
name :: Symbol -> String
symbolArity :: Symbol -> Int
silent :: Symbol -> Bool
undef :: Symbol -> Bool
symbolType :: Symbol -> TypeRep
symbol :: Typeable a => String -> Int -> a -> Symbol
data Term
Var :: Symbol -> Term
Const :: Symbol -> Term
App :: Term -> Term -> Term
showOp :: String -> String
isOp :: String -> Bool
isUndefined :: Term -> Bool
symbols :: Term -> [Symbol]
depth :: Term -> Int
size :: Term -> Int
holes :: Term -> [(Symbol, Int)]
functor :: Term -> Symbol
args :: Term -> [Term]
funs :: Term -> [Symbol]
vars :: Term -> [Symbol]
mapVars :: (Symbol -> Symbol) -> Term -> Term
data Expr a
Expr :: Term -> {-# UNPACK #-} !Int -> ((forall b. Variable b -> b) -> a) -> Expr a
term :: Expr a -> Term
arity :: Expr a -> {-# UNPACK #-} !Int
eval :: Expr a -> (forall b. Variable b -> b) -> a
data Atom a
Atom :: Symbol -> a -> Atom a
sym :: Atom a -> Symbol
value :: Atom a -> a
newtype Variable a
Variable :: Atom (Gen a) -> Variable a
unVariable :: Variable a -> Atom (Gen a)
newtype Constant a
Constant :: Atom a -> Constant a
unConstant :: Constant a -> Atom a
mapVariable :: (Symbol -> Symbol) -> Variable a -> Variable a
mapConstant :: (Symbol -> Symbol) -> Constant a -> Constant a
valuation :: Gen (Variable a -> a)
var :: Variable a -> Expr a
con :: Constant a -> Expr a
app :: Expr (a -> b) -> Expr a -> Expr b
instance Eq Term
instance Functor Atom
instance Functor Variable
instance Functor Constant
instance Show (Expr a)
instance Ord (Expr a)
instance Eq (Expr a)
instance Show Term
instance Ord Term
instance Ord Symbol
instance Eq Symbol
instance Show Symbol
-- | A data structure to represent refining a set of terms into equivalence
-- classes by testing.
module Test.QuickSpec.TestTree
data TestTree a
terms :: TestTree a -> [a]
union :: Ord r => [a -> r] -> TestTree a -> TestTree a -> TestTree a
test :: Ord r => [a -> r] -> [a] -> TestTree a
data TestResults a
cutOff :: Int -> Int -> TestTree a -> TestResults a
numTests :: TestResults a -> Int
classes :: Ord a => TestResults a -> [[a]]
reps :: Ord a => TestResults a -> [a]
discrete :: Ord a => [a] -> TestResults a
-- | A relation between types and values. TypeRel f relates
-- each type a to a set of values of type f a.
module Test.QuickSpec.Utils.TypeRel
type TypeRel f = TypeMap (List O f)
empty :: TypeRel f
singleton :: Typeable a => f a -> TypeRel f
fromList :: [Some f] -> TypeRel f
toList :: TypeRel f -> [Some f]
lookup :: Typeable a => a -> TypeRel f -> [f a]
mapValues :: (forall a. Typeable a => f a -> g a) -> TypeRel f -> TypeRel g
gather :: [Some f] -> Some (List O f)
disperse :: Some (List O f) -> [Some f]
classify :: [Some f] -> [Some (List O f)]
-- | Functions for constructing and analysing signatures.
module Test.QuickSpec.Signature
-- | The class of things that can be used as a signature.
class Signature a
signature :: Signature a => a -> Sig
-- | A signature.
data Sig
Sig :: TypeRel Constant -> TypeRel Variable -> TypeMap Observer -> TypeMap Observer -> TypeMap Witnessed -> First Int -> First Int -> Sig
constants :: Sig -> TypeRel Constant
variables :: Sig -> TypeRel Variable
observers :: Sig -> TypeMap Observer
ords :: Sig -> TypeMap Observer
witnesses :: Sig -> TypeMap Witnessed
maxDepth_ :: Sig -> First Int
minTests_ :: Sig -> First Int
maxDepth :: Sig -> Int
updateDepth :: Int -> Sig -> Sig
minTests :: Sig -> Int
updateMinTests :: Int -> Sig -> Sig
data Used
Used :: Witness -> [Symbol] -> Used
uses :: Sig -> Witness -> Used
summarise :: Sig -> [String]
data Observer a
Observer :: (Gen (a -> b)) -> Observer a
observe :: Typeable a => a -> Sig -> Observer a
emptySig :: Sig
constantSig :: Typeable a => Constant a -> Sig
variableSig :: Typeable a => [Variable a] -> Sig
observerSig :: Typeable a => Observer a -> Sig
typeSig :: Typeable a => a -> Sig
ordSig :: Typeable a => Observer a -> Sig
-- | If withDepth n is in your signature, QuickSpec will consider
-- terms of up to depth n (the default is 3).
withDepth :: Int -> Sig
-- | If withTests n is in your signature, QuickSpec will run at
-- least n tests (the default is 500).
withTests :: Int -> Sig
-- | sig `without` xs will remove the functions in xs
-- from the signature sig. Useful when you want to use
-- prelude but exclude some functions. Example:
-- prelude (undefined :: A) `without` ["head", "tail"].
without :: Signature a => a -> [String] -> Sig
undefinedSig :: Typeable a => String -> a -> Sig
primCon0 :: Typeable a => Int -> String -> a -> Sig
primCon1 :: (Typeable a, Typeable b) => Int -> String -> (a -> b) -> Sig
primCon2 :: (Typeable a, Typeable b, Typeable c) => Int -> String -> (a -> b -> c) -> Sig
primCon3 :: (Typeable a, Typeable b, Typeable c, Typeable d) => Int -> String -> (a -> b -> c -> d) -> Sig
primCon4 :: (Typeable a, Typeable b, Typeable c, Typeable d, Typeable e) => Int -> String -> (a -> b -> c -> d -> e) -> Sig
-- | A constant.
blind0 :: Typeable a => String -> a -> Sig
-- | A unary function.
blind1 :: (Typeable a, Typeable b) => String -> (a -> b) -> Sig
-- | A binary function.
blind2 :: (Typeable a, Typeable b, Typeable c) => String -> (a -> b -> c) -> Sig
-- | A ternary function.
blind3 :: (Typeable a, Typeable b, Typeable c, Typeable d) => String -> (a -> b -> c -> d) -> Sig
-- | A function of arity 4.
blind4 :: (Typeable a, Typeable b, Typeable c, Typeable d, Typeable e) => String -> (a -> b -> c -> d -> e) -> Sig
ord :: (Ord a, Typeable a) => a -> Sig
observing :: Observer a -> a -> Observer a
-- | Mark all the functions in a signature as background functions.
--
-- QuickSpec will only print a law if it contains at least one
-- non-background function.
--
-- The functions in e.g. prelude are declared as background
-- functions.
background :: Signature a => a -> Sig
-- | Similar to vars, but takes a generator as a parameter.
--
-- gvars xs (arbitrary :: Gen a) is the same as vars xs
-- (undefined :: a).
gvars :: Typeable a => [String] -> Gen a -> Sig
-- | Declare a set of variables of a particular type.
--
-- For example, vars ["x","y","z"] (undefined :: Int) defines
-- three variables, x, y and z, of type
-- Int.
vars :: (Arbitrary a, Typeable a) => [String] -> a -> Sig
-- | A constant. The same as fun0.
con :: (Ord a, Typeable a) => String -> a -> Sig
-- | A constant. The same as con.
fun0 :: (Ord a, Typeable a) => String -> a -> Sig
-- | A unary function.
fun1 :: (Typeable a, Typeable b, Ord b) => String -> (a -> b) -> Sig
-- | A binary function.
fun2 :: (Typeable a, Typeable b, Typeable c, Ord c) => String -> (a -> b -> c) -> Sig
-- | A ternary function.
fun3 :: (Typeable a, Typeable b, Typeable c, Typeable d, Ord d) => String -> (a -> b -> c -> d) -> Sig
-- | A function of four arguments.
fun4 :: (Typeable a, Typeable b, Typeable c, Typeable d, Typeable e, Ord e) => String -> (a -> b -> c -> d -> e) -> Sig
-- | An observation function of arity 1.
observer1 :: (Typeable a, Typeable b, Ord b) => (a -> b) -> Sig
-- | An observation function of arity 2.
observer2 :: (Arbitrary a, Typeable a, Typeable b, Typeable c, Ord c) => (a -> b -> c) -> Sig
-- | An observation function of arity 3.
observer3 :: (Arbitrary a, Arbitrary b, Typeable a, Typeable b, Typeable c, Typeable d, Ord d) => (a -> b -> c -> d) -> Sig
-- | An observation function of arity 4.
observer4 :: (Arbitrary a, Arbitrary b, Arbitrary c, Typeable a, Typeable b, Typeable c, Typeable d, Typeable e, Ord e) => (a -> b -> c -> d -> e) -> Sig
testable :: Typeable a => Sig -> a -> Bool
constantApplications :: Typeable a => Sig -> Constant a -> [Witness]
constantArgs :: Typeable a => Sig -> Constant a -> [Witness]
constantRes :: Typeable a => Sig -> Constant a -> Witness
saturatedTypes :: Sig -> [Witness]
inhabitedTypes :: Sig -> [Witness]
argumentTypes :: Sig -> [Witness]
variableTypes :: Sig -> [Witness]
witnessArrow :: Typeable a => Sig -> a -> Maybe (Witness, Witness)
lhsWitnesses :: Typeable a => Sig -> a -> [Witness]
findWitness :: Sig -> TypeRep -> Witness
lookupWitness :: Sig -> TypeRep -> Maybe Witness
disambiguate :: Sig -> [Symbol] -> Term -> Term
instance Monoid Sig
instance Show Used
instance Show Sig
instance Signature a => Signature [a]
instance Signature Sig
-- | The "prelude": a standard signature containing useful functions like
-- ++, which can be used as background theory.
module Test.QuickSpec.Prelude
-- | Just a type. You can instantiate your polymorphic functions at this
-- type to include them in a signature.
newtype A
A :: Int -> A
newtype B
B :: Int -> B
newtype C
C :: Int -> C
-- | A type with two elements. Use this instead of A if testing
-- doesn't work well because the domain of A is too large.
data Two
One :: Two
Two :: Two
-- | A signature containing boolean functions: (||),
-- (&&), not, True, False.
bools :: Sig
-- | A signature containing arithmetic operations: 0, 1,
-- (+), (*). Instantiate it with e.g.
-- arith (undefined :: Int).
arith :: (Typeable a, Ord a, Num a, Arbitrary a) => a -> Sig
-- | A signature containing list operations: [], (:),
-- head, tail, (++). Instantiate it with
-- e.g. lists (undefined :: A).
lists :: (Typeable a, Ord a, Arbitrary a) => a -> Sig
-- | A signature containing higher-order functions: (.),
-- id, and some function variables. Useful for testing map.
funs :: (Typeable a, Ord a, Arbitrary a, CoArbitrary a) => a -> Sig
-- | The QuickSpec prelude. Contains boolean, arithmetic and list
-- functions, and some variables. Instantiate it as e.g. prelude
-- (undefined :: A).
prelude :: (Typeable a, Ord a, Arbitrary a) => a -> Sig
instance Typeable A
instance Typeable B
instance Typeable C
instance Typeable Two
instance Eq A
instance Ord A
instance Arbitrary A
instance CoArbitrary A
instance Eq B
instance Ord B
instance Arbitrary B
instance CoArbitrary B
instance Eq C
instance Ord C
instance Arbitrary C
instance CoArbitrary C
instance Eq Two
instance Ord Two
instance CoArbitrary Two
instance Arbitrary Two
-- | Equations.
module Test.QuickSpec.Equation
data Equation
(:=:) :: Term -> Term -> Equation
showEquation :: Sig -> Equation -> String
equations :: [[Tagged Term]] -> [Equation]
instance Eq Equation
instance Ord Equation
instance Show Equation
-- | Equational reasoning built on top of congruence closure.
module Test.QuickSpec.Reasoning.NaiveEquationalReasoning
data Context
Context :: S -> Map TypeRep Universe -> Int -> Context
rel :: Context -> S
universe :: Context -> Map TypeRep Universe
maxDepth :: Context -> Int
type Universe = IntMap [Int]
type EQ = ReaderT (Map TypeRep Universe, Int) CC
initial :: Int -> [Tagged Term] -> Context
createUniverse :: [Term] -> CC Universe
runEQ :: Context -> EQ a -> (a, Context)
evalEQ :: Context -> EQ a -> a
execEQ :: Context -> EQ a -> Context
liftCC :: CC a -> EQ a
(=?=) :: Term -> Term -> EQ Bool
unifiable :: Equation -> EQ Bool
(=:=) :: Term -> Term -> EQ Bool
unify :: Equation -> EQ Bool
type Subst = Symbol -> Int
substs :: Term -> Map TypeRep Universe -> Int -> [Subst]
subst :: Subst -> Term -> CC Int
flatten :: Term -> CC Int
get :: EQ S
put :: S -> EQ ()
rep :: Term -> EQ Int
-- | The testing loop and term generation of QuickSpec.
module Test.QuickSpec.Generate
terms :: Sig -> TypeRel Expr -> TypeRel Expr
terms' :: Typeable a => Sig -> TypeRel Expr -> a -> [Expr a]
test :: [(StdGen, Int)] -> Sig -> TypeMap (List O Expr) -> TypeMap (TestResults O Expr)
test' :: Typeable a => [(StdGen, Int)] -> Sig -> [Expr a] -> TestResults (Expr a)
genSeeds :: IO [(StdGen, Int)]
generate :: Sig -> IO (TypeMap (TestResults O Expr))
eraseClasses :: TypeMap (TestResults O Expr) -> [[Tagged Term]]
module Test.QuickSpec.Approximate
newtype Plug
Plug :: (forall a. Partial a => Gen a -> Gen a) -> Plug
unPlug :: Plug -> forall a. Partial a => Gen a -> Gen a
type GP = ReaderT Plug Gen
plug :: Partial a => GP a -> GP a
class (Typeable a, Arbitrary a, Eq a) => Partial a where unlifted x = return x
unlifted :: Partial a => a -> GP a
lifted :: Partial a => a -> GP a
approximate :: Partial a => (StdGen, Int) -> a -> a
pobserver :: (Ord a, Partial a) => a -> Sig
genPartial :: Partial a => a -> Gen a
pvars :: (Ord a, Partial a) => [String] -> a -> Sig
instance Partial a => Partial [a]
instance Partial Bool
instance Partial Integer
instance Partial Int
instance Partial ()
-- | The main implementation of QuickSpec.
module Test.QuickSpec.Main
undefinedsSig :: Sig -> Sig
universe :: [[Tagged Term]] -> [Tagged Term]
prune :: Int -> [Tagged Term] -> [Term] -> [Equation] -> [Equation]
defines :: Equation -> Maybe Symbol
definitions :: [Equation] -> [Equation]
runTool :: Signature a => (Sig -> IO ()) -> a -> IO ()
-- | Run QuickSpec on a signature.
quickSpec :: Signature a => a -> IO ()
sampleList :: StdGen -> Int -> [a] -> [a]
-- | Generate random terms from a signature. Useful when QuickSpec is
-- generating too many terms and you want to know what they look like.
sampleTerms :: Signature a => a -> IO ()
-- | The main QuickSpec module.
--
-- This will not make sense if you haven't seen some examples! Look at
-- http://github.com/nick8325/quickspec/tree/master/examples, or
-- read the paper at
-- http://www.cse.chalmers.se/~nicsma/quickspec.pdf.
module Test.QuickSpec
-- | Run QuickSpec on a signature.
quickSpec :: Signature a => a -> IO ()
-- | Generate random terms from a signature. Useful when QuickSpec is
-- generating too many terms and you want to know what they look like.
sampleTerms :: Signature a => a -> IO ()
-- | A signature.
data Sig
-- | The class of things that can be used as a signature.
class Signature a
signature :: Signature a => a -> Sig
-- | A constant. The same as fun0.
con :: (Ord a, Typeable a) => String -> a -> Sig
-- | A constant. The same as con.
fun0 :: (Ord a, Typeable a) => String -> a -> Sig
-- | A unary function.
fun1 :: (Typeable a, Typeable b, Ord b) => String -> (a -> b) -> Sig
-- | A binary function.
fun2 :: (Typeable a, Typeable b, Typeable c, Ord c) => String -> (a -> b -> c) -> Sig
-- | A ternary function.
fun3 :: (Typeable a, Typeable b, Typeable c, Typeable d, Ord d) => String -> (a -> b -> c -> d) -> Sig
-- | A function of four arguments.
fun4 :: (Typeable a, Typeable b, Typeable c, Typeable d, Typeable e, Ord e) => String -> (a -> b -> c -> d -> e) -> Sig
-- | A constant.
blind0 :: Typeable a => String -> a -> Sig
-- | A unary function.
blind1 :: (Typeable a, Typeable b) => String -> (a -> b) -> Sig
-- | A binary function.
blind2 :: (Typeable a, Typeable b, Typeable c) => String -> (a -> b -> c) -> Sig
-- | A ternary function.
blind3 :: (Typeable a, Typeable b, Typeable c, Typeable d) => String -> (a -> b -> c -> d) -> Sig
-- | A function of arity 4.
blind4 :: (Typeable a, Typeable b, Typeable c, Typeable d, Typeable e) => String -> (a -> b -> c -> d -> e) -> Sig
-- | Declare a set of variables of a particular type.
--
-- For example, vars ["x","y","z"] (undefined :: Int) defines
-- three variables, x, y and z, of type
-- Int.
vars :: (Arbitrary a, Typeable a) => [String] -> a -> Sig
-- | Similar to vars, but takes a generator as a parameter.
--
-- gvars xs (arbitrary :: Gen a) is the same as vars xs
-- (undefined :: a).
gvars :: Typeable a => [String] -> Gen a -> Sig
-- | An observation function of arity 1.
observer1 :: (Typeable a, Typeable b, Ord b) => (a -> b) -> Sig
-- | An observation function of arity 2.
observer2 :: (Arbitrary a, Typeable a, Typeable b, Typeable c, Ord c) => (a -> b -> c) -> Sig
-- | An observation function of arity 3.
observer3 :: (Arbitrary a, Arbitrary b, Typeable a, Typeable b, Typeable c, Typeable d, Ord d) => (a -> b -> c -> d) -> Sig
-- | An observation function of arity 4.
observer4 :: (Arbitrary a, Arbitrary b, Arbitrary c, Typeable a, Typeable b, Typeable c, Typeable d, Typeable e, Ord e) => (a -> b -> c -> d -> e) -> Sig
-- | Mark all the functions in a signature as background functions.
--
-- QuickSpec will only print a law if it contains at least one
-- non-background function.
--
-- The functions in e.g. prelude are declared as background
-- functions.
background :: Signature a => a -> Sig
-- | If withDepth n is in your signature, QuickSpec will consider
-- terms of up to depth n (the default is 3).
withDepth :: Int -> Sig
-- | If withTests n is in your signature, QuickSpec will run at
-- least n tests (the default is 500).
withTests :: Int -> Sig
-- | sig `without` xs will remove the functions in xs
-- from the signature sig. Useful when you want to use
-- prelude but exclude some functions. Example:
-- prelude (undefined :: A) `without` ["head", "tail"].
without :: Signature a => a -> [String] -> Sig
-- | Just a type. You can instantiate your polymorphic functions at this
-- type to include them in a signature.
data A
data B
data C
-- | A type with two elements. Use this instead of A if testing
-- doesn't work well because the domain of A is too large.
data Two
-- | The QuickSpec prelude. Contains boolean, arithmetic and list
-- functions, and some variables. Instantiate it as e.g. prelude
-- (undefined :: A).
prelude :: (Typeable a, Ord a, Arbitrary a) => a -> Sig
-- | A signature containing boolean functions: (||),
-- (&&), not, True, False.
bools :: Sig
-- | A signature containing arithmetic operations: 0, 1,
-- (+), (*). Instantiate it with e.g.
-- arith (undefined :: Int).
arith :: (Typeable a, Ord a, Num a, Arbitrary a) => a -> Sig
-- | A signature containing list operations: [], (:),
-- head, tail, (++). Instantiate it with
-- e.g. lists (undefined :: A).
lists :: (Typeable a, Ord a, Arbitrary a) => a -> Sig
-- | A signature containing higher-order functions: (.),
-- id, and some function variables. Useful for testing map.
funs :: (Typeable a, Ord a, Arbitrary a, CoArbitrary a) => a -> Sig