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

2008-07-16 Thread Chris Kuklewicz
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

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

2008-07-16 Thread Sittampalam, Ganesh
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

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

2008-07-15 Thread Chris Kuklewicz
I have reached an impasse in designing a Haskell API for the google's protocol-buffers data language / format. ( http://code.google.com/apis/protocolbuffers/docs/overview.html ) The messages in protobuf are defined in a namespace that nests in the usual hierarchical OO style that Java

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

2008-07-15 Thread Max Bolingbroke
And there is no way ghc can compile these in separate modules. I may be being redundant here, but you may not know that GHC actually can compile mutually recursive modules. See http://www.haskell.org/ghc/docs/latest/html/users_guide/separate-compilation.html#mutual-recursion . Of course, this is

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

2008-07-15 Thread Chris Kuklewicz
Ah, a teachable moment. One of us is not entirely correct about what GHC can do with this example. Hopefully I am wrong, but my experiments... Max Bolingbroke wrote: And there is no way ghc can compile these in separate modules. I may be being redundant here, but you may not know that GHC

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

2008-07-15 Thread Henning Thielemann
On Tue, 15 Jul 2008, Chris Kuklewicz wrote: Consider these 3 files: A.hs: module A(A) where import B(B) data A = A B B.hs module B(B) where import A(A) data B = B A Main.hs module Main where import A import B main = return () Sooner or later you want generalize your datatypes. Then

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

2008-07-15 Thread Roberto Zunino
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

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

2008-07-15 Thread Sterling Clover
What about generating the verbose accessor/single module code, and then creating a hierarchical module space as well, all importing your Base module, and reexporting the data types you want as well as less verbosely named accessor functions? Of course, this will break record update syntax,

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

2008-07-15 Thread Stuart Cook
On Wed, Jul 16, 2008 at 12:54 AM, Henning Thielemann [EMAIL PROTECTED] wrote: Sooner or later you want generalize your datatypes. Then you can define data A b = A b and you do not need to import B any longer. I do not know if this is a generally applicable approach, but it helped me in some

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

2008-07-15 Thread John Meacham
On Tue, Jul 15, 2008 at 12:21:16PM +0100, Chris Kuklewicz wrote: I have reached an impasse in designing a Haskell API for the google's The messages in protobuf are defined in a namespace that nests in the usual hierarchical OO style that Java encourages. To avoid namespace conflicts, I made a

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

2008-07-15 Thread Jason Dusek
John Meacham [EMAIL PROTECTED] wrote: Chris Kuklewicz wrote: I have reached an impasse in designing a Haskell API for the google's The messages in protobuf are defined in a namespace that nests in the usual hierarchical OO style that Java encourages. To avoid namespace conflicts, I