
13 Jul
2009
13 Jul
'09
1:34 p.m.
{-# LANGUAGE CPP #-} main = putStrLn (__FILE__ ++ ":" ++ show __LINE__)
This outputs: test.hs:2
if I had a module Foo.Bar.Car.MyModule, I would like to be able to output something like this on error: Foo.Bar.Car.MyModule:2
It works for me. If you place that text in Try/Me.hs and call ghc -E Try/Me.hs you get Try/Me.hs:2 If you just want to turn slashes into dots, and remove the suffix, that is a simple exercise in Haskell itself main = putStrLn (mangle __FILE__) where mangle ('/':cs) = '.': mangle cs mangle ..... Regards, Malcolm