Copyright | (C) 2015-2017 Ryan Scott |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Ryan Scott |
Portability | Template Haskell |
Safe Haskell | None |
Language | Haskell2010 |
Exports functions to mechanically derive Enum
instances.
Enum
deriveEnum :: Name -> Q [Dec] Source #
Generates an Enum
instance declaration for the given data type or data
family instance.
makeEnumFromThen :: Name -> Q Exp Source #
Generates a lambda expression which behaves like enumFromThen
(without
requiring an Enum
instance).
deriveEnum
limitations
Be aware of the following potential gotchas:
- Type variables of kind
*
are assumed to haveEnum
constraints. If this is not desirable, usemakeToEnum
or one of its cousins.