Version française
Home     About     Download     Resources     Contact us    
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 "foo.ml", 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, rtarpine@hotmail.com
"To err is human, to compute divine.  Trust your computer but not its 
programmer."
  - Morris Kingston

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners