caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Milan Stanojević" <milanst@gmail.com>
To: Caml List <caml-list@inria.fr>
Subject: [Caml-list] strange error with packed modules and module type of
Date: Tue, 29 May 2012 20:25:20 -0400	[thread overview]
Message-ID: <CAKR7PS_i+CzFB83asVn8=+x1iTD1R=aQjSFW3aUKDJd01+3yXQ@mail.gmail.com> (raw)

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

I'm playing with specifying interfaces for packed modules. Afaik, when
compiling library lib, if there is a file lib.mli, compiler will check
whether library obeys the interface in lib.cmi and then use that as
the interface for the library, otherwise the interface will be
inferred.

This is what I have.
foo.ml:
type t = int
let x = 5

foo.mli:
type t
val x : t

g.mli:
module Foo : sig include module type of Foo end


and I compile the library G like this:
ocamlopt.opt -for-pack G -c foo.mli foo.ml
ocamlopt.opt -c g.mli
ocamlopt.opt -pack -o g.cmx foo.cmx

No problems, everything works.

Now I want to get fancy and I add std.ml, and change g.mli (code
included as packed.tar.gz)

std.ml:
module Foo = Foo

g.mli:
module Std : sig include module type of Std end

and compile similarly like before
ocamlopt.opt -for-pack G -c foo.mli foo.ml
ocamlopt.opt -for-pack G -c foo.cmx std.ml
ocamlopt.opt -c g.mli
ocamlopt.opt -pack -o g.cmx foo.cmx std.cmx

But now I get this helpful error message
File "g.cmx", line 1, characters 0-1:
Error: The implementation (obtained by packing)
       does not match the interface g.mli:
       Modules do not match:
         sig module Foo : sig type t = Foo.t val x : t end end
       is not included in
         sig module Foo : sig type t = Foo.t val x : t end end
       Modules do not match:
         sig type t = Foo.t val x : t end
       is not included in
         sig type t = Foo.t val x : t end
       Type declarations do not match:
         type t = Foo.t
       is not included in
         type t = Foo.t


Does anyone know what is going on here?

Thanks,
   Milan

[-- Attachment #2: packed.tar.gz --]
[-- Type: application/x-gzip, Size: 383 bytes --]

             reply	other threads:[~2012-05-30  0:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-30  0:25 Milan Stanojević [this message]
2012-05-30  2:30 ` Markus Mottl
2012-06-07 19:53   ` Milan Stanojević
2012-06-07 23:37     ` Jacques Garrigue
2012-06-08 20:36       ` Milan Stanojević

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='CAKR7PS_i+CzFB83asVn8=+x1iTD1R=aQjSFW3aUKDJd01+3yXQ@mail.gmail.com' \
    --to=milanst@gmail.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).