Skip to content

Commit

Permalink
Use kind projector syntax for liftK
Browse files Browse the repository at this point in the history
  • Loading branch information
SystemFw committed Nov 22, 2017
1 parent 49208e0 commit c7f2e99
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 19 deletions.
4 changes: 1 addition & 3 deletions core/src/main/scala/cats/data/EitherT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,7 @@ object EitherT extends EitherTInstances {
* }}}
*/
final def liftK[F[_], A](implicit F: Functor[F]): F ~> EitherT[F, A, ?] =
new (F ~> EitherT[F, A, ?]) {
def apply[B](fb: F[B]): EitherT[F, A, B] = right(fb)
}
λ[F ~> EitherT[F, A, ?]](right(_))

@deprecated("Use EitherT.liftF.", "1.0.0-RC1")
final def liftT[F[_], A, B](fb: F[B])(implicit F: Functor[F]): EitherT[F, A, B] = right(fb)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,7 @@ private[data] sealed trait CommonIRWSTConstructors {
* }}}
*/
def liftK[F[_], E, L, S](implicit F: Applicative[F], L: Monoid[L]): F ~> IndexedReaderWriterStateT[F, E, L, S, S, ?] =
new (F ~> IndexedReaderWriterStateT[F, E, L, S, S, ?]) {
def apply[A](fa: F[A]): IndexedReaderWriterStateT[F, E, L, S, S, A] = IndexedReaderWriterStateT.liftF(fa)
}
λ[F ~> IndexedReaderWriterStateT[F, E, L, S, S, ?]](IndexedReaderWriterStateT.liftF(_))

@deprecated("Use liftF instead", "1.0.0")
def lift[F[_], E, L, S, A](fa: F[A])(implicit F: Applicative[F], L: Monoid[L]): IndexedReaderWriterStateT[F, E, L, S, S, A] =
Expand Down
4 changes: 1 addition & 3 deletions core/src/main/scala/cats/data/IndexedStateT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,7 @@ private[data] trait CommonStateTConstructors {
* }}}
*/
def liftK[F[_], S](implicit F: Applicative[F]): F ~> IndexedStateT[F, S, S, ?] =
new (F ~> IndexedStateT[F, S, S, ?]) {
def apply[A](fa: F[A]): IndexedStateT[F, S, S, A] = IndexedStateT.liftF(fa)
}
λ[F ~> IndexedStateT[F, S, S, ?]](IndexedStateT.liftF(_))

@deprecated("Use liftF instead", "1.0.0")
def lift[F[_], S, A](fa: F[A])(implicit F: Applicative[F]): IndexedStateT[F, S, S, A] =
Expand Down
6 changes: 2 additions & 4 deletions core/src/main/scala/cats/data/Kleisli.scala
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,8 @@ private[data] sealed trait KleisliFunctions {
* res0: Option[Int] = Some(1)
* }}}
*/
def liftK[F[_], A]: F ~> Kleisli[F, A, ?] = new (F ~> Kleisli[F, A, ?]) {
def apply[B](x: F[B]): Kleisli[F, A, B] =
Kleisli(_ => x)
}
def liftK[F[_], A]: F ~> Kleisli[F, A, ?] =
λ[F ~> Kleisli[F, A, ?]](Kleisli.liftF(_))

@deprecated("Use liftF instead", "1.0.0")
def lift[F[_], A, B](x: F[B]): Kleisli[F, A, B] =
Expand Down
5 changes: 2 additions & 3 deletions core/src/main/scala/cats/data/OptionT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,8 @@ object OptionT extends OptionTInstances {
* res0: Option[Either[String,Int]] = Some(Right(1))
* }}}
*/
def liftK[F[_]](implicit F: Functor[F]): F ~> OptionT[F, ?] = new (F ~> OptionT[F, ?]) {
def apply[A](fa: F[A]): OptionT[F, A] = OptionT.liftF(fa)
}
def liftK[F[_]](implicit F: Functor[F]): F ~> OptionT[F, ?] =
λ[F ~> OptionT[F, ?]](OptionT.liftF(_))
}

private[data] sealed abstract class OptionTInstances extends OptionTInstances0 {
Expand Down
4 changes: 1 addition & 3 deletions core/src/main/scala/cats/data/WriterT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ object WriterT extends WriterTInstances with WriterTFunctions {
* }}}
*/
def liftK[F[_], L](implicit monoidL: Monoid[L], F: Applicative[F]): F ~> WriterT[F, L, ?] =
new (F ~> WriterT[F, L, ?]) {
def apply[V](fa: F[V]): WriterT[F, L, V] = WriterT.liftF(fa)
}
λ[F ~> WriterT[F, L, ?]](WriterT.liftF(_))

@deprecated("Use liftF instead", "1.0.0")
def lift[F[_], L, V](fv: F[V])(implicit monoidL: Monoid[L], F: Applicative[F]): WriterT[F, L, V] =
Expand Down

0 comments on commit c7f2e99

Please sign in to comment.