[Template-haskell] How to extract name and type of exported functions in modules

Simon Peyton-Jones simonpj at microsoft.com
Fri Oct 30 06:16:06 EDT 2009


| First I thought I would examine the source code of template-haskell
| (more specifically qLocation and qReify) to figure out how to do it
| but got stuck. Obviously I have still much to learn when it comes to
| Haskell.
| 
| Could someone explain how Quasi works?

Have you read the paper?  Referred to from here http://www.haskell.org/ghc/docs/latest/html/users_guide/template-haskell.html, the particular bit you want is Section 10 of http://research.microsoft.com/~simonpj/papers/meta-haskell/notes2.ps

| The only way this can work (as fast as I can see) is if where is
| another instance of Quasi than Q and IO but I cannot find that
| instance in the source code.

Yes indeed there is -- the type checker monad!  See TcSplice line 819.

Simon


More information about the Glasgow-haskell-users mailing list