caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: Lauri Alanko <la@iki.fi>
Cc: OCaml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Signature monomorphism in functors
Date: Tue, 18 Jan 2011 23:03:05 +0900	[thread overview]
Message-ID: <F6535A2D-2F8D-484E-8973-8BB06A499F3D@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <20110118121036.GK323@melkinpaasi.cs.helsinki.fi>

On 2011/01/18, at 11:00, Lauri Alanko wrote:

> I guess what I want is "bounded signature polymorphism" of some sort:
> 
> module F(A : sig module type S <: S1 module M : S end) 
>  : S3 with module M = A.M = 
> struct
>  module M = A.M
> end
> 
> module M3B : S3 with module M = M2 = 
>  F(struct module type S = S2 module M = M2 end)
> 
> Alas, there are no signature bounds in ocaml and I cannot offhand
> think of a way to encode them.

You can always encode it by using an abstract module type:

  module type S1'  = sig type t  module type X  module X : X end

This way you can put anything you wish in X.
But this is going to be pretty heavy to use...

Alternatively, if you don't need all the functionality of modules,
objects let you do exactly that. A function from objects to objects may
be polymorphic in the available methods.

Jacques Garrigue


  reply	other threads:[~2011-01-18 14:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-18  2:00 Lauri Alanko
2011-01-18 10:02 ` rossberg
2011-01-18 10:22   ` rossberg
2011-01-18 12:10   ` Lauri Alanko
2011-01-18 14:03     ` Jacques Garrigue [this message]
2011-01-18 16:41     ` rossberg

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=F6535A2D-2F8D-484E-8973-8BB06A499F3D@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=la@iki.fi \
    /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).