From: "Merijn de Jonge" <merijn.de.jonge@gmail.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Writing Identity Functors (or Wrapper modules) inOCAML
Date: Mon, 27 Feb 2006 16:20:01 +0100 [thread overview]
Message-ID: <f40e02a60602270720t6b25dc7n3c7e39f47f79d074@mail.gmail.com> (raw)
In-Reply-To: <OFC9A98EA9.2CF54DE6-ONC1257122.00534F8A-C1257122.0053BFF0@philips.com>
[-- Attachment #1: Type: text/plain, Size: 1595 bytes --]
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 <sebastian.egner@philips.com> wrote:
>
>
> > > 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: 3103 bytes --]
next prev parent reply other threads:[~2006-02-27 15:20 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 ` [Caml-list] Writing Identity Functors (or Wrapper modules) inOCAML Sebastian Egner
2006-02-27 15:20 ` Merijn de Jonge [this message]
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=f40e02a60602270720t6b25dc7n3c7e39f47f79d074@mail.gmail.com \
--to=merijn.de.jonge@gmail.com \
--cc=caml-list@yquem.inria.fr \
/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