Skip to content

Commit

Permalink
Define OptionT.mapFilter in terms of OptionT.subflatMap (#2765)
Browse files Browse the repository at this point in the history
fixes #2757
  • Loading branch information
morgen-peschke authored and kailuowang committed Mar 28, 2019
1 parent 56a1339 commit 9479ce5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/data/OptionT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ final case class OptionT[F[_], A](value: F[Option[A]]) {
flatMap(a => OptionT.liftF(f(a)))

def mapFilter[B](f: A => Option[B])(implicit F: Functor[F]): OptionT[F, B] =
OptionT(F.map(value)(_.flatMap(f)))
subflatMap(f)

def flatMap[B](f: A => OptionT[F, B])(implicit F: Monad[F]): OptionT[F, B] =
flatMapF(a => f(a).value)
Expand Down

0 comments on commit 9479ce5

Please sign in to comment.