Console

trait Console[F[_]]

Effect type agnostic Console with common methods to write to and read from the standard console. Suited only for extremely simple console input and output.

Example:
import cats.Monad
import cats.effect.std.Console
import cats.syntax.all._
def myProgram[F[_]: Console: Monad]: F[Unit] =
  for {
    _ <- Console[F].println("Please enter your name: ")
    n <- Console[F].readLine
    _ <- if (n.nonEmpty) Console[F].println("Hello, " + n) else Console[F].errorln("Name is empty!")
  } yield ()
Companion:
object
class Object
trait Matchable
class Any

Value members

Abstract methods

def error[A](a: A)(implicit S: Show[A]): F[Unit]
Implicitly added by catsKleisliConsole
def error[A](a: A)(implicit S: Show[A]): F[Unit]
def errorln[A](a: A)(implicit S: Show[A]): F[Unit]
Implicitly added by catsKleisliConsole
def errorln[A](a: A)(implicit S: Show[A]): F[Unit]
def println[A](a: A)(implicit S: Show[A]): F[Unit]
Implicitly added by catsKleisliConsole
def println[A](a: A)(implicit S: Show[A]): F[Unit]

Concrete methods

def mapK[G[_]](f: FunctionK[F, G]): Console[G]
Implicitly added by catsKleisliConsole
def mapK[G[_]](f: FunctionK[F, G]): Console[G]
Implicitly added by catsKleisliConsole

Deprecated methods

@deprecated("Not implemented for Scala.js. On Node.js consider using fs2.io.stdin.", "3.4.0")
Implicitly added by catsKleisliConsole
Deprecated
@deprecated("Not implemented for Scala.js. On Node.js consider using fs2.io.stdin.", "3.4.0")
Deprecated
@deprecated("Not implemented for Scala.js. On Node.js consider using fs2.io.stdin.", "3.4.0")
def readLineWithCharset(charset: Charset): F[String]
Implicitly added by catsKleisliConsole
Deprecated
@deprecated("Not implemented for Scala.js. On Node.js consider using fs2.io.stdin.", "3.4.0")
def readLineWithCharset(charset: Charset): F[String]
Deprecated