Browse thread
[Caml-list] polymorphic variant question
- nadji@n...
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2002-08-29 (16:03) |
From: | nadji@n... |
Subject: | [Caml-list] polymorphic variant question |
Hi all, I am puzzled by the code below which doesn't work. # let f = function `B -> ();; val f : [ `B] -> unit = <fun> # let g x = match (x:[`A|`B]) with `A -> () | y -> f y;; Characters 51-52: let g x = match (x:[`A|`B]) with `A -> () | y -> f y;; ^ This expression has type [ `A | `B] but is here used with type [ `B] (denoting the "y" from the "f y") How can I say to OCaml that "y" can't be of type `A ? TIA, Nadji ------------------- 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