From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: nr@eecs.harvard.edu
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] type abbreviation for open polymorhic variants?
Date: Fri, 19 Aug 2005 06:45:46 +0900 (JST) [thread overview]
Message-ID: <20050819.064546.126145582.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <20050818210343.D8E391EB0C3@labrador.eecs.harvard.edu>
From: nr@eecs.harvard.edu (Norman Ramsey)
> I wish to define an abbreviation for the following type:
>
> [> `Nil
> | `Number of float
> | `String of string
> | `Function of func
> | `Table of table
> ]
>
> I am assuming that the underlying machinery involves something like
> row polymorphism, but I don't know how to name the 'row variable'.
You can write
type 'a t = 'a constraint 'a =
[> `Nil
| `Number of float
| `String of string
| `Function of func
| `Table of table ]
But it seems simpler to write
type t =
[ `Nil
| `Number of float
| `String of string
| `Function of func
| `Table of table ]
and use it as [< t] where needed.
Jacques Garrigue
prev parent reply other threads:[~2005-08-18 21:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-18 21:03 Norman Ramsey
2005-08-18 21:45 ` Jacques Garrigue [this message]
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=20050819.064546.126145582.garrigue@math.nagoya-u.ac.jp \
--to=garrigue@math.nagoya-u.ac.jp \
--cc=caml-list@inria.fr \
--cc=nr@eecs.harvard.edu \
/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