caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: David Rajchenbach-Teller <David.Teller@ens-lyon.org>
To: OCaml <caml-list@inria.fr>
Subject: Extracting a subsignature with comments
Date: Tue, 10 Mar 2009 12:39:10 +0100	[thread overview]
Message-ID: <1236685150.7428.16.camel@Blefuscu> (raw)

    Dear list,
 After a few experiments based on the indications of Martin Jambon and
Daniel Bünzli, it seems that, to get the correct type signatures for
OCaml Batteries Included, we'll need 
1) either to write the signature of the whole library manually (in
addition to having written the signature of each individual module)
2) or to be able to generate a signature programmatically based the
contents of existing signatures.

If possible, I'd like to take the second approach. For this purpose,
I'll need to be able to analyse a .mli, extract a submodule and produce
a new .mli from that submodule -- while keeping all the comments
involved, to allow further manipulation by ocamldoc.

For instance, in Batteries, we have a file extList.mli, which looks
roughly like:

«

(** Some module comment *)
module List :
sig
    (**The type of lists*)
    type 'a t = 'a list

    (*etc.*)

     (**Some other module comment*)
     module Labels :
     sig
          (*etc.*)
     end
end
»

>From this .mli, I'd like to be able to extract both module List and
module List.Labels.

Extracting module List would produce something along the lines of

«
(** Some module comment *)

(**The type of lists*)
type 'a t = 'a list

(*etc.*)

(**Some other module comment*)
module Labels :
sig
    (*etc.*)
end
»


Extracting module List.Labels would produce something along the lines of

«

(**Some other module comment*)

(*etc.*)

»


Now, that's a long and ingrate task. So here's me, hoping that someone
has already done it for me, or could advise a tool which could help me.
Any suggestion?

Note that Camlp4 does not seem applicable (at least not as of OCaml
3.11) as it doesn't track which comments are associated to which node,
which often causes it to detach a ocamldoc comment from a declaration
and attach it to another one.

Thanks in advance,
 David

-- 
David Teller-Rajchenbach
 Security of Distributed Systems
  http://www.univ-orleans.fr/lifo/Members/David.Teller
   « Ce matin Un crétin A tué un chercheur. » (air connu)
   Latest News of French Research: System being liquidated. Researchers angry.


                 reply	other threads:[~2009-03-10 11:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1236685150.7428.16.camel@Blefuscu \
    --to=david.teller@ens-lyon.org \
    --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).