Packages

  • package root
    Definition Classes
    root
  • package zio
    Definition Classes
    root
  • package test

    _ZIO Test_ is a featherweight testing library for effectful programs.

    _ZIO Test_ is a featherweight testing library for effectful programs.

    The library imagines every spec as an ordinary immutable value, providing tremendous potential for composition. Thanks to tight integration with ZIO, specs can use resources (including those requiring disposal), have well- defined linear and parallel semantics, and can benefit from a host of ZIO combinators.

    import zio.test._
    import zio.Clock.nanoTime
    import Assertion.isGreaterThan
    
    object MyTest extends DefaultRunnableSpec {
      def spec = suite("clock")(
        test("time is non-zero") {
          for {
            time <- Live.live(nanoTime)
          } yield assertTrue(time >= 0)
        }
      )
    }
    Definition Classes
    zio
  • package laws

    The laws package provides functionality for describing laws as values.

    The laws package provides functionality for describing laws as values. The fundamental abstraction is a set of ZLaws[Caps, R]. These laws model the laws that instances having a capability of type Caps are expected to satisfy. A capability Caps[_] is an abstraction describing some functionality that is common across different data types and obeys certain laws. For example, we can model the capability of two values of a type being compared for equality as follows:

    trait Equal[-A] {
      def equal(a1: A, a2: A): Boolean
    }

    Definitions of equality are expected to obey certain laws:

    1. Reflexivity - a1 === a1
    2. Symmetry - a1 === a2 ==> a2 === a1
    3. Transitivity - (a1 === a2) && (a2 === a3) ==> (a1 === a3)

    These laws define what the capabilities mean and ensure that it is safe to abstract across different instances with the same capability.

    Using ZIO Test, we can represent these laws as values. To do so, we define each law using one of the ZLaws constructors. For example:

    val transitivityLaw = ZLaws.Laws3[Equal]("transitivityLaw") {
      def apply[A: Equal](a1: A, a2: A, a3: A): TestResult =
        ???
    }

    We can then combine laws using the + operator:

    val reflexivityLaw: = ???
    val symmetryLaw:    = ???
    
    val equalLaws = reflexivityLaw + symmetryLaw + transitivityLaw

    Laws have a run method that takes a generator of values of type A and checks that those values satisfy the laws. In addition, objects can extend ZLawful to provide an even more convenient syntax for users to check that instances satisfy certain laws.

    object Equal extends Lawful[Equal]
    
    object Hash extends Lawful[Hash]
    
    object Ord extends Lawful[Ord]
    
    checkAllLaws(Equal + Hash + Ord)(Gen.int)

    Note that capabilities compose seamlessly because of contravariance. We can combine laws describing different capabilities to construct a set of laws requiring that instances having all of the capabilities satisfy each of the laws.

    Definition Classes
    test
  • GenF
  • GenF2
  • LawfulF
  • LawfulF2
  • Laws
  • Laws2
  • LawsF
  • LawsF2
  • ZLawful
  • ZLawful2
  • ZLawfulF
  • ZLawfulF2
  • ZLaws
  • ZLaws2
  • ZLawsF
  • ZLawsF2

object GenF2 extends FunctionVariants

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. GenF2
  2. FunctionVariants
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  9. final def function[R, A, B](gen: Gen[R, B])(implicit trace: ZTraceElement): Gen[R, (A) => B]

    Constructs a generator of functions from A to B given a generator of B values.

    Constructs a generator of functions from A to B given a generator of B values. Two A values will be considered to be equal, and thus will be guaranteed to generate the same B value, if they have the same hashCode.

    Definition Classes
    FunctionVariants
  10. val function1: GenF2[Random, Function1]

    A generator of Function1 A => B values.

  11. final def function2[R, A, B, C](gen: Gen[R, C])(implicit trace: ZTraceElement): Gen[R, (A, B) => C]

    A version of function that generates functions that accept two parameters.

    A version of function that generates functions that accept two parameters.

    Definition Classes
    FunctionVariants
  12. final def function3[R, A, B, C, D](gen: Gen[R, D])(implicit trace: ZTraceElement): Gen[R, (A, B, C) => D]

    A version of function that generates functions that accept three parameters.

    A version of function that generates functions that accept three parameters.

    Definition Classes
    FunctionVariants
  13. final def function4[R, A, B, C, D, E](gen: Gen[R, E])(implicit trace: ZTraceElement): Gen[R, (A, B, C, D) => E]

    A version of function that generates functions that accept four parameters.

    A version of function that generates functions that accept four parameters.

    Definition Classes
    FunctionVariants
  14. final def functionWith[R, A, B](gen: Gen[R, B])(hash: (A) => Int)(implicit trace: ZTraceElement): Gen[R, (A) => B]

    Constructs a generator of functions from A to B given a generator of B values and a hashing function for A values.

    Constructs a generator of functions from A to B given a generator of B values and a hashing function for A values. Two A values will be considered to be equal, and thus will be guaranteed to generate the same B value, if they have have the same hash. This is useful when A does not implement hashCode in a way that is consistent with equality.

    Definition Classes
    FunctionVariants
  15. final def functionWith2[R, A, B, C](gen: Gen[R, C])(hash: (A, B) => Int)(implicit trace: ZTraceElement): Gen[R, (A, B) => C]

    A version of functionWith that generates functions that accept two parameters.

    A version of functionWith that generates functions that accept two parameters.

    Definition Classes
    FunctionVariants
  16. final def functionWith3[R, A, B, C, D](gen: Gen[R, D])(hash: (A, B, C) => Int)(implicit trace: ZTraceElement): Gen[R, (A, B, C) => D]

    A version of functionWith that generates functions that accept three parameters.

    A version of functionWith that generates functions that accept three parameters.

    Definition Classes
    FunctionVariants
  17. final def functionWith4[R, A, B, C, D, E](gen: Gen[R, E])(hash: (A, B, C, D) => Int)(implicit trace: ZTraceElement): Gen[R, (A, B, C, D) => E]

    A version of functionWith that generates functions that accept four parameters.

    A version of functionWith that generates functions that accept four parameters.

    Definition Classes
    FunctionVariants
  18. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  19. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  20. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  21. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  23. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  24. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  25. def toString(): String
    Definition Classes
    AnyRef → Any
  26. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  27. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  28. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from FunctionVariants

Inherited from AnyRef

Inherited from Any

Ungrouped