Skip to content

Commit

Permalink
Kleisli natural transformation
Browse files Browse the repository at this point in the history
  • Loading branch information
adelbertc committed Jul 9, 2015
1 parent 4d582e8 commit cdd5520
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/src/main/scala/scalaz/Kleisli.scala
Expand Up @@ -49,6 +49,9 @@ final case class Kleisli[M[_], A, B](run: A => M[B]) { self =>
def lift[L[_]: Applicative]: Kleisli[λ[α => L[M[α]]], A, B] =
kleisli[λ[α => L[M[α]]], A, B](a => Applicative[L].point(self(a)))

def transform[N[_]](f: M ~> N): Kleisli[N, A, B] =
kleisli(a => f(run(a)))

def lower(implicit M: Monad[M]): Kleisli[M, A, M[B]] =
Kleisli(a => M.pure(this(a)))

Expand Down

0 comments on commit cdd5520

Please sign in to comment.