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 a more direct tailRecM law #1953

Merged
merged 1 commit into from
Oct 7, 2017
Merged

Add a more direct tailRecM law #1953

merged 1 commit into from
Oct 7, 2017

Conversation

johnynek
Copy link
Contributor

@johnynek johnynek commented Oct 7, 2017

I noticed you can implement flatMap from tailRecM and map. This gives a more direct law for flatMap rather than the limited A, A => F[A] iterated law that we have currently (since we can take F[A] and A => F[B] we have less structure on the input, so it is a stronger law.

I'd like to add this even though it shouldn't increase test coverage or currently find any bugs, it is a nice documentation of thinking about tailRecM which I continue to think of as a very important method for FlatMap/Monad when thinking about implementations which use bounded stack such as the scala on the jvm.

@codecov-io
Copy link

codecov-io commented Oct 7, 2017

Codecov Report

Merging #1953 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1953      +/-   ##
==========================================
+ Coverage   96.13%   96.14%   +<.01%     
==========================================
  Files         273      273              
  Lines        4530     4535       +5     
  Branches      116      117       +1     
==========================================
+ Hits         4355     4360       +5     
  Misses        175      175
Impacted Files Coverage Δ
...main/scala/cats/laws/discipline/FlatMapTests.scala 100% <100%> (ø) ⬆️
laws/src/main/scala/cats/laws/FlatMapLaws.scala 100% <100%> (ø) ⬆️

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 9ae4dc4...7dc7ef6. Read the comment docs.

Copy link
Contributor

@adelbertc adelbertc left a comment

Choose a reason for hiding this comment

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

Pretty cool, 👍 !

Copy link
Member

@LukaJCB LukaJCB left a comment

Choose a reason for hiding this comment

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

Great idea!

@LukaJCB
Copy link
Member

LukaJCB commented Oct 7, 2017

Merging with two sign-offs :)

@LukaJCB LukaJCB merged commit 29faf62 into master Oct 7, 2017
@stew stew removed the in progress label Oct 7, 2017
@kailuowang kailuowang deleted the oscar/tailrec-law branch October 10, 2017 18:45
@kailuowang kailuowang added this to the 1.0.0-RC1 milestone Oct 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants