Version française
Home     About     Download     Resources     Contact us    
Browse thread
Type constraints
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jerome Vouillon <vouillon@c...>
Subject: Re: Type constraints

On Thu, 29 May 1997, Ernesto Posse wrote:

> type 'a node = {x: 'a; y: t1}
> and t1 = A | B of t1*t1
> and t2 = C | D of (string * t2) node | E of bool node
> 
> I obtain this message:
> 
> Characters 98-102:
> This type parameter bool should be an instance of type string * t2

In the current release, in mutually recursive type definitions, all
occurrences of a type being defined (here, for instance, 'a node) must
have the same parameters.
This overly restrictive constraint will be removed in the next
release.  In the meantime, as Didier Rousseau noticed, you can move
the definition of type t2 out of the recursive type definition: 

    type 'a node = {x: 'a; y: t1}
    and t1 = A | B of t1*t1
    type t2 = C | D of (string * t2) node | E of bool node

-- Jerome Vouillon