caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Andre Nathan <andre@digirati.com.br>
To: Gabriel Scherer <gabriel.scherer@gmail.com>
Cc: Arnaud Spiwack <aspiwack@lix.polytechnique.fr>, caml-list@inria.fr
Subject: Re: [Caml-list] What am I reinventing here?
Date: Tue, 14 Feb 2012 09:05:52 -0200	[thread overview]
Message-ID: <1329217552.13129.8.camel@andre> (raw)
In-Reply-To: <CAPFanBEwqDjciwwy8nWxj21tuQ-_C6SnU3Ys=5zA3HsXjkTdVg@mail.gmail.com>

On Tue, 2012-02-14 at 11:39 +0100, Gabriel Scherer wrote:
> Yes it is, but you have to use judicious "with .." annotations to make
> the type non-abstract.

Figured out my error... I had tried defining a functor like this:

module type Ops = sig
  type foo
  type bar
  val bar_of_foo : foo -> bar
  val foo_of_bar : bar -> foo
end

module type S = sig
  type foo
  type bar
  val foo : foo -> bar
  val bar : bar -> foo
end

module M (O : Ops) : S
  with type foo = O.foo and type bar = O.bar =
struct
  type foo = O.foo
  type bar = O.bar
  let foo = O.bar_of_foo
  let bar = O.foo_of_bar
end

which is correct, but in the actual code I also have a .mli file and
there I had only written "module M (O : Ops) : S", without the "with
type ..." part. I completely forgot to replicate it there, and that's
why this attempt kept failing...

Thanks so much for your help!

Andre


      reply	other threads:[~2012-02-14 11:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-13 23:33 Andre Nathan
2012-02-14  7:03 ` Arnaud Spiwack
2012-02-14  9:59   ` Andre Nathan
2012-02-14 10:09     ` Gabriel Scherer
2012-02-14 10:24       ` Andre Nathan
2012-02-14 10:39         ` Gabriel Scherer
2012-02-14 11:05           ` Andre Nathan [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=1329217552.13129.8.camel@andre \
    --to=andre@digirati.com.br \
    --cc=aspiwack@lix.polytechnique.fr \
    --cc=caml-list@inria.fr \
    --cc=gabriel.scherer@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).