Michael Snoyman <[email protected]> writes:
> I had a bug in a site of mine[1] for a few weeks, where it would just print:
>
> Prelude.head: empty list
>
> It took a long time to track down the problem
+1: I've been arguing this for something like ten years :-)
One half-baked quasi-solution is to use:
#define head (\xs -> case xs of { (x:_) -> x ; _ -> error("head: empty list
at"++__FILE__++show __LINE__)})
Downsides are that it depends on CPP, and, CPP being a C preprocessor,
it doesn't blend well with lines with single apostrophes on them (e.g.:
head x')
-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