Georg Sauthoff <[EMAIL PROTECTED]> writes:

> Well, how do I compile a Haskell program in such a way, that I
> get a useful error message from read? I mean, like the
> filename/linenumber of the calling expression for starters.

It's dirty, it's mean, but you can use CPP.  (On one line, and with
ghc -cpp):

#define read (\s -> case [ x | (x,t) <- reads s, ("","") <- lex t] of
 { [x] -> x ; 
   [] -> error("read: no parse at "++__FILE__++":"++show __LINE__); 
   _ -> error("read: no parse at "++__FILE__++":"++show __LINE__)})

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to