Copyright | (c) 2015-2018 Rudy Matela |
---|---|
License | 3-Clause BSD (see the file LICENSE) |
Maintainer | Rudy Matela <rudy@matela.com.br> |
Safe Haskell | None |
Language | Haskell2010 |
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, 8.0, 8.2 and 8.4).
If LeanCheck does not compile under later GHCs, this module is probably the culprit.
Synopsis
- 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 #