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

Discuss: finite event streams, event data type #72

@dylemma

Description

@dylemma

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions