-
-
Save stephen-lazaro/3785146ff6300571be6871829d709906 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// We want to decode _multiple things_ from _one row_ | |
def combine[A, B](left: RowDecoder[A], right: RowDecoder[B]): RowDecoder[(A, B)] = ??? | |
// For example, if we wanted to decode a `Debtor` we want this to work: | |
final case class Debtor(id: Int, name: String) | |
// Whip up a decoder using the decoders of the fields! | |
val debtor: RowDecoder[Debtor] = combine(RowDecoder[Int], RowDecoder[String]).map(Debtor.apply) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment