caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Francois Pottier <Francois.Pottier@inria.fr>
To: Tyng-Ruey Chuang <trc@iis.sinica.edu.tw>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] weak type variables in module type declarations
Date: Mon, 28 May 2001 10:03:53 +0200	[thread overview]
Message-ID: <20010528100353.A16789@pauillac.inria.fr> (raw)
In-Reply-To: <200105231324.f4NDOgc28482@mail.iis.sinica.edu.tw>; from trc@iis.sinica.edu.tw on Wed, May 23, 2001 at 09:24:42PM +0800


Dear Tyng-Ruey,

Weak type variables are not allowed to appear in declared signatures,
because there would be no good way of defining their meaning.

Instead of

> 	module type SUM =
> 	sig
> 	  type ('a, 'b) t = Pink of 'a | Blue of 'b
> 
> 	  val pair : ('_a -> ('_a, '_b) t) * ('_a -> ('_a, '_b) t)
> 	end

how about trying

  module type SUM =
  sig
    type a
    type b
    type t = Pink of a | Blue of b

    val pair: (a -> t) * (a -> t)
  end

Then, you can use, say,

  SUM with type a = int
       and type b = bool

in a context where you know that a and b should be instantiated to
int and bool, respectively.

-- 
François Pottier
Francois.Pottier@inria.fr
http://pauillac.inria.fr/~fpottier/
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


  parent reply	other threads:[~2001-05-28  8:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-23 13:24 Tyng-Ruey Chuang
2001-05-23 13:57 ` Remi VANICAT
2001-05-28  8:03 ` Francois Pottier [this message]
2001-05-28 12:50 ` Xavier Leroy

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=20010528100353.A16789@pauillac.inria.fr \
    --to=francois.pottier@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=trc@iis.sinica.edu.tw \
    /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).