Skip to content
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

Add convenient syntax for working with F[Either[E, A]] #169

Merged
merged 6 commits into from
Feb 26, 2020

Conversation

Ssstlis
Copy link
Member

@Ssstlis Ssstlis commented Feb 25, 2020

This PR resolve #149
I had some questions about documentation in source file and do i need to use helpers in tests or not?

F.lift(e)
}

def mergeF(implicit ev: L =:= R, F: Functor[F]): F[R] = {
Copy link
Contributor

@road21 road21 Feb 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def mergeF[A >: R](implicit ev: L <:< A, F: Functor[F]): F[A]?

F.flatMap(productF(eb))(_.traverse { case (r, r1) => f(r, r1) })
}

def mapK[G[_]](implicit F: ~>[F, G]): G[Either[L, R]] = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's a good idea to make natural transformation implicit.
Do we really need mapK and liftTo methods here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the last minute i became doubted about it but decided to left it. So, if it doesn't looks good enough i can cut it.

F.flatMap(e) {
case Right(right) => f(right)
case left @ Left(_) => F.pure(left.rightCast)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can keep just one method from doubleFlatMap, flatMapF

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, seems good

@Odomontois Odomontois added the enhancement New feature or request label Feb 26, 2020
@Odomontois Odomontois merged commit 79c03b8 into tofu-tf:master Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add convenient syntax for working with F[Either[E, A]]
3 participants