anchor.diff:  
               latestValue, self
           )
  +
  +    let withCancellation (ct : CancellationToken) =
  +        let m = Mod.init false
  +        let reg = ct.Register(fun () -> transact (fun () -> Mod.change m true))
  +
  +        switchTrue (latest m)
  +            (stop |> mapIn (fun _ -> reg.Dispose()))
  +            (arr id)
  +
  +
   
       type private Reactimator<'a, 'b>(sf : sf<'a, 'b>, input : 'a, output : 'b -> unit) as this =
           inherit AdaptiveObject()
  
positive.code:             member x.run _ _ = raise EndExn
              member x.dependencies = []   
  
  
      let stop<'a, 'b> = EndSignal<'a, 'b>.Instance
  
  
negative.code:                     nv, switch gc onEvent nc
          )
  
      let rec fold (seed : 's) (acc : 's -> 'a -> 's) (m : sf<'x, 'a>) =
          custom m.dependencies (fun _ ctx x ->
              let (mv,mc) = m.run ctx x
              let s = acc seed mv
              s, fold s acc mc
          )
  
      let rec zip (l : sf<'a, 'b>) (r : sf<'a, 'c>) =
          custom (l.dependencies @ r.dependencies) (fun self ctx a ->
              let (lv, lc) = l.run ctx a
              let (rv, rc) = r.run ctx a
  
              (lv,rv), zip lc rc
  
          )
  
      let inline integrate (f : sf<'a, 'b>) =
          f |> fold LanguagePrimitives.GenericZero (+)
  
      let inline differentiate (y : sf<'a, 'y>) (x : sf<'a, 'x>) =
          zip y x 
              |> fold None (fun last (y,x) ->
                  match last with
                      | Some (_, oy,ox) ->
                          let v = (y - oy) / (x - ox)
                          Some(v, y, x)
                      | None ->
                          Some(LanguagePrimitives.GenericZero, y, x)
                 ) 
              |> mapOut (fun o ->
                  match o with
                      | Some(v,_,_) -> v
                      | _ -> LanguagePrimitives.GenericZero
                 )
  
  
      let switchTrue (guard : sf<'a, bool>) (ifTrue : sf<'a, 'b>) (ifFalse : sf<'a, 'b>) =
          let rec run (currentlyTrue : Option<bool>) (guard : sf<'a, bool>) (ifTrue : sf<'a, 'b>) (ifFalse : sf<'a, 'b>) =
              let deps = 
                  match currentlyTrue with
                      | Some true -> guard.dependencies @ ifTrue.dependencies
                      | Some false -> guard.dependencies @ ifFalse.dependencies
                      | None -> List.concat [guard.dependencies; ifTrue.dependencies; ifFalse.dependencies]
  
              custom deps (fun _ ctx a ->
                  let (gv, gc) = guard.run ctx a
                  if gv then
                      let (ev, ec) = ifTrue.run ctx a
                      ev, run (Some true) gc ec ifFalse
  
                  else
                      let (nv, nc) = ifFalse.run ctx a
                      nv, run (Some false) gc ifTrue nc
              )
   
          run None guard ifTrue ifFalse
  
      let latest (m : IMod<'a>) : sf<'x, 'a> =
          custom [] (fun self ctx _ ->
  