Here's an example I still don't know how to accomplish:

module Map = struct
  module Make (Ord : BatInterfaces.OrderedType) : sig
    include module type of BatMap.Make(Ord).Labels (* this line is invalid *)
  end = struct
    include BatMap.Make(Ord)
    include Labels
  end
end

The idea is I only want "module type of Labels" for the functor's output, but I need BatMap.Make(Ord) within the implementation (perhaps to implement some other functions).

I thought I can simply replace the line "include BatMap.Make(Ord)" with "open BatMap.Make(Ord)", and then not provide the explicit signature. But "open BatMap.Make(Ord)" gives a syntax error.


2012/2/22 Till Varoquaux <till@pps.jussieu.fr>
2012/2/22 Milan Stanojević <milanst@gmail.com>d
> On Tue, Feb 21, 2012 at 3:32 PM, Hezekiah M. Carty <hez@0ok.org> wrote:
>> On Tue, Feb 21, 2012 at 2:37 PM, Ashish Agarwal <agarwal1975@gmail.com> wrote:
>>> I must've accidentally deleted part of my email before hitting send. The
>>> point was to make the first code sample compile after removing the commented
>>> line. But that is not allowed; I get a syntax error:
>>>
>>> $ ocamlfind ocamlc -c -package batteries a.ml
>>> File "a.ml", line 6, characters 38-39:
>>> Error: Syntax error: 'end' expected
>>> File "a.ml", line 4, characters 16-19:
>>> Error: This 'sig' might be unmatched
>>>
>>> I'm wondering if there is a better solution than my second code sample.
>>>
>
> I would consider this a bug. I think than any module expression than
> can be used with "include" should be usable with "include module type
> of"
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa-roc.inria.fr/wws/info/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>

Milan is right: the language grammar does say that both [include] and
[module type of] should work on module_expr. However, based upon the
manual(*),  [A(B)] and  [A.B] are syntacticly valid module_expr's but
[A(B).C] isn't. Is this because of an inherent limitation in the
module system?

[*]http://caml.inria.fr/pub/docs/manual-ocaml/manual019.html#module-expr