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 A017BBB9A for ; Tue, 25 Oct 2005 10:53:46 +0200 (CEST) Received: from aloxe.inria.fr (aloxe.inria.fr [128.93.11.21]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j9P8rkbK012089 for ; Tue, 25 Oct 2005 10:53:46 +0200 Received: from aloxe.inria.fr (localhost [127.0.0.1]) by aloxe.inria.fr (Postfix) with ESMTP id 3E35E800C for ; Tue, 25 Oct 2005 10:53:46 +0200 (CEST) Date: Tue, 25 Oct 2005 10:53:45 +0200 From: Virgile Prevosto To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] any types in signatures of functor arguments Message-ID: <20051025105345.319f8366@aloxe.inria.fr> In-Reply-To: <20051025.112220.68541121.keiko@kurims.kyoto-u.ac.jp> References: <20051024.175154.68545642.keiko@kurims.kyoto-u.ac.jp> <20051025.112220.68541121.keiko@kurims.kyoto-u.ac.jp> X-Mailer: Sylpheed-Claws 1.9.6 (GTK+ 2.8.3; i586-mandrake-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 435DF29A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 functor:01 functor:01 struct:01 sig:01 val:01 struct:01 tutto:98 oggi:98 volta:98 signatures:01 int:01 int:01 modules:01 modules: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 Le mar 25 oct 2005 11:22:20 CEST, Keiko Nakata a ecrit: > So it seems that I cannot avoid modifying modules to which F is > applied. Actually, I already written several modules, say M and N, in > separate files. Later, I defined the functor F so as to apply it to > the modules M and N. I thought that it would be nice if I can avoid > modifying the implementations and interface files of M and N, > since it will affect other parts of my program. > It might be possible to only modify the arguments you give to F, with the use of include: module M = struct let f (`A x) = x end module F(X:sig type s type t = [ `A of s] val f: t -> int end) = struct let f = function `A _ as a -> X.f a | `B -> 0 end;; module FM = F(struct include M type s = int type t = [ `A of s ]) -- E tutto per oggi, a la prossima volta Virgile