On Tue, Nov 08, 2005 at 02:43:47PM +0000, Malcolm Wallace wrote:
> Of course, there is the old stand-by C pre-processor trick:
> 
>     #define superError(s)  error (s++"\nin file "++__FILE__ \
>                                   ++" at line "++__LINE__)

There is a nice trick I saw in darcs' code to make this even more
Haskellish:

    #define superError  (\s -> error (s++"\nin file "++ __FILE__ \
                            ++" at line "++ show (__LINE__ :: Int)))

so you can simply write:

    superError "message"

Best regards
Tomasz
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to