English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] variant with tuple arg in pattern match?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-04-09 (00:22)
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

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