Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Discuss: finite event streams, event data type #72

Open
dylemma opened this issue Jun 5, 2013 · 0 comments
Open

Discuss: finite event streams, event data type #72

dylemma opened this issue Jun 5, 2013 · 0 comments

Comments

@dylemma
Copy link
Contributor

dylemma commented Jun 5, 2013

Making event streams finite opens a lot of doors for new methods and capabilities on event streams. @nafg you've mentioned to me you like what bacon.js does, so following suit, we could have an Event data type along the lines of

/** base event type */
sealed trait Event[+T]

/** sent when `fire` is called */
case class Next[+T](item: T) extends Event[T] //aka Fire

/** maybe unnecessary for us, but represents an event error */
case class Error(cause: Throwable) extends Event[Nothing]

/** sent when the eventstream is finished, or when `stop` or
    some similar method gets called */
case object Done extends Event[Nothing]

/** this is how bacon.js sends the "current" value for their
    equivalent of a Signal, when an observer subscribes to it */
case object Initial[+T](item: T) extends Event[T]

Supposing eventstreams used Event[T] under the hood, we could implement things like ++ for stream concatenation, def end: Future[Time], and potentially clean up the Signal API by removing the current method as you had mentioned in conversation previously.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant