smartcheck-0.2.4: A smarter QuickCheck.

Safe HaskellSafe
LanguageHaskell2010

Test.SmartCheck.Types

Contents

Synopsis

Documentation

data SubT Source #

Constructors

(Arbitrary a, SubTypes a) => SubT 

Fields

Instances

subT :: (Arbitrary a, SubTypes a) => a -> SubT Source #

data Result a Source #

Possible results of iterateArb.

Constructors

BaseType

Base type. Won't analyze.

FailedPreCond

Couldn't satisfy the precondition of a QuickCheck property

FailedProp

Failed the property---either we expect failure and it passes or we expect to pass it and we fail.

Result a

Satisfied it, with the satisfying value.

Instances

Monad Result Source # 

Methods

(>>=) :: Result a -> (a -> Result b) -> Result b #

(>>) :: Result a -> Result b -> Result b #

return :: a -> Result a #

fail :: String -> Result a #

Functor Result Source # 

Methods

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

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

Applicative Result Source # 

Methods

pure :: a -> Result a #

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

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

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

Eq a => Eq (Result a) Source # 

Methods

(==) :: Result a -> Result a -> Bool #

(/=) :: Result a -> Result a -> Bool #

Read a => Read (Result a) Source # 
Show a => Show (Result a) Source # 

Methods

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

show :: Result a -> String #

showList :: [Result a] -> ShowS #

class (Arbitrary a, Show a, Typeable a) => SubTypes a where Source #

This class covers algebraic datatypes that can be transformed into Trees. subTypes is the main method, placing values into trees.

for a datatype with constructors A and C,

subTypes (A (C 0) 1)
[Node {rootLabel = C 0, subForest = []}]

Methods

subTypes :: a -> Forest SubT Source #

Turns algebraic data into a forest representation.

subTypes :: (Generic a, GST (Rep a)) => a -> Forest SubT Source #

Turns algebraic data into a forest representation.

baseType :: a -> Bool Source #

Base types (e.g., Int, Char) aren't analyzed.

replaceChild :: Typeable b => a -> Forest Subst -> b -> Maybe a Source #

Generically replace child i in m with value s. A total function: returns Nothing if you try to replace a child with an ill-typed child s. (Returns Just (the original data) if your index is out of bounds).

replaceChild :: (Generic a, GST (Rep a), Typeable b) => a -> Forest Subst -> b -> Maybe a Source #

Generically replace child i in m with value s. A total function: returns Nothing if you try to replace a child with an ill-typed child s. (Returns Just (the original data) if your index is out of bounds).

toConstr :: a -> String Source #

Get the string representation of the constructor.

toConstr :: (Generic a, GST (Rep a)) => a -> String Source #

Get the string representation of the constructor.

showForest :: a -> Forest String Source #

showForest generically shows a value while preserving its structure (in a Tree). Always returns either a singleton list containing the tree (a degenerate forest) or an empty list for baseTypes. An invariant is that the shape of the tree produced by showForest is the same as the one produced by subTypes.

showForest :: (Generic a, GST (Rep a)) => a -> Forest String Source #

showForest generically shows a value while preserving its structure (in a Tree). Always returns either a singleton list containing the tree (a degenerate forest) or an empty list for baseTypes. An invariant is that the shape of the tree produced by showForest is the same as the one produced by subTypes.

Instances

SubTypes Bool Source # 
SubTypes Char Source # 
SubTypes Double Source # 
SubTypes Float Source # 
SubTypes Int Source # 
SubTypes Int8 Source # 
SubTypes Int16 Source # 
SubTypes Int32 Source # 
SubTypes Int64 Source # 
SubTypes Integer Source # 
SubTypes Word Source # 
SubTypes Word8 Source # 
SubTypes Word16 Source # 
SubTypes Word32 Source # 
SubTypes Word64 Source # 
SubTypes () Source # 
(Arbitrary a, SubTypes a, Typeable * a) => SubTypes [a] Source # 

Methods

subTypes :: [a] -> Forest SubT Source #

baseType :: [a] -> Bool Source #

replaceChild :: Typeable * b => [a] -> Forest Subst -> b -> Maybe [a] Source #

toConstr :: [a] -> String Source #

showForest :: [a] -> Forest String Source #

(Arbitrary a, SubTypes a, Typeable * a) => SubTypes (Maybe a) Source # 
(Integral a, Arbitrary a, SubTypes a, Typeable * a) => SubTypes (Ratio a) Source # 
(RealFloat a, Arbitrary a, SubTypes a, Typeable * a) => SubTypes (Complex a) Source # 
(Arbitrary a, SubTypes a, Typeable * a, Arbitrary b, SubTypes b, Typeable * b) => SubTypes (Either a b) Source # 
(Arbitrary a, SubTypes a, Typeable * a, Arbitrary b, SubTypes b, Typeable * b) => SubTypes (a, b) Source # 

Methods

subTypes :: (a, b) -> Forest SubT Source #

baseType :: (a, b) -> Bool Source #

replaceChild :: Typeable * b => (a, b) -> Forest Subst -> b -> Maybe (a, b) Source #

toConstr :: (a, b) -> String Source #

showForest :: (a, b) -> Forest String Source #

(Arbitrary a, SubTypes a, Typeable * a, Arbitrary b, SubTypes b, Typeable * b, Arbitrary c, SubTypes c, Typeable * c) => SubTypes (a, b, c) Source # 

Methods

subTypes :: (a, b, c) -> Forest SubT Source #

baseType :: (a, b, c) -> Bool Source #

replaceChild :: Typeable * b => (a, b, c) -> Forest Subst -> b -> Maybe (a, b, c) Source #

toConstr :: (a, b, c) -> String Source #

showForest :: (a, b, c) -> Forest String Source #

(Arbitrary a, SubTypes a, Typeable * a, Arbitrary b, SubTypes b, Typeable * b, Arbitrary c, SubTypes c, Typeable * c, Arbitrary d, SubTypes d, Typeable * d) => SubTypes (a, b, c, d) Source # 

Methods

subTypes :: (a, b, c, d) -> Forest SubT Source #

baseType :: (a, b, c, d) -> Bool Source #

replaceChild :: Typeable * b => (a, b, c, d) -> Forest Subst -> b -> Maybe (a, b, c, d) Source #

toConstr :: (a, b, c, d) -> String Source #

showForest :: (a, b, c, d) -> Forest String Source #

(Arbitrary a, SubTypes a, Typeable * a, Arbitrary b, SubTypes b, Typeable * b, Arbitrary c, SubTypes c, Typeable * c, Arbitrary d, SubTypes d, Typeable * d, Arbitrary e, SubTypes e, Typeable * e) => SubTypes (a, b, c, d, e) Source # 

Methods

subTypes :: (a, b, c, d, e) -> Forest SubT Source #

baseType :: (a, b, c, d, e) -> Bool Source #

replaceChild :: Typeable * b => (a, b, c, d, e) -> Forest Subst -> b -> Maybe (a, b, c, d, e) Source #

toConstr :: (a, b, c, d, e) -> String Source #

showForest :: (a, b, c, d, e) -> Forest String Source #

data Idx Source #

Index into a Tree/Forest, where level is the depth from the root and column is the distance d is the dth value on the same level. Thus, all left-most nodes are in column 0. This is a "matrix view" of tree-structured data.

Constructors

Idx 

Fields

Instances

Eq Idx Source # 

Methods

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

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

Ord Idx Source #

Sort in order of depth first then left to right.

Methods

compare :: Idx -> Idx -> Ordering #

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

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

(>) :: Idx -> Idx -> Bool #

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

max :: Idx -> Idx -> Idx #

min :: Idx -> Idx -> Idx #

Show Idx Source # 

Methods

showsPrec :: Int -> Idx -> ShowS #

show :: Idx -> String #

showList :: [Idx] -> ShowS #

data Subst Source #

Keep or substitue a value in the tree.

Constructors

Keep 
Subst 

data Replace a Source #

Nominally, a list for value generalization indexes and existential generalization.

Constructors

Replace 

Fields

Instances

Eq a => Eq (Replace a) Source # 

Methods

(==) :: Replace a -> Replace a -> Bool #

(/=) :: Replace a -> Replace a -> Bool #

Read a => Read (Replace a) Source # 
Show a => Show (Replace a) Source # 

Methods

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

show :: Replace a -> String #

showList :: [Replace a] -> ShowS #

For constructing new instances of SubTypes

gst :: GST f => f a -> Forest SubT Source #

grc :: (GST f, Typeable b) => f a -> Forest Subst -> b -> Maybe (f a) Source #

gtc :: GST f => f a -> String Source #

gsf :: GST f => f a -> Forest String Source #