HORIZON HASKELLDocslts/ghc-9.14.xd82dee82026-10-12Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · d82dee8 · 2026-10-12

Modulederiving-compat-0.6.8Haskell2010

Data.Enum.Deriving

Exports functions to mechanically derive Enum instances.

  • 7 values

Enum

7 declarations
valuederiveEnum :: Name -> Q [Dec]
#

Generates an Enum instance declaration for the given data type or data family instance.

valuemakeSucc :: Name -> Q Exp
#

Generates a lambda expression which behaves like succ (without requiring an Enum instance).

valuemakePred :: Name -> Q Exp
#

Generates a lambda expression which behaves like pred (without requiring an Enum instance).

deriveEnum limitations

0 declarations

Be aware of the following potential gotchas:

  • Type variables of kind * are assumed to have Enum constraints. If this is not desirable, use makeToEnum or one of its cousins.

  • Generated Enum instances for poly-kinded data family instances are likely to require the use of the TypeInType extension on GHC 8.0, 8.2, or 8.4.