[Haskell-cafe] mutually recursive modules

ajb at spamcop.net ajb at spamcop.net
Fri Sep 24 22:21:52 EDT 2004

G'day all.

Quoting Henning Thielemann <iakd0 at clusterf.urz.uni-halle.de>:

> Why can't GHC and Hugs go this way?

As Alastair noted, the problem is that Haskell allows you to export
symbols from a module whose types are unknown unless you type-check
modules that it imports.  Simple example:

     module A where
     import B
     a = b

     module B where
     import A
     b = a

This is only a problem for exported symbols which have no type
declarations.  As Alastair said:

> I guess that leaves two options:
> 1) Insist on a prototype for any exported function.
> 2) Insist on a prototype for any imported function which is used.
> The latter is more in keeping with Haskell's lazy checking of import clashes.

That's true, but you have to ask why you're exporting a function if
you're not going to use it.  On the other hand, in the presence of
Haskell's "export everything" feature, it makes a certain amount of

Andrew Bromage

More information about the Haskell-Cafe mailing list