Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] strange match error
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jeff Polakow <jpolakow@g...>
Subject: [Caml-list] strange match error
Hello,

I ran into a strange (I think) error and was wondering if someone
out there can help me out.

Why does the following program:
  type tt = A of string * int | B;;
  let f x = print_string ((fst x)^"\n");;
  let g x = match x with A y -> f y | B -> ();;

produce the following response from ocaml?
  # #use "caml_test.ml";;
  type tt = A of string * int | B
  val f : string * 'a -> unit = <fun>
  File "caml_test.ml", line 3, characters 23-26:
  The constructor A expects 2 argument(s), but is here applied to 1
argument(s)

Shouldn't the type reconstructor/checker realize that y is a pair?

thanks,
  Jeff
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners