Compiler problem or dumb mistake?

mgross@dorsai.org mgross@dorsai.org
Sat, 2 Feb 2002 15:58:39 -0500 (EST)


Here's the problematic snippet, using GHC 5.00.2: 

mapWidList :: [(Int,Int,Bool)] -> [WidNode] -> Int-> [WidNode]  
mapWidList showList
           widNodes seq   
	                --map  (\x -> (checkWid showList x (widNodes!!x)))
	                -- [0 .. ((length widNodes) -1)]
                        | (length widNodes ) < seq + 1 = []
		        | otherwise  = (checkWid showList
			                   seq (widNodes!!seq) ):
			                   (mapWidList showList widNodes
			                   (seq+1))


The commented lines are what I would really like, but trace indicated 
that the anonymous function is never invoked, so I wrote out explictly
recursive code. However, while trace indicates that the both alternatives
are appropriately repeatedly tested, checkWid is never invoked. I have 
modified checkWid to assure that laziness is not the problem (I suffed in 
code that prevents prediction of the result returned by checkWid), so
something else is going on here. Anyone care to take a shot at this one? 

Thanks in advance. 

Murray Gross
mgross@dorsai.org