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

F# not able to infer correct type? #133

Closed simendsjo closed 4 years ago

simendsjo commented 4 years ago

Using fromEventHandler, it infers to argument to be obj rather then the supplied type. If I copy/paste the code to my project instead, it works, which makes me suspect something odd about the F# inference rules related to external projects or something.

https://github.com/fsprojects/FSharp.Control.Reactive/blob/master/src/FSharp.Control.Reactive/Observable.fs#L791

Maybe _ needs to be replaced with 'EventArgs? I haven't investigated the root cause of this.

EDIT: To reproduce

    let o : IObservable<EventArgs> =
        FSharp.Control.Reactive.Observable.fromEventHandler<EventArgs>
            ignore
            ignore

Gives

Type mismatch. Expecting a
    'IObservable<EventArgs>'    
but given a
    'IObservable<obj>'    
The type 'EventArgs' does not match the type 'obj'
PhilT commented 4 years ago

Duplicate of #129?

panesofglass commented 4 years ago

Is this fixed in 4.3.0?