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
Type abstraction and (polymorphic) equality
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-06-29 (20:28)
From: Christophe TROESTLER <Christophe.Troestler@u...>
Subject: Re: [Caml-list] Type abstraction and (polymorphic) equality
On Wed, 29 Jun 2005, Jon Harrop <> wrote:
> On Wednesday 29 June 2005 01:31, Christophe TROESTLER wrote:
> >     type t = ... with compare x y = ...
> That looks lovely. Apparently a similar facility is available in
> Haskell.  However, there are disadvantages. Unless you're doing
> whole-program compilation, you'll need to carry a compare function
> with every datum. That's a huge performance cost and it probably
> isn't too easy to optimise it away.

Does it need to be the case?  One certainly needs to tag the types
with special equality functions but these tag could be generated for
each program (so as to reduce the necessary tag space), couldn't they?
Then, again for each program, one would provide a special tailored
equality function instead of "compare_val".  Does this make sense?