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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 196A3BC57 for ; Tue, 27 Apr 2010 10:31:26 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjgBACo91kvUTWUHkGdsb2JhbACDF5kxFQEBAQEJCQwHEQQerDyRQYElgnptBA X-IronPort-AV: E=Sophos;i="4.52,279,1270418400"; d="scan'208";a="61473889" Received: from mx3.wp.pl ([212.77.101.7]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 27 Apr 2010 10:31:25 +0200 Received: (wp-smtpd smtp.wp.pl 2179 invoked from network); 27 Apr 2010 10:31:22 +0200 Received: from 18-161.2-0.pl (HELO [192.168.1.101]) (d0@[91.189.18.161]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with AES256-SHA encrypted SMTP for ; 27 Apr 2010 10:31:22 +0200 Message-ID: <4BD6A0D9.7070900@wp.pl> Date: Tue, 27 Apr 2010 10:31:21 +0200 From: Dawid Toton User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4 MIME-Version: 1.0 To: caml-list Subject: Extending Set - strange behavior of abstract type Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-WP-AV: skaner antywirusowy poczty Wirtualnej Polski S. A. X-WP-SPAM: NO 0000000 [URMk] X-Spam: no; 0.00; struct:01 ord:01 orderedtype:01 struct:01 ord:01 ocaml:01 char:01 char:01 abstract:01 compiles:01 functions:01 expression:02 module:03 module:03 let:03 I tried to extend the standard Set module with new operations. I got error messages about type incompatibilities (the Set.S.t as exposed by my implementation and Set.S.t used by functions from the original Set). I have reduced my code to the following small example: module Set = struct module Make (Ord : Set.OrderedType) = struct module Set = Set.Make(Ord) include Set end end module OrdChar = struct type t = char let compare = compare end module Raw1 = Set.Make (OrdChar) module Raw2 = Set.Make (struct type t = char let compare = compare end) let aaa (aa : Raw1.t) (bb : Raw1.Set.t) = (aa = bb) let aaa (aa : Raw2.t) (bb : Raw2.Set.t) = (aa = bb) Only the last line results in an error: Error: This expression has type Raw2.Set.t but is here used with type Raw2.t All the rest of the code compiles correctly. It means that types Raw1.t and Raw1.Set.t can be unified. My question is: why these nearly identical statements results in different behavior of the type t? I'd really prefer Raw1 and Raw2 to be identical. I use ocaml 3.11.0. Dawid