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 to Monad ifM example #1546

Merged
merged 1 commit into from
Mar 3, 2017
Merged

Conversation

sullivan-
Copy link
Contributor

I found this section pretty confusing, but cleared up my misunderstanding quickly in the console.
This extra line in the example might help make it clear to people what is going on.

@@ -112,6 +112,8 @@ statement into the monadic context.
import cats.implicits._

Monad[List].ifM(List(true, false, true))(List(1, 2), List(3, 4))

Monad[List].ifM(List(true, false, false))(List(1, 2), List(3, 4))
Copy link
Contributor

Choose a reason for hiding this comment

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

how about also adding names to parameters?
like

Monad[List].ifM(List(true, false, true))(ifTrue = List(1, 2), ifFalse = List(3, 4))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we did that I think we could leave out the extra example. I will add parameter names. Do you want me to pull the second example?

@sullivan-
Copy link
Contributor Author

I added param names, left the second example in. happy to adjust further.

I did a push -f here so a merge would only bring in one commit

@codecov-io
Copy link

codecov-io commented Mar 1, 2017

Codecov Report

Merging #1546 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1546   +/-   ##
=======================================
  Coverage   92.48%   92.48%           
=======================================
  Files         246      246           
  Lines        3885     3885           
  Branches      132      132           
=======================================
  Hits         3593     3593           
  Misses        292      292

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 91d8858...06cac41. Read the comment docs.

Monad[List].ifM(List(true, false, true))(List(1, 2), List(3, 4))
Monad[List].ifM(List(true, false, true))(ifTrue = List(1, 2), ifFalse = List(3, 4))

Monad[List].ifM(List(true, false, false))(ifTrue = List(1, 2), ifFalse = List(3, 4))
Copy link
Contributor

@kailuowang kailuowang Mar 1, 2017

Choose a reason for hiding this comment

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

I agree that with the parameter names, the second example looks redundant.

Copy link
Contributor

Choose a reason for hiding this comment

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

tend to agree, parameter names make it clear imo
i also was confused by the original example

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, i got rid of the extra line

I found this section pretty confusing, but cleared up my misunderstanding quickly in the console.
added param names per suggestions on PR.
@johnynek
Copy link
Contributor

johnynek commented Mar 3, 2017

👍

@peterneyens peterneyens merged commit ecdd27f into typelevel:master Mar 3, 2017
@kailuowang kailuowang modified the milestone: 1.0.0-MF Apr 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants