Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

- data SubT = (Arbitrary a, SubTypes a) => SubT {
- unSubT :: a

- subT :: (Arbitrary a, SubTypes a) => a -> SubT
- data Result a
- = BaseType
- | FailedPreCond
- | FailedProp
- | Result a

- class (Arbitrary a, Show a, Typeable a) => SubTypes a where
- data Idx = Idx {}
- data Subst
- data Replace a = Replace {}
- errorMsg :: String -> a
- gst :: GST f => f a -> Forest SubT
- grc :: (GST f, Typeable b) => f a -> Forest Subst -> b -> Maybe (f a)
- gtc :: GST f => f a -> String
- gsf :: GST f => f a -> Forest String

# Documentation

Possible results of iterateArb.

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

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 = []}]

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.

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.

Keep or substitue a value in the tree.

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