Reloading and templates

Simon Marlow marlowsd at gmail.com
Mon Jul 11 14:31:51 CEST 2011


On 04/07/2011 23:35, Jonas Almström Duregård wrote:
> 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 <http://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?

This is the ticket:

   http://hackage.haskell.org/trac/ghc/ticket/481

please add your comments there.

Cheers,
	Simon




More information about the Glasgow-haskell-users mailing list