[Haskell-cafe] Cyclic Inclusions

Iavor Diatchki iavor.diatchki at gmail.com
Wed Aug 13 14:46:44 EDT 2008


The Haskell'98 report does not specify if/how recursive modules should
work.  I wrote a paper a long time ago that formalizes and implements
this feature (http://www.purely-functional.net/yav/publications/modules98.pdf).
 I very much doubt that separate compilation is much of a problem in
practise because you only need to compile modules that are _recursive_
at the same time, and usually these tend to be fairly small.  Figuring
out the interface of the modules is a bit trickier in some
pathological cases involving module re-exports, but this is already
the case with non-recursive modules.

One real technical problem that I remember was implementing
"defaulting", which is specified in terms of a single module.  With
recursive modules, one could get mutually recursive functions from
different modules, in which case it is not clear which set of
defaulting rules to apply or how to combine them.

Hope that this helps,

On Wed, Aug 13, 2008 at 4:30 AM,  <ajb at spamcop.net> wrote:
> G'day.
> Quoting "C.M.Brown" <cmb21 at kent.ac.uk>:
>> However I saw no real argument for not having cyclic inclusions. You
>> say we shouldn't have to spend time writing hi-boot files, and yet  you
>> also think
>> that GHC should not do it automatically. So we have to restrict all
>> programmers to never writing cyclic inclusions?  :)
> GHC generates .hi files for most modules automatically.  The only reason
> why hi-boot files are needed for cyclic imports is because of the
> possibility that you can't generate a .hi file from the module alone.  If
> you could do that, then you could support cyclic imports without needing
> hi-boot files.
> Cheers,
> Andrew Bromage
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list