Safe Haskell | None |
---|---|
Language | Haskell98 |
Generation of random shrinkable, showable functions. See the paper "Shrinking and showing functions" by Koen Claessen.
Example of use:
>>>
:{
>>>
let prop :: Fun String Integer -> Bool
>>>
prop (Fun _ f) = f "monkey" == f "banana" || f "banana" == f "elephant"
>>>
:}
>>>
quickCheck prop
*** Failed! Falsifiable (after 3 tests and 134 shrinks): {"elephant"->1, "monkey"->1, _->0}
To generate random values of type
,
you must have an instance Fun
a b
.
If your type has a Function
aShow
instance, you can use functionShow
to write the instance; otherwise,
use functionMap
to give a bijection between your type and a type that is already an instance of Function
.
See the
instance for an example of the latter.Function
[a]
Documentation
The type of possibly partial concrete functions
Function Bool Source | |
Function Char Source | |
Function Int Source | |
Function Integer Source | |
Function Word8 Source | |
Function () Source | |
Function OrdC Source | |
Function OrdB Source | |
Function OrdA Source | |
Function C Source | |
Function B Source | |
Function A Source | |
Function a => Function [a] Source | |
(Function a, Integral a) => Function (Ratio a) Source | |
Function a => Function (Maybe a) Source | |
(Function a, Function b) => Function (Either a b) Source | |
(Function a, Function b) => Function (a, b) Source | |
(Function a, Function b, Function c) => Function (a, b, c) Source | |
(Function a, Function b, Function c, Function d) => Function (a, b, c, d) Source | |
(Function a, Function b, Function c, Function d, Function e) => Function (a, b, c, d, e) Source | |
(Function a, Function b, Function c, Function d, Function e, Function f) => Function (a, b, c, d, e, f) Source | |
(Function a, Function b, Function c, Function d, Function e, Function f, Function g) => Function (a, b, c, d, e, f, g) Source |
functionMap :: Function b => (a -> b) -> (b -> a) -> (a -> c) -> a :-> c Source
functionShow :: (Show a, Read a) => (a -> c) -> a :-> c Source