Reloading and templates

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


Hi,

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
a

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

-- 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
5

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?

Regards,
Jonas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20110705/f532ddbb/attachment.htm>


More information about the Glasgow-haskell-users mailing list