From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 858A4BB91 for ; Thu, 27 Jan 2005 01:00:22 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j0R00MGA009468 for ; Thu, 27 Jan 2005 01:00:22 +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 BAA29419 for ; Thu, 27 Jan 2005 01:00:21 +0100 (MET) Received: from mail15.bluewin.ch (mail15.bluewin.ch [195.186.18.63]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j0R00LGS009465 for ; Thu, 27 Jan 2005 01:00:21 +0100 Received: from [10.0.1.2] (83.77.244.50) by mail15.bluewin.ch (Bluewin AG 7.0.035) id 41DE9B9E001E766C for caml-list@inria.fr; Thu, 27 Jan 2005 00:00:21 +0000 Mime-Version: 1.0 (Apple Message framework v619) Content-Transfer-Encoding: 7bit Message-Id: <6AFC6161-6FF6-11D9-ABDA-000393DBC266@epfl.ch> Content-Type: text/plain; charset=US-ASCII; format=flowed To: caml-list@inria.fr From: =?ISO-8859-1?Q?Daniel_B=FCnzli?= Subject: Phantom types and polymorphic variants Date: Thu, 27 Jan 2005 01:00:13 +0100 X-Mailer: Apple Mail (2.619) X-Miltered: at nez-perce with ID 41F82F16.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41F82F15.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; epfl:01 variants:01 well-typed:01 polymorphic:01 constraint:01 constraint:01 unit:02 unit:02 types:02 let:03 let:03 fork:04 fork:04 daniel:04 daniel:04 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: Hello, Suppose I have the following (well-typed) definitions > type tool = [`Spoon | `Fork] > > type 'a t = unit constraint 'a = [< tool] > > type 'a toolspec = unit constraint 'a = [< tool] > > let spoon : [< tool > `Spoon ] toolspec = () > let fork : [< tool > `Fork ] toolspec = () > > let create : ([< tool ] as 'a) -> 'a t = fun t -> () > let create' : ([< tool ] as 'a) toolspec -> 'a t = fun t -> () I don't really understand why the type of the value returned by create and create' differ : > # create `Spoon;; > - : [< Test.tool > `Spoon ] Test.t = () > # create' spoon;; > - : [< Test.tool ] Test.t = () I expected the second value to have the same type as the first. Thanks for your explanations, Daniel