Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Carl Eastlund <ceastlund@janestreet.com>
To: caml-list@inria.fr
Subject: [Caml-list] Weird type error involving 'include' and applicative functors
Date: Fri, 13 Feb 2015 16:40:18 -0500	[thread overview]
Message-ID: <CALyFioQxTr+kGYp_94d9LMqcO6xmLCFqA_PiKoSmAW79oOUY6Q@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1730 bytes --]

This seems to be a compiler bug, but let me know if I've missed something.
The behavior I see is that Make_ok1 and Make_ok2 compile fine, but the very
similar functor Make_bad does not.  I get this compile error:

========================================

      Error: Signature mismatch:
             Modules do not match:
               sig
                 module C : sig module T : sig  end type t = Make(T).t end
                 module T = C.T
                 type t = Make(T).t
               end
             is not included in
               sig type t module C : sig type t = t end end
             In module C:
             Modules do not match:
               sig module T : sig  end type t = Make(T).t end
             is not included in
               sig type t = C.t end
             In module C:
             Type declarations do not match:
               type t = Make(T).t
             is not included in
               type t = t

========================================

And here is the code:

========================================

module type S = sig type t end
module Make (M : sig end) : S = struct type t end

module Make_ok1 (M : sig end) : sig

  type t
  module A : S with type t = t

end = struct

  module A = struct
    include Make (struct end)
  end
  include A

end

module Make_ok2 (M : sig end) : sig

  type t
  module B : S with type t = t

end = struct

  module T = struct end
  module B = struct
    include Make (T)
  end
  include B

end

module Make_bad (M : sig end) : sig

  type t
  module C : S with type t = t

end = struct

  module C = struct
    module T = struct end
    include Make (T)
  end
  include C

end

========================================

--
Carl Eastlund

[-- Attachment #2: Type: text/html, Size: 2855 bytes --]

             reply	other threads:[~2015-02-13 21:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-13 21:40 Carl Eastlund [this message]
2015-02-15 10:26 ` Gabriel Scherer
2015-02-16 18:03   ` Leo White
2015-02-17 21:40     ` Milan Stanojević
2015-02-19 18:21       ` Milan Stanojević
2015-02-19 18:23         ` Milan Stanojević
2015-02-24  4:38   ` Jacques Garrigue
2015-02-24  5:54     ` Jacques Garrigue

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=CALyFioQxTr+kGYp_94d9LMqcO6xmLCFqA_PiKoSmAW79oOUY6Q@mail.gmail.com \
    --to=ceastlund@janestreet.com \
    --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