caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
To: Francois Berenger <francois.berenger@inria.fr>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] getting rid of ocamlbuild's .mlpack files in a project
Date: Thu, 20 Aug 2015 16:01:05 +0200	[thread overview]
Message-ID: <CAHvkLrPmpPBMNz8uT44TScBYhk9ji40rTF_HR+V+TZSPa-Wb9g@mail.gmail.com> (raw)
In-Reply-To: <55D5D7C6.5050300@inria.fr>

Well, that would work for non-recursive modules. If you have recursive
modules (for example, A contains "val f : t -> B.t" and B contains
"val f : t -> A.t"), you will need to use recursive modules "module
rec Toto ..." and find two limitations :
1/ "module rec" requires all your modules to have a signature, whereas
your .mlpack file could contain modules without .mli files, and still
work with recursive modules
2/ the shape and ordering of modules in "module rec" is limited, and
it is possible to have recursive toplevel modules that can just not be
included in a "module rec": for example, if you use a toplevel
"include" in one of the modules.

There is a tool that does automatically what you did: see "ocp-pack" in
http://www.ocamlpro.com/blog/2011/08/10/ocaml-pack-functors.html

I used it on Alt-Ergo, and could not compile it because of the above
restrictions...

--Fabrice


On Thu, Aug 20, 2015 at 3:36 PM, Francois Berenger
<francois.berenger@inria.fr> wrote:
> Dear list,
>
> Just a quick note for posterity on how to remove a .mlpack file
> from a project, since Google was not my friend on this subject.
>
> .mlpack files are a feature supported by ocamlbuild.
> As documented in section 18.3.16 of
> http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual032.html
>
> I think only ocamlbuild supports .mlpack files.
> So, you might want to get rid of them because you are switching
> a project to another build system.
> Or, maybe, you want the "feature" without becoming bound to ocamlbuild.
>
> In any case, here is a recipe that works for me.
>
> I replaced the file
>
> util.mlpack
> ---
> util/Toto
> ---
>
> by the file
>
> util.mlp
> ---
> module Toto :
> sig
> #include "util/toto.mli"
> end = struct
> #include "util/toto.ml"
> end
> ---
>
> Then, using the excellent cppo ocaml preprocessor from Martin Jambon,
> you can do:
>
> cppo util.mlp > util.ml
>
> I think this util.ml file does explicitely what the util.mlpack file was
> doing when processed by ocamlbuild, at the cost of a preprocessing step.
>
> Best regards,
> Francois.
>
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs



-- 
Fabrice LE FESSANT
Chercheur en Informatique
INRIA Paris Rocquencourt -- OCamlPro
Programming Languages and Distributed Systems

      reply	other threads:[~2015-08-20 14:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-20 13:36 Francois Berenger
2015-08-20 14:01 ` Fabrice Le Fessant [this message]

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=CAHvkLrPmpPBMNz8uT44TScBYhk9ji40rTF_HR+V+TZSPa-Wb9g@mail.gmail.com \
    --to=fabrice.le_fessant@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=francois.berenger@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).