Re: [GHC] #7405: use of -no-hs-main causes TH compiles to fail

2012-11-21 Thread GHC
#7405: use of -no-hs-main causes TH compiles to fail
---+
  Reporter:  MtnViewMark   |  Owner: 
  Type:  bug   | Status:  closed 
  Priority:  normal|  Milestone:  7.8.1  
 Component:  Template Haskell  |Version:  7.4.2  
Resolution:  wontfix   |   Keywords: 
Os:  MacOS X   |   Architecture:  x86
   Failure:  None/Unknown  | Difficulty:  Unknown
  Testcase:|  Blockedby: 
  Blocking:|Related: 
---+
Changes (by igloo):

  * status:  new = closed
  * resolution:  = wontfix


Comment:

 I agree, this isn't something we can/should fix.

 Mark, you could work around the problem by moving the TH module and
 everything below it into a library. Or even moving all the Haskell code
 into a library, and just having the C main as an executable. Cabal
 packages can contain both a library and an executable, so as long as there
 is only one cut point it won't have too much overhead.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7405#comment:3
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7405: use of -no-hs-main causes TH compiles to fail

2012-11-19 Thread GHC
#7405: use of -no-hs-main causes TH compiles to fail
-+--
Reporter:  MtnViewMark   |   Owner:  
Type:  bug   |  Status:  new 
Priority:  normal|   Milestone:  7.8.1   
   Component:  Template Haskell  | Version:  7.4.2   
Keywords:|  Os:  MacOS X 
Architecture:  x86   | Failure:  None/Unknown
  Difficulty:  Unknown   |Testcase:  
   Blockedby:|Blocking:  
 Related:|  
-+--
Changes (by simonmar):

  * difficulty:  = Unknown
  * milestone:  = 7.8.1


Comment:

 I understand the problem (thanks for a good analysis), but I don't see an
 easy way to fix it.  GHC can't know, for a given `.o` file, whether it is
 needed by the transitive dependencies of the current `.h` file.  I'm all
 out of bright ideas on this one.  Anyone else?

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7405#comment:2
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7405: use of -no-hs-main causes TH compiles to fail

2012-11-12 Thread GHC
#7405: use of -no-hs-main causes TH compiles to fail
-+--
Reporter:  MtnViewMark   |  Owner:  
Type:  bug   | Status:  new 
Priority:  normal|  Component:  Template Haskell
 Version:  7.4.2 |   Keywords:  
  Os:  MacOS X   |   Architecture:  x86 
 Failure:  None/Unknown  |  Blockedby:  
Blocking:|Related:  
-+--

Comment(by MtnViewMark):

 '''tl;dr:''' If you have any .c files in a project, they can't depend
 (even transitively) on any .hs modules that use TH - since all .o files
 are loaded during the TH expansions. If you have a .c file for an
 alternate main (hence using -no-hs-main), then the whole program is a
 transitive dependency, and hence can't use TH anywhere!

 cabal-out.txt shows a somewhat re-formatted output of build from cabal -v
 -v.

 You can see that in the case that fails to build (the third executable)
 the ghc --make command includes the real-main.o file (from the C
 compilation), as one would expect. The problem is that this .o file is
 getting loaded during the TH execution... presumably GHC can't tell if the
 .o files will be needed or not by TH code being run, and so just includes
 it to be safe.

 The problem is that that .o file depends, in this case directly, on the
 module being spliced by TH.

 It turns out that the -no-hs-main flag is a red herring - it is just that
 when you compile with -no-hs-main, you usually include a .c file that
 depends on some Haskell main-like entry point which by design
 transitively depends on the rest of the program. Hence, none of the
 program can use TH - since the .o file compiled from the .c file will be
 loaded into all TH runs.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7405#comment:1
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs