anchor.diff:              | Shape.FSharpUnion _ -> false
               | _ -> not typeof<'T>.IsSealed
   
  -        fun stack cache t ->
  -            if obj.ReferenceEquals(t,null) then t 
  -            elif isOpen && t.GetType() <> typeof<'T> then
  -                cloneUntyped stack cache t :?> 'T
  -            else
  -                do stack.Push t
  -                let id = stack.ObjectId
  -                let t' =
  -                    let mutable t' = Unchecked.defaultof<_>
  -                    if cache.TryGetValue(id, &t') then t'
  -                    elif stack.IsCycle then
  -                        cache.CreateUninitializedInstance<'T>(id, t.GetType())
  -                    else
  -                        let t' = cloner stack cache t
  -                        cache.AddValue(id, t')
  -
  -                do stack.Pop()
  -                t'
  +        { new Cloner<'T>() with
  +            member _.Clone stack cache t =
  +                if obj.ReferenceEquals(t, null) then t 
  +                elif isOpen && t.GetType() <> typeof<'T> then
  +                    cloneUntyped stack cache t :?> 'T
  +                else
  +                    do stack.Push t
  +                    let id = stack.ObjectId
  +                    let t' =
  +                        let mutable t' = Unchecked.defaultof<_>
  +                        if cache.TryGetValue(id, &t') then t'
  +                        elif stack.IsCycle then
  +                            cache.CreateUninitializedInstance<'T>(id, t.GetType())
  +                        else
  +                            let t' = cloner.Clone stack cache t
  +                            cache.AddValue(id, t')
  +
  +                    do stack.Pop()
  +                    t' }
   
       and mkClonerCached<'T> (ctx : TypeGenerationContext) : Cloner<'T> =
  -        match ctx.InitOrGetCachedValue<Cloner<'T>> (fun c s t -> c.Value s t) with
  +        match ctx.InitOrGetCachedValue<Cloner<'T>> (fun cell -> { new Cloner<'T>() with member _.Clone s c t = cell.Value.Clone s c t }) with
           | Cached(value = v) -> v
           | NotCached t ->
               let c = mkClonerMain<'T> ctx |> mkRefEqCloner
  
positive.code:                                     and 't : struct> () =
  
                      let ec = mkClonerCached<'t> ctx
                      EQ(fun s c (t:Nullable<'t>) -> 
                          if t.HasValue then Nullable(ec s c t.Value)
                          else t) }
  
          | Shape.FSharpList s ->
              s.Element.Accept {
                  new ITypeVisitor<Cloner<'T>> with
                      member _.Visit<'t> () =
                          let ec = mkClonerCached<'t> ctx
                          EQ(fun s c ts -> List.map (ec s c) ts) }
  
          | Shape.FSharpSet s ->
              s.Accept {
                  new IFSharpSetVisitor<Cloner<'T>> with
                      member _.Visit<'t when 't : comparison> () =
                          let tc = mkClonerCached<'t> ctx
                          EQ(fun s c ts -> Set.map (tc s c) ts) }
  
          | Shape.FSharpMap s ->
              s.Accept {
  
negative.code: 
  /// Creates a deep clone for the provided value.
  /// Accounts for reference equality and object cycles.
  let clone<'T> (t : 'T) : 'T = Impl.mkCloner<'T>().Clone (ObjectStack()) (ObjectCache()) t