Packages

final class Scenario[F[_], +A] extends AnyVal

Description of an interaction between two parties, where generally one is the application (bot) and the other is Telegram user.

Particular interaction is coherent with some scenario as long as it matches the description (i.e. every step of the interaction matches the step described in scenario).

Scenario forms a monad in A with pure and flatMap.

Linear Supertypes
AnyVal, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Scenario
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##(): Int
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
  4. def >>[B](s2: => Scenario[F, B]): Scenario[F, B]

    Lazy flatMap which ignores the result of the first scenario.

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def attempt: Scenario[F, Either[Throwable, A]]

    returns

    Scenario which wraps successful result values in Right and raised errors in Left.

  7. def flatMap[B](fn: (A) => Scenario[F, B]): Scenario[F, B]

    Chains this scenario with the one produced by applying fn to the result of this scenario.

  8. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  9. def handleErrorWith[A2 >: A](fn: (Throwable) => Scenario[F, A2]): Scenario[F, A2]

    returns

    this or scenario which is result of provided function if error occurs.

  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. def map[B](fn: (A) => B): Scenario[F, B]

    Maps successful result values using provided function.

  12. def mapK[G[_]](f: ~>[F, G]): Scenario[G, A]

    Maps effect type from F to G using the supplied transformation.

    Maps effect type from F to G using the supplied transformation.

    Warning: this operation can result into StackOverflowError if this is nested with a lot of flatMap operations.

  13. def pipe(implicit F: ApplicativeError[F, Throwable]): Pipe[F, TelegramMessage, A]

    Pipe which produces a stream with at most single value of type A evaluated in F effect as a result of the successful interaction matching this description.

    Pipe which produces a stream with at most single value of type A evaluated in F effect as a result of the successful interaction matching this description. If an unhandled error result was encountered during the interaction, it will be raised here.

  14. def stopOn(p: (TelegramMessage) => Boolean): Scenario[F, A]

    Stops this scenario on first input message matching the predicate.

  15. def stopWith(p: (TelegramMessage) => Boolean)(cancellation: (TelegramMessage) => F[Unit]): Scenario[F, A]

    Stops this scenario on first input message matching the predicate and evaluates cancellation function with this message.

  16. def toString(): String
    Definition Classes
    Any
  17. def tolerate(fn: (TelegramMessage) => F[Unit]): Scenario[F, A]

    Alias for tolerateN(1)

  18. def tolerateAll(fn: (TelegramMessage) => F[Unit]): Scenario[F, A]

    Same as tolerateN, but retries until the scenario is fully matched.

    Same as tolerateN, but retries until the scenario is fully matched.

    Often used in combination with stopOn/stopWith to give users a way to 'escape' the scenario.

  19. def tolerateN(n: Int)(fn: (TelegramMessage) => F[Unit]): Scenario[F, A]

    Restarts this scenario if it was mismatched, up to n times, evaluating fn applied to the input element that was mismatched.

    Restarts this scenario if it was mismatched, up to n times, evaluating fn applied to the input element that was mismatched.

    This can be useful, when you expect some input from the user (e.g. data in specific format) and want to retry if the input was not correct.

Inherited from AnyVal

Inherited from Any

Ungrouped