Jacques Garrigue recently implemented a patch that tries to keep
user-provided type names when printing out types, and also when giving
error messages. In your example, there probably is an internal variable
that's called "a" because of the type name you provided. Some wizardry
happens with GADTs, so another type variable is generated. The other
one ends up being printed, and because it's called "a" too, the
type-checker has to find another suitable name.
Or something like that. Maybe change type a b. to type foo bar. will
give different results :).
Cheers,
jonathan
On Thu 22 Mar 2012 01:05:08 PM CET, Julien Signoles wrote:
Hello,
Le 22 mars 2012 10:51, Roberto Di Cosmo <robe...@dicosmo.org
<mailto:robe...@dicosmo.org>> a écrit :
val length : ('a1, 'b) l -> int = <fun>
Why do we get 'a1, and not 'a, in the type?
Well, probably, since 'a is instantiated to int during
type checking, it may be the case that 'a, as type name, is
still marked as taken during the type output, so we get ('a1,'b)
The type is perfectly sound... it is just 'surprising' for
a regular user... do you think this should be considered a bug?
IMHO it is not a bug (as you said, the type is sound), but you could
write a feature request like "generate variable name as best as
possible"...
--
Julien
--
Caml-list mailing list. Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs