| Copyright | (c) 2017-2019 Rudy Matela |
|---|---|
| License | 3-Clause BSD (see the file LICENSE) |
| Maintainer | Rudy Matela <rudy@matela.com.br> |
| Safe Haskell | None |
| Language | Haskell2010 |
Test.Extrapolate.Speculation
Description
This module is part of Extrapolate, a library for generalization of counter-examples.
This defines utilities for speculation about side conditions.
You are probably better off importing Test.Extrapolate.
Documentation
Values of type Expr represent objects or applications between objects.
Each object is encapsulated together with its type and string representation.
Values encoded in Exprs are always monomorphic.
An Expr can be constructed using:
val, for values that areShowinstances;value, for values that are notShowinstances, like functions;:$, for applications betweenExprs.
> val False False :: Bool
> value "not" not :$ val False not False :: Bool
An Expr can be evaluated using evaluate, eval or evl.
> evl $ val (1 :: Int) :: Int 1
> evaluate $ val (1 :: Int) :: Maybe Bool Nothing
> eval 'a' (val 'b') 'b'
Showing a value of type Expr will return a pretty-printed representation
of the expression together with its type.
> show (value "not" not :$ val False) "not False :: Bool"
Expr is like Dynamic but has support for applications and variables
(:$, var).
The var underscore convention:
Functions that manipulate Exprs usually follow the convention
where a value whose String representation starts with '_'
represents a variable.
Instances
| Eq Expr | O(n). Does not evaluate values when comparing, but rather uses their representation as strings and their types. This instance works for ill-typed expressions. |
| Ord Expr | O(n). Does not evaluate values when comparing, but rather uses their representation as strings and their types. This instance works for ill-typed expressions. Expressions come first
when they have smaller complexity ( |
| Show Expr | Shows > show (value "not" not :$ val False) "not False :: Bool" |