[Template-haskell] What happened to currentLoc ?

Simon Peyton-Jones simonpj at microsoft.com
Thu Oct 25 04:02:11 EDT 2007


There's nothing difficult about this, but it's sadly not implemented. This exists:
        currentModule :: Q String exists
but not currentLoc.

To add currentLoc would mean changing the definition of the Q monad; not hard, but an API change.  Then currentLoc would report the location of the splice -- I assume that's what you want.

Would you like to make a Trac feature request for this?  No reason it should not go in 6.10.

Simon

| -----Original Message-----
| From: template-haskell-bounces at haskell.org [mailto:template-haskell-bounces at haskell.org] On Behalf Of
| Alfonso Acosta
| Sent: 24 October 2007 22:46
| To: template-haskell at haskell.org
| Subject: [Template-haskell] What happened to currentLoc ?
|
| Hi,
|
| I've been trying to improve error reporting in my TH-based embedded
| compiler. I sometimes build data structures using splices. Those
| structures can later cause an error at runtime which, to be more
| informative, should give the line and module in which the splice was
| executed (i.e. tell to what structure the error refering by telling
| where it was exactly created)
|
| I have just read about currentLoc in the "Notes on Template Haskell 2"
| document.
|
| currentLoc :: Q (FilePath, Int)
|
|   -- Returns the location of the top-level splice being executed.
|
| Was it ever implemented? Are there any plans to do it?
|
| The path to the module is not really important (it should be enough
| with currentModule) but the line information can be really helpful.
|
| Thanks,
|
| Fons
| _______________________________________________
| template-haskell mailing list
| template-haskell at haskell.org
| http://www.haskell.org/mailman/listinfo/template-haskell


More information about the template-haskell mailing list