Re: [Haskell-cafe] Questions about haskell CPP macros

2009-07-13 Thread Stephan Friedrichs
Malcolm Wallace wrote: > > {-# 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

Re: [Haskell-cafe] Questions about haskell CPP macros

2009-07-13 Thread Malcolm Wallace
{-# 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

Re: [Haskell-cafe] Questions about haskell CPP macros

2009-07-13 Thread Stephan Friedrichs
Matthew Elder wrote: > {-# LANGUAGE CPP #-} > main = putStrLn (__FILE__ ++ ":" ++ show __LINE__) > > This outputs: > test.hs:2 > > 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

Re: [Haskell-cafe] Questions about haskell CPP macros

2009-07-13 Thread Claus Reinke
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: {-# LANGUAGE CPP #-} main = putStrLn (__FILE__ ++ ":" ++ show __LINE__) This outputs: test.hs:2 Unfortunately, if your file is in a hierar

[Haskell-cafe] Questions about haskell CPP macros

2009-07-13 Thread Matthew Elder
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: {-# LANGUAGE CPP #-} main = putStrLn (__FILE__ ++ ":" ++ show __LINE__) This outputs: test.hs:2 Unfortunately, if your file is