| Copyright | (c) 2017 Rudy Matela |
|---|---|
| License | 3-Clause BSD (see the file LICENSE) |
| Maintainer | Rudy Matela <rudy@matela.com.br> |
| Safe Haskell | None |
| Language | Haskell2010 |
Test.Extrapolate.Derive
Description
This module is part of Extrapolate, a library for generalization of counter-examples.
This is a module for deriving Generalizable instances.
Needs GHC and Template Haskell (tested on GHC 8.0).
If Extrapolate does not compile under later GHCs, this module is the probable culprit.
Documentation
deriveGeneralizable :: Name -> DecsQ Source #
Derives a Generalizable instance for a given type Name.
Consider the following Stack datatype:
data Stack a = Stack a (Stack a) | Empty
Writing
deriveGeneralizable ''Stack
will automatically derive the following Generalizable instance:
instance Generalizable a => Generalizable (Stack a) where tiers = cons2 Stack \/ cons0 Empty
Needs the TemplateHaskell extension.
deriveGeneralizableIfNeeded :: Name -> DecsQ Source #
Same as deriveGeneralizable but does not warn when instance already exists
(deriveGeneralizable is preferable).
deriveGeneralizableCascading :: Name -> DecsQ Source #
Derives a Generalizable instance for a given type Name
cascading derivation of type arguments as well.