How to convert between Rx 1 Observable and F# 3 observable?
Asked Answered
S

0

6

I'm limited to .net 3.5 and want to use Reactive Extensions with F# 3.0.

Apparently, F# and RX introduce different versions of System.IObservable<T>

open System.Reactive
open System.Timers
open System
[<EntryPoint>]
let main argv = 
    let timer = new Timer(500.0)
    timer.AutoReset <- true
    timer.Start()
    timer.Elapsed
    |> Observable.scan (fun i _ -> i + 1) (-1)
    :> IObservable<int>
    |> ignore
    0

This fails with: The type 'System.IObservable' is not compatible with the type 'System.IObservable'

Is it possible to use both? Or is there a version of RX compatible with .net 3.5 without conflicts? I also tried looking for sources of rx 1, but didn't find, although I'm not sure if it will be useful

Subtract answered 27/6, 2016 at 14:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.