caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Patrick M Doane <patrick@watson.org>
To: Laurent Vibert <lvibert@irisa.fr>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Polymorphic variant abbreviations
Date: Wed, 19 Sep 2001 12:35:09 -0400 (EDT)	[thread overview]
Message-ID: <Pine.BSF.3.96.1010919122743.95614A-100000@fledge.watson.org> (raw)
In-Reply-To: <Pine.GSO.4.21.0109190955400.444-100000@mushroom.irisa.fr>

On Wed, 19 Sep 2001, Laurent Vibert wrote:

> > I was hoping that I could use this:
> > 
> >   let f ~a:#a = ...
> 
> you should write :
> 
> let f ~a : #a = ...

But then I get a syntax error for the next argument:

  let f1 ~a : #a ~b : #b = ...

Hmm.. try adding parens as usual for type constraints:

  let f1 (~a : #a) (~b : #b) = ...

but still a syntax error.

Move the tilde outside,

  let f1 ~(a : #a) ~(b : #b) = ..

This is syntactically valid, but doesn't give the most flexible typing.

Finally, last try:

  let f1 ~a:(#a as a) ~b:(#b as b) = ...

produces the correct type:

  val f1 : a:#a -> b:#b -> ...

It would have been nice if I could achieve that with just a ~ like this:

  let f1 ~a:#a -> ~b:#b


Patrick

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  reply	other threads:[~2001-09-19 16:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-18 22:48 Patrick M Doane
2001-09-19  0:05 ` Patrick M Doane
2001-09-19  8:37   ` Laurent Vibert
2001-09-19  8:56   ` Remi VANICAT
2001-09-19  8:01 ` Laurent Vibert
2001-09-19 16:35   ` Patrick M Doane [this message]
2001-09-19 12:45 ` Jacques Garrigue
2001-09-19 16:58   ` Patrick M Doane

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=Pine.BSF.3.96.1010919122743.95614A-100000@fledge.watson.org \
    --to=patrick@watson.org \
    --cc=caml-list@inria.fr \
    --cc=lvibert@irisa.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).