> I've compiled a program with GHC, but when I run it, it runs
> to partial completion (i.e. I get some correct-looking output) and
> terminates with:
>
> Fail: Prelude.(!!): index too large
>
> Great. Is there any way I can work out where, exactly, the !! failed?
> I only use it with constants (0..3) in my own code, so the culprit's
> probably hidden in some library function. Could it be trigged by (++)
> or putStr, perhaps?
If you're using GHC, you might like to recompile your program with
-prof -auto-all:
ghc -prof -auto-all Main.hs -o myprogram
and then running it with +RTS -xc:
./myprogram +RTS -xc
It's *possible* this will give you some useful information about where
the error originated. This feature is not very polished yet, but I've
found it useful.
Note that you must have the profiling versions of the libraries for
this to work... if you get an error message about *.p_hi not being
found, you don't have them.
> Please Cc: me any replies, as I'm not on this list.
This is generally considered rude; you should read a list you post to,
to ensure that (a) your question hasn't already been asked, and (b)
that people don't have to go to extraordinary effort to ensure you see
their replies.
> -kzm
--KW 8-)
--
Keith Wansbrough <[EMAIL PROTECTED]>
http://www.cl.cam.ac.uk/users/kw217/
Cambridge University Computer Laboratory.