+
+ -- Get the wrapper from the head of each group. We're going to
+ -- use it as the pattern in this case expression, so we need to
+ -- ensure that any type variables it mentions in the pattern are
+ -- in scope. So we put its wrappers outside the case, and
+ -- zap the wrapper for it.
+ wraps :: [CoreExpr -> CoreExpr]
+ wraps = map (eqn_wrap . head) groups
+
+ groups' = [ eqn { eqn_wrap = idWrapper } : eqns | eqn:eqns <- groups ]