From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by margaux.inria.fr, Wed, 5 May 93 17:43:33 +0200 Received: from concorde.inria.fr by margaux.inria.fr, Wed, 5 May 93 11:53:35 +0200 Received: from couchey.inria.fr by concorde.inria.fr; Wed, 5 May 1993 11:53:57 +0200 Received: by couchey.inria.fr (5.57/Ultrix3.0-C) id AA04243; Wed, 5 May 93 11:53:31 +0200 Date: Wed, 5 May 93 11:53:31 +0200 From: Damien.Doligez@inria.fr (Damien Doligez) Message-Id: <9305050953.AA04243@couchey.inria.fr> To: caml-list@margaux Subject: Re: new library modules Sender: weis@margaux Xavier Leroy writes : >I guess you mean (in the case of "set"): [...] > type 'a ordering == 'a -> 'a -> int;; > > type ('a, 'b) set_operations = > { empty: 'a t; > is_empty: 'a t -> bool; > mem: 'a -> 'a t -> bool; > add: 'a -> 'a t -> 'a t; > iter: ('a -> 'b) -> 'a t -> unit; > (* and so on *) };; > > value make: 'a ordering -> ('a, 'b) set_operations;; This is not what I meant. What I meant was : type 'a t;; type 'a ordering == 'a -> 'a -> int;; value make : 'a ordering -> 'a t and is_empty : 'a t -> bool and so on ... and in the implementation : type 'a t = { my_order: 'a ordering; data: (* internal representation *) };; This has the advantage that you cannot use the wrong ordering when working with a given set, and that you do not have to use a type annotation when creating the set (with the "make" function). Damien Doligez