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
Re: additions to standard library?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Markus Mottl <mottl@m...>
Subject: Re: additions to standard library?
> But  when  using functorial  interfaces  like  Set.Make,  you have  to
> redefine these  functions for each  application of the  functor. Thus,
> you  really need these  functions to  be defined  in the  functor i.e.
> together with the datatype (and, by the way, you can then define these
> functions a bit more efficiently---without using exceptions).

Exactly - this raises another question which has been bothering me from
time to time when using the module system:

How can you extend the functionality of a module without having to "copy"
the definitions of the underlying module "by hand"? In a case which I found
particularly ugly (in the "res"-library), I had to "copy" nearly 100 lines
as in:

  module Foo = struct
    module B = ...
    type t = B.t
    let iter = B.iter
    let iteri = B.iteri
    let map =
    let mapi = B.mapi

Everytime the other module gets extended, I have to add code by hand here,
too, to make it available. I do not see any simple workaround for this.
Extending standard libraries with needed functionality would be much easier
if there were a convenient way to get around the problem above.

Markus Mottl

Markus Mottl,,