Skip to content

Commit

Permalink
Merge pull request #1090 from tbrown1979/master
Browse files Browse the repository at this point in the history
Adding a way to create a Kleisli with just F[B]
  • Loading branch information
non committed Jun 8, 2016
2 parents e1a8257 + 08675c1 commit a315749
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/src/main/scala/cats/data/Kleisli.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ object Kleisli extends KleisliInstances with KleisliFunctions

private[data] sealed trait KleisliFunctions {

def lift[F[_], A, B](x: F[B]): Kleisli[F, A, B] =
Kleisli(_ => x)

def pure[F[_], A, B](x: B)(implicit F: Applicative[F]): Kleisli[F, A, B] =
Kleisli(_ => F.pure(x))

Expand Down Expand Up @@ -121,7 +124,7 @@ private[data] sealed abstract class KleisliInstances extends KleisliInstances0 {
new TransLift[Kleisli[?[_], A, ?]] {
type TC[M[_]] = Trivial

def liftT[M[_], B](ma: M[B])(implicit ev: Trivial): Kleisli[M, A, B] = Kleisli[M, A, B](a => ma)
def liftT[M[_], B](ma: M[B])(implicit ev: Trivial): Kleisli[M, A, B] = Kleisli.lift(ma)
}

implicit def catsDataApplicativeErrorForKleisli[F[_], A, E](implicit AE: ApplicativeError[F, E]): ApplicativeError[Kleisli[F, A, ?], E]
Expand Down

0 comments on commit a315749

Please sign in to comment.