Slide 41
Slide 41 text
Handling ResultSets
case class Person(id: Int, name: String, nickname: Option[String])
def personGet[F[_]: Monad]: Kleisli[F, ResultSet[F], Person] = for
id <- get[Int]("id")
name <- get[String]("name")
nickname <- get[Option[Stirng]]("nickname")
yield Person(id, name, nickname)
def personGet[F[_]: Applicative]: Kleisli[F, ResultSet[F], Person] =
(get[String]("id"),
get[String]("name"),
get("nickname")[Option[String]).mapN(Person.apply)