[RFC] Mutable records as a GHC extension
BurningWitness:
ADTs cannot be updated in place, they’re constructed anew each time, right? Why do we then use
x { a = b }and notC { a = b, .. = x }?
I agree with your distaste for that syntax. I especially dislike it’s called ‘update’ syntax, because there’s no update going on in the imperative programming sense of overwriting a location. ‘rebuild shorthand’ might be better terminology. I always use the explicit constructor syntax, which works reasonably smoothly with the .. RecordWildcards.
I agree the HasField and friends/‘update’ mechanisms are just too perplexing to be worth using. Indeed auto-naming a function same as a field (as in H98) runs counter to the drive to eliminate punning from other parts of the language.
What’s more perspicuous in the earlier proposal’s data decl is that a mutable structure can appear only within IO (or ST).
Discussion in the ATmosphere