[Haskell] Re: [Haskell-cafe] field record update syntax
Jacques Carette
carette at mcmaster.ca
Fri Jan 28 09:34:28 EST 2005
"S. Alexander Jacobson" <alex at alexjacobson.com> wrote:
> (Moved to Haskell list because this is now a suggestion for the language)
> I do a lot of this soft of thing.
> foo {bar = fn $ bar foo
> ,baz = fn2 $ baz foo
> }
>
> It would be much nicer if this syntax did the equivalent:
> foo {bar \= fn
> ,baz \= fn2
> }
> -Alex-
What about 'lifting' this higher? You are (essentially) suggesting a nice syntax for constructing functions from a
record to itself. While your syntax is essentially pointfree, the semantics is 'pointwise' (in that it refers to a
specific record) -- not to be confused with the fact that any such function needs to be done compontent-wise.
Wouldn't be even more convenient (as well as more 'functional') if a syntax like
\foo {bar \= fn
,baz \= fn2
}
built a record-to-record function? [The \foo might even be enough to allow bar = fn instead of bar = fn].
Jacques
More information about the Haskell
mailing list