From: Don Syme <dsyme@microsoft.com>
To: "'William Chesters'" <williamc@dai.ed.ac.uk>
Subject: RE: Record typing question
Date: Thu, 4 Nov 1999 06:30:26 -0800
>Spooky, I raised this point a few days ago!
Ah ha - I see that now. I haven't been keeping up to date with the
discussion list!
> type 'a foo = { a: 'a; b: 'a }
> let f x = { x with a = 1 }
> Here "f: 'a foo -> int foo" won't wash, because the "b" field will
> stay an int, contra the definition. Before lifting the current
> restriction, one would have to check that no type equalities between
> fields are broken.
I guess it should be f: int foo -> int foo. All the field assignments would
act in parallel as far as the type system goes, so
type 'a foo = { a: 'a; b: 'a; c: int }
let f x = { x with a = [x.a]; b = [x.b] }
would be f: 'a foo -> 'a list foo
Cheers,
Don
This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:28 MET