From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 8FBBABB81 for ; Tue, 7 Dec 2004 08:12:49 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id iB77Cm18012041 for ; Tue, 7 Dec 2004 08:12:49 +0100 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 IAA11463 for ; Tue, 7 Dec 2004 08:12:48 +0100 (MET) Received: from postfix4-2.free.fr (postfix4-2.free.fr [213.228.0.176]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iB77Cmi5000640 for ; Tue, 7 Dec 2004 08:12:48 +0100 Received: from [192.168.0.1] (rkeller-6-82-229-183-156.fbx.proxad.net [82.229.183.156]) by postfix4-2.free.fr (Postfix) with ESMTP id 281A023C8AB; Tue, 7 Dec 2004 08:12:47 +0100 (CET) Message-ID: <41B557D4.2000306@inria.fr> Date: Tue, 07 Dec 2004 08:12:20 +0100 From: Alain Frisch User-Agent: Mozilla Thunderbird 0.8 (X11/20040926) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jim Farrand Cc: caml-list@inria.fr Subject: Re: [Caml-list] Type constraints References: <20041206195527.GA32094@draco.skynet> In-Reply-To: <20041206195527.GA32094@draco.skynet> X-Enigmail-Version: 0.86.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 41B557F1.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41B557F0.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; frisch:01 frisch:01 caml-list:01 wrote:01 sig:01 val:01 struct:01 sig:01 val:01 struct:01 structures:01 signatures:01 constraint:01 constraints:01 btw:02 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: Jim Farrand wrote: > Hi, > The problem is that the type constraint generated, > > ((fun x -> x) : 'a -> 'a) > > does not reject values with a less general type. This is fine when the > type given matches the function, as it does above, but causes me > problems if the type given is less general. Maybe you can use local structures and signatures: (e :: s) ==> let module M : sig val v : s end = struct let v = e end in M.v;; where s is a type scheme. Btw, does someone know why in # let module M : sig val v: 'a -> 'a end = struct let v x = x end in M.v;; - : '_a -> '_a = the type variable is not generalized ? -- Alain