anchor.diff:              Expression.Block(e1P, e2P) |> asExpr
   
           | Patterns.Let (v,e,b) -> 
  +            let env =
  +                match env.letrec with
  +                | None -> env
  +                | _ -> { env with letrec = None }
  +
               let vP = Expression.Variable (v.Type, v.Name)
               let eP = ConvExpr env e
               let assign = Expression.Assign (vP, eP) |> asExpr
   
  -            let envInner = { env with varEnv = Map.add v (vP |> asExpr) env.varEnv } 
  -            let bodyP = ConvExpr envInner b 
  +            let env = { env with varEnv = env.varEnv |> Map.add v (vP |> asExpr) } 
  +            let bodyP = ConvExpr env b 
   
               Expression.Block ([vP], [assign; bodyP]) |> asExpr
   
  
positive.code:                   
                  let ``type`` = funcFSharp.MakeGenericType parameterTypes
  
                  let ``constructor`` = ``type``.GetConstructor [| ``function``.GetType (); stateType |]
  
                  match capturedVars with
                  | [] ->
                      let obj = ``constructor``.Invoke [| ``function``; null |]
                      Expression.Constant (obj) |> asExpr
                  | v1 :: [] ->
                      let state = Map.find v1 env.varEnv
                      Expression.New (``constructor``, [Expression.Constant(``function``) |> asExpr; state]) |> asExpr
                  | _ ->
                      let state =
                          capturedVars
                          |> List.map (fun var -> Map.find var env.varEnv)
  
                      let stateConstructor =
                          let types = 
                              capturedVars
                              |> List.map (fun var -> var.Type)
                              |> List.toArray
  
                          stateType.GetConstructor types
  
                      Expression.New (``constructor``, [Expression.Constant(``function``) |> asExpr; Expression.New(stateConstructor, state) |> asExpr]) |> asExpr
              else
                  let v, body = firstVar, firstBody
  
  
negative.code:         f8hole := f8
          B.Invoke(f1,f2,f3,f4,f5,f6,f7,f8)
  
      type FuncFSharp<'state,'a> (f:Func<'state,'a>) =
          inherit FSharpFunc<unit, 'a>()
          [<Core.DefaultValue false>] val mutable State : 'state
          override this.Invoke _ = f.Invoke this.State
  
      type FuncFSharp<'state,'a,'b> (f:Func<'state,'a,'b>) =
          inherit FSharpFunc<'a,'b>()
          [<Core.DefaultValue false>] val mutable State : 'state
          override this.Invoke a = f.Invoke (this.State,a)
  
      type FuncFSharp<'state,'a,'b,'c> (f:Func<'state,'a,'b,'c>) =
          inherit OptimizedClosures.FSharpFunc<'a,'b,'c>()
          [<Core.DefaultValue false>] val mutable State : 'state
          override this.Invoke (a,b) = f.Invoke (this.State,a,b)
          override this.Invoke a = fun b -> f.Invoke (this.State,a,b)
  
      type FuncFSharp<'state,'a,'b,'c,'d> (f:Func<'state,'a,'b,'c,'d>) =
          inherit OptimizedClosures.FSharpFunc<'a,'b,'c,'d>()
          [<Core.DefaultValue false>] val mutable State : 'state
          override this.Invoke (a,b,c) = f.Invoke (this.State,a,b,c)
          override this.Invoke a = fun b c -> f.Invoke (this.State,a,b,c)
  
      type FuncFSharp<'state,'a,'b,'c,'d,'e> (f:Func<'state,'a,'b,'c,'d,'e>) =
          inherit OptimizedClosures.FSharpFunc<'a,'b,'c,'d,'e>()
          [<Core.DefaultValue false>] val mutable State : 'state
          override this.Invoke (a,b,c,d) = f.Invoke (this.State,a,b,c,d)
          override this.Invoke a = fun b c d -> f.Invoke (this.State,a,b,c,d)
  
      type FuncFSharp<'state,'a,'b,'c,'d,'e,'f> (f:Func<'state,'a,'b,'c,'d,'e,'f>) =
          inherit OptimizedClosures.FSharpFunc<'a,'b,'c,'d,'e,'f>()
          [<Core.DefaultValue false>] val mutable State : 'state
          override this.Invoke (a,b,c,d,e) = f.Invoke (this.State,a,b,c,d,e)
          override this.Invoke a = fun b c d e -> f.Invoke (this.State,a,b,c,d,e)
  
      let IsVoidType (ty:System.Type)  = (ty = typeof<System.Void>)
  
  