-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Describe the solution
Hey, I just discovered Eventkit, I love it and would like to explore it better, as an RxJS alternative to power stream-oriented apps with Rimmel.js
Now, here's a little issue that I think is very important: in monadic law, given a monad m, the operation m flatMap n should return another monad of the same type of m.
This means, if Stream is both Observable and Observer, calling the pipe method on it should still preserve both interfaces, but currently it doesn't appear to.
const s = Stream(0).pipe(
map(x=>x+1)
);
s.push(123) // should still work
s.subscribe() // just like thisThere are some cases when it's desirable to have a read-only derived stream given a source, but other cases where having both is best.
Take this click-counter example. It doesn't work yet, but that's what I'm trying to achieve with this request.
In the code, total is a stream: a pipeline that takes events in and emits their count. It's conceptually one thing, doesn't make sense to split it, so we want to keep it as one, just like in the code, so we can connect both ends to an HTML template to make it talk to the real world (so we can also implement advanced FP concepts such as Extensible Effects in the most ergonomic way).