Concat

zio.blocks.combinators.Concat
See theConcat companion object
trait Concat[L, R]

Typeclass describing the element type produced by sequential concatenation of values of type L and R.

The derivation rules — implemented per platform — are:

  • same type: keep that type;
  • subtype + supertype: keep the supertype;
  • siblings sharing a unique meaningful common supertype (e.g. Dog and Cat extending sealed Animal): keep that supertype (a supertype is ''meaningful'' when it is not a noise type such as Any, AnyRef, AnyVal, Object, Product, or Serializable);
  • otherwise: widen disjoint values into Either[L, R] on Scala 2 (or produce the native union L | R on Scala 3).

Stream.concat uses isIdentityLike to decide whether it can reuse elements as-is or must wrap/project them through left and right.

Type parameters

L

left element type

R

right element type

Attributes

Companion
object
Source
Concat.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Type members

Types

type Out

Attributes

Source
Concat.scala

Value members

Abstract methods

def isIdentityLike: Boolean

True when both input sides can be viewed directly as Out without allocating wrapper values.

True when both input sides can be viewed directly as Out without allocating wrapper values.

Attributes

Returns

whether concat can reuse existing elements as the output type

Source
Concat.scala
def left(l: L): Out

Projects a left-side value into the concat output type.

Projects a left-side value into the concat output type.

Value parameters

l

left-side value

Attributes

Returns

the value represented as Out

Source
Concat.scala
def right(r: R): Out

Projects a right-side value into the concat output type.

Projects a right-side value into the concat output type.

Value parameters

r

right-side value

Attributes

Returns

the value represented as Out

Source
Concat.scala