Skip to content

GHC API crashes on template haskell splices

The GHC API crashes when type checking these two modules:

TH.hs:

{-# LANGUAGE TemplateHaskell #-}

module TH where

import Language.Haskell.TH

decl = [d| f x = x]

TH2.hs:

{-# LANGUAGE TemplateHaskell #-}

module TH2 where

import TH

$( decl )

The crash happens in HscMain.compileExpr, when compiling and linking the spliced-in code. The crash is due to a fromJust: Nothing. I don't have the error message at hand.

It would be nice if this could be fixed in 6.10.* since it makes Haddock crash when processing several packages on Hackage.

I will add both TH.hs and TH2.hs to the test suite in the code.haskell.org/haddock repository later. (I thought I had done this, but I apparently forgot to add TH.hs). You can the use test/runtests.hs to invoke the crash.

Trac metadata
Trac field Value
Version 6.10.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information