On Wed, 28 Mar 2007, Rónán_Daly <ronan dalyr.com> wrote:
>
> Hi there,
>
> dmitry grebeniuk wrote:
> > Shalom, Ronan.
> >
> > The most simple way is to define type t outside
of
> > module B
> Unfortunately, I'm trying to work inside an existing
framework, where
> module B has already been defined. If I move t out,
then I guess
> anything that refers to B.t will break. In the end
though, I might just
> have to bite the bullet!
What you can do is to constrain the signature of B. It is
not funny
(you need to replace t by A.t in the signature of B and hide
t) but it
will work. Here is a short example to see what I mean :
module A = struct type t = X | Y end
module B = struct include A let f = function X -> 1 |
Y -> 2 end
module type BTYPE = sig val f : A.t -> int end
module C = struct include A include (B:BTYPE) end
My 0.02¤
ChriS
Archives up to November 11, 2006 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http:/
/groups.yahoo.com/group/ocaml_beginners/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
ht
tp://groups.yahoo.com/group/ocaml_beginners/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:ocaml_beginners-digest@yahoogroups.com
mailto:ocaml_beginners-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
ocaml_beginners-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|