* [Caml-list] record update-apply
@ 2015-01-28 17:03 Christoph Höger
2015-01-28 21:51 ` Nick Lucaroni
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Höger @ 2015-01-28 17:03 UTC (permalink / raw)
To: caml-list
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dear all,
I often find myself writing code like this
{foo with bar = f foo.bar}
and would like to avoid the redundancy of typing 'bar'. So it would be
very convenient to have an applied-to operator:
{foo with bar <- f}
This would only need one additional syntactic sort at the very first
stage, since the operator can immediately be de-sugared into the
already-existing with-form.
What do you think?
- --
Christoph Höger
Technische Universität Berlin
Fakultät IV - Elektrotechnik und Informatik
Übersetzerbau und Programmiersprachen
Sekr. TEL12-2, Ernst-Reuter-Platz 7, 10587 Berlin
Tel.: +49 (30) 314-24890
E-Mail: christoph.hoeger@tu-berlin.de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iEYEARECAAYFAlTJFm4ACgkQhMBO4cVSGS+4igCgu2ANaWyr5ZehpvW6XODpKlpJ
1vwAmQHCibACt3skuOOOrmlptZ95xg3p
=gqBi
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] record update-apply
2015-01-28 17:03 [Caml-list] record update-apply Christoph Höger
@ 2015-01-28 21:51 ` Nick Lucaroni
2015-01-29 3:08 ` Yaron Minsky
0 siblings, 1 reply; 3+ messages in thread
From: Nick Lucaroni @ 2015-01-28 21:51 UTC (permalink / raw)
To: Christoph Höger; +Cc: caml-list
[-- Attachment #1: Type: text/plain, Size: 1633 bytes --]
This is really the update function of a lens. Anil has taken a part of a
project that had contained a lens package into its own library,
https://github.com/avsm/ocaml-lens . Although a ppx library with lenses
would be most appropriate (since this is all still manual).
--
Nicholas Lucaroni
On Wed, Jan 28, 2015 at 12:03 PM, Christoph Höger <
christoph.hoeger@tu-berlin.de> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Dear all,
>
> I often find myself writing code like this
>
> {foo with bar = f foo.bar}
>
> and would like to avoid the redundancy of typing 'bar'. So it would be
> very convenient to have an applied-to operator:
>
> {foo with bar <- f}
>
> This would only need one additional syntactic sort at the very first
> stage, since the operator can immediately be de-sugared into the
> already-existing with-form.
>
> What do you think?
>
>
> - --
> Christoph Höger
>
> Technische Universität Berlin
> Fakultät IV - Elektrotechnik und Informatik
> Übersetzerbau und Programmiersprachen
>
> Sekr. TEL12-2, Ernst-Reuter-Platz 7, 10587 Berlin
>
> Tel.: +49 (30) 314-24890
> E-Mail: christoph.hoeger@tu-berlin.de
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
>
> iEYEARECAAYFAlTJFm4ACgkQhMBO4cVSGS+4igCgu2ANaWyr5ZehpvW6XODpKlpJ
> 1vwAmQHCibACt3skuOOOrmlptZ95xg3p
> =gqBi
> -----END PGP SIGNATURE-----
>
> --
> Caml-list mailing list. Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
[-- Attachment #2: Type: text/html, Size: 2543 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] record update-apply
2015-01-28 21:51 ` Nick Lucaroni
@ 2015-01-29 3:08 ` Yaron Minsky
0 siblings, 0 replies; 3+ messages in thread
From: Yaron Minsky @ 2015-01-29 3:08 UTC (permalink / raw)
To: Nick Lucaroni; +Cc: Christoph Höger, caml-list
Fieldslib uses camlp4, but basically gets the job done. A Field.t is
more or less a lens (you can write a simple function that constructs a
lens from a Field.t), so that gives you the basic bits you need.
We're going to do a ppx rewrite soon.
y
On Wed, Jan 28, 2015 at 4:51 PM, Nick Lucaroni
<nicholas.r.lucaroni@gmail.com> wrote:
> This is really the update function of a lens. Anil has taken a part of a
> project that had contained a lens package into its own library,
> https://github.com/avsm/ocaml-lens . Although a ppx library with lenses
> would be most appropriate (since this is all still manual).
>
>
>
> --
> Nicholas Lucaroni
>
>
> On Wed, Jan 28, 2015 at 12:03 PM, Christoph Höger
> <christoph.hoeger@tu-berlin.de> wrote:
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Dear all,
>>
>> I often find myself writing code like this
>>
>> {foo with bar = f foo.bar}
>>
>> and would like to avoid the redundancy of typing 'bar'. So it would be
>> very convenient to have an applied-to operator:
>>
>> {foo with bar <- f}
>>
>> This would only need one additional syntactic sort at the very first
>> stage, since the operator can immediately be de-sugared into the
>> already-existing with-form.
>>
>> What do you think?
>>
>>
>> - --
>> Christoph Höger
>>
>> Technische Universität Berlin
>> Fakultät IV - Elektrotechnik und Informatik
>> Übersetzerbau und Programmiersprachen
>>
>> Sekr. TEL12-2, Ernst-Reuter-Platz 7, 10587 Berlin
>>
>> Tel.: +49 (30) 314-24890
>> E-Mail: christoph.hoeger@tu-berlin.de
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1
>>
>> iEYEARECAAYFAlTJFm4ACgkQhMBO4cVSGS+4igCgu2ANaWyr5ZehpvW6XODpKlpJ
>> 1vwAmQHCibACt3skuOOOrmlptZ95xg3p
>> =gqBi
>> -----END PGP SIGNATURE-----
>>
>> --
>> Caml-list mailing list. Subscription management and archives:
>> https://sympa.inria.fr/sympa/arc/caml-list
>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-29 3:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-28 17:03 [Caml-list] record update-apply Christoph Höger
2015-01-28 21:51 ` Nick Lucaroni
2015-01-29 3:08 ` Yaron Minsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox