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 nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 30E71D460 for ; Tue, 25 Oct 2005 14:15:36 +0200 (CEST) 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 j9PCFZ0f031881 for ; Tue, 25 Oct 2005 14:15:35 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA22205 for ; Tue, 25 Oct 2005 14:15:35 +0200 (MET DST) Received: from mail.tcs.inf.tu-dresden.de (tcs01.inf.tu-dresden.de [141.76.75.1]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j9PCFY5i023665 for ; Tue, 25 Oct 2005 14:15:35 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.tcs.inf.tu-dresden.de (Sun Java System Messaging Server 6.1 HotFix 0.06 (built Nov 11 2004)) with ESMTP id <0IOX00J4O0PYZ200@mail.tcs.inf.tu-dresden.de> for caml-list@inria.fr; Tue, 25 Oct 2005 14:15:34 +0200 (MEST) Received: from tcs01.inf.tu-dresden.de ([127.0.0.1]) by localhost (mail.tcs.inf.tu-dresden.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 29733-10 for ; Tue, 25 Oct 2005 14:15:34 +0200 (MEST) Received: from ithif59.inf.tu-dresden.de (ithif59.inf.tu-dresden.de [141.76.75.59]) by mail.tcs.inf.tu-dresden.de (Sun Java System Messaging Server 6.1 HotFix 0.06 (built Nov 11 2004)) with ESMTPS id <0IOX00KDG0PY1O00@mail.tcs.inf.tu-dresden.de> for caml-list@inria.fr; Tue, 25 Oct 2005 14:15:34 +0200 (MEST) Received: from tews by ithif59.inf.tu-dresden.de with local (Exim 4.50) id 1EUNiI-0003TU-AX for caml-list@inria.fr; Tue, 25 Oct 2005 14:15:34 +0200 Date: Tue, 25 Oct 2005 14:15:34 +0200 From: Hendrik Tews Subject: Re: [Caml-list] any types in signatures of functor arguments In-reply-to: <20051024.175154.68545642.keiko@kurims.kyoto-u.ac.jp> To: caml-list@inria.fr Message-id: MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT X-Virus-Scanned: amavisd-new at tcs.inf.tu-dresden.de References: <20051024.175154.68545642.keiko@kurims.kyoto-u.ac.jp> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 X-Miltered: at nez-perce with ID 435E21E7.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 435E21E6.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; hendrik:01 tews:01 tews:01 caml-list:01 functor:01 functor:01 concretely:01 typable:01 sig:01 val:01 struct:01 abbreviation:01 sig:01 val:01 struct:01 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 Keiko Nakata writes: Why I cannot have *any types* in signatures of functor arguments? Concretely, the following F is not typable. module F(X:sig type t = [`A of _ ] val f : t -> int end) = struct let f = function `A x as a -> X.f a | `B -> 0 end The problem is rather that your type abbreviation is illegal: # type t = [`A of _ ];; A type variable is unbound in this type declaration. In case `A of 'a the variable 'a is unbound Use module F(X:sig val f : [`A of _ ] -> int end) = struct let f = function `A x as a -> X.f a | `B -> 0 end or a type abbreviation that works. Either type 'a t = [`A of _ ] as 'a;; or type 'a t = [`A of _ as 'a ];; Where the latter is the same as the already proposed type 'a t = [ `A of 'a ];; Bye, Hendrik