how to track down infinite loop?

David Roundy droundy@abridgegame.org
Wed, 26 Mar 2003 14:24:30 -0500


On Wed, Mar 26, 2003 at 07:40:30AM -0800, Andy Moran wrote:
> On Wednesday 26 March 2003 07:23 am, David Roundy wrote:
> 
> I would try using Debug.Trace.trace.  It takes a string and an expression, 
> and returns the expressions while outputting the string to stderr (I 
> think).  You can choose your own mnemonics to prevent the truncation 
> problem.

Thanks for the hint! I like trace, strongly reminiscent of the good old
technique of sprinkling printfs around.  :)

It turned out the problem was running sequence on an infinite list of type
[Maybe a].  In retrospect obvious, but sort of hard to notice (especially
since the infinite list is created in a different module from the sequence
call.  Fortunately, in this case it is safe to just truncate the list to
some large size (since the function in question is only used in the
quickChecking code, and not in the actual code).
-- 
David Roundy
http://civet.berkeley.edu/droundy/