-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Implement OptionT#foreachF
#4015
Conversation
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.
Looks good and reasonable to me, thanks.
Would it be too much trouble to add a sort of "stabilizing" test case to OptionTSutie
please? I don't really think it is absolutely necessary here, but I believe it is always nice to have.
Just an idea: would you consider by chance to add a similar |
Thanks, yes I can add a test, sorry for being lazy :) what do you mean by "stabilizing"? I was thinking a prop testing its identity with Regarding |
I just meant although the implementation seems straightforward, but it might be useful to "pin" it to make sure it won't be accidentally broken in the future. The Prop based test you mentioned would be just great.
Agree, that makes sense to me. |
* Transform this `OptionT[F, A]` into a `F[Unit]`. | ||
* This is identical to `foldF(F.unit)(f)`. | ||
*/ | ||
def foreachF[B](f: A => F[Unit])(implicit F: Monad[F]): F[Unit] = |
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.
side note, this foldMap
where B =:= F[Unit]
. But I think we can't implicitly resolve Monoid[F[A]]
given F[_]: Applicative
(since I don't think that resolves without additional imports).
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.
Interesting note!
* Transform this `OptionT[F, A]` into a `F[Unit]`. | ||
* This is identical to `foldF(F.unit)(f)`. | ||
*/ | ||
def foreachF[B](f: A => F[Unit])(implicit F: Monad[F]): F[Unit] = |
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.
B
type parameter is unused. Can we remove it?
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.
Oops, right. Thanks.
def foreachF[B](f: A => F[Unit])(implicit F: Monad[F]): F[Unit] = | |
def foreachF(f: A => F[Unit])(implicit F: Monad[F]): F[Unit] = |
Co-authored-by: P. Oscar Boykin <johnynek@users.noreply.github.com>
No description provided.