From: Edgar Friendly <thelema...@gmail.com> > This error message was new to me, and I wondered what's going on and > why: > > # type ('a, 'b) t = [ `A | `T of ('b, 'a) t ];; > Error: In the definition of t, type ('a, 'b) t should be ('b, 'a) t
Structural recursive types (objects and polymorphic variants) must be regular. I.e., type abbreviations must always have the same parameters. The error message is a bit confusing, due to the way type variables are printed (original names are not kept), but it says that type parameters got exchanged. If you really want to define this type, you have to unroll it by hand: type ('a, 'b) t = [ `A of 'a | `T of [ `A of 'b | `T of ('a,'b) t]];; (I added an argument to `A to make the parameters meaningful.) Jacques Garrigue _______________________________________________ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs