Safe Haskell | Safe-Infered |
---|

Generation of random shrinkable, showable functions. Not really documented at the moment!

Example of use:

`>>>`

`:{`

`>>>`

`let prop :: Fun String Integer -> Bool`

`>>>`

`prop (Fun _ f) = f "monkey" == f "banana" || f "banana" == f "elephant"`

`>>>`

`:}`

`>>>`

*** Failed! Falsifiable (after 3 tests and 134 shrinks): {"elephant"->1, "monkey"->1, _->0}`quickCheck prop`

To generate random values of type

,
you must have an instance `Fun`

a b

.
If your type has a `Function`

a`Show`

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

Function Bool | |

Function Char | |

Function Int | |

Function Integer | |

Function Word8 | |

Function () | |

Function OrdC | |

Function OrdB | |

Function OrdA | |

Function C | |

Function B | |

Function A | |

Function a => Function [a] | |

Function a => Function (Maybe a) | |

(Function a, Function b) => Function (Either a b) | |

(Function a, Function b) => Function (a, b) |

functionMap :: Function b => (a -> b) -> (b -> a) -> (a -> c) -> a :-> cSource

functionShow :: (Show a, Read a) => (a -> c) -> a :-> cSource