Safe Haskell | None |
---|
Test.IOTasks.Var
Synopsis
- type Varname = String
- data Var a where
- pattern Var :: (Varname, TypeRep a) -> Var a
- class Embeddable a where
- asInteger :: a -> Integer
- asOriginal :: Integer -> a
- embeddingRange :: [Integer]
- data Embedded a where
- Embedded :: forall a. (Show a, Embeddable a) => Integer -> Embedded a
- data SomeVar where
- someVar :: Typeable a => Var a -> SomeVar
- someVarname :: SomeVar -> Varname
- withSomeVar :: SomeVar -> (forall a. Typeable a => Var a -> r) -> r
- data SomeConsistentVars where
- SomeConsistentVars :: forall a. Typeable a => [Var a] -> SomeConsistentVars
- someConsistentVars :: [SomeVar] -> Maybe SomeConsistentVars
- withSomeConsistentVars :: SomeConsistentVars -> (forall a. Typeable a => [Var a] -> r) -> r
- withConsistentList :: [SomeVar] -> (forall a. Typeable a => [Var a] -> r) -> Maybe r
- filterType :: Typeable a => [SomeVar] -> [Var a]
- intVar :: Varname -> Var Integer
- stringVar :: Varname -> Var String
- boolVar :: Varname -> Var Bool
- embeddedVar :: (Typeable a, Embeddable a, Show a, Read a) => Varname -> Var (Embedded a)
- varname :: Var a -> Varname
- varTypeRep :: Var a -> TypeRep a
- class VarExp (e :: Type -> Type) where
- data MergedVars a
- merge :: [Var a] -> MergedVars a
Documentation
Constructors
IntVar :: Varname -> Var Integer | |
BoolVar :: Varname -> Var Bool | |
StringVar :: Varname -> Var [Char] | |
EmbeddedVar :: forall a1. (Embeddable a1, Show a1, Read a1) => TypeRep a1 -> Varname -> Var (Embedded a1) |
class Embeddable a where Source #
Values embeddable into a finite set of integers
Laws:
asInteger . asOriginal = id
For types with Eq instances that induce non-trivial equivalence classes, at least the weaker
asOriginal (asInteger x) == x = True
should hold. However program coverage is weakened in such scenarios, as generated inputs will only
ever contain values from the co-domain of asOriginal
.
Methods
asInteger :: a -> Integer Source #
asOriginal :: Integer -> a Source #
embeddingRange :: [Integer] Source #
data Embedded a where Source #
Constructors
Embedded :: forall a. (Show a, Embeddable a) => Integer -> Embedded a |
someVarname :: SomeVar -> Varname Source #
withSomeVar :: SomeVar -> (forall a. Typeable a => Var a -> r) -> r Source #
data SomeConsistentVars where Source #
Constructors
SomeConsistentVars :: forall a. Typeable a => [Var a] -> SomeConsistentVars |
someConsistentVars :: [SomeVar] -> Maybe SomeConsistentVars Source #
withSomeConsistentVars :: SomeConsistentVars -> (forall a. Typeable a => [Var a] -> r) -> r Source #
withConsistentList :: [SomeVar] -> (forall a. Typeable a => [Var a] -> r) -> Maybe r Source #
filterType :: Typeable a => [SomeVar] -> [Var a] Source #
embeddedVar :: (Typeable a, Embeddable a, Show a, Read a) => Varname -> Var (Embedded a) Source #
varTypeRep :: Var a -> TypeRep a Source #
class VarExp (e :: Type -> Type) where Source #
Abstraction over different types of variable-expressions.
A variable-expression references one or more specification variables and can be used to access the values assigned to these specific variables.
If an expression references more than one variable, the values of these
variables are interleaved chronologically. I.e., currentValue
will provide
access to the current value of the last modified variable from the list and
allValues
gives a list where values appear in the order they were given to the program.
Additionally, all referenced variables must be of the same type.
Instances need to make sure that the resulting list is sorted!
Methods
toVarList :: e a -> [Var a] Source #
Computes the list of variables referenced by the variable expression.
Instances
VarExp MergedVars Source # | |
Defined in Test.IOTasks.Var Methods toVarList :: MergedVars a -> [Var a] Source # | |
VarExp Var Source # | |
data MergedVars a Source #
Instances
VarExp MergedVars Source # | |
Defined in Test.IOTasks.Var Methods toVarList :: MergedVars a -> [Var a] Source # | |
Show (MergedVars a) Source # | |
Defined in Test.IOTasks.Var Methods showsPrec :: Int -> MergedVars a -> ShowS show :: MergedVars a -> String showList :: [MergedVars a] -> ShowS | |
Eq (MergedVars a) Source # | |
Defined in Test.IOTasks.Var |
merge :: [Var a] -> MergedVars a Source #