+ -- Check if the argument is a variable that
+ -- is in scope at the function definition site
+ -- It's worth specialising on this if
+ -- (a) it's used in an interesting way in the body
+ -- (b) we know what its value is
+argToPat in_scope con_env (Var v) arg_occ
+ | not (isLocalId v) || v `elemVarEnv` in_scope,
+ case arg_occ of { UnkOcc -> False; other -> True }, -- (a)
+ isValueUnfolding (idUnfolding v) -- (b)
+ = return (True, Var v)
+
+{- I'm really not sure what this comment means
+ And by not wild-carding we tend to get forall'd
+ variables that are in soope, which in turn can
+ expose the weakness in let-matching
+ See Note [Matching lets] in Rules
+ -- Check for a variable bound inside the function.
+ -- Don't make a wild-card, because we may usefully share
+ -- e.g. f a = let x = ... in f (x,x)
+ -- NB: this case follows the lambda and con-app cases!!