Changes between Version 36 and Version 37 of Records/OverloadedRecordFields/Implementation


Ignore:
Timestamp:
Aug 12, 2013 4:34:50 PM (2 years ago)
Author:
adamgundry
Comment:

GADT record updates sorted

Legend:

Unmodified
Added
Removed
Modified
  • Records/OverloadedRecordFields/Implementation

    v36 v37  
    126126== GADT record updates ==
    127127
    128 Annoyingly, the generated code for `setField` doesn't typecheck for GADTs, because of #2595. Consider the example
     128Consider the example
    129129
    130130{{{
     
    133133}}}
    134134
    135 At the moment, my code generates
     135It would be nice to generate
    136136
    137137{{{
     
    140140}}}
    141141
    142 but this record update is rejected by the typechecker, even though it is perfectly sensible. The alternative is for me to generate the explicit update
     142but this record update is rejected by the typechecker, even though it is perfectly sensible, because of #2595. The currently implemented workaround is instead to generate the explicit update
    143143
    144144{{{
     
    146146}}}
    147147
    148 which is fine, but rather long-winded if there are many constructors or fields. Essentially this is doing the job of the desugarer for record updates. I wonder if it would be easier to fix #2595. Perhaps not; the general case makes my brain hurt. I only need a rather special case: updating one field, where either the type does not change, or none of the local constraints mention changing type variables.
     148which is fine, but rather long-winded if there are many constructors or fields. Essentially this is doing the job of the desugarer for record updates.
    149149
    150150Note that `W` does not admit type-changing single update for either field, because of the `a ~ b` constraint. Without it, though, type-changing update should be allowed.
     
    250250== To do ==
    251251
    252 * Sort out GADT record updates.
    253252* Sort out data families with duplicated fields.
    254253* Improve error messages from typechecker:
     
    260259* How should deprecation work for fields? Not at all?
    261260* Document the extension, including new warnings.
     261* Reorganise the test cases.