
| You probably mean | J. Sparud, "Fixing Some Space Leaks without a Garbage Collector", FPCA'93. | http://citeseer.ist.psu.edu/sparud93fixing.html Indeed. | as implemented in hbc. It is also possible to use Wadler's | garbage-collector fix for this space leak, as implemented in nhc98. | P Wadler, "Fixing a Space Leak with a Garbage Collector", SP&E Sept 1987. | | When the GC discovers a selector function applied to an evaluated | argument, it "evaluates" the selector on-the-fly by just swizzling | pointers. It needs some co-operation from the compiler to make | selector functions look obvious, but that isn't too difficult. GHC does this, but it does not always work. What starts as let x = fst t in let h = case x of { True -> 1; False -> 2 } in ... may become let h = case t of { (x,_) -> case x of {True->1;False->2} } ... and now there is no selector thunk any more. So the selector stuff is fragile to otherwise-valuable optimisations. And that's what's happening in this case. A non-optimising compiler is fine. Simon
participants (1)
-
Simon Peyton-Jones