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=2.0 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST,DNS_FROM_RFC_WHOIS 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 C7024BBAF for ; Tue, 20 Jan 2009 17:33:55 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AokBAAWMdUlDww+vkWdsb2JhbACOZYUiAQEBAQkLCgcRA6d5j0AFAgGCSIMo X-IronPort-AV: E=Sophos;i="4.37,295,1231110000"; d="scan'208";a="19907308" Received: from web111508.mail.gq1.yahoo.com ([67.195.15.175]) by mail2-smtp-roc.national.inria.fr with SMTP; 20 Jan 2009 17:33:53 +0100 Received: (qmail 964 invoked by uid 60001); 20 Jan 2009 16:33:53 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=erU1beiZjNFBHYKHLL03FNRWUMOKH4pc0OLgslSG11f08GBGPFQSgvMR3AgmBSs4yIy7CVEfTQM93FwtMroHILvFfOfs4UzvqcM3lMZ6cOD8HgxwVFkdHRapxTnA6cETgH5IIKddf+RXhCDZzL76SqVtU4z/1kYs1AtG7V0kr6g=; X-YMail-OSG: X9h3NEIVM1nid5UUz5zOjmnvt3D8n9c.Sc_ddiSsuwXkh.syDaqTE2mW5duFsKNxjMwRO6_TGDmtIEWVswDGLRudBu9VSIGDg5Rd5Vx0Es6c6QW.w8.N7Jr_QHiNantWJTPBuh2cPvxnyQ9fLQU7V.Lw_DOrF2PeE1j36_JnE1QiaC4TxGp1o4cmw85xJ.Lowas5GpcnG51ImPJTzrn1isUOa6rQGthb50zYEMOsKkDmZDDl7TwqaEj.yXd2iq_bow-- Received: from [213.205.71.63] by web111508.mail.gq1.yahoo.com via HTTP; Tue, 20 Jan 2009 08:33:53 PST X-Mailer: YahooMailWebService/0.7.260.1 Date: Tue, 20 Jan 2009 08:33:53 -0800 (PST) From: Dario Teixeira Subject: Re: [Caml-list] Private types in 3.11, again To: caml-list@yquem.inria.fr In-Reply-To: <597161.6065.qm@web111501.mail.gq1.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-ID: <865755.99476.qm@web111508.mail.gq1.yahoo.com> X-Spam: no; 0.00; variants:01 variants:01 node:01 annotations:01 coercions:01 node:01 sig:01 val:01 val:01 struct:01 seq:01 seq:01 printf:01 sprintf:01 printf:01 Hi again, I ditched the regular variants in favour of polymorphic variants, hoping the coercion trick described by Jacques Garrigue would help [1]. I've also simplified the formulation as much as possible. Anyway, I'm still stuck with the same problem: while function 'sprint' works alright inside the Node module, its clone 'sprint2' fails to compile when placed outside. Is this a case where no amount of explicit annotations and coercions will work or am I missing something obvious? Thanks in advance! Regards, Dario Teixeira [1] http://groups.google.com/group/fa.caml/msg/855011402f1ca1b5 module Node: sig =09type elem_t =3D [ `Text of string | `Bold of elem_t list ] =09type +'a t =3D private elem_t =09val text: string -> [> `Basic ] t =09val bold: 'a t list -> [> `Complex ] t =09val sprint: 'a t -> string end =3D struct =09type elem_t =3D [ `Text of string | `Bold of elem_t list ] =09type +'a t =3D elem_t =09let text str =3D `Text str =09let bold seq =3D `Bold seq =09let rec sprint =3D function =09=09| `Text str=09-> Printf.sprintf "(Text %s)" str =09=09| `Bold seq=09-> Printf.sprintf "(Bold %s)" (List.fold_left (^) "" (L= ist.map sprint seq)) end module Foobar: sig =09val sprint2: 'a Node.t -> string end =3D struct =09let rec sprint2 node =3D match (node : _ Node.t :> [> ]) with =09=09| `Text str=09-> Printf.sprintf "(Text %s)" str =09=09| `Bold seq=09-> Printf.sprintf "(Bold %s)" (List.fold_left (^) "" (L= ist.map sprint2 (seq : _ Node.t list :> [>] list))) end =0A=0A=0A