Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* RFH: Values do not match: val bar1 : Foo.foo_t is not included in val bar1 : Foo.foo_t
@ 2010-05-23 22:03 Goswin von Brederlow
  2010-05-25  8:28 ` [Caml-list] " Julien Signoles
  0 siblings, 1 reply; 3+ messages in thread
From: Goswin von Brederlow @ 2010-05-23 22:03 UTC (permalink / raw)
  To: caml-list

Hi,

I'm playing around with packs and ways to avoid having to duplicate
module signatures all over the place. So I came up with the following
idea: Each module declares an external and internal module type and
restricts itself to the internal type. The pack then further restricts
the module to the external type.

But then I get a type error I can't make heads or tails of:

File "pack.cmx", line 1, characters 0-1:
Error: The implementation (obtained by packing)
       does not match the interface pack.mli:
       Modules do not match:
         sig
           module type Extern = sig val bar1 : Foo.foo_t end
           module type Intern =
             sig val bar1 : Foo.foo_t val bar2 : Foo.foo_t end
           module I : sig val bar1 : Foo.foo_t val bar2 : Foo.foo_t end
           val bar1 : Foo.foo_t
           val bar2 : Foo.foo_t
         end
       is not included in
         sig val bar1 : Foo.foo_t end
       Values do not match:
         val bar1 : Foo.foo_t
       is not included in
         val bar1 : Foo.foo_t
make: *** [all] Error 2


Can anyone explain that to me?

MfG
        Goswin
--

Here is a simple example that gives the above error:
(also on http://mrvn.homeip.net/t/)

---------------[ Makefile ]---------------
all:
        ocamlopt -for-pack Pack -c foo.ml
        ocamlopt -for-pack Pack -c bar.ml
        ocamlopt -c pack.mli
        ocamlopt -pack -o pack.cmx foo.cmx bar.cmx

clean:
        rm -f *.o *.cmx *.cmi *~

---------------[ bar.ml ]---------------
module type Extern = sig
  val bar1 : Foo.foo_t
end

module type Intern = sig
  include Extern
  val bar2 : Foo.foo_t
end

module I : Intern = struct
  let bar1 = Foo.foo2
  let bar2 = Foo.BAZ
  let bar3 = Foo.BLUB
end

include I

---------------[ foo.ml ]---------------
module type Extern = sig
  type foo_t = FOO | BAR | BAZ | BLUB
  val foo1 : foo_t
end

module type Intern = sig
  include Extern
  val foo2 : foo_t
end

module I : Intern = struct
  type foo_t = FOO | BAR | BAZ | BLUB
  let foo1 = FOO
  let foo2 = BAR
  let foo3 = BLUB
end

include I

---------------[ pack.mli ]---------------
module Foo : sig
  include Foo.Extern
end

module Bar : sig
  include Bar.Extern
end

-----------------------------------


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

end of thread, other threads:[~2010-05-25 13:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-23 22:03 RFH: Values do not match: val bar1 : Foo.foo_t is not included in val bar1 : Foo.foo_t Goswin von Brederlow
2010-05-25  8:28 ` [Caml-list] " Julien Signoles
2010-05-25 13:23   ` Goswin von Brederlow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox