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 SAA18117; Wed, 25 Apr 2001 18:16:34 +0200 (MET DST) 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 SAA18100 for ; Wed, 25 Apr 2001 18:16:34 +0200 (MET DST) Received: from shell5.ba.best.com (shell5.ba.best.com [206.184.139.136]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f3PGGTX23577; Wed, 25 Apr 2001 18:16:29 +0200 (MET DST) Received: from localhost (bpr@localhost) by shell5.ba.best.com (8.9.3/8.9.2/best.sh) with ESMTP id JAA23778; Wed, 25 Apr 2001 09:16:29 -0700 (PDT) Date: Wed, 25 Apr 2001 09:16:29 -0700 (PDT) From: Brian Rogoff To: Francois Thomasset cc: caml-list@inria.fr Subject: Re: [Caml-list] le neophyte et les modules, types parametres In-Reply-To: <200104251549.f3PFn0116328@ionie.inria.fr> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN Content-Transfer-Encoding: QUOTED-PRINTABLE Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, 25 Apr 2001, Francois Thomasset wrote: > D=E9sol=E9 de poser des qustions simplistes mais je suis perdu dans les m= odules. > Dans l'id=E9e de construire une table de symboles je d=E9finis ceci : > # type symbol =3D string * int ;; > # type comparison =3D Equiv | Smaller | Greater;; > # module type ORDERED =3D > sig > type 'a t > val order : 'a t -> 'a t -> comparison > end;; > module type ORDERED =3D > sig type 'a t val order : 'a t -> 'a t -> comparison end > # module type AVL_FUNCTOR =3D functor ( Key : ORDERED ) -> > sig > type 'a key =3D 'a Key.t > type avl_btree =3D ('a key * int) btree > ... > end;; > The type constructor Key.t expects 1 argument(s), > but is here applied to 0 argument(s) >=20 > D'accord je suppose que c'est le type 'a qui manque (un jour ce sera les= =20 > morceaux d'environnement attach=E9s aux symboles, donc je n'ai pas envie = de=20 > pr=E9ciser tout de suite) ; mais je ne comprends pas comment le dire autr= ement=20 > que ci-dessus ; quelque chose a du m'=E9chapper... >=20 > Question: how to use a parameter type in a module, cf example above That looks fine, other than the missing type parameter 'a in your definition of avl_btree. That would give a different error message than the one you show though, so I don't understand that message either.=20 The following should compile: type comparison =3D Equiv | Smaller | Greater;; module type ORDERED =3D sig type 'a t val order : 'a t -> 'a t -> comparison end;; type 'a btree =3D Leaf | Node of 'a * 'a btree * 'a btree;; module type AVL_FUNCTOR =3D functor ( Key : ORDERED ) -> sig type 'a key =3D 'a Key.t type 'a avl_btree =3D ('a key * int) btree end;; -- Brian ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr