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 nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id EED09BBBB for ; Mon, 27 Feb 2006 16:20:03 +0100 (CET) Received: from pproxy.gmail.com (pproxy.gmail.com [64.233.166.176]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k1RFK2i5013102 for ; Mon, 27 Feb 2006 16:20:03 +0100 Received: by pproxy.gmail.com with SMTP id i49so752310pye for ; Mon, 27 Feb 2006 07:20:02 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=ecTiXr9TZGeViwHYK+eKHQgWLektXqO/IzUzehshKb4VJjzUu/arUzcH58QMC+QOTzNxhQWq2nwfGLfe+Ic/xqOs+6JAVYh9A6ILG1qGjevFUTZf83Wt4ZE6wzu154Npb3qg1rNYRpto3JbRCGFXwxISzfjZy5pCKNfbKjjzqwg= Received: by 10.64.21.20 with SMTP id 20mr4916070qbu; Mon, 27 Feb 2006 07:20:01 -0800 (PST) Received: by 10.64.253.4 with HTTP; Mon, 27 Feb 2006 07:20:01 -0800 (PST) Message-ID: Date: Mon, 27 Feb 2006 16:20:01 +0100 From: "Merijn de Jonge" To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Writing Identity Functors (or Wrapper modules) inOCAML In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_4095_21798436.1141053601949" References: X-Miltered: at nez-perce with ID 440318A2.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 functors:01 sig:01 val:01 struct:01 explicitely:01 struct:01 sig:01 val:01 explicitely:01 wrote:01 wrote:01 abstract:01 abstract:01 define:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=2.0 required=5.0 tests=HTML_50_60,HTML_MESSAGE, RCVD_BY_IP,RCVD_IN_BL_SPAMCOP_NET autolearn=disabled version=3.0.3 ------=_Part_4095_21798436.1141053601949 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi guys, Thank you all for the quick reply. I overlooked the paragraph "Re-exported variant type or record type: an equation, a representation." Adding the "type representation" did the trick. I needed a concrete type, so the solution to make it abstract is not appropriate in my case. Thanks agin. Merijn de Jonge On 2/27/06, Sebastian Egner wrote: > > > > > module type IHelloWorld =3D > > > sig > > > type helloWorldType =3D Hello | World > > > val hello : unit -> helloWorldType > > > end > > > > > > module Wrapper (X: IHelloWorld) : IHelloWorld =3D > > > struct > > > type helloWorldType =3D X.helloWorldType > > > let hello =3D X.hello > > > end > > > > You have to explicitely define Hello and World in the wrapper. Try this > : > > > > module Wrapper(X:IHelloWorld): IHelloWorld =3D > > struct > > type helloWorldType =3D X.helloWorldType =3D Hello | Word > > let hello =3D X.hello > > end > > Alternatively, you have defined too much In IHelloWorld > (depends on what you wanted to do in the first place). > Then try this: > > module type IHelloWorld =3D > sig > type helloWorldType (* now abstract *) > val hello : unit -> helloWorldType > end > > module Wrapper (X: IHelloWorld) : > (IHelloWorld with type helloWorldType =3D X.helloWorldType) =3D > struct > type helloWorldType =3D X.helloWorldType > let hello =3D X.hello > end > > ... > > Sebastian Egner. ------=_Part_4095_21798436.1141053601949 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi guys,

Thank you all for the quick reply.

I overlooked the = paragraph "Re-exported variant type or record type: an
equation, a = representation."  Adding the "type representation" did= the trick.
I needed a concrete type, so the solution to make it abstract is not appropriate in my case.

Thanks agin.

Merijn de Jonge

On 2/27/06, Sebastian Egner <seba= stian.egner@philips.com> wrote:

> >       m= odule type IHelloWorld =3D
> >       sig
> >          type helloWorldType =3D Hello | World
> >         val hello : unit -> helloWorldType=
> >       end
> >
> >       module Wrapper (X: IHelloWorld) : IHelloWorl= d =3D
> >       struct
> >         type helloWorldType =3D X.helloWorldT= ype
> >         let hello =3D X.hello
> >       end
>
> You have to explicitely define Hello and World in the wrapper. Try this :
>
> module Wrapper(X:IHelloWorld): IHelloWorld =3D
> struct
>   type helloWorldType =3D X.helloWorldType =3D Hello | Word
>   let hello =3D X.hello
> end

Alternatively, you have defined too much In IHelloWorld

(depends on what you wanted to do in the first pla= ce).
Then try this:

      module type IHelloWorld =3D
      sig
        type helloWorldType (* now abstract *)
        val = hello : unit -> helloWorldType
      end

      module Wrapper (X: IHelloWorl= d) :
        (IHelloWorld wi= th type helloWorldType =3D X.helloWorldType) =3D
      struct=
        type helloWorldType = =3D X.helloWorldType
        let hello =3D X.hello<= /tt>
      end

        ...

Sebastian Egner.

------=_Part_4095_21798436.1141053601949--