Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
module aggregation
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Bernd Grobauer <grobauer@b...>
Subject: Re: module aggregation
Wolfgang Lux <> writes:
>> I want to aggregate two modules in one in order
>> to improve some standard modules or some module
>> define by functors . How can I do this in Ocaml ? 
>This answer is very simple: You cannot.
>The only way to achieve your goal would be to define a new module,
>copy all values of the module M1 you want to preserve and then add or
>change those values which you do not want to include from M1 or add to

Some time ago I was wondering about something kind of equivalent to this problem, regarding module
types:   including an already defined module type in order to keep module types more
readable,  instead of copying all the definitions already made. For example in ML
I could write something like

module type ExtendedList =
   include ListType
   split::  ('a -> boole) -> 'a list -> 'alist * 'alist

There is no such thing include in the OCAML-language. Is this because it is incompatible with the type system?