Skip to content

Instantly share code, notes, and snippets.

@dbrattli
Last active October 22, 2018 11:30
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dbrattli/61e986bfc72dcc1e0830f6f70af1fee4 to your computer and use it in GitHub Desktop.
Single.fs
let single<'a> (value: 'a) : IObservable<'a> =
let noop = fun () -> ()
let subscribe (obs: IObserver<'a>) : IDisposable =
obs.OnNext value
obs.OnCompleted ()
{ new IDisposable with member __.Dispose () = noop () }
{ new IObservable<'a> with member __.Subscribe obs' = subscribe obs' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment