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 1CF90BC48 for ; Mon, 18 Apr 2005 16:02:09 +0200 (CEST) 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 j3IE289Z000693 for ; Mon, 18 Apr 2005 16:02:08 +0200 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 QAA12226 for ; Mon, 18 Apr 2005 16:02:08 +0200 (MET DST) Received: from mail.barettadeit.com (h213-255-109-130.albacom.net [213.255.109.130] (may be forged)) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j3IE27qq002064 for ; Mon, 18 Apr 2005 16:02:08 +0200 Received: from [10.0.0.10] (alex.barettalocal.com [10.0.0.10]) by mail.barettadeit.com (Postfix) with ESMTP id AB4A3802C954 for ; Mon, 18 Apr 2005 16:02:07 +0200 (CEST) Message-ID: <4263BDDF.3050903@barettadeit.com> Date: Mon, 18 Apr 2005 16:02:07 +0200 From: Alex Baretta User-Agent: Debian Thunderbird 1.0 (X11/20050116) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ocaml Subject: Problem with local modules X-Enigmail-Version: 0.90.0.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 4263BDE0.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4263BDDF.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; baretta:01 merging:01 heap:01 filliatre:01 heap:01 bool:01 struct:01 bool:01 struct:01 checker:01 baretta:01 ...:98 ...:98 expression:01 modules:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.2 X-Spam-Level: I have written a list-of-sorted-lists merging function which takes advantage of a functional heap module by Jean-Christophe Filliatre. I would like to avoid the functorial style of the heap library by using local modules; however, the type system does not allow me to bind the "type t" of the local parameter module to a type variable, which is bound in the containing expression. This is what I would like to have: let rev_merge_list_rev_filter_append (cmp : 'a -> 'a -> int) (p : 'a -> bool) (ll : 'a list list) (accu : 'a list) = let module Ordered = struct type t = Obj.t * (Obj.t list) let compare (x,tlx) (y,tly) = cmp ((Obj.obj x):'a) ((Obj.obj y):'a) end in let module Heap = Heap.Functional (Ordered) in ... This is what I had to write. let rev_merge_list_rev_filter_append (cmp : 'a -> 'a -> int) (p : 'a -> bool) (ll : 'a list list) (accu : 'a list) = let module Ordered = struct type t = Obj.t * (Obj.t list) let compare (x,tlx) (y,tly) = cmp ((Obj.obj x):'a) ((Obj.obj y):'a) end in let module Heap = Heap.Functional (Ordered) in ... Is this a limitation of the type theory or of the type checker? Is there any other way out than using the Obj module? Alex -- ********************************************************************* http://www.barettadeit.com/ Baretta DE&IT A division of Baretta SRL tel. +39 02 370 111 55 fax. +39 02 370 111 54 Our technology: The Application System/Xcaml (AS/Xcaml) The FreerP Project