[Haskell] Re: (small) records proposal for Haskell '06

Iavor Diatchki iavor.diatchki at gmail.com
Wed Jan 4 13:53:02 EST 2006


On 1/4/06, David Roundy <droundy at abridgegame.org> wrote:
> > What happens to record updates?
> >
> > setFoo x r = r { foo = x }
> >
> > Or is the proposal to remove updates as well?
> Ah, good point, I hadn't thought about that.  My proposal was to keep
> record updates which would indeed mean that we'd need to require that all
> "foo"s in a given data type have the same type.  Which I don't think is a
> bad thing either... it just hadn't occurred to me.

This is not the problem...  What is the type of the 'setFoo' function?
 When you think about that, you are likely to run into the usual 'Has'
or 'Lacks' predicates in the types.  I think the same pattern pops up
whenever you want to have labels access fields (for projection or
update) in records of different types, because the evidence for the
predicates tells you where in this particular type to find the field.

Another option is of course to somehow modify the syntax so that
record update specifies at what type we want to perform the update. 
In any case these seem like rather substantial changes that have not
been tested nearly as well as say the Trex or other record systems out


More information about the Haskell mailing list