Copyright | (C) 2015-2017 Ryan Scott |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Ryan Scott |
Portability | Template Haskell |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Data.Enum.Deriving.Internal
Contents
Description
Exports functions to mechanically derive Enum
instances.
Note: this is an internal module, and as such, the API presented here is not guaranteed to be stable, even between minor releases of this library.
Synopsis
- deriveEnum :: Name -> Q [Dec]
- makeSucc :: Name -> Q Exp
- makePred :: Name -> Q Exp
- makeToEnum :: Name -> Q Exp
- makeFromEnum :: Name -> Q Exp
- makeEnumFrom :: Name -> Q Exp
- makeEnumFromThen :: Name -> Q Exp
Enum
deriveEnum :: Name -> Q [Dec] Source #
Generates an Enum
instance declaration for the given data type or data
family instance.
makeSucc :: Name -> Q Exp Source #
Generates a lambda expression which behaves like succ
(without
requiring an Enum
instance).
makePred :: Name -> Q Exp Source #
Generates a lambda expression which behaves like pred
(without
requiring an Enum
instance).
makeToEnum :: Name -> Q Exp Source #
Generates a lambda expression which behaves like toEnum
(without
requiring an Enum
instance).
makeFromEnum :: Name -> Q Exp Source #
Generates a lambda expression which behaves like fromEnum
(without
requiring an Enum
instance).
makeEnumFrom :: Name -> Q Exp Source #
Generates a lambda expression which behaves like enumFrom
(without
requiring an Enum
instance).
makeEnumFromThen :: Name -> Q Exp Source #
Generates a lambda expression which behaves like enumFromThen
(without
requiring an Enum
instance).