Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Weird behavior with mutually recursive type definitions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Francois Pottier <Francois.Pottier@i...>
Subject: More confusion with mutually recursive type definitions

> But if it is yet to be defined (which is the case with mutually
> recursive definitions), you must keep everything monomorphic so that
> constraints can be enforced later.

OK, so I understand the following error message:

  # type 'a t = 'a and u = int t and v = bool t;;
  This type bool should be an instance of type int

But then, why is the following declaration accepted?

  # type 'a t = 'a and u = A of int t and v = B of bool t;;
  type 'a t = 'a
  type u = | A of int t
  type v = | B of bool t

I am still confused...

François Pottier