anchor.diff:      let inline sumM (s : aset<IMod<'a>>) = foldGroupM (+) (-) LanguagePrimitives.GenericZero s
       let inline productM (s : aset<IMod<'a>>) = foldGroupM (*) (/) LanguagePrimitives.GenericOne s
   
  -    let private callbackTable = ConditionalWeakTable<IAdaptiveObject, ConcurrentHashSet<IDisposable>>()
  -    type private CallbackSubscription(m : IAdaptiveObject, cb : unit -> unit, live : ref<bool>, reader : IDisposable, set : ConcurrentHashSet<IDisposable>) =
  -        
  +    let private callbackTable = ConditionalWeakTable<obj, ConcurrentHashSet<IDisposable>>()
  +    type private CallbackSubscription(m : obj, cb : unit -> unit, live : ref<bool>, reader : IAdaptiveObject, set : ConcurrentHashSet<IDisposable>) =
  +        let disposable = reader |> unbox<IDisposable>
  +
           member x.Dispose() = 
               if !live then
                   live := false
  -                reader.Dispose()
  -                m.MarkingCallbacks.Remove cb |> ignore
  +                disposable.Dispose()
  +                reader.MarkingCallbacks.Remove cb |> ignore
                   set.Remove x |> ignore
  +                if set.Count = 0 then
  +                    callbackTable.Remove(m) |> ignore
   
           interface IDisposable with
               member x.Dispose() = x.Dispose()
  
positive.code:         r.AddOutput m
          m
  
      let contains (elem : 'a) (set : aset<'a>) =
          set |> toMod |> Mod.map (fun s -> s.Contains elem)
  
      let containsAll (elems : #seq<'a>) (set : aset<'a>) =
          set |> toMod |> Mod.map (fun s -> elems |> Seq.forall (fun e -> s.Contains e))
  
      let containsAny (elems : #seq<'a>) (set : aset<'a>) =
          set |> toMod |> Mod.map (fun s -> elems |> Seq.exists (fun e -> s.Contains e))
  
  
      let map (f : 'a -> 'b) (set : aset<'a>) = 
          let scope = Ag.getContext()
          AdaptiveSet(fun () -> set.GetReader() |> map scope f) :> aset<'b>
  
      let bind (f : 'a -> aset<'b>) (m : IMod<'a>) =
          let scope = Ag.getContext()
          AdaptiveSet(fun () -> m |> bind scope (fun v -> (f v).GetReader())) :> aset<'b>
  
      let bind2 (f : 'a -> 'b -> aset<'c>) (ma : IMod<'a>) (mb : IMod<'b>) =
          let scope = Ag.getContext()
          AdaptiveSet(fun () -> bind2 scope (fun a b -> (f a b).GetReader()) ma mb) :> aset<'c>
  
  
      let collect (f : 'a -> aset<'b>) (set : aset<'a>) = 
          let scope = Ag.getContext()
          AdaptiveSet(fun () -> set.GetReader() |> collect scope (fun v -> (f v).GetReader())) :> aset<'b>
  
      let choose (f : 'a -> Option<'b>) (set : aset<'a>) =
          let scope = Ag.getContext()
          AdaptiveSet(fun () -> set.GetReader() |> choose scope f) :> aset<'b>
  
      let filter (f : 'a -> bool) (set : aset<'a>) =
          choose (fun v -> if f v then Some v else None) set
  
      let concat (set : aset<aset<'a>>) =
          collect id set
  
  
negative.code:             !self ()
          )
  
          let callbackSet = callbackTable.GetOrCreateValue(set)
          let s = new CallbackSubscription(set, !self, live, m, callbackSet)
          callbackSet.Add s |> ignore
          s :> IDisposable
  
  