From: Dumitru Potop-Butucaru <dumitru.potop_butucaru@inria.fr>
To: caml-list@inria.fr
Subject: Bug in the module system of version 3.12.0+beta1
Date: Wed, 21 Jul 2010 15:38:46 +0200 [thread overview]
Message-ID: <4C46F866.9050900@inria.fr> (raw)
[-- Attachment #1: Type: text/plain, Size: 1745 bytes --]
Hello,
I started several days ago to use version 3.12.0+beta1
(at the suggestion of a colleague to whom I explained
what I need).
I have one main problem, which I see as a bug.
The code I want to write is the following:
module IntList = Set.Make(struct type t=int let compare x y = x-y end) ;;
module type Simple =
sig
type t
end
;;
module type Abc =
functor (M:Simple) ->
sig
val x : M.t
end
;;
module MyModule :
sig
include Abc(module type of IntSet)
val y : int
end
=
struct
let x = IntSet.empty
let y = 0
end
;;
The code gives a syntax error on the include line of the
signature of MyModule. I also tried several variants of the code,
including:
include Abc(IntSet) instead of the rejected include
or
module type TTT = Abc(IntSet) ;;
...
include TTT
In the manual, it appears that these syntaxes are indeed not
permitted, which I think is a bug, given that converting all
module types to full module makes everything work smoothly:
module IntList =
struct
include Set.Make(struct
type t = int
let compare x y = x - y
end)
let zero = empty
end
;;
module type Simple =
sig
type t
val zero : t
end
;;
module Abc (M:Simple) :
sig
val x : M.t
end
=
struct
let x = M.zero
end
;;
module MyModule :
sig
include module type of Abc(IntList)
val y : int
end
=
struct
let x = IntList.empty
let y = 10
end
;;
Of course, transforming module types into modules
just for the purpose of writing "module type of "
defeats the very purpose of interfaces (this is why I
think this is a bug, not a feature). Can someone help me
(e.g., with a bugfix)?
Yours,
Dumitru
[-- Attachment #2: dumitru_potop_butucaru.vcf --]
[-- Type: text/x-vcard, Size: 301 bytes --]
begin:vcard
fn:Dumitru Potop-Butucaru
n:Potop-Butucaru;Dumitru
org:INRIA Rocquencourt;Project AOSTE
adr:;;Domaine de Voluceau, BP 105;Le Chesnay;;F-78153;France
email;internet:dumitru.potop@inria.fr
tel;work:+33-139.63.55.80
x-mozilla-html:FALSE
url:http://www.DumitruPotop.net
version:2.1
end:vcard
next reply other threads:[~2010-07-21 13:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-21 13:38 Dumitru Potop-Butucaru [this message]
2010-07-21 14:13 ` [Caml-list] " Jeremy Yallop
2010-07-21 15:49 ` rossberg
2010-07-21 18:41 ` Dumitru Potop-Butucaru
2010-07-22 2:29 ` Alain Frisch
2010-07-22 6:36 ` Dumitru Potop-Butucaru
2010-07-22 6:18 ` Jacques Garrigue
[not found] ` <4C47E768.4080507@inria.fr>
[not found] ` <9454F06C-C286-4A1F-8A9F-CA3B27F8E3BB@gmail.com>
2010-07-22 7:07 ` Dumitru Potop-Butucaru
2010-07-22 9:37 ` rossberg
2010-07-22 10:44 ` Jacques Garrigue
2010-07-22 12:28 ` Dumitru Potop-Butucaru
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=4C46F866.9050900@inria.fr \
--to=dumitru.potop_butucaru@inria.fr \
--cc=caml-list@inria.fr \
--cc=dumitru.potop@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).