| > * R{x} constructs a record, and is equivalent to R{x=x}
| > * r{x} updates the x field of record r, and is equivalent to r{x=x}
| > * R{x} can be used as a pattern; its meaning is not defined by the
| > report, but is presumably supposed to be the same as R{x=x}
This brings us to another issue. Doesn't the following definition look
a bit awkward?
R{ x = x }
At first sight, it looks like it means:
R{ x = bottom }
But it doesn't. Why does a binding using `=' suddenly have another meaning
then usual? I think
R{ x = f x }
should just mean:
let x' = f x' in R{ x = x' }.
Moreover, look at the following two expressions:
R{ a = b },
let f R{ a = b } = 3 in f.
In the first one, the variable (field name) a is bound to b. In the second
one, the variable b is bound to the field name a. Why is it suddenly the
case that variables on the right hand side of an `=' sign get bound?
I can see two solutions to these problems:
- make `=' inside records work like they work in `let's. That is,
recursive definitions work, and binding is always done on the left hand
side.
- choose another symbol than `='. It is confusing otherwise!
But of course, introducing these kind of changes will break existing
Haskell programs...
Regards,
Koen.
--
Koen Claessen,
[EMAIL PROTECTED],
http://www.cs.chalmers.se/~koen,
Chalmers University of Technology.