Observable is just a function that takes an observer and returns a function

Learning Observable By Building Observable

Ben Lesh

2.6K25

Here is what I find confusing in this definition:

- The reader needs to know what Observer is. Ok, you give the details about Observer’s Shape right below. But that still does not replace the definition.
- What kind of function is returned? What is the signature? What does it do? In your example this is the cancellation function. Is this always the case? If yes, this does not seem to be the actual most useful part of the Observable, which is to push data to Observer. Is it correct?
- The deja vu feeling is strong, reminding the popular Monad’s definition as “just a monoid in category of endofunctors: http://stackoverflow.com/questions/3870088/a-monad-is-just-a-monoid-in-the-category-of-endofunctors-whats-the-proble%E2%85%BF
- Is _every_ function I can possibly write, taking an Observer and returning any possible function always an Observable? No other restrictions?