Trait

scalaz.zio

App

Related Doc: package zio

Permalink

trait App extends RTS

The entry point for a purely-functional application on the JVM.

import java.io.IOException
import scalaz.zio.{App, IO}
import scalaz.zio.console._

object MyApp extends App {

  def run(args: List[String]): IO[Nothing, ExitStatus] =
    myAppLogic.attempt.map(_.fold(_ => 1, _ => 0)).map(ExitStatus.ExitNow(_))

  def myAppLogic: IO[IOException, Unit] =
    for {
      _ <- putStrLn("Hello! What is your name?")
      n <- getStrLn
      _ <- putStrLn("Hello, " + n + ", good to meet you!")
    } yield ()
}
Linear Supertypes
RTS, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. App
  2. RTS
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. sealed trait ExitStatus extends AnyRef

    Permalink

Abstract Value Members

  1. abstract def run(args: List[String]): IO[Nothing, ExitStatus]

    Permalink

    The main function of the application, which will be passed the command-line arguments to the program and has to return an IO with the errors fully handled.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. object ExitStatus

    Permalink
  5. val MaxResumptionDepth: Int

    Permalink

    This determines the maximum number of resumptions placed on the stack before a fiber is shifted over to a new thread to prevent stack overflow.

    This determines the maximum number of resumptions placed on the stack before a fiber is shifted over to a new thread to prevent stack overflow.

    Definition Classes
    RTS
  6. final val YieldMaxOpCount: Int(1048576)

    Permalink

    Determines the maximum number of operations executed by a fiber before yielding to other fibers.

    Determines the maximum number of operations executed by a fiber before yielding to other fibers.

    FIXME: Replace this entirely with the new scheme.

    Definition Classes
    RTS
  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def defaultHandler: (List[Throwable]) ⇒ IO[Nothing, Unit]

    Permalink

    The default handler for unhandled exceptions in the main fiber, and any fibers it forks that recursively inherit the handler.

    The default handler for unhandled exceptions in the main fiber, and any fibers it forks that recursively inherit the handler.

    Definition Classes
    RTS
  10. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  15. final def impureCanceler(canceler: PureCanceler): Canceler

    Permalink
    Definition Classes
    RTS
  16. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  17. final def main(args0: Array[String]): Unit

    Permalink

    The Scala main function, intended to be called only by the Scala runtime.

  18. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  19. def nonFatal(t: Throwable): Boolean

    Permalink

    Utility function to avoid catching truly fatal exceptions.

    Utility function to avoid catching truly fatal exceptions. Do not allocate memory here since this would defeat the point of checking for OOME.

    Attributes
    protected
    Definition Classes
    RTS
  20. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  22. final def schedule[E, A](block: ⇒ A, duration: Duration): Async[E, Unit]

    Permalink
    Definition Classes
    RTS
  23. lazy val scheduledExecutor: ScheduledExecutorService

    Permalink
    Definition Classes
    RTS
  24. final def submit[A](block: ⇒ A): Unit

    Permalink
    Definition Classes
    RTS
  25. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  26. val threadPool: ExecutorService

    Permalink

    The main thread pool used for executing fibers.

    The main thread pool used for executing fibers.

    Definition Classes
    RTS
  27. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  28. final def unsafeRun[E, A](io: IO[E, A]): A

    Permalink

    Effectfully and synchronously interprets an IO[E, A], either throwing an error, running forever, or producing an A.

    Effectfully and synchronously interprets an IO[E, A], either throwing an error, running forever, or producing an A.

    Definition Classes
    RTS
  29. final def unsafeRunAsync[E, A](io: IO[E, A])(k: Callback[E, A]): Unit

    Permalink
    Definition Classes
    RTS
  30. final def unsafeRunSync[E, A](io: IO[E, A]): ExitResult[E, A]

    Permalink

    Effectfully interprets an IO, blocking if necessary to obtain the result.

    Effectfully interprets an IO, blocking if necessary to obtain the result.

    Definition Classes
    RTS
  31. final def unsafeShutdownAndWait(timeout: Duration): Unit

    Permalink
    Definition Classes
    RTS
  32. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from RTS

Inherited from AnyRef

Inherited from Any

Ungrouped