[Haskell-cafe] Questions about haskell CPP macros

Matthew Elder matt at mattelder.org
Mon Jul 13 12:31:06 EDT 2009

Hello Cafe,

I am trying to improve the error reporting in my sendfile library, and I
know I can find out the current file name and line number with something
like this:

main = putStrLn (__FILE__ ++ ":" ++ show __LINE__)

This outputs:

Unfortunately, if your file is in a hierarchy of folders, this flat file
name doesn't give much context. Is there a macro to find out the current
module? IE if I had a module Foo.Bar.Car.MyModule, I would like to be able
to output something like this on error:

Any help is appreciated!


Need somewhere to put your code? http://patch-tag.com
Want to build a webapp? http://happstack.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090713/4ec211c6/attachment.html

More information about the Haskell-Cafe mailing list