caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] strange error with packed modules and module type of
@ 2012-05-30  0:25 Milan Stanojević
  2012-05-30  2:30 ` Markus Mottl
  0 siblings, 1 reply; 5+ messages in thread
From: Milan Stanojević @ 2012-05-30  0:25 UTC (permalink / raw)
  To: Caml List

[-- 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 --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-06-08 20:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-30  0:25 [Caml-list] strange error with packed modules and module type of Milan Stanojević
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ć

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).