
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. -- Lennart On Fri, 24 Sep 2004, Henning Thielemann wrote:
Date: Fri, 24 Sep 2004 16:17:24 +0200 (MESZ) From: Henning Thielemann
Reply-To: Henning Thielemann To: Malcolm Wallace Cc: haskell-cafe@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 modules.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Lennart