English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 1999-08-22 (19:14)
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