IO

object IO extends IOCompanionPlatform with IOLowPriorityImplicits
Companion
class
trait Sum
trait Mirror
trait IOLowPriorityImplicits
class IOCompanionPlatform
class Object
trait Matchable
class Any

Type members

Types

type Par[A] = T[[A] =>> IO[A], A]

Inherited classlikes

protected class IOSemigroup[A](val A: Semigroup[A])
Inhertied from
IOLowPriorityImplicits

Inherited types

type MirroredElemLabels <: Tuple
The names of the product elements
Inhertied from
Mirror
type MirroredLabel <: String
The name of the type
Inhertied from
Mirror

Value members

Methods

def apply[A](thunk: => A): IO[A]
def delay[A](thunk: => A): IO[A]
def defer[A](thunk: => IO[A]): IO[A]
def async[A](k: Either[Throwable, A] => Unit => IO[Option[IO[Unit]]]): IO[A]
def async_[A](k: Either[Throwable, A] => Unit => Unit): IO[A]
def canceled: IO[Unit]
def cede: IO[Unit]
def cont[K, R](body: Cont[[A] =>> IO[A], K, R]): IO[R]
This is a low-level API which is meant for implementors,
please use background, start, async, or Deferred instead,
depending on the use case
def executionContext: IO[ExecutionContext]
def monotonic: IO[FiniteDuration]
def never[A]: IO[A]
def parTraverseN[T <: ([_$21] =>> Any), A, B](n: Int)(ta: T[A])(f: A => IO[B])(evidence$3: Traverse[T]): IO[T[B]]
Like Parallel.parTraverse, but limits the degree of parallelism.
def parSequenceN[T <: ([_$22] =>> Any), A](n: Int)(tma: T[IO[A]])(evidence$4: Traverse[T]): IO[T[A]]
Like Parallel.parSequence, but limits the degree of parallelism.
def pure[A](value: A): IO[A]
def raiseError[A](t: Throwable): IO[A]
def realTime: IO[FiniteDuration]
def sleep(delay: FiniteDuration): IO[Unit]
def uncancelable[A](body: Poll[[A] =>> IO[A]] => IO[A]): IO[A]
def unit: IO[Unit]
def stub: IO[Nothing]
def bothOutcome[A, B](left: IO[A], right: IO[B]): IO[(OutcomeIO[A], OutcomeIO[B])]
def both[A, B](left: IO[A], right: IO[B]): IO[(A, B)]
def fromFuture[A](fut: IO[Future[A]]): IO[A]
def race[A, B](left: IO[A], right: IO[B]): IO[Either[A, B]]
def racePair[A, B](left: IO[A], right: IO[B]): IO[Either[(OutcomeIO[A], FiberIO[B]), (FiberIO[A], OutcomeIO[B])]]
def ref[A](a: A): IO[Ref[[A] =>> IO[A], A]]
def deferred[A]: IO[Deferred[[A] =>> IO[A], A]]
def bracketFull[A, B](acquire: Poll[[A] =>> IO[A]] => IO[A])(use: A => IO[B])(release: (A, OutcomeIO[B]) => IO[Unit]): IO[B]
def whenA(cond: Boolean)(action: => IO[Unit]): IO[Unit]
Returns the given argument if cond is true, otherwise IO.Unit
See also
IO.unlessA for the inverse
IO.raiseWhen for conditionally raising an error
def unlessA(cond: Boolean)(action: => IO[Unit]): IO[Unit]
Returns the given argument if cond is false, otherwise IO.Unit
See also
IO.whenA for the inverse
IO.raiseWhen for conditionally raising an error
def raiseWhen(cond: Boolean)(e: => Throwable): IO[Unit]
Returns raiseError when the cond is true, otherwise IO.unit
Example
{{{
val tooMany = 5
val x: Int = ???
IO.raiseWhen(x >= tooMany)(new IllegalArgumentException("Too many"))
}}}
def raiseUnless(cond: Boolean)(e: => Throwable): IO[Unit]
Returns raiseError when cond is false, otherwise IO.unit
Example
{{{
val tooMany = 5
val x: Int = ???
IO.raiseUnless(x < tooMany)(new IllegalArgumentException("Too many"))
}}}
def readLine: IO[String]
Reads a line as a string from the standard input using the platform's
default charset, as per java.nio.charset.Charset.defaultCharset().
The effect can raise a java.io.EOFException if no input has been consumed
before the EOF is observed. This should never happen with the standard
input, unless it has been replaced with a finite java.io.InputStream
through java.lang.System#setIn or similar.
Returns
an IO effect that describes reading the user's input from the
standard input as a string
See also
cats.effect.std.Console#readLineWithCharset for reading using a
custom java.nio.charset.Charset
def print[A](a: A)(S: Show[A]): IO[Unit]
Prints a value to the standard output using the implicit cats.Show
instance.
Value Params
a
value to be printed to the standard output
See also
cats.effect.std.Console for more standard input, output and error
operations
def println[A](a: A)(S: Show[A]): IO[Unit]
Prints a value to the standard output followed by a new line using the
implicit cats.Show instance.
Value Params
a
value to be printed to the standard output
See also
cats.effect.std.Console for more standard input, output and error
operations
def eval[A](fa: Eval[A]): IO[A]
def fromOption[A](o: Option[A])(orElse: => Throwable): IO[A]
def fromEither[A](e: Either[Throwable, A]): IO[A]
def fromTry[A](t: Try[A]): IO[A]

Inherited methods

def blocking[A](thunk: => A): IO[A]
Inhertied from
IOCompanionPlatform
def interruptible[A](many: Boolean)(thunk: => A): IO[A]
Inhertied from
IOCompanionPlatform
def suspend[A](hint: Type)(thunk: => A): IO[A]
Inhertied from
IOCompanionPlatform
def realTimeInstant: IO[Instant]
Inhertied from
IOCompanionPlatform
def fromCompletableFuture[A](fut: IO[CompletableFuture[A]]): IO[A]
Inhertied from
IOCompanionPlatform

Implicits

Implicits

implicit def showForIO[A](evidence$5: Show[A]): Show[IO[A]]
implicit def monoidForIO[A](evidence$6: Monoid[A]): Monoid[IO[A]]
implicit val semigroupKForIO: SemigroupK[[A] =>> IO[A]]
implicit def asyncForIO: Async[[A] =>> IO[A]]
implicit def parallelForIO: Aux[[A] =>> IO[A], [A] =>> Par[A]]
implicit val consoleForIO: Console[[A] =>> IO[A]]

Inherited implicits

implicit def showForIONoPure[A]: Show[IO[A]]
Inhertied from
IOLowPriorityImplicits
implicit def semigroupForIO[A](evidence$7: Semigroup[A]): Semigroup[IO[A]]
Inhertied from
IOLowPriorityImplicits