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

Type reference error in FSI #52

Closed fwaris closed 9 years ago

fwaris commented 9 years ago

The following very simple code does not compile in FSI:

r @"..\packages\FSharp.Control.Reactive.3.0.1\lib\net40\FSharp.Control.Reactive.dll"

r @"..\packages\Rx-Core.2.2.5\lib\net45\System.Reactive.Core.dll"

r @"..\packages\Rx-Core.2.2.5\lib\net45\System.Reactive.Core.dll"

r @"..\packages\Rx-Interfaces.2.2.5\lib\net45\System.Reactive.Interfaces.dll"

r @"..\packages\Rx-Linq.2.2.5\lib\net45\System.Reactive.Linq.dll"

open System.Reactive.Linq open FSharp.Control.Reactive

let a = seq [1;2;4] let a2 = a.ToObservable() let o1 = a2 |> Observable.iter(fun _ -> ()) //error here

The error I get is:

error FS0074: The type referenced through 'System.Reactive.Linq.Observable' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Reactive.Linq'.

System.Reactive.Linq is already referenced so I don't understand what might be happening.

fwaris commented 9 years ago

Well, it turns out that the solution is to move the FSharp.Control.Reactive.dll to last in the #r list.

It may be related to how the new FSI binds assemblies. Anyways, good to know for future.

With FSharp.Control.Reactive as the very first #r entry I don't see the "Binding... " messages in the FSI output. But when I move it to last, I do see the binding messages.