... | ... | @@ -24,6 +24,11 @@ Kind signatures are handled by `TcTyClsDecls.tcTyClsDecl` together with all othe |
|
|
|
|
|
Instances of indexed types are type checked by `TcTyClDecls.tcIdxTyInstDecl`; i.e., the same functions that performs their kind checking. Kind checking and type checking of instances of indexed types can be combined, as we don't need to worry as much about recursive dependencies as we have to for standard type declarations. In particular, the kinds of indexed types are declared by their signature and we don't have to compute any recursiveness information, as we never know whether we reached a fixed point for open types. (Hence, we conservatively assume indexed types to be always `Recursive`. This is safe as they are implicit loop breakers due to to implying coercions.)
|
|
|
|
|
|
### Deriving clauses at data instances
|
|
|
|
|
|
|
|
|
The main issue when handling `deriving` clauses for data instances in `TcDeriv` is using the representation tycon, where needed (instead of the family tycon, which appears in the actual declaration). In particular, the list of constructors is only available from the representation tycon. These constructors already have appropriate signatures mentioning the family tycon in the result type, so that most of the deriving machinery works out of the box. As `TcDeriv.makeDerivEqns` extracts the set of class instances that need to be derived from the un-typechecked source form, we need the new `TcEnv.tcLookupFamInst` to look up type-checked family instances from tycon/type-indexes pairs. (All information needed for that is already available in the type checker environment.)
|
|
|
|
|
|
## Core representation of signatures of indexed families
|
|
|
|
|
|
|
... | ... | |