#3560: Template Haskell attempts to load unnecessary packages
-----------------------------+----------------------------------------------
Reporter:  heatsink          |          Owner:                  
    Type:  bug               |         Status:  new             
Priority:  normal            |      Component:  Template Haskell
 Version:  6.10.4            |       Severity:  normal          
Keywords:                    |       Testcase:                  
      Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
-----------------------------+----------------------------------------------
 To run TH splices, GHC's interpreter loads all packages specified on the
 command line, even if they are not needed.  This causes compilation to
 fail when an unused package works with the compiler, but not with the
 interpreter.

 Consider the one-line program {{{{-# LANGUAGE TemplateHaskell #-} main =
 print $([|1|])}}}.  I can compile it with {{{ghc --make Main.hs}}}.  If I
 add the extra command line parameter {{{-package WeakTest}}}, compilation
 fails when attempting to load the WeakTest package.  (This package
 demonstrates a GHCi bug and is attached to #3333).

 Why put a superfluous package on the command line?  This may happen
 because a build system uses the same set of flags to compile every file.
 This is the current behavior of Cabal.

 A possible solution would be for GHC to reuse the mechanism that GHC
 --make uses for deciding which command line packages to actually load.
 This way, extra packages won't prevent compilation.  This would make it
 easier to use TH in a project that relies on non-interpreted packages.

 See also #3333.  Possibly related #2555.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3560>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to