Changes between Version 5 and Version 6 of Records/OverloadedRecordFields/Design


Ignore:
Timestamp:
Apr 22, 2014 10:03:02 AM (11 months ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Records/OverloadedRecordFields/Design

    v5 v6  
    165165 * If there is only one data type that has all the fields  `f1` .. `fn` mentioned in the update, then that is the data type to be updated. 
    166166 
    167  * If more than one data type has all those fields, a type signature may be used to disambiguate. For example, 
     167 * If more than one data type has all those fields, a type signature may be used to disambiguate, in one of two places: either `r :: <type> { fi=ei }` or `r { fi=ei } :: <type>`.  
     168 
     169For example, 
    168170{{{ 
    169171e { x = t } 
    170172}}} 
    171   currently relies on the name `x` to determine the datatype of the record. If this is ambiguous, a type signature can be given either to `e` or to the whole expression (but nowhere else). Thus either 
     173currently relies on the name `x` to determine the datatype of the record. If this is ambiguous, a type signature can be given either to `e` or to the whole expression (but nowhere else). Thus either 
    172174{{{ 
    173175  e :: T Int { x = t } 
    174176}}} 
    175   or 
     177or 
    176178{{{ 
    177179  e { x = t } :: T Int 
    178180}}} 
    179   will be accepted. (Really only the type constructor is needed, whereas this approach requires the whole type to be specified, but it seems simpler than inventing a whole new syntax.) 
     181will be accepted. (Really only the type constructor is needed, whereas this approach requires the whole type to be specified, but it seems simpler than inventing a whole new syntax.) 
    180182 
    181183