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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 7FDA0BBBB for ; Mon, 27 Feb 2006 16:14:54 +0100 (CET) Received: from gw-eur4.philips.com (gw-eur4.philips.com [161.85.125.10]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k1RFErlQ008321 for ; Mon, 27 Feb 2006 16:14:54 +0100 Received: from smtpscan-eur4.philips.com (smtpscan-eur4.mail.philips.com [130.144.57.167]) by gw-eur4.philips.com (Postfix) with ESMTP id A5C6749711; Mon, 27 Feb 2006 15:14:53 +0000 (UTC) Received: from smtpscan-eur4.philips.com (localhost [127.0.0.1]) by localhost.philips.com (Postfix) with ESMTP id 23B8556; Mon, 27 Feb 2006 15:14:53 +0000 (GMT) Received: from smtprelay-eur2.philips.com (smtprelay-eur2.philips.com [130.144.57.171]) by smtpscan-eur4.philips.com (Postfix) with ESMTP id 9579857; Mon, 27 Feb 2006 15:14:50 +0000 (GMT) Received: from ehvrmh02.diamond.philips.com (ehvrmh02-srv.diamond.philips.com [130.139.27.125]) by smtprelay-eur2.philips.com (Postfix) with ESMTP id 2B17342; Mon, 27 Feb 2006 15:14:49 +0000 (GMT) In-Reply-To: To: caml-list@yquem.inria.fr Cc: Merijn de Jonge , merijn.de.jonge@philips.com Subject: Re: [Caml-list] Writing Identity Functors (or Wrapper modules) inOCAML MIME-Version: 1.0 X-Mailer: Lotus Notes Release 6.0.3 September 26, 2003 Message-ID: From: Sebastian Egner Date: Mon, 27 Feb 2006 16:13:29 +0100 X-MIMETrack: Serialize by Router on ehvrmh02/H/SERVER/PHILIPS(Release 6.5.3FP1HF291 | September 19, 2005) at 27/02/2006 16:13:33, Serialize complete at 27/02/2006 16:13:33 Content-Type: multipart/alternative; boundary="=_alternative 0053BFEDC1257122_=" X-Miltered: at concorde with ID 4403176D.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 abstract:01 abstract:01 define:01 define:01 modules:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=HTML_50_60,HTML_MESSAGE, SUBJ_HAS_SPACES autolearn=disabled version=3.0.3 This is a multipart message in MIME format. --=_alternative 0053BFEDC1257122_= Content-Type: text/plain; charset="US-ASCII" > > module type IHelloWorld = > > sig > > type helloWorldType = Hello | World > > val hello : unit -> helloWorldType > > end > > > > module Wrapper (X: IHelloWorld) : IHelloWorld = > > struct > > type helloWorldType = X.helloWorldType > > let hello = X.hello > > end > > You have to explicitely define Hello and World in the wrapper. Try this : > > module Wrapper(X:IHelloWorld): IHelloWorld = > struct > type helloWorldType = X.helloWorldType = Hello | Word > let hello = 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 = sig type helloWorldType (* now abstract *) val hello : unit -> helloWorldType end module Wrapper (X: IHelloWorld) : (IHelloWorld with type helloWorldType = X.helloWorldType) = struct type helloWorldType = X.helloWorldType let hello = X.hello end ... Sebastian Egner. --=_alternative 0053BFEDC1257122_= Content-Type: text/html; charset="US-ASCII"
> >       module type IHelloWorld =
> >       sig
> >          type helloWorldType = Hello | World
> >         val hello : unit -> helloWorldType
> >       end
> >
> >       module Wrapper (X: IHelloWorld) : IHelloWorld =
> >       struct
> >         type helloWorldType = X.helloWorldType
> >         let hello = X.hello
> >       end
>
> You have to explicitely define Hello and World in the wrapper. Try this :
>
> module Wrapper(X:IHelloWorld): IHelloWorld =
> struct
>   type helloWorldType = X.helloWorldType = Hello | Word
>   let hello = 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 =
      sig
        type helloWorldType (* now abstract *)
        val hello : unit -> helloWorldType
      end

      module Wrapper (X: IHelloWorld) :
        (IHelloWorld with type helloWorldType = X.helloWorldType) =
      struct
        type helloWorldType = X.helloWorldType
        let hello = X.hello
      end

        ...

Sebastian Egner. --=_alternative 0053BFEDC1257122_=--