caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: michael.le_barbier@laposte.net (Michaël Le Barbier)
To: Julien Moutinho <julien.moutinho@gmail.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Strategy to avoid name collision in signatures
Date: Sun, 04 Nov 2007 08:34:24 +0100	[thread overview]
Message-ID: <86zlxu79bz.fsf@Llea.celt.neu> (raw)
In-Reply-To: <20071104000116.GA2256@localhost> (Julien Moutinho's message of "Sun\, 4 Nov 2007 01\:01\:17 +0100")

Julien Moutinho <julien.moutinho@gmail.com> writes:

> I'm not sure if it could be of some help, but here is another scheme
> wherein the functor <name>Type.Make does not include its argument PROTO,
> so that there is no namespace conflict with type t.
> However the PROTO structure can no longer be used anonymously:

This is fine. Here's how I will work it out:

module Ordered =
struct

  module type PROTO =
    type t
    val compare: t -> t -> int
  end

  module type S =
    type t
    val compare: t -> t -> int
    val ge: t -> t -> bool
  end

  module Macro (P:PROTO) =
  struct
    let ge x y = (compare x y) >= 0
  end

  module Make (P:PROTO) =
  struct
    type t = P.t
    include Macro(P)
  end

end


It seems as economic as possible, provided I want to provide both the
`Macro' and `Make' version. Thanks for the hint!
-- 
Cordialement,
Michaël LB


      reply	other threads:[~2007-11-04  7:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-03 22:20 Michaël Le Barbier
2007-11-03 22:47 ` [Caml-list] " Andrej Bauer
2007-11-04  6:15   ` Michaël Le Barbier
2007-11-04  0:01 ` Julien Moutinho
2007-11-04  7:34   ` Michaël Le Barbier [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=86zlxu79bz.fsf@Llea.celt.neu \
    --to=michael.le_barbier@laposte.net \
    --cc=caml-list@yquem.inria.fr \
    --cc=julien.moutinho@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).