From: Goswin von Brederlow <goswin-v-b@web.de>
To: caml-list@inria.fr
Subject: RFH: Values do not match: val bar1 : Foo.foo_t is not included in val bar1 : Foo.foo_t
Date: Mon, 24 May 2010 00:03:01 +0200 [thread overview]
Message-ID: <87632el1ii.fsf@frosties.localdomain> (raw)
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
-----------------------------------
next reply other threads:[~2010-05-23 22:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-23 22:03 Goswin von Brederlow [this message]
2010-05-25 8:28 ` [Caml-list] " Julien Signoles
2010-05-25 13:23 ` Goswin von Brederlow
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=87632el1ii.fsf@frosties.localdomain \
--to=goswin-v-b@web.de \
--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