| Copyright | (c) 2015-2017 Rudy Matela |
|---|---|
| License | 3-Clause BSD (see the file LICENSE) |
| Maintainer | Rudy Matela <rudy@matela.com.br> |
| Safe Haskell | None |
| Language | Haskell2010 |
Test.LeanCheck.Derive
Description
This module is part of LeanCheck, a simple enumerative property-based testing library.
This is an experimental module for deriving Listable instances.
Needs GHC and Template Haskell (tested on GHC 7.4, 7.6, 7.8, 7.10 and 8.0).
If LeanCheck does not compile under later GHCs, this module is probably the culprit.
- deriveListable :: Name -> DecsQ
- deriveListableIfNeeded :: Name -> DecsQ
- deriveListableCascading :: Name -> DecsQ
- deriveTiers :: Name -> ExpQ
- deriveList :: Name -> ExpQ
Documentation
deriveListable :: Name -> DecsQ Source #
Derives a Listable instance for a given type Name.
Consider the following Stack datatype:
data Stack a = Stack a (Stack a) | Empty
Writing
deriveListable ''Stack
will automatically derive the following Listable instance:
instance Listable a => Listable (Stack a) where tiers = cons2 Stack \/ cons0 Empty
Needs the TemplateHaskell extension.
deriveListableIfNeeded :: Name -> DecsQ Source #
Same as deriveListable but does not warn when instance already exists
(deriveListable is preferable).
deriveListableCascading :: Name -> DecsQ Source #
deriveTiers :: Name -> ExpQ Source #
deriveList :: Name -> ExpQ Source #