Skip to content
  • Simon Peyton Jones's avatar
    [project @ 2001-11-16 15:42:26 by simonpj] · 772ffb22
    Simon Peyton Jones authored
    ---------------------------------------
    	Add continuation splitting to Simplify
    	---------------------------------------
    
    When the simplifier finds a 'case', it calls mkDupableAlt
    to make the "continuation" (that is, the context of the
    case expression) duplicatable, so that it can push it into
    the case branches.  This is crucial for the case-of-case
    transformation.
    
    But it turns out that it's a bad idea to do that when
    the context is "I'm the argument of a strict function".  Consider
    
    	f (case x of { True -> False; False -> True }) arg2
    
    where f is a strict function.  Then we *could* (and were)
    transforming to
    
    	let $j a = f a arg2
    	in
    	case x of { True -> $j False; False -> $j True }
    
    But this is in general a terribly bad thing to do.
    See the example in comments with Simplify.mkDupableCont.
    772ffb22