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
Polymorphic comparison
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre Weis <weis@p...>
Subject: Polymorphic comparison
Subject: Polymorphic <<
Date: Mon, 17 Oct 94 16:10:57 +0100

Caml has a polymorphic equality with type scheme 'a -> 'a -> bool. It
tests structural equality between values of the same type
(isomorphism), and fails when applied to functions.

On the other hand comparisons are monomorphic: we have comparisons for
integers (prefix <=), strings (le_string), floatting point numbers
(le_float) but no polymorphic comparisons.
In the next 0.7 version of Caml Light, we plan to extend comparisons to a
polymorphic function (i.e. prefix < : 'a -> 'a -> bool, instead of the
now available prefix < : int -> int -> bool).

To extend comparisons to unrelated pairs of values, that is defining
prefix <  with type scheme 'a -> 'b -> bool seems a bit strange to me.
What do you plan to do with such a general type scheme for comparisons ?