From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA10778; Mon, 24 Sep 2001 18:26:56 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA10774 for ; Mon, 24 Sep 2001 18:26:55 +0200 (MET DST) Received: from goliath.siemens.de ([194.138.37.131]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f8OGQsX26865 for ; Mon, 24 Sep 2001 18:26:54 +0200 (MET DST) Received: from mail1.siemens.de (mail1.siemens.de [139.23.33.14]) by goliath.siemens.de (8.11.6/8.11.6) with ESMTP id f8OGQpl07983; Mon, 24 Sep 2001 18:26:51 +0200 (MET DST) Received: from mars.cert.siemens.de (ust.mchp.siemens.de [139.23.201.17]) by mail1.siemens.de (8.11.6/8.11.6) with ESMTP id f8OGQp100098; Mon, 24 Sep 2001 18:26:51 +0200 (MET DST) Received: from basecamp.cert (basecamp.mchp.siemens.de [139.23.202.131]) by mars.cert.siemens.de (8.12.0/8.12.0/Siemens CERT [ $Revision: 1.17 ]) with ESMTP id f8OGQpED050542; Mon, 24 Sep 2001 18:26:51 +0200 (CEST) Received: by basecamp.mchp.siemens.de with Internet Mail Service (5.5.2653.19) id ; Mon, 24 Sep 2001 18:26:51 +0200 Message-ID: <4F8477CFC03A71499AD8DDA428F5E114037723@basecamp.mchp.siemens.de> From: Christian.Schaller@cert.siemens.de To: florian@hars.de Cc: caml-list@inria.fr Subject: RE: [Caml-list] Haskell features in O'Caml Date: Mon, 24 Sep 2001 18:26:50 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > The correct answer might have been a reference to the module system. > You can specify the type of a function either in a separate *.mli-file > or in an explicit module declaration: > > # module M : sig > val mul : int -> int -> int > end = struct > let mul a b = a * b > end;; > module M : sig val mul : int -> int -> int end > # M.mul 2 3;; > - : int = 6 > # module N : sig > val mul : int -> int -> int > end = struct > let mul a b = a *. b (* Arithmetic is monomorphic - no > type classes *) > end;; > Signature mismatch: > Modules do not match: > [...] > Unfortunately there seems to be a difference between explicit module declaration as seen above and the separation of interface and implementation. Since implementation is not automatically checked against the interface (or did I get something wrong?), you just load you implementation (or compile it) without using (or compiling) the appropriate interface and there will be no complaint about mismatch in signature and structure. I'd prefer the compiler/desktop automatically look for interface definition while compiling/loading. One more or less off-topic question about interfaces: is there a way to see the all what's inside a module when I'm opening it using "open" (like "module M : sig val mul : int -> int -> int end" in above example)? Thanks a lot!!! bye Chris... ------------------- 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