Proposal: Improved error message of "Error in array index"

Tomasz Zielonka tomasz.zielonka at gmail.com
Tue Nov 8 15:19:22 EST 2005


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


More information about the Glasgow-haskell-users mailing list