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
Labeled arguments and polymorphic return types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-08-11 (18:18)
From: Andre Nathan <andre@d...>
Subject: Labeled arguments and polymorphic return types

Consider the following definition:

# let f ~a = print_int a; raise Exit;;
val f : a:int -> 'a = <fun>

If I call f without using the argument label, I get the following

# f 1;;
Warning X: this argument will not be used by the function.
- : a:int -> 'a = <fun>

The call works if I use the label ("f ~a:1"), if I define f without a
label for its argument, or if I remove the "raise" statement (causing
the return value to be unit instead of 'a).

Why is this warning generated?

Thanks in advance,