Browse thread
[Caml-list] variant with tuple arg in pattern match?
[
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: | Alain Frisch <frisch@c...> |
| Subject: | Re: [Caml-list] variant with tuple arg in pattern match? |
On Sun, 8 Apr 2001, Pierre Weis wrote: > I suggest to explicitely annotate the constructor definitions as in: > > type t = > | C : int -> int -> t > This notation is explicit, intuitive, and allows refined type checking > in some cases (for instance > type 'a t = C : int -> bool -> (int * bool) t). How does this interact with pattern matching ? If constructor types are not uniform, it seems that it is no longer possible to say whether a simple (without guards) pattern matching is exhaustive or not. For instance, with the declaration: type 'a t = A : int t | B : 'a -> 'a t do you issue a warning for: function B x -> x ? -- Alain Frisch ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr