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 WAA14801; Tue, 23 Mar 2004 22:02:33 +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 WAA14995 for ; Tue, 23 Mar 2004 22:02:32 +0100 (MET) Received: from calmail-cl.berkeley.edu (mailfarm.Berkeley.EDU [128.32.61.106]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i2NL2UHd026161 for ; Tue, 23 Mar 2004 22:02:30 +0100 Received: from [64.162.212.212] (HELO tallman.kefka.frap.net) by calmail-cl.berkeley.edu (CommuniGate Pro SMTP 4.1.8) with SMTP id 8819398; Tue, 23 Mar 2004 13:02:29 -0800 Received: by tallman.kefka.frap.net (sSMTP sendmail emulation); Tue, 23 Mar 2004 13:02:30 -0800 Date: Tue, 23 Mar 2004 13:02:30 -0800 From: Kenneth Knowles To: Tim Docker Cc: caml-list@inria.fr Subject: Re: [Caml-list] Basic question about modules Message-ID: <20040323210230.GA8003@tallman.kefka.frap.net> References: <7F3CFECC66117548BE71E9D7CD2EFB504349A4@nt_lon_exm01.pc.internal.macquarie.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7F3CFECC66117548BE71E9D7CD2EFB504349A4@nt_lon_exm01.pc.internal.macquarie.com> User-Agent: Mutt/1.5.6i X-Miltered: at concorde by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; knowles:99 caml-list:01 mli:01 mli:01 ocamlc:01 inspect:01 val:01 val:01 prettier:01 bool:01 ocaml:01 sig:01 toplevel:01 syntax:02 modules:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Status: X-Keywords: X-UID: 336 > types and functions, I'm at a loss as how to write the contents > of the mli file that corresponds to the one automatically generated > above (specifically the StringMap bit). > > A pointer would be much appreciated, either how to write the .mli > file, or a generally better way of doing this stuff. Well, you can use `ocamlc -i' to initially create the .mli file, or inspect its output for help. Also, by typing it into the ocaml toplevel you get: # module StringMap = Map.Make(String);; module StringMap : sig type key = String.t and 'a t = 'a Map.Make(String).t val empty : 'a t val add : key -> 'a -> 'a t -> 'a t val find : key -> 'a t -> 'a val remove : key -> 'a t -> 'a t val mem : key -> 'a t -> bool val iter : (key -> 'a -> unit) -> 'a t -> unit val map : ('a -> 'b) -> 'a t -> 'b t val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b end There is some syntax for "Map.S with type key = String.t" that would be a bit prettier, but I don't remember it offhand. Kenn ------------------- 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