Browse thread
Type constraints
-
Ernesto Posse
- Pascal Brisset
- Wolfgang Lux
- Didier Rousseau
- Valerie.Menissier-Morain@d...
- Jerome Vouillon
[
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: | Valerie.Menissier-Morain@d... |
| Subject: | Re: Type constraints |
Why do you need to define t2 simultaneously to 'a node and t1?
The following session is ok in Caml Light
> Caml Light version 0.73
#type 'a node = {x: 'a; y: t1}
and t1 = A | B of t1*t1;;
Type node defined.
Type t1 defined.
#type t2 = C | D of (string * t2) node;;
Type t2 defined.
#type t2 = C | D of (string * t2) node | E of bool node;;
Type t2 defined.
#
or, if you prefer in Objective Caml
Objective Caml version 1.05
# type 'a node = {x: 'a; y: t1}
a nd t1 = A | B of t1*t1;;
type 'a node = { x: 'a; y: t1 }
type t1 = | A | B of t1 * t1
# type t2 = C | D of (string * t2) node;;
type t2 = | C | D of (string * t2) node
# type t2 = C | D of (string * t2) node | E of bool node;;
type t2 = | C | D of (string * t2) node | E of bool node
V. Ménissier-Morain