Packages

sealed abstract class SyncIO[+A] extends Serializable

A pure abstraction representing the intention to perform a side effect, where the result of that side effect is obtained synchronously.

SyncIO is similar to IO, but does not support asynchronous computations. Consequently, a SyncIO can be run synchronously on any platform to obtain a result via unsafeRunSync. This is unlike IO#unsafeRunSync, which cannot be safely called in general -- doing so on the JVM blocks the calling thread while the async part of the computation is run and doing so on Scala.js is not supported.

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

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. def *>[B](that: SyncIO[B]): SyncIO[B]

    Alias for productR.

    Alias for productR.

    See also

    SyncIO#productR

  4. def <*[B](that: SyncIO[B]): SyncIO[A]

    Alias for productL.

    Alias for productL.

    See also

    SyncIO#productL

  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. def >>[B](that: => SyncIO[B]): SyncIO[B]

    Alias for flatMap(_ => that).

    Alias for flatMap(_ => that).

    See also

    SyncIO#flatMap

  7. def as[B](b: B): SyncIO[B]

    Alias for map(_ => b).

    Alias for map(_ => b).

    See also

    SyncIO#map

  8. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  9. def attempt: SyncIO[Either[Throwable, A]]

    Materializes any sequenced exceptions into value space, where they may be handled.

    Materializes any sequenced exceptions into value space, where they may be handled.

    This is analogous to the catch clause in try/catch, being the inverse of SyncIO.raiseError. Thus:

    SyncIO.raiseError(ex).attempt.unsafeRunSync === Left(ex)
    See also

    SyncIO.raiseError

  10. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  11. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  13. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  14. def flatMap[B](f: (A) => SyncIO[B]): SyncIO[B]

    Monadic bind on SyncIO, used for sequentially composing two SyncIO actions, where the value produced by the first SyncIO is passed as input to a function producing the second SyncIO action.

    Monadic bind on SyncIO, used for sequentially composing two SyncIO actions, where the value produced by the first SyncIO is passed as input to a function producing the second SyncIO action.

    Due to this operation's signature, flatMap forces a data dependency between two SyncIO actions, thus ensuring sequencing (e.g. one action to be executed before another one).

    Any exceptions thrown within the function will be caught and sequenced in to the result SyncIO[B].

    f

    the bind function

    returns

    SyncIO produced by applying f to the result of the current SyncIO

  15. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. def handleErrorWith[B >: A](f: (Throwable) => SyncIO[B]): SyncIO[B]

    Handle any error, potentially recovering from it, by mapping it to another SyncIO value.

    Handle any error, potentially recovering from it, by mapping it to another SyncIO value.

    Implements ApplicativeError.handleErrorWith.

  17. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. def map[B](f: (A) => B): SyncIO[B]

    Functor map on SyncIO.

    Functor map on SyncIO. Given a mapping function, it transforms the value produced by the source, while keeping the SyncIO context.

    Any exceptions thrown within the function will be caught and sequenced into the result SyncIO[B].

    f

    the mapping function

    returns

    SyncIO that evaluates to the value obtained by applying f to the result of the current SyncIO

  20. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  22. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  23. def productL[B](that: SyncIO[B]): SyncIO[A]

    Executes that only for the side effects.

    Executes that only for the side effects.

    that

    SyncIO to be executed after this SyncIO

    returns

    SyncIO which sequences the effects of that but evaluates to the result of this SyncIO

  24. def productR[B](that: SyncIO[B]): SyncIO[B]

    Sequences that without propagating the value of the current SyncIO.

    Sequences that without propagating the value of the current SyncIO.

    that

    SyncIO to be executed after this SyncIO

    returns

    SyncIO which sequences the effects of that

  25. def redeem[B](recover: (Throwable) => B, map: (A) => B): SyncIO[B]
  26. def redeemWith[B](recover: (Throwable) => SyncIO[B], bind: (A) => SyncIO[B]): SyncIO[B]
  27. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  28. def to[F[_]](implicit F: Sync[F]): F[A]

    Translates this SyncIO to any F[_] data type that implements Sync.

  29. def toString(): String
    Definition Classes
    SyncIO → AnyRef → Any
  30. def unsafeRunSync(): A

    Produces the result by running the encapsulated effects as impure side effects.

    Produces the result by running the encapsulated effects as impure side effects.

    Any exceptions raised within the effect will be re-thrown during evaluation.

    As the name says, this is an UNSAFE function as it is impure and performs side effects and throws exceptions. You should ideally only call this function *once*, at the very end of your program.

    returns

    the result of evaluating this SyncIO

  31. def void: SyncIO[Unit]

    Alias for map(_ => ()).

    Alias for map(_ => ()).

    See also

    SyncIO#map

  32. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  33. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  34. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped