[Haskell-cafe] mutually recursive modules
lennart at augustsson.net
Fri Sep 24 10:37:01 EDT 2004
There is no reliable way to extract the interface from an
implementation short of compiling the implementation.
So the only "proper" way to handle mutually recursive module
is to have hand-written interface files where there is a cycle.
This is how Haskell used to be, but alas, hand written interface
files fell out of fashion at some point.
On Fri, 24 Sep 2004, Henning Thielemann wrote:
> Date: Fri, 24 Sep 2004 16:17:24 +0200 (MESZ)
> From: Henning Thielemann <iakd0 at clusterf.urz.uni-halle.de>
> Reply-To: Henning Thielemann <lemming at henning-thielemann.de>
> To: Malcolm Wallace <Malcolm.Wallace at cs.york.ac.uk>
> Cc: haskell-cafe at haskell.org
> Subject: Re: [Haskell-cafe] mutually recursive modules
> 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
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe