caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Bug in the module system of version 3.12.0+beta1
@ 2010-07-21 13:38 Dumitru Potop-Butucaru
  2010-07-21 14:13 ` [Caml-list] " Jeremy Yallop
  0 siblings, 1 reply; 11+ messages in thread
From: Dumitru Potop-Butucaru @ 2010-07-21 13:38 UTC (permalink / raw)
  To: caml-list

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


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

end of thread, other threads:[~2010-07-22 12:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-21 13:38 Bug in the module system of version 3.12.0+beta1 Dumitru Potop-Butucaru
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

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