The trouble is that 'error' calls an I/O function to print its message, and the 
I/O functions in turn depend on a *lot* of stuff. So 'error' can be defined 
only when a lot of other functions have been defined.

But 'error' is *needed* very early; e.g. to define 'head'.

Hence the module loop.

However, GHC.Base (which SOURCE-imports GHC.Err) re-exports 'error', so in fact 
every other module need only import GHC.Base.  The other modules do not need to 
import GHC.Err.

I'll commit a patch that removes all the unnecessary SOURCE imports of GHC.Err. 
 But remember that many of these modules are still compiled before GHC.Err.

Does that make sense?

Simon

| -----Original Message-----
| From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Neil Mitchell
| Sent: 31 December 2007 16:57
| To: [email protected]
| Subject: Re: Remove GHC.Err import from Data.Maybe
|
| Hi
|
| GHC.Arr and GHC.Base both also have this issue, but they could well be
| necessary.
|
| These imports of Err all include {-# SOURCE #-} pragmas, which GHC
| warns me are unnecessary, but clear change the output. What do the
| SOURCE pragma's do? I couldn't find them in the manual.
|
| Thanks
|
| Neil
|
| On 12/31/07, Neil Mitchell <[EMAIL PROTECTED]> wrote:
| > Hi,
| >
| > I noticed that Data.List uses "error" normally, but Data.Maybe
| > explicitly imports it from GHC.Err. Is there a reason for this?
| > Removing the import GHC.Err line still appears to work.
| >
| > This caused me issues with circular modules and recursive boot files,
| > in various mixtures. It's not a fatal issue, but since it seems to be
| > a cleanup, it might be worth doing.
| >
| > Thanks
| >
| > Neil
| >
|
| _______________________________________________
| Cvs-ghc mailing list
| [email protected]
| http://www.haskell.org/mailman/listinfo/cvs-ghc

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to