haskell-cafe@haskell.org
[Top] [All Lists]

Re: [Haskell-cafe] Prelude.undefined

Subject: Re: [Haskell-cafe] Prelude.undefined
From: Alexander Dunlap
Date: Tue, 2 Mar 2010 22:24:23 -0800
On Tue, Mar 2, 2010 at 9:06 PM, Tom Hawkins <tomahawkins@xxxxxxxxx> wrote:
> How do I track down an reference to an undefined value? ÂMy program
> must not be using a library correctly because the program makes no
> direct use of 'undefined'. ÂRunning with +RTS -xc yields:
>
> <GHC.Err.CAF>Test: Prelude.undefined
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@xxxxxxxxxxx
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

While the debugger, etc., are very useful tools, I find that often the
easiest way to track down this sort of bug is to test your code
function-by-function. Make sure each function does what you want it to
when run in isolation; this will quickly lead to tracking down the
caller of "undefined". (If your code is not structured in a way that
allows this sort of testing, you might consider restructuring it to
make it more modular.)

Alex
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@xxxxxxxxxxx
http://www.haskell.org/mailman/listinfo/haskell-cafe

<Prev in Thread] Current Thread [Next in Thread>