Typecheck record update via desugaring
There are quite a few tickets relating to inadequacies of record update, including
- #18311 (closed)
- #10856 (closed)
- #2595 (closed)
- #10808 (closed)
- #3632 (closed): updating existentials if you do all of them at once
- #16501 (closed)
- #21289 (closed)
- #21158 (closed)
Record update is a place where our general plan of typechecking the source syntax seems particularly hard to do. It wold be much easier (and correct by construction) to desugar (but still in HsSyn) and typecheck that.
Fortunately we now have a way to do that: our Re-engineer rebindable syntax ticket, #17582. A lot of attention is paid there to maintaining good error messages, which is the main challenge of this approach.
So this ticket is to propose: let's use the work on #17582 to solve our record-update tickets.
See also #21158 (closed) for why this will be a breaking change.
Edited by Simon Peyton Jones