Changes between Version 48 and Version 49 of TypeFunctionsTypeChecking


Ignore:
Timestamp:
Feb 23, 2007 3:24:58 AM (7 years ago)
Author:
chak
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TypeFunctionsTypeChecking

    v48 v49  
    4646An additional complication is that the associated types of a class need already be available when type checking the super class context and the method signatures of the same class, or other things in the same type checking knot.  Hence, we need to make them available in the temporary environment constructed in the knot tied by `TcTyClsDecls.tcTyAndClassDecls`.  Special care is required as this knot tying relies on the property that the list of declarations, `alg_at_decls`, and the list of `TyThing`s produced by type checking the declarations, `rec_alg_tyclss`, match up (for zipping them together within `mkGlobalThings`).  We guarantee this by always entering the associated types of a class right after that class in the declaration list. 
    4747 
    48 An important property of associated types is that their index types always coincide with the class instance arguments at those argument positions that used the same type variables in the associated family declaration.   To check that property, each `AlgTyCon` and each `SynTyCon` contains a field `tyConArgPoss :: Maybe [Int]` that has a value of the form `Just poss` for associated family `TyCon`s, where `poss` gives the argument position in the class head for each family argument.  For example, 
     48An important property of associated types is that their index types always coincide with the class instance arguments at those argument positions that use the same type variables in the associated family declaration.   To check that property, the right hand-sides of `AlgTyConRhs` and `SynTyConRhs` of `AlgTyCon` and `SynTyCon`, respectively, contain a field of type `Maybe [Int]` in the variant indicating an open family declaration (i.e., variant `OpenTyCon` and `OpenSynTyCon`).  This field has a value of the form `Just poss` for associated family `TyCon`s, where `poss` gives the argument position in the class head for each family argument.  For example, 
    4949{{{ 
    5050class C a b c where