[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Jacques Garrigue <garrigue@m...> |
| Subject: | Re: [Caml-list] type abbreviation for open polymorhic variants? |
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