Even I removed all user space packages, the error was still. I think
it is a ghc pkg problem, that every package register itself as
package:function while ghc (or cabal?) required
package-version:function.
That's not the problem, it's the symptom. Package symbols are always versioned; ghc only shows the version when it's the only way to disambiguate symbols.
So when it shows you a conflict where one is versioned and the other isn't, you have multiple versions of a package installed.
But --constraint='template-haskell-2.7.0.0' did make it compiled.
And that's how you prevent it.