caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe Filliatre <filliatr@lri.fr>
To: Pietro Abate <Pietro.Abate@anu.edu.au>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] signature mismatch
Date: Tue, 17 Jun 2003 15:46:26 +0200	[thread overview]
Message-ID: <16111.7090.128250.979329@gargle.gargle.HOWL> (raw)
In-Reply-To: <20030617132753.GA20764@anu.edu.au>


Pietro Abate writes:
 > Hi all,
 > I get this error trying to compile the file below:
 > 
 > File "pp.ml", line 28, characters 22-24:
 > Signature mismatch:
 > Modules do not match:
 >   sig type t = BB.t val toast : t -> t -> bool end
 > is not included in
 >   sig type t = AA.t val toast : t -> t -> bool end
 > Type declarations do not match:
 >   type t = BB.t
 > is not included in
 >   type t = AA.t
 > 
 > how can I force BB.t to be the same as AA.t ?
 > why it's not enforced by the functor declaration (with type...) ?

Types AA.t and BB.t are abstract, due to the declarations "module AA :
A1" and "module BB : A2" and  to the fact that "t" is abstract in both
interfaces A1 and A2. You should write instead

	module AA : A1 with type t = int = ...
	module BB : A2 with type t = int = ...
	module C = Make (AA) (BB)

(Another possibility is  to declare "type t =  int" in both signatures
A1 and A2 but it is probably not what you want to do.)

-- 
Jean-Christophe Filliâtre (http://www.lri.fr/~filliatr)


 > -----------------
 > module type A1 = sig
 >     type t 
 >     val test : t -> t -> bool
 > end
 > 
 > module type A2 = sig
 >     type t 
 >     val toast : t -> t -> bool
 > end
 > 
 > module Make (A : A1 ) (B : A2 with type t = A.t) = struct
 >     let fifi a b c =
 >         if c > 1 then A.test a b 
 >         else B.toast b a
 > end
 > 
 > module AA : A1 = struct 
 >     type t = int
 >     let test f1 f2 = true
 > end
 > 
 > module BB : A2 = struct
 >     type t = int
 >     let toast f1 f2 = false
 > end
 > 
 > module C = Make (AA) (BB)
 > 
 > ---------------------
 > 
 > -- 
 > Civilization advances by extending the number
 > of important operations which we can perform 
 > without thinking. (Alfred North Whitehead)
 > 
 > -------------------
 > 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

-------------------
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 13:52 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 [this message]
2003-06-17 14:01 ` Andreas Rossberg
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=16111.7090.128250.979329@gargle.gargle.HOWL \
    --to=filliatr@lri.fr \
    --cc=Jean-Christophe.Filliatre@lri.fr \
    --cc=Pietro.Abate@anu.edu.au \
    --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;
as well as URLs for NNTP newsgroup(s).