Stefan O'Rear wrote:
On Wed, Oct 31, 2007 at 10:58:40AM +0100, Ketil Malde wrote:
Bjorn Lisper <lisper@it.kth.se> writes:
Wait, Jerzy. Haskell implementations do not have to be lazy as long as they preserve the more abstract semantics. Optimistic evaluation has been considered, for instance by Robert Ennals. I'm not sure if the GC hack proposed by Wadler¹ that lets the garbage collector replace "fst (a,b)" with "a" (and similar for other unchecked selectors) counts as optimistic evaluation, but I wonder what the status of this is. GHC doesn't seem to do it, and I wonder if there is any particular reason? Too specific?
GHC nominally does do it (look for 'selector thunks' in the RTS and commentary), but it doesn't work and we don't know why.
GHC HEAD has a fix for the example in that ticket, and 6.8.1 has a workaround (I bumped the recursion depth limit enough to make it run in constant space). Do you have an example that still doesn't work, particularly with the HEAD? Cheers, Simon