Packages

p

cats

effect

package effect

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

Type Members

  1. type Async[F[_]] = effect.kernel.Async[F]
  2. type Clock[F[_]] = effect.kernel.Clock[F]
  3. type Concurrent[F[_]] = effect.kernel.GenConcurrent[F, Throwable]
  4. type Cont[F[_], K, R] = effect.kernel.Cont[F, K, R]
  5. type Deferred[F[_], A] = effect.kernel.Deferred[F, A]
  6. sealed abstract case class ExitCode extends Product with Serializable

    Represents the exit code of an application.

    Represents the exit code of an application.

    code is constrained to a range from 0 to 255, inclusive.

  7. type Fiber[F[_], E, A] = effect.kernel.Fiber[F, E, A]
  8. type FiberIO[A] = effect.kernel.Fiber[IO, Throwable, A]
  9. type GenConcurrent[F[_], E] = effect.kernel.GenConcurrent[F, E]
  10. type GenSpawn[F[_], E] = effect.kernel.GenSpawn[F, E]
  11. type GenTemporal[F[_], E] = effect.kernel.GenTemporal[F, E]
  12. sealed abstract class IO[+A] extends IOPlatform[A]

    A pure abstraction representing the intention to perform a side effect, where the result of that side effect may be obtained synchronously (via return) or asynchronously (via callback).

    A pure abstraction representing the intention to perform a side effect, where the result of that side effect may be obtained synchronously (via return) or asynchronously (via callback).

    IO values are pure, immutable values and thus preserve referential transparency, being usable in functional programming. An IO is a data structure that represents just a description of a side effectful computation.

    IO can describe synchronous or asynchronous computations that:

    1. on evaluation yield exactly one result 2. can end in either success or failure and in case of failure flatMap chains get short-circuited (IO implementing the algebra of MonadError) 3. can be canceled, but note this capability relies on the user to provide cancelation logic

    Effects described via this abstraction are not evaluated until the "end of the world", which is to say, when one of the "unsafe" methods are used. Effectful results are not memoized, meaning that memory overhead is minimal (and no leaks), and also that a single effect may be run multiple times in a referentially-transparent manner. For example:

    val ioa = IO.println("hey!")
    
    val program = for {
      _ <- ioa
      _ <- ioa
    } yield ()
    
    program.unsafeRunSync()

    The above will print "hey!" twice, as the effect will be re-run each time it is sequenced in the monadic chain.

    IO is trampolined in its flatMap evaluation. This means that you can safely call flatMap in a recursive function of arbitrary depth, without fear of blowing the stack.

    def fib(n: Int, a: Long = 0, b: Long = 1): IO[Long] =
      IO.pure(a + b) flatMap { b2 =>
        if (n > 0)
          fib(n - 1, b, b2)
        else
          IO.pure(a)
      }
  13. trait IOApp extends AnyRef
  14. sealed trait IOLocal[A] extends AnyRef
  15. trait LiftIO[F[_]] extends AnyRef
  16. type MonadCancel[F[_], E] = effect.kernel.MonadCancel[F, E]
  17. type MonadCancelThrow[F[_]] = effect.kernel.MonadCancel[F, Throwable]
  18. type Outcome[F[_], E, A] = effect.kernel.Outcome[F, E, A]
  19. type OutcomeIO[A] = effect.kernel.Outcome[IO, Throwable, A]
  20. type ParallelF[F[_], A] = T[F, A]
  21. type Poll[F[_]] = effect.kernel.Poll[F]
  22. type Ref[F[_], A] = effect.kernel.Ref[F, A]
  23. type Resource[F[_], +A] = effect.kernel.Resource[F, A]
  24. type ResourceIO[A] = effect.kernel.Resource[IO, A]
  25. type Spawn[F[_]] = effect.kernel.GenSpawn[F, Throwable]
  26. type Sync[F[_]] = effect.kernel.Sync[F]
  27. sealed abstract class SyncIO[+A] extends AnyRef

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

    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 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 throws an exception upon encountering an async boundary.

  28. type Temporal[F[_]] = effect.kernel.GenTemporal[F, Throwable]
  29. type Unique[F[_]] = effect.kernel.Unique[F]

Value Members

  1. val Async: effect.kernel.Async.type
  2. val Clock: effect.kernel.Clock.type
  3. val Concurrent: effect.kernel.GenConcurrent.type
  4. val Deferred: effect.kernel.Deferred.type
  5. val GenConcurrent: effect.kernel.GenConcurrent.type
  6. val GenSpawn: effect.kernel.GenSpawn.type
  7. val GenTemporal: effect.kernel.GenTemporal.type
  8. val MonadCancel: effect.kernel.MonadCancel.type
  9. val MonadCancelThrow: effect.kernel.MonadCancel.type
  10. val Outcome: effect.kernel.Outcome.type
  11. val ParallelF: effect.kernel.Par.ParallelF.type
  12. val Ref: effect.kernel.Ref.type
  13. val Resource: effect.kernel.Resource.type
  14. val Spawn: effect.kernel.GenSpawn.type
  15. val Sync: effect.kernel.Sync.type
  16. val Temporal: effect.kernel.GenTemporal.type
  17. val Unique: effect.kernel.Unique.type
  18. object ExitCode extends Serializable
  19. object IO extends IOCompanionPlatform with IOLowPriorityImplicits
  20. object IOApp
  21. object IOLocal
  22. object LiftIO
  23. object SyncIO extends SyncIOCompanionPlatform with SyncIOLowPriorityImplicits
  24. object implicits extends AllSyntax with AllInstances

Inherited from AnyRef

Inherited from Any

Ungrouped