Packages

final class CallbackOption[+A] extends AnyVal

Callback that can short-circuit along the way when conditions you specify, aren't met.

Especially useful for event handlers such as key handlers, drag-and-drop handlers, etc, where you check a condition, perform an effect, check another condition, perform another effect, etc.

This is meant to be lightweight, and be immediately useful without the typical pain of imports, implicit conversions and extension methods then normally accompany monad transforms in Scala.

For a more generic (i.e. beyond Option) or comprehensive monad transformer use Cats or similar.

Self Type
CallbackOption[A]
Linear Supertypes
AnyVal, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CallbackOption
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new CallbackOption(underlyingRepr: UnderlyingRepr[A])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##: Int
    Definition Classes
    Any
  3. def &&[B](b: CallbackOption[B]): CallbackOption[Unit]
    Annotations
    @inline()
  4. def *>[B](next: CallbackOption[B]): CallbackOption[B]

    Alias for >>.

    Alias for >>.

    Where >> is often associated with Monads, *> is often associated with Applicatives.

    Annotations
    @inline()
  5. def <*[B](next: CallbackOption[B]): CallbackOption[A]

    Sequence actions, discarding the value of the second argument.

  6. def <<[B](prev: CallbackOption[B]): CallbackOption[A]

    Sequence a callback to run before this, discarding any value produced by it.

    Sequence a callback to run before this, discarding any value produced by it.

    Annotations
    @inline()
  7. def <<?[B](prev: Option[CallbackOption[B]]): CallbackOption[A]

    Convenient version of << that accepts an Option

  8. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
  9. def >>[B](next: CallbackOption[B]): CallbackOption[B]

    Sequence a callback to run after this, discarding any value produced by this.

  10. def >>=[B](f: (A) => CallbackOption[B]): CallbackOption[B]

    Alias for flatMap.

    Alias for flatMap.

    Annotations
    @inline()
  11. def asCallback: CallbackTo[Option[A]]
  12. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  13. def filter(condition: (A) => Boolean): CallbackOption[A]
  14. def filterNot(condition: (A) => Boolean): CallbackOption[A]
  15. def finallyRun[B](runFinally: CallbackOption[B]): CallbackOption[A]

    Wraps this callback in a try-finally block and runs the given callback in the finally clause, after the current callback completes, be it in error or success.

  16. def flatMap[B](f: (A) => CallbackOption[B]): CallbackOption[B]
  17. def flatMapCB[B](f: (A) => CallbackTo[B]): CallbackOption[B]
  18. def flatMapOption[B](f: (A) => Option[B]): CallbackOption[B]
  19. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  20. def getOrElse[AA >: A](default: => AA): CallbackTo[AA]
  21. def handleError[AA >: A](f: (Throwable) => CallbackOption[AA]): CallbackOption[AA]
  22. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  23. def map[B](f: (A) => B)(implicit ev: MapGuard[B]): CallbackOption[Out]
  24. def orElse[AA >: A](tryNext: CallbackOption[AA]): CallbackOption[AA]
  25. def toCallback(implicit ev: <:<[A, Unit]): Callback
  26. def toString(): String
    Definition Classes
    Any
  27. def unary_!(implicit ev: <:<[A, Unit]): CallbackOption[Unit]
  28. val underlyingRepr: UnderlyingRepr[A]
  29. def unless(cond: => Boolean): CallbackOption[A]

    Conditional execution of this callback.

    Conditional execution of this callback. Reverse of when().

    cond

    The condition required to be false for this callback to execute.

    returns

    Some result of the callback executed, else None.

    Annotations
    @inline()
  30. def unless_(cond: => Boolean): CallbackOption[Unit]

    Conditional execution of this callback.

    Conditional execution of this callback. Reverse of when_().

    cond

    The condition required to be false for this callback to execute.

    returns

    Some result of the callback executed, else None.

    Annotations
    @inline()
  31. def void: CallbackOption[Unit]

    Discard the value produced by this callback.

  32. def voidExplicit[B](implicit ev: <:<[A, B]): CallbackOption[Unit]

    Discard the value produced by this callback.

    Discard the value produced by this callback.

    This method allows you to be explicit about the type you're discarding (which may change in future).

    Annotations
    @inline()
  33. def when(cond: => Boolean): CallbackOption[A]

    Conditional execution of this callback.

    Conditional execution of this callback.

    cond

    The condition required to be true for this callback to execute.

  34. def when_(cond: => Boolean): CallbackOption[Unit]

    Conditional execution of this callback.

    Conditional execution of this callback.

    cond

    The condition required to be true for this callback to execute.

  35. def withFilter(condition: (A) => Boolean): CallbackOption[A]
    Annotations
    @inline()
  36. def zip[B](cb: CallbackOption[B]): CallbackOption[(A, B)]
  37. def |[AA >: A](tryNext: CallbackOption[AA]): CallbackOption[AA]

    Alias for orElse.

    Alias for orElse.

    Annotations
    @inline()
  38. def |>[B](f: (A) => B)(implicit ev: MapGuard[B]): CallbackOption[Out]

    Alias for map.

    Alias for map.

    Annotations
    @inline()
  39. def ||[B](b: CallbackOption[B]): CallbackOption[Unit]
    Annotations
    @inline()

Inherited from AnyVal

Inherited from Any

Ungrouped