"Claus Reinke" <[EMAIL PROTECTED]> writes:
> no direct answer to your question, but a general comment on the
> original problem (speaking from bad experience;-): things like
> "head" have no place in a Haskell program of any non-trivial size,
> because of their useless error messages.
I must say I liked John Meacham's description of his "magic
underscore". My solution to this problem is redefining the
troublesome functions as cpp macros, e.g:
#define BUG(C_,M_) (error ("Program error - '"++C_++"' failed: "++M_++".
Location: '"++__FILE__++"' line "++show __LINE__))
#define head (\xs -> case xs of { (x:_) -> x ; _ -> BUG("head","empty list")})
Ideally, I think something like this should be the default behavior
for these functions.
-kzm
PS: If anybody wants, I can mail my additional cpp definitions for 'head',
'at' (array indexing, I couldn't work out how to redefine the bang),
'read' and 'fromJust'.
--
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