Changes between Version 22 and Version 23 of TypeFunctions
 Timestamp:
 Jul 31, 2006 9:16:22 PM (10 years ago)
Legend:
 Unmodified
 Added
 Removed
 Modified

TypeFunctions
v22 v23 45 45 To represent type functions and associated data types, we need to generalise data type declarations `TyData` and type synonym declarations `TySynonym` to allow type patterns instead of just type variables as parameters. We do so by way of the field `tcdPats` of type `Maybe [LHsType name]`, used as follows: 46 46 * If it is `Nothing`, we have a ''vanilla'' data type declaration or type synonym declaration and `tcdVars` contains the type parameters of the type constructor. 47 * If it is `Just pats`, we have the definition of an associated data type or a type function equations (toplevel or nested in an instance declarations). Then, 'pats' are type patterns for the typeindexes of the type constructor and `tcdVars` are the variables in those patterns. Hence, the arity of the type constructor is `length tcdPats` and *not*`length tcdVars`.47 * If it is `Just pats`, we have the definition of an associated data type or a type function equations (toplevel or nested in an instance declarations). Then, 'pats' are type patterns for the typeindexes of the type constructor and `tcdVars` are the variables in those patterns. Hence, the arity of the type constructor is `length tcdPats` and ''not'' `length tcdVars`. 48 48 In both cases (and as before type functions), `tcdVars` collects all variables we need to quantify over. 49 49