caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Question about polymorphic variants
@ 2005-10-28  9:57 Xavier Clerc
  2005-10-28 11:59 ` [Caml-list] " Jacques Garrigue
  0 siblings, 1 reply; 9+ messages in thread
From: Xavier Clerc @ 2005-10-28  9:57 UTC (permalink / raw)
  To: caml-list

Hello,

I have a question concerning polymorphic variants and type inference.
Formulating my question from the example of section 4.2 in the ocaml  
manual (version 3.08), I define a function f:

let f = function
| `On -> 1
| `Off -> 0

which is inferred as: val f : [< `Off | `On ] -> int

Then, I use this function in the following expression :

List.map f

which is in turn inferred as: _[< `Off | `On ] list -> int list


My question is about the meaning of the leading underscore in the  
inferred type (given that I understand the meaning of the underscore  
in an expression such as "Stack.create ()" that is inferred as: '_a  
Stack.t).


Regards,

Xavier Clerc


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-11-07 13:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-28  9:57 Question about polymorphic variants Xavier Clerc
2005-10-28 11:59 ` [Caml-list] " Jacques Garrigue
2005-10-28 12:27   ` Xavier Clerc
2005-10-29  0:26     ` Jacques Garrigue
2005-10-31 17:08       ` Xavier Clerc
2005-11-01  0:27         ` Jacques Garrigue
2005-11-04 13:20           ` Xavier Clerc
2005-11-07  3:11             ` Jacques Garrigue
2005-11-07 13:39               ` Xavier Clerc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).