Skip to content

Commit

Permalink
reader contravariant on input (#2922)
Browse files Browse the repository at this point in the history
  • Loading branch information
kklorenzotesta authored and kailuowang committed Jun 28, 2019
1 parent 9c2371a commit 8387863
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/data/Kleisli.scala
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ final case class Kleisli[F[_], -A, B](run: A => F[B]) { self =>
def tapWithF[C, AA <: A](f: (AA, B) => F[C])(implicit F: FlatMap[F]): Kleisli[F, AA, C] =
Kleisli(a => F.flatMap(run(a))(b => f(a, b)))

def toReader[AA <: A]: Reader[AA, F[B]] = Kleisli[Id, AA, F[B]](run)
def toReader: Reader[A, F[B]] = Kleisli[Id, A, F[B]](run)

def apply(a: A): F[B] = run(a)
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/cats/data/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ package object data {
type NonEmptyChain[+A] = NonEmptyChainImpl.Type[A]
val NonEmptyChain = NonEmptyChainImpl

type ReaderT[F[_], A, B] = Kleisli[F, A, B]
type ReaderT[F[_], -A, B] = Kleisli[F, A, B]
val ReaderT = Kleisli

type Reader[A, B] = ReaderT[Id, A, B]
type Reader[-A, B] = ReaderT[Id, A, B]

object Reader {
def apply[A, B](f: A => B): Reader[A, B] = ReaderT[Id, A, B](f)
Expand Down

0 comments on commit 8387863

Please sign in to comment.