[MLton] A variation of functional record update notation

Vesa Karvonen vesa.karvonen@cs.helsinki.fi
Mon, 8 Aug 2005 19:34:56 +0300


Quoting Matthew Fluet <fluet@cs.cornell.edu>:
> > Above, `set' refers to the update function. The syntax is fairly readable
> > even when the update function is referred to by a longvid:
> > 
> >    record >| R.set#field1 value1
> >           >| R.set#field2 value2
> >           ...
> >           >| R.set#fieldN valueN
> > 
> > This way there is no need to define a separate infix operator for functional
> > record update.
> 
> Perhaps more importantly, one would need a separate infix operator for
> each record type.  You still need a separate R.set function for each
> record type, but the infix pipe operator stays the same.

Yes, that is a good point.

Do you think that it would make sense to provide a simple script (maybe Emacs
lisp) to generate a signature/structure (say RECORDS/Records) of makeSetter
-functions (upto desired N) and change the FRU-page to use the piping notation?

I'm biased, of course, but the piping notation seems to considerably
increase the utility of the FRU technique. I have previously not used the
FRU technique due to the inconvenience of the fixity declarations, but I
can imagine using this notation (as I already have >| at top-level in my
utility libraries).

-Vesa Karvonen