Skip to content

Is it possible to add concrete implementation of monad for IObservable<'a> ? #459

Open
@Hong-Xiang

Description

@Hong-Xiang

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions