
27 Jul
2009
27 Jul
'09
1:05 p.m.
Jon Fairbairn wrote:
Parenthesis around updates would make them into functions, ie ({a=1,b=2,...}) would mean the same as (\d -> d{a=1,b=2,...}), but be more concise.
yes it is, however field updates are occasionally slightly annoying, since they can't change something's type at all, IIRC. Say, data C nx ny = C { x :: nx, y :: ny } x_set :: nx2 -> C nx1 ny -> C nx2 ny --x_set x2 c = c {x = x2} --type error --x_set x2 = ({x = x2}) --still a type error x_set x2 c = C {x = x2, y = y c} --legal Which is possibly a reason to stay away from field-update syntax on some occasions, and therefore not want it to get a more prominent place in the language if it doesn't deserve it yet. -Isaac