Re: Module vs Module Type?

"Philippe Veber [email protected] [ocaml_beginners]" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <CAOOOohR6iAo8tbZ9DHXU7uawmbbjWcwc3ZhurpiwMd6LcR4wgw@mail.gmail.com>
Hi Bob,

Yes, that's basically right. Here's an example

module type S = sig
  type t
  val neutral : t
  val plus : t -> t -> t
end

module Z : S = struct
  type t = int
  let neutral = 0
  let plus = ( + )
end



2015-02-22 23:56 GMT+01:00 Bob Fang [email protected] [ocaml_beginners]
<[email protected]>:

>
>
> Dear all,
>
> Hi, sorry this might be a stupid question, so according to my
> understanding we have these correspondence:
>     Module Struct Implementation of the module   Module Type Sig Type of
> the module
>
> So signature are like the type of a module, and we can define them using module
> type keyword and we can only use struct to implement the module, is this
> correct?
>
> Thanks a lot.
>
> Best,
>
> Bob
>
>
>
>
>
> --
> Bob Fang
>
>
>
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.