forProduct2<A, B, C> static method

Codec<A> forProduct2<A, B, C>(
  1. Codec<B> codecB,
  2. Codec<C> codecC,
  3. A apply(
    1. B,
    2. C
    ),
  4. Tuple2<B, C> tupled(
    1. A
    ),
)

/////////////////////////////////////////////////////////////////////////// /////////////////////////////// ProductN ////////////////////////////////// ///////////////////////////////////////////////////////////////////////////

Implementation

static Codec<A> forProduct2<A, B, C>(
  Codec<B> codecB,
  Codec<C> codecC,
  A Function(B, C) apply,
  Tuple2<B, C> Function(A) tupled,
) =>
    Codec(
      Decoder.forProduct2(codecB.decoder, codecC.decoder, apply),
      Encoder.forProduct2(codecB.encoder, codecC.encoder, tupled),
    );