Re: [Haskell-cafe] Mutually recursive modules and google protocol-buffers

Thanks Roberto! Roberto Zunino wrote:
Chris Kuklewicz wrote:
There is no way to create a "A.hs-boot" file that has all of (1) Allows A.hs-boot to be compiled without compiling B.hs first (2) Allows B.hs (with a {-# SOURCE #-} pragma) to be compiled after A.hs-boot (3) Allows A.hs to compiled after A.hs-boot with a consistent interface
I thought the following A.hs-boot would suffice:
module A(A) where data A
There's no need to provide the data constructors for type A. Does this violate any of the goals above?
Regards, Zun.
I tried that experiment. The failure is complicated, and triggers be a ghc bug. Hmmm... the bug for
module A(A) where data A deriving Show
using "ghc -c -XGeneralizedNewtypeDeriving A.hs-boot" is
A.hs-boot:2:0:ghc-6.8.3: panic! (the 'impossible' happened) (GHC version 6.8.3 for powerpc-apple-darwin): newTyConEtadRhs main:A.A{tc r5z}
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Is this a known bug? But now I see that
module A(A(..)) where import B(B) data A = A B | End deriving Show
does work. And avoids the bug! -- Chris

Hi,
module A(A) where data A deriving Show
I think you should use "instance Show A" rather than "deriving Show". All the boot file needs to do is say that the instance exists, not explain how it is constructed. Cheers, Ganesh ============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ==============================================================================
participants (2)
-
Chris Kuklewicz
-
Sittampalam, Ganesh