caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Tim Docker" <timothy.docker@macquarie.com>
To: <caml-list@inria.fr>
Subject: [Caml-list] Basic question about modules
Date: Tue, 23 Mar 2004 20:42:22 -0000	[thread overview]
Message-ID: <7F3CFECC66117548BE71E9D7CD2EFB504349A4@nt_lon_exm01.pc.internal.macquarie.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1032 bytes --]

Having used haskell, I'm getting to grips with the core ocaml
language, but am somewhat confused by modules.

If I compile a simple file, X.ml:

 | module StringMap = Map.Make (String)
 | 
 | type info = int list StringMap.t
 |
 | type named_values = {
 |    details : info
 | }
 |
 | ..... other stuff ....

then ocamlc will automatically build a x.cmi file that exports
everything. I can use this from another file Y.ml:

 | let x = X.StringMap.empty;;
 |
 | let y = { X.details=X.StringMap.add "xxx" [1;2;3] x }

although the X.StringMap.fn syntax seems a bit unwieldy.

If I want to restrict what gets exported, I have to
write an x.mli file. Whilst I've written mli files for simple
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.

Thanks,

Tim


[-- Attachment #2: Type: text/html, Size: 1630 bytes --]

             reply	other threads:[~2004-03-23 20:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-23 20:42 Tim Docker [this message]
2004-03-23 21:02 ` Kenneth Knowles
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=7F3CFECC66117548BE71E9D7CD2EFB504349A4@nt_lon_exm01.pc.internal.macquarie.com \
    --to=timothy.docker@macquarie.com \
    --cc=caml-list@inria.fr \
    /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).