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
Question about polymorphic variants
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-10-28 (09:56)
From: Xavier Clerc <xcforum@f...>
Subject: Question about polymorphic variants

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 : 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  


Xavier Clerc