caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Sebastian Egner <sebastian.egner@philips.com>
To: caml-list@yquem.inria.fr
Cc: Merijn de Jonge <merijn.de.jonge@gmail.com>, merijn.de.jonge@philips.com
Subject: Re: [Caml-list] Writing Identity Functors (or Wrapper modules) 	inOCAML
Date: Mon, 27 Feb 2006 16:13:29 +0100	[thread overview]
Message-ID: <OFC9A98EA9.2CF54DE6-ONC1257122.00534F8A-C1257122.0053BFF0@philips.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0602271600200.14206@pc9-159>

[-- Attachment #1: Type: text/plain, Size: 1072 bytes --]

> >       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.

[-- Attachment #2: Type: text/html, Size: 2187 bytes --]

  reply	other threads:[~2006-02-27 15:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-27 14:49 Writing Identity Functors (or Wrapper modules) in OCAML Merijn de Jonge
2006-02-27 15:04 ` [Caml-list] " Julien Signoles
2006-02-27 15:13   ` Sebastian Egner [this message]
2006-02-27 15:20     ` [Caml-list] Writing Identity Functors (or Wrapper modules) inOCAML Merijn de Jonge
2006-02-27 15:06 ` [Caml-list] Writing Identity Functors (or Wrapper modules) in OCAML Jean-Christophe Filliatre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=OFC9A98EA9.2CF54DE6-ONC1257122.00534F8A-C1257122.0053BFF0@philips.com \
    --to=sebastian.egner@philips.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=merijn.de.jonge@gmail.com \
    --cc=merijn.de.jonge@philips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).