Trait/Object

scalaz.zio

Schedule

Related Docs: object Schedule | package zio

Permalink

trait Schedule[-A, +B] extends AnyRef

Defines a stateful, possibly effectful, recurring schedule of actions.

A Schedule[A, B] consumes A values, and based on the inputs and the internal state, decides whether to recur or conclude. Every decision is accompanied by a (possibly zero) delay, and an output value of type B.

Schedules compose in each of the following ways:

1. Intersection, using the && operator, which requires that both schedules continue, using the longer of the two durations. 2. Union, using the || operator, which requires that only one schedule continues, using the shorter of the two durations. 3. Sequence, using the <||> operator, which runs the first schedule until it ends, and then switches over to the second schedule.

Thanks to (1), Schedule[A, B] forms an applicative functor on the output value B, allowing rich composition of different schedules.

Self Type
Schedule[A, B]
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Schedule
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. abstract type State

    Permalink

    The internal state type of the schedule.

Abstract Value Members

  1. abstract val initial: IO[Nothing, State]

    Permalink

    The initial state of the schedule.

  2. abstract val update: (A, State) ⇒ IO[Nothing, Decision[State, B]]

    Permalink

    Updates the schedule based on a new input and the current state.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def &&[A1 <: A, C](that: Schedule[A1, C]): Schedule[A1, (B, C)]

    Permalink

    Returns a new schedule that continues only as long as both schedules continue, using the maximum of the delays of the two schedules.

  4. final def *>[A1 <: A, C](that: Schedule[A1, C]): Schedule[A1, C]

    Permalink

    The same as &&, but ignores the left output.

  5. final def <*[A1 <: A, C](that: Schedule[A1, C]): Schedule[A1, B]

    Permalink

    The same as &&, but ignores the right output.

  6. final def <<<[C](that: Schedule[C, A]): Schedule[C, B]

    Permalink

    A backwards version of >>>.

  7. final def <>[A1 <: A, B1 >: B](that: Schedule[A1, B1]): Schedule[A1, B1]

    Permalink

    The same as <||>, but merges the output.

  8. final def <||>[A1 <: A, C](that: Schedule[A1, C]): Schedule[A1, Either[B, C]]

    Permalink

    Returns a new schedule that first executes this schedule to completion, and then executes the specified schedule to completion.

  9. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. final def >>>[C](that: Schedule[B, C]): Schedule[A, C]

    Permalink

    Returns the composition of this schedule and the specified schedule, by piping the output of this one into the input of the other, and summing delays produced by both.

  11. final def andThen[A1 <: A, C](that: Schedule[A1, C]): Schedule[A1, Either[B, C]]

    Permalink

    An alias for <||>

  12. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  13. final def both[A1 <: A, C](that: Schedule[A1, C]): Schedule[A1, (B, C)]

    Permalink

    A named alias for &&.

  14. final def bothWith[A1 <: A, C, D](that: Schedule[A1, C])(f: (B, C) ⇒ D): Schedule[A1, D]

    Permalink

    The same as both followed by map.

  15. final def check[A1 <: A, C](test: (A1, B) ⇒ IO[Nothing, Boolean]): Schedule[A1, B]

    Permalink

    Peeks at the state produced by this schedule, executes some action, and then continues the schedule or not based on the specified state predicate.

  16. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  17. final def collect: Schedule[A, List[B]]

    Permalink

    Returns a new schedule that collects the outputs of this one into a list.

  18. final def combineWith[A1 <: A, C](that: Schedule[A1, C])(g: (Boolean, Boolean) ⇒ Boolean, f: (Duration, Duration) ⇒ Duration): Schedule[A1, (B, C)]

    Permalink
  19. final def compose[C](that: Schedule[C, A]): Schedule[C, B]

    Permalink

    An alias for <<<

  20. final def const[C](c: ⇒ C): Schedule[A, C]

    Permalink

    Returns a new schedule that maps this schedule to a constant output.

  21. final def contramap[A1](f: (A1) ⇒ A): Schedule[A1, B]

    Permalink

    Returns a new schedule that deals with a narrower class of inputs than this schedule.

  22. final def delayed(f: (Duration) ⇒ Duration): Schedule[A, B]

    Permalink

    Returns a new schedule with the specified pure modification applied to each delay produced by this schedule.

  23. final def dimap[A1, C](f: (A1) ⇒ A, g: (B) ⇒ C): Schedule[A1, C]

    Permalink

    Returns a new schedule that contramaps the input and maps the output.

  24. final def either[A1 <: A, C](that: Schedule[A1, C]): Schedule[A1, (B, C)]

    Permalink

    A named alias for ||.

  25. final def eitherWith[A1 <: A, C, D](that: Schedule[A1, C])(f: (B, C) ⇒ D): Schedule[A1, D]

    Permalink

    The same as either followed by map.

  26. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  27. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  28. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  29. final def fold[Z](z: Z)(f: (Z, B) ⇒ Z): Schedule[A, Z]

    Permalink

    Returns a new schedule that folds over the outputs of this one.

  30. final def foldM[Z](z: IO[Nothing, Z])(f: (Z, B) ⇒ IO[Nothing, Z]): Schedule[A, Z]

    Permalink

    Returns a new schedule that effectfully folds over the outputs of this one.

  31. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  32. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  33. final def initialized[A1 <: A](f: (IO[Nothing, State]) ⇒ IO[Nothing, State]): Schedule[A1, B]

    Permalink

    Returns a new schedule with the specified initial state transformed by the specified initial transformer.

  34. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  35. final def jittered(min: Double, max: Double): Schedule[A, B]

    Permalink

    Applies random jitter to the schedule bounded by the specified factors.

  36. final def jittered: Schedule[A, B]

    Permalink

    Applies random jitter to the schedule bounded by the factors 0.0 and 1.0.

  37. final def logInput[A1 <: A](f: (A1) ⇒ IO[Nothing, Unit]): Schedule[A1, B]

    Permalink

    Sends every input value to the specified sink.

  38. final def logOutput(f: (B) ⇒ IO[Nothing, Unit]): Schedule[A, B]

    Permalink

    Sends every output value to the specified sink.

  39. final def loop: Schedule[A, B]

    Permalink

    Returns a new schedule that loops this one forever, resetting the state when this schedule is done.

  40. final def map[A1 <: A, C](f: (B) ⇒ C): Schedule[A1, C]

    Permalink

    Returns a new schedule that maps over the output of this one.

  41. final def modifyDelay(f: (B, Duration) ⇒ IO[Nothing, Duration]): Schedule[A, B]

    Permalink

    Returns a new schedule with the specified effectful modification applied to each delay produced by this schedule.

  42. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  43. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  44. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  45. final def onDecision[A1 <: A](f: (A1, Decision[State, B]) ⇒ IO[Nothing, Unit]): Schedule[A1, B]

    Permalink

    A new schedule that applies the current one but runs the specified effect for every decision of this schedule.

    A new schedule that applies the current one but runs the specified effect for every decision of this schedule. This can be used to create schedules that log failures, decisions, or computed values.

  46. final def reconsider[A1 <: A, B1 >: B](f: (A1, Decision[State, B]) ⇒ Decision[State, B1]): Schedule[A1, B1]

    Permalink

    Returns a new schedule that reconsiders the decision made by this schedule.

  47. final def reconsiderM[A1 <: A, B1 >: B](f: (A1, Decision[State, B]) ⇒ IO[Nothing, Decision[State, B1]]): Schedule[A1, B1]

    Permalink

    Returns a new schedule that effectfully reconsiders the decision made by this schedule.

  48. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  49. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  50. final def unary_!: Schedule[A, B]

    Permalink

    Returns a new schedule that inverts the decision to continue.

  51. final def untilInput[A1 <: A](f: (A1) ⇒ Boolean): Schedule[A1, B]

    Permalink

    Returns a new schedule that continues the schedule only until the predicate is satisfied on the input of the schedule.

  52. final def untilValue(f: (B) ⇒ Boolean): Schedule[A, B]

    Permalink

    Returns a new schedule that continues the schedule only until the predicate is satisfied on the output value of the schedule.

  53. final def updated[A1 <: A, B1 >: B](f: ((A, State) ⇒ IO[Nothing, Decision[State, B]]) ⇒ (A1, State) ⇒ IO[Nothing, Decision[State, B1]]): Schedule[A1, B1]

    Permalink

    Returns a new schedule with the update function transformed by the specified update transformer.

  54. final def void: Schedule[A, Unit]

    Permalink

    Returns a new schedule that maps this schedule to a Unit output.

  55. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  56. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  57. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  58. final def whileInput[A1 <: A](f: (A1) ⇒ Boolean): Schedule[A1, B]

    Permalink

    Returns a new schedule that continues this schedule so long as the predicate is satisfied on the input of the schedule.

  59. final def whileValue(f: (B) ⇒ Boolean): Schedule[A, B]

    Permalink

    Returns a new schedule that continues this schedule so long as the predicate is satisfied on the output value of the schedule.

  60. final def ||[A1 <: A, C](that: Schedule[A1, C]): Schedule[A1, (B, C)]

    Permalink

    Returns a new schedule that continues as long as either schedule continues, using the minimum of the delays of the two schedules.

Inherited from AnyRef

Inherited from Any

Ungrouped