Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Andreas Rossberg <rossberg@ps.uni-sb.de>
To: caml-list@inria.fr
Subject: Re: [Caml-list] signature mismatch
Date: Tue, 17 Jun 2003 16:01:16 +0200	[thread overview]
Message-ID: <3EEF1F2C.1060903@ps.uni-sb.de> (raw)
In-Reply-To: <20030617132753.GA20764@anu.edu.au>

Pietro Abate wrote:
> 
> how can I force BB.t to be the same as AA.t ?

module BB : A2 with type t = A1.t = struct
     type t = A1.t
     let toast f1 f2 = false
end

 > why it's not enforced by the functor declaration (with type...) ?

Well, it is, but probably in a sense different from what you think. 
That's why the compiler complains, because the constraint is not 
satisfied for the arguments you pass to the functor.

When you write

> module AA : A1 = ...

You declare module AA and introduce an abstract type t. That means that 
AA.t is a fresh type, distinct from any other type in your program. 
Likewise with

> module BB : A2 = ...

In particular, both types are distinct from each other (and int!). 
Consequently,

> module C = Make (AA) (BB)

is not well typed, because the constraint you state on Make's arguments 
requires AA.t and BB.t to be equivalent, which they aren't.

The solution, as sketched above, is to avoid type abstraction for at 
least one of the modules.

Hope this helps,

| Andreas

-- 
Andreas Rossberg, rossberg@ps.uni-sb.de

"Computer games don't affect kids; I mean if Pac Man affected us
  as kids, we would all be running around in darkened rooms, munching
  magic pills, and listening to repetitive electronic music."
  - Kristian Wilson, Nintendo Inc.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  parent reply	other threads:[~2003-06-17 14:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-17 13:27 Pietro Abate
2003-06-17 13:44 ` Damien Pous
2003-06-17 13:46 ` Jean-Christophe Filliatre
2003-06-17 14:01 ` Andreas Rossberg [this message]
2003-06-18  8:30   ` Julien Signoles
2003-06-18  8:56     ` Andreas Rossberg

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=3EEF1F2C.1060903@ps.uni-sb.de \
    --to=rossberg@ps.uni-sb.de \
    --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