RE: [Haskell-cafe] Re: Module.T naming style

On 15 July 2005 11:53, Malcolm Wallace wrote:
"Simon Marlow"
writes: I hope you weren't including GHC in "most compilers" :-) GHC's implementation of mutually recursive modules is conformant with Haskell 98 (see Section 5.7).
It depends on how you interpret this phrase: "may require that imported modules contain additional information" If you count writing a separate .hs-boot file as being the additional information that is somehow "contained" within the module, then I suppose nhc98 is also conformant with the report.
True, I considered mentioning this detail, but decided against it - the fact that the type signatures aren't actually in the same file isn't really important. We follow the spirit of the specification. You guys should really document that nhc98 support mut. rec. modules too.
The only difference with nhc98 is that you hand-write a .hi file, rather than a .hs-boot file, but the syntax is very similar to plain Haskell. Also, the hand-written .hi file will be replaced with a machine-generated one after compilation, but that is only a problem if the user inadvertently removes all the .hi files.
Hand-writing .hi files is how GHC used to work (up to version 0.29, IIRC). It's not entirely satisfactory because you can get into situations where you have to 'make' several times to get to a fixed point, and you can construct examples that never reach a fixed point. And 'make' complains about recursive dependencies a lot. What does hmake do? It used to be Really Fun(TM) when GHC was built like this... you could improve GHC's performance by simply typing 'make' a couple more times to let the inter-module optimisations propagate a bit further :) Cheers, Simon

You guys should really document that nhc98 support mut. rec. modules too.
Agreed. I believe the Haskell'98 libraries are mutually recursive by definition (Prelude imports Ratio, and Ratio imports the Prelude), so probably all compilers have had to deal with this from the start. nhc98's library implementation is absolutely full of mutually-recursive modules!
Hand-writing .hi files is how GHC used to work (up to version 0.29, IIRC). It's not entirely satisfactory because you can get into situations where you have to 'make' several times to get to a fixed point, and you can construct examples that never reach a fixed point.
I believe, provided the hand-written boot file gives accurate type signatures in the first place, there is no (correctness) need to compile any file a second time. At least, this is the case in nhc98 where the interface file records only type signatures. However, certainly if you /do/ re-compile, often the /sequence/ of signatures in the .hi file never reaches a fixpoint. Although I can see that, because GHC stores optimisation information in the .hi file, you might need to recompile several times to reach a /performance/ fixpoint.
And 'make' complains about recursive dependencies a lot. What does hmake do?
hmake warns the user about the mutually recursive cycle of modules, then goes ahead to compile them (once) in an arbitrary order. Regards, Malcolm

On Fri, Jul 15, 2005 at 03:23:18PM +0100, Simon Marlow wrote:
Hand-writing .hi files is how GHC used to work (up to version 0.29, IIRC). It's not entirely satisfactory because you can get into situations where you have to 'make' several times to get to a fixed point, and you can construct examples that never reach a fixed point. And 'make' complains about recursive dependencies a lot. What does hmake do?
I always thought it would be nice if you could specify special 'recursive groups' rules in make. so that if a set of recursive dependencies were found, it would look if they matched such a rule and fire it if needed. John -- John Meacham - ⑆repetae.net⑆john⑈

Hello Simon, Friday, July 15, 2005, 6:23:18 PM, you wrote:
If you count writing a separate .hs-boot file as being the additional
SM> It used to be Really Fun(TM) when GHC was built like this... you could SM> improve GHC's performance by simply typing 'make' a couple more times to SM> let the inter-module optimisations propagate a bit further :) you can advertise it as "multi-pass optimizing compiler" :) -- Best regards, Bulat mailto:bulatz@HotPOP.com
participants (4)
-
Bulat Ziganshin
-
John Meacham
-
Malcolm Wallace
-
Simon Marlow