caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Kenneth Knowles <kknowles@berkeley.edu>
To: Tim Docker <timothy.docker@macquarie.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Basic question about modules
Date: Tue, 23 Mar 2004 13:02:30 -0800	[thread overview]
Message-ID: <20040323210230.GA8003@tallman.kefka.frap.net> (raw)
In-Reply-To: <7F3CFECC66117548BE71E9D7CD2EFB504349A4@nt_lon_exm01.pc.internal.macquarie.com>


> 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


  reply	other threads:[~2004-03-23 21:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-23 20:42 Tim Docker
2004-03-23 21:02 ` Kenneth Knowles [this message]
2004-03-23 21:12 ` Matthieu Dubuget
2004-03-23 21:59 Tim Docker
2004-03-23 22:33 ` Kenneth Knowles

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040323210230.GA8003@tallman.kefka.frap.net \
    --to=kknowles@berkeley.edu \
    --cc=caml-list@inria.fr \
    --cc=timothy.docker@macquarie.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).