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
[Caml-list] Type variables won't generalize
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Ryan Tarpine <rtarpine@h...>
Subject: [Caml-list] Type variables won't generalize
I have an odd typing problem, odd because it occurs only when using ocamlc 
and not ocaml.  I've cut my code down to the following small snippet:

type 'a my_object = {
  partner : 'a my_object ref;
  data : 'a ref

let rec object1 = {
  partner = ref object2;
  data = ref `PNone
and object2 = {
  partner = ref object2;
  data = ref `PNone

That runs fine when passed to ocaml, but when I run it through ocamlc I get:

File "", line 6, characters 18-66:
The type of this expression, _[> `PNone] my_object,
contains type variables that cannot be generalized

What's wrong with my code?  Thanks in advance!

Ryan Tarpine,
"To err is human, to compute divine.  Trust your computer but not its 
  - Morris Kingston

Join the world’s largest e-mail service with MSN Hotmail.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: