Template Haskell *does* work with profiling, you just have to compile the code without profiling first (Cabal knows how to do this and does it automatically).
The big obstacles to loading profiled code into ghci are (a) lack of support in the byte code compiler and interpreter and (b) ghci itself would need to be a profiled executable.
Hello Mikhail,
It is a known issue that Template Haskell does not work with profiling (because
GHCi and profiling do not work together, and TH uses GHCi's linker). [1] Actually,
with the new linker patches that are landing soon we are not too far off from
having this work.
Edward
[1] http://ghc.haskell.org/trac/ghc/ticket/4837
Excerpts from Mikhail Glushenkov's message of Mon Sep 09 14:15:54 -0700 2013:
> Hi,
>
> On Mon, Sep 9, 2013 at 10:11 PM, Simon Marlow <marlowsd@gmail.com> wrote:
> >
> > I think Kazu is saying that when he builds something with profiling using
> > cabal-install, it fails because cabal-install tries to build a dynamic
> > version too. We don't want dyanmic/profiled libraries (there's no point,
> > you can't load them into GHCi). Perhaps this is something that needs fixing
> > in cabal-install?
>
> Aren't they needed when compiling libraries that are using Template
> Haskell for profiling? The issue sounds like it could be TH-related.
>