From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 38F14BBAF for ; Wed, 25 Jun 2008 17:30:14 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhEBAN8AYkjUGyocmWdsb2JhbACBW5B6AQEBAQEIBQYJEQOZdYVJ X-IronPort-AV: E=Sophos;i="4.27,703,1204498800"; d="scan'208";a="12523926" Received: from smtp2-g19.free.fr ([212.27.42.28]) by mail2-smtp-roc.national.inria.fr with ESMTP; 25 Jun 2008 17:30:14 +0200 Received: from smtp2-g19.free.fr (localhost.localdomain [127.0.0.1]) by smtp2-g19.free.fr (Postfix) with ESMTP id 99F9C12B74D for ; Wed, 25 Jun 2008 17:30:13 +0200 (CEST) Received: from localhost.localdomain (c5850-a2-3-62-147-58-102.dial.proxad.net [62.147.58.102]) by smtp2-g19.free.fr (Postfix) with ESMTP id 8719812B738 for ; Wed, 25 Jun 2008 17:30:12 +0200 (CEST) Date: Wed, 25 Jun 2008 15:30:43 +0200 From: Fabrice Marchant To: caml-list@yquem.inria.fr Subject: Building a Set module for elements of a Map Message-ID: <20080625153043.3bd7895c@free.fr> X-Mailer: Claws Mail 3.2.0 (GTK+ 2.12.10; i486-pc-linux-gnu) X-Face: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; functor:01 struct:01 struct:01 orderedtype:01 pervasives:01 orderedtype:01 modules:02 output:02 output:02 seems:03 module:03 module:03 let:03 let:03 problem:05 Hi List ! Please consider a functor F that takes as input the output signature of a Map. Here is the only way I see to declare a Set module whose elements type are Map.S.key : module F ( M : Map.S ) = struct module MKeySet = Set.Make ( struct type t = M.key let compare = compare end ) end The problem is to access the OrderedType that permitted to build the Map M. It seems to have disappeared inside the output Map signature S. So the trial of regeneration : struct type t = M.key let compare = compare end It maybe exists a straightforward signature we could pick somewhere inside Map related modules ? Moreover I'm afraid this "Ersatz" of signature based on _Pervasives_.compare is in some cases deficient, because different from original OrderedType of Map elements... A parallel question for values type : how to declare inside F a module MValueSet to accomodate target elements of the input Map ? Any light ? Fabrice