caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Virgile Prevosto <virgile.prevosto@m4x.org>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] any types in signatures of functor arguments
Date: Tue, 25 Oct 2005 10:53:45 +0200	[thread overview]
Message-ID: <20051025105345.319f8366@aloxe.inria.fr> (raw)
In-Reply-To: <20051025.112220.68541121.keiko@kurims.kyoto-u.ac.jp>

Le mar 25 oct 2005 11:22:20 CEST, Keiko Nakata <keiko@kurims.kyoto-
u.ac.jp> a ecrit:

> So it seems that I cannot avoid modifying modules to which F is
> applied. Actually, I already written several modules, say M and N, in
> separate files. Later, I defined the functor F so as to apply it to
> the modules M and N. I thought that it would be nice if I can avoid
> modifying the implementations and interface files of M and N,
> since it will affect other parts of my program.
> 

It might be possible to only modify the arguments you give to F, with
the use of include:

module M = struct let f (`A x) = x end

module F(X:sig type s type t = [ `A of s] val f: t -> int end) =
  struct let f = function `A _ as a -> X.f a | `B -> 0
  end;;

module FM = F(struct include M type s = int type t = [ `A of s ])

-- 
E tutto per oggi, a la prossima volta
Virgile


  reply	other threads:[~2005-10-25  8:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-24  8:51 Keiko Nakata
2005-10-24 14:08 ` [Caml-list] " Brian Hurt
2005-10-25  2:22   ` Keiko Nakata
2005-10-25  8:53     ` Virgile Prevosto [this message]
2005-10-25  9:49       ` Keiko Nakata
2005-10-25 10:08         ` fva en UMBRIEL
2005-10-25 12:15 ` Hendrik Tews

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=20051025105345.319f8366@aloxe.inria.fr \
    --to=virgile.prevosto@m4x.org \
    --cc=caml-list@yquem.inria.fr \
    /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).