-
-
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 MonadTrans typeclass #844
Conversation
Current coverage is
|
} | ||
|
||
object MonadTrans { | ||
def apply[MT[_[_], _]](implicit MT: MonadTrans[MT]) = MT |
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.
Missing return type
Looks good. I just left a couple very minor comments. I think we could also have instances for Kleisli and StateT, though that could be a separate PR. |
|
||
implicit val optionTMonadTrans: MonadTrans[OptionT] = new MonadTrans[OptionT] { | ||
def liftM[M[_], A](ma: M[A])(implicit M: Monad[M]): OptionT[M, A] = | ||
OptionT(M.map(ma)(Some.apply)) |
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.
I think this could just delegate to liftF
I think that I'm pondering whether it might make sense to have something like |
Hmm I'm confused by this. Your branch seems to not have the latest from master, so |
@ceedubs Travis CI will use GitHub's merge commit, which in this case is ece069f, which has 7c9c209 for a parent and includes the |
Thanks @travisbrown. It works fine if I merge in the latest from master. I tried out my idea and I think it looks like it could work. I'll probably submit a PR (maybe to Stew's branch) tomorrow for discussion. |
thanks @stew, this helped me finally understand MonadTrans. |
This is similar to MonadTrans in scalaz. It allows you to lift a Monad into a transformer wrapping that monad
I skipped Hoist, since I've never seen that actually used in the wild.
I was shamed into doing this by @djspiewak :)