caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Sylvain Le Gall <sylvain@le-gall.net>
To: caml-list@inria.fr
Subject: Re: Type constraint to explain that a polymorphic variants is included into another
Date: Fri, 8 Oct 2010 22:10:09 +0000 (UTC)	[thread overview]
Message-ID: <slrniav5m1.fmh.sylvain@gallu.homelinux.org> (raw)
In-Reply-To: <AANLkTimE75FD_86jpd0wbEcrHp4vCHCS-pkDutfYHiW2@mail.gmail.com>

On 08-10-2010, Jake Donham <jake@donham.org> wrote:
> On Fri, Oct 8, 2010 at 10:13 AM, Sylvain Le Gall <sylvain@le-gall.net> wrote:
>> This code doesn't compile because I see no way to explain that F.kind is
>> included into plugin_kind.
>
> As you have written it, F.kind is of course completely abstract. I am
> not sure where you need F.kind to be a strict subtype of plugin_kind,
> but you could say type kind = plugin_kind (this seems a bit useless
> however).
>
> I don't think there is a way to use subtyping implicitly when applying
> a functor, but you can always do it explicitly by interposing a module
> of signature PLUGIN_FAMILY which embeds the specific kind in
> plugin_kind and passes the other components through.
>
> You could also have a general and a specific type in the plugin
> signature, and use the general one for general operations (e.g. help)
> but the specific one wherever that is needed. I am not sure I
> understand what you're trying to achieve however.
>

My goal is that the compiler prevents me to do 
Build.act pkg.plugin_install 
-> because plugin_install is of type [`Install] plugin and Build.act
   needs [`Build] plugin

but allow me to do 

help pkg.plugin_install 
-> because help needs [`Build | `Install] plugin.

But maybe I am missing something here and try to overengineer something
simple.

Regards,
Sylvain Le Gall


  reply	other threads:[~2010-10-08 22:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-08 17:13 Sylvain Le Gall
2010-10-08 18:13 ` [Caml-list] " Jake Donham
2010-10-08 22:10   ` Sylvain Le Gall [this message]
2010-10-08 20:09 ` Jacques Garrigue
2010-10-11  8:49   ` Sylvain Le Gall

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=slrniav5m1.fmh.sylvain@gallu.homelinux.org \
    --to=sylvain@le-gall.net \
    --cc=caml-list@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).