Browse thread
[Caml-list] Typing problem with polymorphic variants
- Alessandro Baretta
[
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: | -- (:) |
| From: | Alessandro Baretta <alex@b...> |
| Subject: | [Caml-list] Typing problem with polymorphic variants |
This just baffles me. > Values do not match: > val feature : > [> `Clear | `Length of int | `Pitch of int > | `Width of 'a] -> string > is not included in > val feature : [> `Clear] -> string Why are "match-anything" functions of the kind of let f = function | `Foo -> "foo" | `Bar -> "bar" | _ -> "?" incompatible with signatures like val f : [> `Foo ] -> string ? There clearly is no case when a value of type [> `Foo] will not be acceptable for f. So why does the type checker reject this? Alex ------------------- 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