Generalizing a type class

Example: extracting the set of names defined by a declaration, or a pattern.

Before

class DefinedNames def where
  definedNames :: def -> [(HsIdent,IdType)]

After

class DefinedNames i def | def->i where
  definedNames :: def -> [(HsIdentI i,IdTy i)]

Thanks to functional dependencies, the class still behaves like a single parameter class. (No new ambiguities...)

(See modules DefinedNames, DefinedNamesBaseStruct, DefinedNamesBase.)