[GHC] #1012: ghc panic with mutually recursive modules and template haskell

GHC trac at galois.com
Thu Dec 20 12:55:50 EST 2007


#1012: ghc panic with mutually recursive modules and template haskell
----------------------------+-----------------------------------------------
 Reporter:  guest           |          Owner:          
     Type:  merge           |         Status:  reopened
 Priority:  normal          |      Milestone:  _|_     
Component:  Compiler        |        Version:  6.6     
 Severity:  normal          |     Resolution:          
 Keywords:                  |     Difficulty:  Unknown 
 Testcase:  TH_import_loop  |   Architecture:  Multiple
       Os:  Multiple        |  
----------------------------+-----------------------------------------------
Changes (by fons):

  * status:  closed => reopened
  * resolution:  fixed =>

Comment:

 Don't know if this deserves its own ticket but it seems that ghci (or ghc
 --make) fails when running a compile-time function imported from a
 mutually-recursive group of modules which _doesn't_ include the module
 currently being compiled.

 ModuleA.hs-boot
 {{{
 module ModuleA
 }}}

 ModuleA.hs
 {{{
 module ModuleA where
 import ModuleC
 }}}

 ModuleC.hs
 {{{
 odule ModuleC where

 import Language.Haskell.TH

 import {-# SOURCE #-} ModuleA

 nothing = return [] :: Q [Dec]
 }}}

 ModuleB.hs (makes use of a function of C but is _not_ included in the
 group of recursive modules)
 {{{
 {-# LANGUAGE TemplateHaskell #-}
 module ModuleB where

 import ModuleC

 $(nothing)
 }}}


 {{{
 $ ghci ModuleB.hs
 GHCi, version 6.8.1: http://www.haskell.org/ghc/  :? for help
 Loading package base ... linking ... done.
 [1 of 4] Compiling ModuleA[boot]    ( ModuleA.hs-boot, interpreted )
 [2 of 4] Compiling ModuleC          ( ModuleC.hs, interpreted )
 [3 of 4] Compiling ModuleB          ( ModuleB.hs, interpreted )
 module main:ModuleA cannot be linked; it is only available as a boot
 module
 >
 }}}


 Furthermore, it would be really useful if the error message indicated the
 compilation failed due to Template Haskell. (It took me a while to figure
 out why it was caused)

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1012#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list