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
[Caml-list] User-defined equality on types?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Andreas Rossberg <rossberg@p...>
Subject: Re: [Caml-list] User-defined equality on types?
Brian Rogoff wrote:
> On Mon, 23 Apr 2001, Xavier Leroy wrote:
> > > I'd like to suggest allowing the user to define a chosen interpretation
> > > of the equality symbol, and perhaps the polymorphic orderings too, on
> > > each new (maybe just abstract) data type. This seems natural in the
> > > context of abstract data types with non-canonical representation, giving
> > > a kind of quotient type. Has this ever been considered?
> >
> > Yes.  This was one of the first motivations for Haskell type classes,
> > I believe.
> Would the proposed generic polymorphism extension solve this problem?

Probably not, because unlike type classes generic functions are closed
and do not allow adding cases for new types later on.

Andreas Rossberg,

"Computer games don't affect kids.
 If Pac Man affected us as kids, we would all be running around in
 darkened rooms, munching pills, and listening to repetitive music."
To unsubscribe, mail  Archives: