caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Lauri Alanko <la@iki.fi>
To: caml-list@pauillac.inria.fr
Subject: [Caml-list] Module equivalence across definitions
Date: Sat, 13 Oct 2001 21:07:33 +0300	[thread overview]
Message-ID: <20011013210733.G412@la.iki.fi> (raw)

[Pardon for possible duplicates]

Hello. Given:


module type T = sig
  type t
end

module A : T = struct
  type t = A
end

module B(X:T) = struct
  type t = B
  let v = B
end

module type CT = sig
  val a : B(A).t
end

module C : CT = struct
  module Aalias = A
  module BA = B(Aalias)
  let a = BA.v
end


I get an error:


Signature mismatch:
Modules do not match:
  sig
    module Aalias : sig type t = A.t end
    module BA : sig type t = B(Aalias).t = B val v : t end
    val a : BA.t
  end
is not included in
  CT
Values do not match: val a : BA.t is not included in val a : B(A).t


But changing "module BA = B(Aalias)" to "module BA = B(A)" makes everything
work.

What gives? I'm used to seeing structural equivalence being used everywhere
in O'Caml's type system, but here simply renaming a module seems to give it
a distinct new identity. Is this a bug or a feature?


Lauri Alanko
la@iki.fi
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


             reply	other threads:[~2001-10-16 21:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-13 18:07 Lauri Alanko [this message]
2001-10-17  7:05 ` Tom Hirschowitz

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=20011013210733.G412@la.iki.fi \
    --to=la@iki.fi \
    --cc=caml-list@pauillac.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).