Interesting.  At least I understand what is going on here.

View.hs is roughly
        module View where
        import {-# SOURCE #-} Client( Client )
        data View = View Client

Compiled afterwards, Client.hs is
        module Client where
        import View( View )
        data Foo = Foo View

        $(... stuff that defines data type Client ...)

GHC typechecks the stuff before the splice before running the splice,
because the splice may mention things earlier in the file.  But
typechecking the data Foo = ... makes GHC suck in the definition for
View, which mentions Client.Client, which is not yet defined in this
module, because we have not yet run the splice.

If you like, before the splice runs, we should still use Client.hi-boot
to fill any any missing definitions.  Sigh.  

I don't see an easy fix, and I'm reluctant to invest time in a non-easy
fix because I think the whole hi-boot thing could do with
re-engineering.  Only I don't know exactly how it should be
re-engineered....

Simon


| -----Original Message-----
| From: [EMAIL PROTECTED]
[mailto:glasgow-haskell-bugs-
| [EMAIL PROTECTED] On Behalf Of George Russell
| Sent: 17 September 2004 11:01
| To: [EMAIL PROTECTED]
| Subject: Template Haskell and boot files
| 
| Hello GHC bug fixers,
| 
| I just sent a program which ghc --make couldn't compile but
| individual ghc -c commands could.
| 
| Now I have just tried to work around this, using Template Haskell
| to use a "data" rather than "newtype" declaration for ghc6.2
| Unfortunately the new code has the opposite problem!  It breaks
| ghc -c, but ghc --make works.  This is also for both ghc6.2
| and ghc6.2.20040915
| 
| with -c it doesn't work:
| 
| # ghc -c -fglasgow-exts ViewType.hs
| # ghc -c -fglasgow-exts VersionGraphClient.hs
| 
| tcLookup: `VersionGraphClient.VersionGraphClient' is not in scope
| In the data type declaration for `View'
| 
| with --make it does work:
| # ghc --make -fglasgow-exts VersionGraphClient.hs
| Chasing modules from: VersionGraphClient.hs
| Compiling ViewType         ( ./ViewType.hs, ./ViewType.o )
| Compiling VersionGraphClient ( VersionGraphClient.hs, VersionGr
| Loading package base ... linking ... done.
| Loading package haskell98 ... linking ... done.
| Loading package haskell-src ... linking ... done.
| 
| 
| 
| 

_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to