caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Variable pattern matching tuple
@ 2006-09-19  1:26 Denis Bueno
  2006-09-19  1:40 ` [Caml-list] " Pietro Abate
  0 siblings, 1 reply; 2+ messages in thread
From: Denis Bueno @ 2006-09-19  1:26 UTC (permalink / raw)
  To: OCaml Mailing List

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-19  1:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-19  1:26 Variable pattern matching tuple Denis Bueno
2006-09-19  1:40 ` [Caml-list] " Pietro Abate

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).