You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently IObservable<'a> works fine with map / |>>, but does not work with monad CE.
Since IObservable<'a> has LINQ extension methods IObservable.Select, IObservable.SelectMany and Observable.Return. It seems that it might be nature to have monad instance just following System.Reactive.Linq 's implementation.
As discussed in here, adding concrete implementation for IObservable<'a> in FSharpPlu.Control might be the easiest way to achieve this.
Is it possible to add monad instance concrete implementation directly to F#+?
If there is no other constrains, adding concreate implementation in Control/Monad.fs might be as easy as several lines of code to direct call IObservable<'a>'s corresponding extension methods.
But there might be some problems, like introduce dependency to System.Reactive, and maybe Using / Defer and other methods needs also be considered. But considering IObservable<'a> is already provided in System namespace, and Rx.Net is an popular functional style library, solving these problems might have enough benefits.
The text was updated successfully, but these errors were encountered:
But there might be some problems, like introduce dependency to System.Reactive,
I think that's the main concern.
We could add an implementation that doesn't take a dependency on System.Reactive, but I'm not very familiar with the details of different implementations of SelectMany.
In anycase, it should always be possible to "extract" the SelectMany code from System.Reactive (since it's open source) and put it here in an Observable.fs extension file, then add the corresponding overload for >>=.
If you want to go that road that contribution would be more than welcome and I can certainly help you integrating it.
Currently
IObservable<'a>
works fine withmap
/|>>
, but does not work withmonad
CE.Since
IObservable<'a>
has LINQ extension methodsIObservable.Select
,IObservable.SelectMany
andObservable.Return
. It seems that it might be nature to have monad instance just following System.Reactive.Linq 's implementation.As discussed in here, adding concrete implementation for
IObservable<'a>
inFSharpPlu.Control
might be the easiest way to achieve this.Is it possible to add monad instance concrete implementation directly to F#+?
If there is no other constrains, adding concreate implementation in Control/Monad.fs might be as easy as several lines of code to direct call
IObservable<'a>
's corresponding extension methods.But there might be some problems, like introduce dependency to System.Reactive, and maybe
Using
/Defer
and other methods needs also be considered. But consideringIObservable<'a>
is already provided in System namespace, and Rx.Net is an popular functional style library, solving these problems might have enough benefits.The text was updated successfully, but these errors were encountered: