Tuple2

Tuple2.Left and Tuple2.Right are Projection stages for Scala's standard scala.Tuple2 type. Each extracts one element of a pair (A, B) and always yields Yield.Some with Status.Success, because a tuple always has both elements present.

Use Tuple2.Left[T] and Tuple2.Right[T] to obtain a typed Projection[(T, ?), T] or Projection[(?, T), T] respectively.

import h8io.stages.projections.*
Tuple2.Left[String](("hello", 42))
// res0: h8io.stages.Yield[(String, ?$2), String, Nothing] = Some(
//   out = "hello",
//   status = Success,
//   evolution = <function1>
// )
Tuple2.Right[Int](("hello", 42))
// res1: h8io.stages.Yield[(?$5, Int), Int, Nothing] = Some(
//   out = 42,
//   status = Success,
//   evolution = <function1>
// )