Packages

object CancelableF

Source
CancelableF.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CancelableF
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. trait Empty[F[_]] extends CancelableF[F] with IsDummy[F]

    Interface for cancelables that are empty or already canceled.

  2. trait IsDummy[F[_]] extends AnyRef

    Marker for cancelables that are dummies that can be ignored.

Value Members

  1. def apply[F[_]](token: F[Unit])(implicit F: Sync[F]): F[CancelableF[F]]

    Given a token that does not guarantee idempotency, wraps it in a CancelableF value that guarantees the given token will execute only once.

  2. def cancelAll[F[_]](seq: CancelableF[F]*)(implicit F: Sync[F]): CancelToken[F]

    Given a collection of cancelables, creates a token that on evaluation will cancel them all.

    Given a collection of cancelables, creates a token that on evaluation will cancel them all.

    This function collects non-fatal exceptions and throws them all at the end as a composite, in a platform specific way:

    • for the JVM "Suppressed Exceptions" are used
    • for JS they are wrapped in a CompositeException
  3. def cancelAllTokens[F[_]](seq: CancelToken[F]*)(implicit F: Sync[F]): CancelToken[F]

    Given a collection of cancel tokens, creates a token that on evaluation will cancel them all.

    Given a collection of cancel tokens, creates a token that on evaluation will cancel them all.

    This function collects non-fatal exceptions and throws them all at the end as a composite, in a platform specific way:

    • for the JVM "Suppressed Exceptions" are used
    • for JS they are wrapped in a CompositeException
  4. def collection[F[_]](refs: CancelableF[F]*)(implicit F: Sync[F]): CancelableF[F]

    Builds a CancelableF reference from a sequence, cancelling everything when cancel gets evaluated.

  5. def empty[F[_]](implicit F: Applicative[F]): CancelableF[F]

    Returns a dummy CancelableF that doesn't do anything.

  6. def unsafeApply[F[_]](token: F[Unit])(implicit F: Sync[F]): CancelableF[F]

    Unsafe version of apply.

    Unsafe version of apply.

    This function is unsafe because creating the returned BooleanCancelableF allocates internal shared mutable state, thus breaking referential transparency, which can catch users by surprise.

    Annotations
    @UnsafeBecauseImpure()
  7. def wrap[F[_]](token: CancelToken[F]): CancelableF[F]

    Wraps a cancellation token into a CancelableF instance.

    Wraps a cancellation token into a CancelableF instance.

    Compared with apply the returned value does not guarantee idempotency.

    N.B. the returned result is as pure as the wrapped result. Since we aren't allocating mutable internal state for creating this value, we don't need to return the value in F[_], like in apply.