From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA29562 for caml-redistribution; Mon, 25 Oct 1999 20:53:09 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA08706 for ; Sat, 23 Oct 1999 19:40:59 +0200 (MET DST) Received: from mail5.svr.pol.co.uk (mail5.svr.pol.co.uk [195.92.193.20]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id TAA26404 for ; Sat, 23 Oct 1999 19:40:57 +0200 (MET DST) Received: from modem-69.slamdunk.dialup.pol.co.uk ([62.136.207.69] helo=toy.william.bogus) by mail5.svr.pol.co.uk with esmtp (Exim 2.12 #2) id 11f5A1-0005aj-00 for caml-list@inria.fr; Sat, 23 Oct 1999 18:40:57 +0100 Received: (from williamc@localhost) by toy.william.bogus (8.8.7/8.8.7) id SAA04758; Sat, 23 Oct 1999 18:32:14 +0100 Date: Sat, 23 Oct 1999 18:32:14 +0100 Message-Id: <199910231732.SAA04758@toy.william.bogus> From: William Chesters To: caml-list@inria.fr Subject: Two small observations Sender: weis `with' is not fully polymorphic. For instance, in type 'a t = { length: int; elt: int -> 'a } let map: ('a -> 'b) -> 'a t -> 'b t = fun f t -> { t with elt = f ° t.elt } the inferred type for map is given by val map : ('a -> 'a) -> 'a t -> 'a t I can see that this is a simple way out of the problem of what to say if a `with' changes fields in a way inconsistent with the others' types, but it is a little confusing. The other thing is that the compiler doesn't tell you if your type annotations turn out to be over-optimistic, like that on `map' above. It would be nice to have the option of having it generate a warning in these cases.