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 PAA25234; Fri, 29 Nov 2002 15:03:28 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA26025 for ; Fri, 29 Nov 2002 15:03:27 +0100 (MET) Received: from audi.ibcp.fr (audi.ibcp.fr [193.51.160.127]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id gATE3QX26297 for ; Fri, 29 Nov 2002 15:03:26 +0100 (MET) Received: from pc-bioinfo1.ibcp.fr (pc-bioinfo1.ibcp.fr [193.51.160.63]) by audi.ibcp.fr (Postfix) with ESMTP id 7C0307AEAD; Fri, 29 Nov 2002 15:03:26 +0100 (CET) Date: Fri, 29 Nov 2002 15:03:26 +0100 (CET) From: Martin Jambon X-X-Sender: martin@pc-bioinfo1.ibcp.fr To: Alain Frisch Cc: caml-list@inria.fr Subject: Re: [Caml-list] Type aliases In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > You can get something close to what you want with: > > module Ints : > sig > type 'a integer > > val int: int -> 'a integer > val get: 'a integer -> int > > val ( + ): 'a integer -> 'a integer -> 'a integer > val ( * ): 'a integer -> 'a integer -> 'a integer > (* etc... *) > end = > struct > type 'a integer = int > let int x = x > let get x = x > include Pervasives > end Great! Thanks a lot. Finally, I decided to define only the 2 conversion functions, since we have to make difficult choices like the following: Should we define val ( * ) : 'a integer -> 'b integer -> 'b integer or val ( * ) : 'a integer -> 'a integer -> 'a integer or val ( * ) : int -> 'a integer -> 'a integer ? So, this is enough to avoid confusion between keys that have the same representation (commonly int or string) and is complementary to the use of labeled arguments. (and no preprocessing is required to make (1 + 1) valid). Martin ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners