ghc-9.0.2: The GHC API

GHC.Tc.Deriv.Generate

Description

Generating derived instance declarations

This module is nominally subordinate' to GHC.Tc.Deriv, which is the official' interface to deriving-related things.

This is where we do all the grimy bindings' generation.

Synopsis

# Documentation

Constructors

 DerivAuxBind AuxBindSpec A new, top-level auxiliary binding. Used for deriving Eq, Ord, Enum, Ix, and Data. See Note [Auxiliary binders]. DerivFamInst FamInst A new type family instance. Used for:DeriveGeneric, which generates instances of Rep(1)DeriveAnyClass, which can fill in associated type family defaultsGeneralizedNewtypeDeriving, which generates instances of associated type families for newtypes

genAuxBinds :: DynFlags -> SrcSpan -> BagDerivStuff -> SeparateBagsDerivStuff Source #

Take a BagDerivStuff and partition it into SeparateBagsDerivStuff. Also generate the code for auxiliary bindings based on the declarative descriptions in the supplied AuxBindSpecs. See Note [Auxiliary binders].

Produces a function binding. When no equations are given, it generates a binding of the given arity and an empty case expression for the last argument that it passes to the given function to produce the right-hand side.

Produces a function binding. When there are no equations, it generates a binding with the given arity that produces an error based on the name of the type of the last argument.