caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
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	[thread overview]
Message-ID: <4F8477CFC03A71499AD8DDA428F5E114037723@basecamp.mchp.siemens.de> (raw)

> 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


             reply	other threads:[~2001-09-24 16:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-24 16:26 Christian.Schaller [this message]
2001-09-24 19:53 ` Remi VANICAT
  -- strict thread matches above, loose matches on Subject: below --
2001-09-24 22:51 Christian.Schaller
2001-09-25  9:15 ` Remi VANICAT
2001-09-23 23:25 Arturo Borquez
2001-09-22 14:56 Arturo Borquez
2001-09-23 16:08 ` Florian Hars
2001-09-23 16:21 ` Mattias Waldau
2001-09-23 17:50   ` Dave Mason
2001-09-24 11:14     ` Sven
2001-09-24 15:29       ` Brian Rogoff
2001-09-22 11:46 Steven Murdoch

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=4F8477CFC03A71499AD8DDA428F5E114037723@basecamp.mchp.siemens.de \
    --to=christian.schaller@cert.siemens.de \
    --cc=caml-list@inria.fr \
    --cc=florian@hars.de \
    /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).