anchor.diff:  let (|QueryFor|_|) g = function
       | InstanceMethodApp g g.query_for_vref  ([srcTy;qTy;resTy;_qInnerTy], _builder, [src;selector]) ->  Some (qTy, srcTy, resTy, src, selector)
       | _ ->  None
  -
   
   let (|QueryYield|_|) g = function
       | InstanceMethodApp g g.query_yield_vref  ([resTy;qTy], _builder, [res]) ->  Some (qTy, resTy, res)
  
positive.code:         None
  
  let (|MaybeRefTupled|) e = tryDestRefTupleExpr e 
  let (|AnyInstanceMethodApp|_|) e = 
      match e with 
      | Expr.App(Expr.Val (vref, _, _), _, tyargs, [obj; MaybeRefTupled args], _) -> Some (vref, tyargs, obj, args)
      | _ -> None
  
  let (|InstanceMethodApp|_|) g (expectedValRef:ValRef) e = 
  //#if DEBUG
  //    expectedValRef.Deref |> ignore
  //#endif
      //printfn "for vref = %A" (expectedValRef.TryDeref  |> Option.map (fun x -> x.DisplayName))
      match e with 
      | AnyInstanceMethodApp (vref, tyargs, obj, args) when valRefEq g vref expectedValRef -> Some (tyargs, obj, args)
      | _ ->  None
  
negative.code: 
          // Inlining lambda 
    (* ----------       printf "Inlining lambda near %a = %s\n"  outputRange m (showL (exprL f2))  (* JAMES: *) ----------*)
          let f2R = remarkExpr m (copyExpr cenv.g CloneAllAndMarkExprValsAsCompilerGenerated f2)
          // Optimizing arguments after inlining
  
          // REVIEW: this is a cheapshot way of optimizing the arg expressions as well without the restriction of recursive  
          // inlining kicking into effect 
          let argsR = args |> List.map (fun e -> let eR, _einfo = OptimizeExpr cenv env e in eR) 
          // Beta reduce. MakeApplicationAndBetaReduce cenv.g does all the hard work. 
          // Inlining:  beta reducing 
          let exprR = MakeApplicationAndBetaReduce cenv.g (f2R, f2ty, [tyargs], argsR, m)
          // Inlining: reoptimizing
          Some(OptimizeExpr cenv {env with dontInline= Zset.add lambdaId env.dontInline} exprR)
            
      | _ -> None
  
  /// Optimize/analyze an application of a function to type and term arguments
  and OptimizeApplication cenv env (f0, f0ty, tyargs, args, m) =
      // trying to devirtualize
      match TryDevirtualizeApplication cenv env (f0, tyargs, args, m) with 
  