fsprojects / FSharp.Control.Reactive

Extensions and wrappers for using Reactive Extensions (Rx) with F#.
http://fsprojects.github.io/FSharp.Control.Reactive
Other
284 stars 58 forks source link

Add Disposable.disposeWith function #145

Closed Micha-kun closed 4 years ago

Micha-kun commented 4 years ago

Description

CompositeDisposable has an extension method called DisposeWith very useful when working with frameworks like ReactiveUI that uses CompositeDisposables extensively. There isn't a functional version of this method.

Repro steps

use d = new CompositeDisposable()
let x = Disposable.Empty
x.DisposeWith(d) |> ignore

Expected behavior

use d = new CompositeDisposable()
Disposable.Empty
 |> Disposable.disposeWith d |> ignore

Actual behavior

I cannot pipe DisposeWith method function-friendly.

Known workarounds

Create a helper function in F# wrapping this functionality making functional.friendly

Micha-kun commented 4 years ago

Well, more than a bug, it's like an improvement 😅