Trait/Object

zio.prelude

These

Related Docs: object These | package prelude

Permalink

sealed trait These[+A, +B] extends AnyRef

These is a data type representing a value that may either be a Left with anA, a Right with a B, or a Both with an A and a B.

These can be useful to model certain domains where both values may be present in addition to one or the other. For example, in streaming applications we may want to consume values from two upstream producers concurrently. Depending on the timing of the producers either one producer, the other, or both producers may have values that are ready to be consumed. Using These provides a convenient way to model all of these possibilities in a single "flat" data type.

These can also be useful for representing computations that may produce both a value and an error. For example, transferring money between two bank accounts might either succeed, fail completely if there are not sufficient funds, or succeed with some warnings if the sender's account balance would be very low after the transfer or the receiver's account has not been verified. These allows modeling these types of computations and preserving information regarding all errors while still potentially returning a successful computation.

Self Type
These[A, B]
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. These
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

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 &>[A1 >: A, C](that: These[A1, C])(implicit arg0: Commutative[A1]): These[A1, C]

    Permalink

    A symbolic alias for zipParRight.

  4. final def *>[A1 >: A, C](that: These[A1, C])(implicit arg0: Associative[A1]): These[A1, C]

    Permalink

    A symbolic alias for zipRight.

  5. final def <&[A1 >: A, C](that: These[A1, C])(implicit arg0: Commutative[A1]): These[A1, B]

    Permalink

    A symbolic alias for zipParLeft.

  6. final def <&>[A1 >: A, C](that: These[A1, C])(implicit arg0: Commutative[A1]): These[A1, (B, C)]

    Permalink

    A symbolic alias for zipPar.

  7. final def <*[A1 >: A, C](that: These[A1, C])(implicit arg0: Associative[A1]): These[A1, B]

    Permalink

    A symbolic alias for zipLeft.

  8. final def <*>[A1 >: A, C](that: These[A1, C])(implicit arg0: Associative[A1]): These[A1, (B, C)]

    Permalink

    A symbolic alias for zip.

  9. final def <+>[A1 >: A, C](that: ⇒ These[A1, C])(implicit arg0: Associative[A1]): These[A1, Either[B, C]]

    Permalink

    A symbolic alias for orElseEither.

  10. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  11. final def >>=[A1 >: A, C](f: (B) ⇒ These[A1, C])(implicit arg0: Associative[A1]): These[A1, C]

    Permalink

    A symbolic alias for flatMap.

  12. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  13. final def bimap[A2, C](f: (A) ⇒ A2, g: (B) ⇒ C): These[A2, C]

    Permalink

    Transforms both the A value and the B value with the specified functions f and g.

  14. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  15. final def eq(arg0: AnyRef): Boolean

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

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. final def flatMap[A1 >: A, C](f: (B) ⇒ These[A1, C])(implicit arg0: Associative[A1]): These[A1, C]

    Permalink

    Returns a new computation based on the successful result of this computation.

    Returns a new computation based on the successful result of this computation. If this computation contains a success the new computation will be performed, even if this computation also contains errors. Any errors produced by the two computations will be combined using the Associative instance for A. If this computation does not contain a success then the original failure will be returned unchanged.

  19. final def flatten[A1 >: A, C](implicit ev: <:<[B, These[A1, C]], ev2: Associative[A1]): These[A1, C]

    Permalink

    Flattens a nested These computation to a single level.

  20. final def flip: These[B, A]

    Permalink

    Flips the left and right values.

  21. final def fold[C](left: (A) ⇒ C, right: (B) ⇒ C)(both: (A, B) ⇒ C): C

    Permalink

    Folds each of the possibile cases into a summary value.

  22. final def forEach[F[+_], C](f: (B) ⇒ F[C])(implicit arg0: IdentityBoth[F], arg1: Covariant[F]): F[These[A, C]]

    Permalink

    Transforms the successful result of this compuation with the specified effectual function, leaving any error value unchanged.

  23. final def getClass(): Class[_]

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

    Permalink
    Definition Classes
    AnyRef → Any
  25. final def isBoth: Boolean

    Permalink

    Returns whether this value is a Both.

  26. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  27. final def isLeft: Boolean

    Permalink

    Returns whether this value is a Left.

  28. final def isRight: Boolean

    Permalink

    Returns whether this value is a Right.

  29. final def map[C](f: (B) ⇒ C): These[A, C]

    Permalink

    Transforms the B value with the specified function.

  30. final def mapLeft[A2](f: (A) ⇒ A2): These[A2, B]

    Permalink

    Transforms the A value with the specified function.

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

    Permalink
    Definition Classes
    AnyRef
  32. final def notify(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  34. final def orElse[A1 >: A, B1 >: B](that: ⇒ These[A1, B1])(implicit arg0: Associative[A1]): These[A1, B1]

    Permalink
  35. final def orElseEither[A1 >: A, C](that: ⇒ These[A1, C])(implicit arg0: Associative[A1]): These[A1, Either[B, C]]

    Permalink
  36. def reduceMap[C](f: (A) ⇒ C, g: (B) ⇒ C)(implicit C: Associative[C]): C

    Permalink
  37. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  38. final def toEither: Either[A, B]

    Permalink

    Converts this value to an Either containing a Right if this value contains a success or a Left otherwise, discarding information about any errors in the case of success.

  39. final def toOption: Option[B]

    Permalink

    Converts this value to an Option containing Some if this value contains a success or None otherwise, discarding information about any errors in the case of success.

  40. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  41. final def toValidation: Validation[A, B]

    Permalink

    Converts this value to a validation success if this value contains a success or a validation failure otherwise, discarding information about any errors in the case of success.

  42. final def toValidationNonEmptyChunk[A1](implicit ev: <:<[A, NonEmptyChunk[A1]]): Validation[A1, B]

    Permalink

    Converts this value to a validation success if this value contains a success or a validation failure otherwise, submerging multiple errors into the structure of the validation and discarding information about any errors in the case of success.

  43. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  46. final def zip[A1 >: A, C, D](that: These[A1, C])(implicit arg0: Associative[A1]): These[A1, (B, C)]

    Permalink

    Combines this computation sequentially with that computation, combining their results into a tuple.

    Combines this computation sequentially with that computation, combining their results into a tuple. If this computation does not return a success that computation will not be performed. If both computations are performed any errors will be combined using the Associative instance for A.

  47. final def zipLeft[A1 >: A, C, D](that: These[A1, C])(implicit arg0: Associative[A1]): These[A1, B]

    Permalink

    Combines this computation sequentially with that computation, returning only the left value.

    Combines this computation sequentially with that computation, returning only the left value. If this computation does not return a success that computation will not be performed. If both computations are performed any errors will be combined using the Associative instance for A.

  48. final def zipPar[A1 >: A, C, D](that: These[A1, C])(implicit arg0: Commutative[A1]): These[A1, (B, C)]

    Permalink

    Combines this computation with that computation into a tuple, performing both computations even if this computation does not return a success and combining any errors using the Commutative instance for A.

  49. final def zipParLeft[A1 >: A, C, D](that: These[A1, C])(implicit arg0: Commutative[A1]): These[A1, B]

    Permalink

    Combines this computation with that computation and returning only the left value, performing both computations even if this computation does not return a success and combining any errors using the Commutative instance for A.

  50. final def zipParRight[A1 >: A, C, D](that: These[A1, C])(implicit arg0: Commutative[A1]): These[A1, C]

    Permalink

    Combines this computation with that computation and returning only the right value, performing both computations even if this computation does not return a success and combining any errors using the Commutative instance for A.

  51. final def zipRight[A1 >: A, C, D](that: These[A1, C])(implicit arg0: Associative[A1]): These[A1, C]

    Permalink

    Combines this computation sequentially with that computation, returning only the right value.

    Combines this computation sequentially with that computation, returning only the right value. If this computation does not return a success that computation will not be performed. If both computations are performed any errors will be combined using the Associative instance for A.

  52. final def zipWith[A1 >: A, C, D](that: These[A1, C])(f: (B, C) ⇒ D)(implicit arg0: Associative[A1]): These[A1, D]

    Permalink

    Combines this computation sequentially with that computation, combining their results with the specified function.

    Combines this computation sequentially with that computation, combining their results with the specified function. If this computation does not return a success that computation will not be performed. If both computations are performed any errors will be combined using the Associative instance for A.

  53. final def zipWithPar[A1 >: A, C, D](that: These[A1, C])(f: (B, C) ⇒ D)(implicit arg0: Commutative[A1]): These[A1, D]

    Permalink

    Combines this computation with that computation using the specified function, performing both computations even if this computation does not return a success and combining any errors using the Commutative instance for A.

Inherited from AnyRef

Inherited from Any

Ungrouped