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.Eq.Deriving

Exports functions to mechanically derive Eq, Eq1, and Eq2 instances. Note that upstream GHC does not have the ability to derive Eq1 or Eq2 instances, but since the functionality to derive Eq extends very naturally Eq1 and Eq2, the ability to derive the latter two classes is provided as a convenience.

  • 9 values

Eq

3 declarations
valuederiveEq :: Name -> Q [Dec]
#

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

valuemakeEq :: Name -> Q Exp
#

Generates a lambda expression which behaves like (==) (without requiring an Eq instance).

valuemakeNotEq :: Name -> Q Exp
#

Generates a lambda expression which behaves like (/=) (without requiring an Eq instance).

Eq1

3 declarations
valuederiveEq1 :: Name -> Q [Dec]
#

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

valuemakeLiftEq :: Name -> Q Exp
#

Generates a lambda expression which behaves like liftEq (without requiring an Eq1 instance).

This function is not available with transformers-0.4.

valuemakeEq1 :: Name -> Q Exp
#

Generates a lambda expression which behaves like eq1 (without requiring an Eq1 instance).

Eq2

3 declarations
valuederiveEq2 :: Name -> Q [Dec]
#

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

This function is not available with transformers-0.4.

valuemakeLiftEq2 :: Name -> Q Exp
#

Generates a lambda expression which behaves like liftEq2 (without requiring an Eq2 instance).

This function is not available with transformers-0.4.

valuemakeEq2 :: Name -> Q Exp
#

Generates a lambda expression which behaves like eq2 (without requiring an Eq2 instance).

This function is not available with transformers-0.4.

deriveEq limitations

0 declarations

Be aware of the following potential gotchas:

  • Type variables of kind * are assumed to have Eq constraints. Type variables of kind * -> * are assumed to have Eq1 constraints. Type variables of kind * -> * -> * are assumed to have Eq2 constraints. If this is not desirable, use makeEq or one of its cousins.

  • The Eq1 class had a different definition in transformers-0.4, and as a result, deriveEq1 implements different instances for the transformers-0.4 Eq1 than it otherwise does. Also, makeLiftEq is not available when this library is built against transformers-0.4, only 'makeEq1.

  • The Eq2 class is not available in transformers-0.4, and as a result, neither are Template Haskell functions that deal with Eq2 when this library is built against transformers-0.4.