Documentation
¶
Overview ¶
Package event implements the Event type.
Index ¶
- func After[A any](dur time.Duration, a A) warp.Event[A]
- func Alt[A any](x warp.Event[A], y warp.Event[A]) warp.Event[A]
- func Ap[A, B any](fab warp.Event[func(A) B], fa warp.Event[A]) warp.Event[B]
- func Chain[A, B any](fa warp.Event[A], f func(A) warp.Event[B]) warp.Event[B]
- func Count[A any](fa warp.Event[A]) warp.Event[int]
- func CountAll[A any](ctx context.Context, fa warp.Event[A]) int
- func Empty() warp.Event[struct{}]
- func Filter[A any](fa warp.Event[A], predicate warp.Predicate[A]) warp.Event[A]
- func FilterMap[A, B any](fa warp.Event[A], f func(a A) warp.Nilable[B]) warp.Event[B]
- func Fold[A, B any](fa warp.Event[A], b B, f func(A, B) B) warp.Event[B]
- func From[A any](as []A) warp.Event[A]
- func FromChannel[A any](source <-chan A) warp.Event[A]
- func FromIO[A any](io warp.IO[A]) warp.Event[A]
- func Interval(dur time.Duration) warp.Event[time.Time]
- func Map[A, B any](fa warp.Event[A], f func(A) B) warp.Event[B]
- func MapNotNil[A, B any](fa warp.Event[A], f func(A) *B) warp.Event[B]
- func Of[A any](a A) warp.Event[A]
- func Once[A any](fa warp.Event[A], predicate warp.Predicate[A]) warp.Event[A]
- func Reduce[A, B any](ctx context.Context, fa warp.Event[A], b B, f func(B, A) B) B
- func ReduceRight[A, B any](ctx context.Context, fa warp.Event[A], b B, f func(A, B) B) B
- func SampleOn[A, B any](fa warp.Event[A], fab warp.Event[func(A) B]) warp.Event[B]
- func SampleOn_[A, B any](fa warp.Event[A], fb warp.Event[B]) warp.Event[A]
- func Take[A any](fa warp.Event[A], n int) warp.Event[A]
- func Until[A any](fa warp.Event[A], predicate warp.Predicate[A]) warp.Event[A]
- func WithLast[A any](fa warp.Event[A]) warp.Event[Last[A]]
- func WithTime[A any](fa warp.Event[A]) warp.Event[Time[A]]
- type Last
- type Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Ap ¶
Ap creates an event by applying the latest observed function from the first event on each value received from the second event.
func Chain ¶
Chain creates an event which composes two events in sequence, using the return value of the first event to determine the next one.
func Filter ¶
Filter creates an event which emits values from a source event when a predicate holds.
func Fold ¶
Fold creates an event which combines the values from a source event by applying a function starting with an initial value.
func FromChannel ¶
func MapNotNil ¶
MapNotNil creates an event which filters out any nil values by applying a function on each value received from some source event.
func Once ¶
Once creates an event which emits values from an event for once and the last time when a predicate holds.
func Reduce ¶
Reduce returns a value by applying a function on each value received from an event, in order, passing in the value and the return value from the calculation on the preceding element.
func ReduceRight ¶
ReduceRight applies a function against an accumulator and each observed value of the event (from right-to-left) to reduce it to a single value. Same as Reduce but applied from end to start.
func SampleOn ¶
SampleOn creates an event which samples the latest values from the first event at the times when the second event fires.
func SampleOn_ ¶
SampleOn_ creates an event which samples the latest values from the first event at the times when the second event fires, ignoring the values produced by the second event.