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 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 21CC7BBAF for ; Mon, 19 Jan 2009 16:09:19 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoICAFsmdElDww+FkWdsb2JhbACOZIUjAQEBAQkLCgcRA7AljRQFAgGFcA X-IronPort-AV: E=Sophos;i="4.37,289,1231110000"; d="scan'208";a="19824719" Received: from web111501.mail.gq1.yahoo.com ([67.195.15.133]) by mail2-smtp-roc.national.inria.fr with SMTP; 19 Jan 2009 16:09:18 +0100 Received: (qmail 6716 invoked by uid 60001); 19 Jan 2009 15:09:16 -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=b0tiMsJNPxIATzh3K/MvupfxmO/zo26dwKdFJK+QX6JYDP+lqr/BgqgFI7h4n7m4qP1R5ldRaMPGd1q2X1ZktjXxwDKLOtHsF6Q/uO8iKKBcOWKsRZKKaKkXRi/uNv++1dsV4f5qpGYLP6m5cdEYDDAQeSzyB50iFPx5rVzs2cY=; X-YMail-OSG: df_gnP0VM1lJltn_0lDMWHR6dMs.Oh9mJaDetiVrBJRANyh6QF7PSFmeu6UPUlte_8ilhaWmrvIzBxk2XgM5xdjDYhYSNLbaR5Xb0P1xKWrCWhGgsjjykKZpy33bbCcVnCqn2tWe9yccDF3NESMqTuoRXt5ouaTjSFxfr_kpU6GXBZ9UjDD3FyH4MjWpgw-- Received: from [213.205.70.198] by web111501.mail.gq1.yahoo.com via HTTP; Mon, 19 Jan 2009 07:09:16 PST X-Mailer: YahooMailWebService/0.7.260.1 Date: Mon, 19 Jan 2009 07:09:16 -0800 (PST) From: Dario Teixeira Subject: Re: [Caml-list] Private types in 3.11, again To: caml-list@yquem.inria.fr In-Reply-To: <279131.80665.qm@web111514.mail.gq1.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-ID: <597161.6065.qm@web111501.mail.gq1.yahoo.com> X-Spam: no; 0.00; foobar:01 node:01 node:01 sig:01 val:01 val:01 struct:01 seq:01 seq:01 foobar:01 sig:01 struct:01 failwith:01 rec:01 compile:01 Hi, > So my question is how can I make the Foobar code behave as if it were > defined inside Node. Based on a previous thread [1], I'm guessing there > is a solution, but I've been unable to hit on its exact formulation. There have been no replies yet to my question, but I'm still stuck with this little problem. The offending code is below; though it doesn't compile, I reckon that all it needs is a suitable type annotation. I'm guessing this because the function capitalise_node function will compile fine if placed inside the Node module. Any ideas on how to solve this? Thanks in advance! Best regards, Dario Teixeira module Node: sig =09type node_t =3D =09=09private =09=09| Text of string =09=09| Bold of node_t list =09=09| Href of string =09=09| Mref of string * node_t list =09type +'a t =3D private node_t =09val text: string -> [> `Nonlink ] t =09val bold: 'a t list -> 'a t =09val href: string -> [> `Link ] t =09val mref: string -> [< `Nonlink ] t list -> [> `Link ] t end =3D struct =09type node_t =3D =09=09| Text of string =09=09| Bold of node_t list =09=09| Href of string =09=09| Mref of string * node_t list =09type +'a t =3D node_t =09let text txt =3D Text txt =09let bold seq =3D Bold seq =09let href lnk =3D Href lnk =09let mref lnk seq =3D Mref (lnk, seq) end module Foobar: sig =09open Node =09val capitalise_node: 'a t -> 'a t end =3D struct =09open Node =09let capitalise_node node =3D =09=09let rec capitalise_node_aux forbid_link node =3D match (forbid_link, = node) with =09=09=09| (_, Text txt)=09=09=09-> text (String.capitalize txt) =09=09=09| (x, Bold seq)=09=09=09-> bold (List.map (capitalise_node_aux x) = seq) =09=09=09| (false, Href lnk)=09=09-> href lnk =09=09=09| (false, Mref (lnk, seq))=09-> mref lnk (List.map (capitalise_nod= e_aux true) seq) =09=09=09| _=09=09=09=09-> failwith "oops" =09=09in capitalise_node_aux false node end =0A=0A=0A