-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds a new LiftTrans typeclass #853
Conversation
This typeclass adds a `liftT` function which is similar to the liftM function on the scalaz MonadTrans typeclass, however this one takes into account that you might not need the power of a monad in order to be able to lift into a transformer, for example, we are able to Lift any M[A] into a Kleisli[M, B, A] regardless of whether or not M is a Monad, Functor, or any other such thing. Thish would be useful in cases where you are constructing an applicative computation using values for which you don't have a monad.
Current coverage is
|
package syntax | ||
|
||
trait TransLiftSyntax { | ||
implicit def transLiftSyntax[M[_], A](ma: M[A]): TransLiftOps[M, A] = new TransLiftOps(ma) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need an Unapply
version here?
Excellent work, @stew. This is better than what I came up with yesterday and was planning on submitting via PR today. 👍 in general. I left some minor comments that don't necessarily need to be addressed in this PR. |
I'm stuck on getting this to work for Validation. I'd love for other ideas, or to see what @ceedubs has on this, or just merge this and say "tough luck, more type lambdas" to people ;) |
What's Validation? ;) My current inclination is to merge this and say "tough luck, more type lambdas". But I'm also interested in exploring a bit more in this area. I'd say 👍 for a merge but we shouldn't feel set in stone on this approach. |
👍 , leaving |
Adds a new LiftTrans typeclass
This typeclass adds a
liftT
function which is similar to the liftMfunction on the scalaz MonadTrans typeclass, however this one takes into
account that you might not need the power of a monad in order to be able
to lift into a transformer, for example, we are able to Lift any M[A]
into a Kleisli[M, B, A] regardless of whether or not M is a Monad,
Functor, or any other such thing. Thish would be useful in cases where
you are constructing an applicative computation using values for which
you don't have a monad.