Reloading and templates

Jonas Almström Duregård jonas.duregard at
Tue Jul 5 00:35:33 CEST 2011


In ghci, if you change a module that exports a TH template it will not
recompile modules that use the template. Example:

-- In A.hs
{-#LANGUAGE TemplateHaskell#-}
module A where
import Language.Haskell.TH
a = [d|x = 5|]

-- in B.hs
{-#LANGUAGE TemplateHaskell#-}
import A

-- As expected in ghci B.hs:
*Main> x

-- But if i change the def. of a to [d|x = 4|] and do :r
[1 of 2] Compiling A                ( A.hs, interpreted )
Ok, modules loaded: A, Main.
*Main> x

The only workaround i know is to reload all modules. I assume you have the
same problem when compiling with ghc. This has caused headaches for me on
several occasions lately, is there a ticket for it or should i submit one?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Glasgow-haskell-users mailing list