Changes between Version 80 and Version 81 of TypeFunctions


Ignore:
Timestamp:
Jun 29, 2007 4:47:11 AM (7 years ago)
Author:
chak
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TypeFunctions

    v80 v81  
    5555type family T a1 .. an [:: <kind>] 
    5656}}} 
    57  and introduce `n`-ary type functions (with `n` >= 1), which may be of higher-kind.  Again, the type variables can have kind signatures and the result kind signature is optional, with `*` being the default.  Equations for an `n`-ary type function must specify exactly `n` arguments, which serve as indexes.  
    58  * Applications of type functions need to supply all indexes after unfolding of all ordinary type synonyms.  (This is the same saturation requirement that we already have on ordinary type synonyms.) 
    59  * Instances of data families and equations of type functions have the keyword `instance` after the first keyword.  They otherwise have the same form as ordinary data type/newtype and type synonym declarations, respectively, but can have non-variable type indexes as arguments.  Type indexes can include applications of data families, but no type synonym families. 
    60  * Instances of type families are only valid if a kind signature for the type constructor is in scope.  The kind of an indexed type is solely determined from the kind signature.  Instances must conform to this kind.  In particular, the argument count of data and newtype instances must match the arity indicated by the kind.  The number of arguments of a type equation must be equal to the number of type indexes (i.e., type variables in the head) of the family declaration.  Instances of data families can be both data types or newtypes (or a mix of the two). 
     57 and introduce `n`-ary type functions (with `n` >= 1), which may be of higher-kind.  Again, the type variables can have kind signatures and the result kind signature is optional, with `*` being the default.  Type instances for an `n`-ary type function must specify exactly `n` arguments, which serve as indexes.  
     58 * Applications of type synonym families need to supply all indexes after unfolding of all ordinary type synonyms.  (This is the same saturation requirement that we already have on ordinary type synonyms.) 
     59 * Instances of data and type families have the keyword `instance` after the first keyword.  They otherwise have the same form as ordinary data type and type synonym declarations, respectively, but can have non-variable type indexes as arguments.  Type indexes can include applications of data families, but no type synonym families. 
     60 * Instances of type families are only valid if a kind signature for the type constructor is in scope.  The kind of an indexed type is solely determined from the kind signature.  Instances must conform to this kind.  In particular, the argument count of data and newtype instances must match the arity indicated by the kind.  The number of arguments of a type synonym instance must be equal to the number of type indexes (i.e., type variables in the head) of the family declaration.  Instances of data families can be both data types or newtypes (or a mix of the two). 
    6161 * Data family instances can have deriving clauses as usual (but they do not support the non-standard deriving of `Typeable`). 
    6262 * Associated types are type families declared as part of a type class.  The syntax of family declarations in class declarations and of type instance declarations in instance declarations is as for toplevel declarations, but without the `family` and `instance` keywords.