Skip to content

Instantly share code, notes, and snippets.

@plmrry
Created January 10, 2017 22:59
Show Gist options
  • Save plmrry/d39f71412df64dffbf2b5f8667f4e72f to your computer and use it in GitHub Desktop.
Save plmrry/d39f71412df64dffbf2b5f8667f4e72f to your computer and use it in GitHub Desktop.
Stupid stream
class Stream<T> {
constructor(private start: Start<T>) {}
listen(next: Listener<T>) { this.start(next) }
}
class Stream<T> {
constructor(private start: Start<T>) {}
compose<U>(fn: (stream: Stream<T>) => Stream<U>): Stream<U> {
return fn(this);
}
listen(next: Listener<T>) { this.start(next) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment