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 abstract class ExitStatus extends Serializable with Product

    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 extends Serializable

    Permalink
  5. val YieldMaxOpCount: Int

    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
  6. final def asInstanceOf[T0]: T0

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def defaultHandler: (Cause[Any]) ⇒ 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
  9. final def eq(arg0: AnyRef): Boolean

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

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

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

    Permalink

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

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

    Permalink
    Definition Classes
    AnyRef
  17. 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
  18. final def notify(): Unit

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

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

    Permalink
    Definition Classes
    RTS
  21. lazy val scheduledExecutor: ScheduledExecutorService

    Permalink

    The thread pool for scheduling timed tasks.

    The thread pool for scheduling timed tasks.

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

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

    Permalink
    Definition Classes
    AnyRef
  24. val threadPool: ExecutorService

    Permalink

    The main thread pool used for executing fibers.

    The main thread pool used for executing fibers.

    Definition Classes
    RTS
  25. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  26. 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
  27. final def unsafeRunAsync[E, A](io: IO[E, A])(k: Callback[E, A]): Unit

    Permalink
    Definition Classes
    RTS
  28. 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
  29. final def unsafeShutdownAndWait(timeout: Duration): Unit

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

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

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

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

Inherited from RTS

Inherited from AnyRef

Inherited from Any

Ungrouped