From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr 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 13086BB81 for ; Fri, 11 Nov 2005 06:11:43 +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 jAB5Bg4k017118 for ; Fri, 11 Nov 2005 06:11:42 +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 GAA10854 for ; Fri, 11 Nov 2005 06:11:42 +0100 (MET) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jAB5BeoC031990 for ; Fri, 11 Nov 2005 06:11:41 +0100 Received: from localhost (suiren [130.54.16.25]) by kurims.kurims.kyoto-u.ac.jp (8.13.1/8.13.1) with ESMTP id jAB5BJmf006988; Fri, 11 Nov 2005 14:11:35 +0900 (JST) Date: Fri, 11 Nov 2005 14:12:22 +0900 (JST) Message-Id: <20051111.141222.106258050.garrigue@math.nagoya-u.ac.jp> To: keiko@kurims.kyoto-u.ac.jp Cc: caml-list@inria.fr Subject: Re: [Caml-list] private rows question From: Jacques Garrigue In-Reply-To: <20051110.125000.68545682.keiko@kurims.kyoto-u.ac.jp> References: <20051110.125000.68545682.keiko@kurims.kyoto-u.ac.jp> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 4374280E.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4374280C.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 functor:01 typable:01 sig:01 val:01 struct:01 int:01 int:01 jacques:01 jacques:01 garrigue:03 garrigue:03 module:03 let:03 let:03 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 From: Keiko Nakata > Why the following functor G is not typable? > I thought that g could have a type something like int -> [< `A | `B ]. > > module G(X:sig type t = private [< `A ] val f : int -> t end) = struct > let g x = if x = 0 then `B else X.f x > end Since g may return `B, and probably `A (the probably concerns your intention), the expected type would be g : int -> [> `A | `B ] Next, if you want f to have a private row type, then you should disconnect its type from the type of g (otherwise the type of g must be the same as f.) So I would expect something like: let g x = if x = 0 then `B else (X.f x : [< `A] :> [> `A]) Jacques