caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Denis Bueno" <dbueno@gmail.com>
To: "OCaml Mailing List" <caml-list@inria.fr>
Subject: Variable pattern matching tuple
Date: Mon, 18 Sep 2006 21:26:15 -0400	[thread overview]
Message-ID: <6dbd4d000609181826p6beca937y515903dc76628fc3@mail.gmail.com> (raw)

The following is not intuitive to me.

# type 'a withint = Withint of 'a * int;;
type 'a withint = Withint of 'a * int
# let foo = Withint ("hi there", 4);;
val foo : string withint = Withint ("hi there", 4)
# match foo with Withint _ -> ();;
- : unit = ()
# match foo with Withint d -> d;; (* expression A*)
Characters 15-24:
  match foo with Withint d -> d;;
                 ^^^^^^^^^
The constructor Withint expects 2 argument(s),
but is here applied to 1 argument(s)
#

What is the reason that expression A won't compile? Can't one variable
stand for a tuple in a pattern-matching clause?

-Denis


             reply	other threads:[~2006-09-19  1:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-19  1:26 Denis Bueno [this message]
2006-09-19  1:40 ` [Caml-list] " Pietro Abate

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=6dbd4d000609181826p6beca937y515903dc76628fc3@mail.gmail.com \
    --to=dbueno@gmail.com \
    --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).