Version franēaise
Home     About     Download     Resources     Contact us    
Browse thread
Writing Identity Functors (or Wrapper modules) in OCAML
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jean-Christophe Filliatre <filliatr@l...>
Subject: Re: [Caml-list] Writing Identity Functors (or Wrapper modules) in OCAML

Merijn de Jonge writes:
 > 
 > I've problems in writing an Identity Functor in OCAML that I want to use as
 > a wrapper module.

A type representation is missing: you should write your wrapper as

======================================================================
      module Wrapper (X: IHelloWorld) : IHelloWorld =
       struct
         type helloWorldType = X.helloWorldType = Hello | World
         let hello = X.hello
       end
======================================================================

See the paragraph "Re-exported variant type or record type: an
equation, a representation." in section 6.8.1 of the Ocaml manual
(http://caml.inria.fr/pub/docs/manual-ocaml/manual016.html)

Hope this helps,
-- 
Jean-Christophe Filliātre (http://www.lri.fr/~filliatr)