caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: Malcolm Matalka <mmatalka@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Expressing module sig and impl in mli file
Date: Wed, 19 Sep 2012 16:25:21 +0900	[thread overview]
Message-ID: <CA+p7B-yZ5_sQM2Tb8Q67z5EUhquDCteS1uTwtABu15cFo29BJQ@mail.gmail.com> (raw)
In-Reply-To: <CAKziXDWDAuhUNa_muTL9T9vjuO9_LrLR-wknCciPMCSHhkA6pw@mail.gmail.com>

On Wed, Sep 19, 2012 at 7:40 AM, Malcolm Matalka <mmatalka@gmail.com> wrote:
> I spoke too soon!  Below is my testcase and error.  Where did I go wrong?
>
> foo.mli:
> open Core.Std
>
> module Bar : sig
>   include Identifier with type t = String.t
> end
>
> foo.ml:
> open Core.Std
>
> module Bar : Identifier = String
>
> The error:
>        Type declarations do not match:
>          type t = Bar.t
>        is not included in
>          type t = Core.Std.String.t

First comment: there is no need to use include here.
You can just write

  module Bar : Identifier with type t = String.t

in the interface.
Since there is an interface, there is not need to restrict Bar
in the implementation, so just write:

  module Bar = String

If you want to add a signature in the implementation,
it should be a subtype of the interface signature.

Jacques Garrigue

      parent reply	other threads:[~2012-09-19  7:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-18 21:02 Malcolm Matalka
2012-09-18 21:13 ` Gabriel Scherer
2012-09-18 21:31   ` Malcolm Matalka
2012-09-18 22:40     ` Malcolm Matalka
2012-09-19  2:11       ` Edgar Friendly
2012-09-19  7:11         ` David House
2012-09-19  7:36           ` Malcolm Matalka
2012-09-19  7:49             ` David House
2012-09-19  7:51               ` David House
2012-09-19  8:00                 ` Malcolm Matalka
2012-09-19  8:11                   ` Gabriel Scherer
2012-09-19  7:25       ` Jacques Garrigue [this message]

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=CA+p7B-yZ5_sQM2Tb8Q67z5EUhquDCteS1uTwtABu15cFo29BJQ@mail.gmail.com \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=mmatalka@gmail.com \
    /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).