How to properly communicate compile-time information to Template Haskell functions?

Since so many people are interested in the question, I’ll add my current approach, perhaps somebody will find it useful. Probably the best way would be if TH allowed to read -D parameters on GHC’s command line, but it seems nothing like this is currently implemented. A simple module allows TH to read compile-time environment. … Read more

Using TemplateHaskell to list all names in a namespace

Unfortunately, you cannot do this with TH alone. Try the haskell-src-meta to parse the Haskell module as a TH AST. It will require the IO features of the Q monad to load the module though. Please reference https://ghc.haskell.org/trac/ghc/ticket/9699#ticket to see the current rough spec (1) Extend ​ModuleInfo (obtained from ​reifyModule) to ModuleInfo [Module] [Name], where … Read more

Getting associated type synonyms with template Haskell

It is not implemented because nobody requested it. The odd thing is that TH uses its own AST, which doesn’t follow internal compiler’s AST. As a result, any new feature (e.g. associated type families) is not automatically available via TH. Some one have to open a ticket and implement it. For the reference: internal reifyClass … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)