From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA22847; Thu, 19 Apr 2001 19:44:45 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA22770 for ; Thu, 19 Apr 2001 19:44:44 +0200 (MET DST) Received: from alcaudon.tsc.uc3m.es (alcaudon.tsc.uc3m.es [163.117.145.35]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f3JHidL12220 for ; Thu, 19 Apr 2001 19:44:43 +0200 (MET DST) Received: from tsc.uc3m.es ([163.117.145.58]) by alcaudon.tsc.uc3m.es (Netscape Messaging Server 4.15) with ESMTP id GC1VYB00.26E; Thu, 19 Apr 2001 19:44:35 +0200 Message-ID: <3ADF2405.4976B91E@tsc.uc3m.es> Date: Thu, 19 Apr 2001 19:44:37 +0200 From: "Francisco Valverde Albacete" X-Mailer: Mozilla 4.76 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: John R Harrison , caml-list@inria.fr Subject: Re: [Caml-list] User-defined equality on types? References: <200104181942.MAA05265@dhpc0010.pdx.intel.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, please read below the question: John R Harrison 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? Have you considered using functors defining your datatype structures? In that way you can customise the use of equality throught the whole module with something like: module ParameterisedADT (Eq: sig type t val (=) : t -> t -> bool end) = struct (* code of the ADT with whatever uses of your own "="! *) end you just have to supply a structure for formal parameter Eq with the adequate semantics. The semantics of this new operation will be entirely up to the implementation in the parameter module (you can do really strange things here). Hope it helps. Fran Valverde PS: I apologise for the lack of French version. My French is way too rusty to write anything sensible with it. FVA. ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr