caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: blue storm <bluestorm.dylc@gmail.com>
To: Alexey Rodriguez <mrchebas@gmail.com>
Cc: OCaml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Partially hiding modules in packages
Date: Wed, 9 Sep 2009 21:40:25 +0200	[thread overview]
Message-ID: <527cf6bc0909091240u3aa0bb40u3186457a33c0636c@mail.gmail.com> (raw)
In-Reply-To: <4b39c80a0909091200v7ae57950q4775d4b4ed4a51b3@mail.gmail.com>

The problem with your packages.tgz example is that you use "module
type Foo = .." in the .mli. This gives the signature of a module type,
that is, it refers to a _module type_ defined in the implementation
file.

What you want to do here is to give the signature of a _module_, not a
module types, so here is the correct syntax :

  module Foo : sig
    type foo_t

    val initial : foo_t
    val show : foo_t -> string
  end


Regarding your original problem, I've had the same needs and came up
with a slightly different solution : in order to avoid the additional
indirection level related to -pack (Foobar.Foo), is used a flattened
representation by adding a "foobar.ml" file containing only :

  include Foo

(and possibly include of other modules in the package). Then the
foobarl.mli is :

  type foo_t

  val initial : foo_t
  val show : foo_t -> string

And values can be referred with Foobar.foo, instead of Foobar.Foo.foo.
Of course this is only useful if you don't want the user to see the
internal module hierarchy, wich may not be what you had in mind.


  reply	other threads:[~2009-09-09 19:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-09 19:00 Alexey Rodriguez
2009-09-09 19:40 ` blue storm [this message]
2009-09-10 12:29   ` [Caml-list] " Alexey Rodriguez
2009-11-28 18:49   ` Guillaume Yziquel
2009-09-09 20:24 ` Alain Frisch
2009-09-10  6:08 ` Jean-Christophe Filliâtre

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=527cf6bc0909091240u3aa0bb40u3186457a33c0636c@mail.gmail.com \
    --to=bluestorm.dylc@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=mrchebas@gmail.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).