[Haskell-cafe] Re: Syntax for modifying nested product types

Ferenc Wagner wferi at afavant.elte.hu
Sat Apr 24 00:47:11 EDT 2004


Graham Klyne <GK at ninebynine.org> writes:

> At 18:18 22/04/04 -0400, Mark Carroll wrote:
>
>> I have data objects where each component is a labelled
>> field through which I access or modify it.
>
> Wading into the labelled field debate...
>
> I have found that using the labelled field update syntax
> can lead to difficulties in changing the underlying
> implementation of a type.

Yeah, interesting this topic came up exactly when I got mad
with record updates.  I'd like to fill in a record from a
file which contains labels and values.  I'd like to give the
gist of this operation as a list of pairs:

[("label1", label1), ("label2", label2), ...]

and abstract away the operation of updating the field.  I
couldn't find a way.  Basically, I couldn't write an update
function parametrized by the field name.  Is it possible at
all?
-- 
Feri.


More information about the Haskell-Cafe mailing list