[Haskell-cafe] mutually recursive modules

Henning Thielemann iakd0 at clusterf.urz.uni-halle.de
Fri Sep 24 10:17:24 EDT 2004


On Fri, 24 Sep 2004, Malcolm Wallace wrote:

> The main obstacle is that Haskell systems generally process one
> file/module at a time.  To extract an interface from each module
> first, before further processing, would not only require a second
> pass over the source files, but to load all of them simultaneously,
> which can be rather space-hungry.

I don't see where it is necessary to load more modules than usually. 
Modula doesn't support cycles in the dependencies. Each implementation
depends only on interfaces of other modules and the interfaces must not
depend cyclicly. Haskell compilers can reduce the problem to the situation
of Modula by extracting the interface from the implementation. Maybe it's
better if the user explicitly allows mutually recursive modules with a
command line option which will invoke an automatic interface generation.
The generation of an interface file should depend only on the
corresponding implementation file, as it is the case for manual .hiboot
creation.  For mutually recursive functions across modules the signature
had to be specified by the user to avoid the simultaneous loading of all
modules. 



More information about the Haskell-Cafe mailing list