caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Dawid Toton <d0@wp.pl>
To: caml-list@yquem.inria.fr
Subject: [Caml-list] Re: function that works on different record types, assuming they have a given field
Date: Wed, 30 Mar 2011 14:38:46 +0200	[thread overview]
Message-ID: <4D932456.4000803@wp.pl> (raw)
In-Reply-To: <13A708B2-732E-4D51-A740-BCFDC4E0212F@gmail.com>

On 03/28/2011 08:35 PM, Joel Reymont wrote:
> On Mar 28, 2011, at 7:34 PM, David Rajchenbach-Teller wrote:
>
>> you can obtain the same behavior by using objects instead of records:
> Yes, that used to work very well... until I was forced to switch to records :-).
>
When I had this problem I used one common record type:

type ('foo, 'bar') common =
  {foo : 'foo
  ;bar : 'bar
  ;x : int
  }

type with_bar = (unit, string) common
type with_foo = (double, unit) common

However, I can see that with more different independent types this is
going to be quite ugly.

Dawid

  reply	other threads:[~2011-03-30 12:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-28 18:16 [Caml-list] " Joel Reymont
2011-03-28 18:34 ` David Rajchenbach-Teller
2011-03-28 18:35   ` Joel Reymont
2011-03-30 12:38     ` Dawid Toton [this message]
2011-03-30 14:15       ` [Caml-list] " Gabriel Scherer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D932456.4000803@wp.pl \
    --to=d0@wp.pl \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).