Skip to content

Adds monad laws and a tool to check them #543

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

Merged
merged 29 commits into from
Aug 30, 2020
Merged

Adds monad laws and a tool to check them #543

merged 29 commits into from
Aug 30, 2020

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Aug 8, 2020

Tada! 🎉

TODOs for later:

  • add hypothesis to dev dependencies
  • add docs for contrib.hypothesis
  • test all possible arguments to check_all_laws
  • add laws for applicative and bindable
  • add type tests for SupportsEquality
  • add tests for .equals()
  • add equals to all containers that can be compared
  • add type tests for check_all_laws
  • test .laws() method resolution for different types
  • fix typesafety/test_interfaces/test_iterable/test_inheritance.yml
  • add IOBasedN tests

New laws to implement:

Closes #533
Closes #564
Closes #563
Closes #541
Closes #542

@sobolevn
Copy link
Member Author

sobolevn commented Aug 8, 2020

Ok, it is better to switch to https://hypothesis.readthedocs.io/en/latest/data.html#hypothesis.strategies.builds and create custom strategies for our internal types. We would need https://hypothesis.readthedocs.io/en/latest/data.html#hypothesis.strategies.register_type_strategy for it.

@sobolevn sobolevn changed the title WIP: adds first monad laws and a tool to check them WIP: adds monad laws and a tool to check them Aug 26, 2020
Copy link
Contributor

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

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

This is about all I have time for, but nothing stands out as problematic. Good luck!

@sobolevn
Copy link
Member Author

@Zac-HD Thanks a lot for your help! 👍

@codecov
Copy link

codecov bot commented Aug 29, 2020

Codecov Report

Merging #543 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            master      #543    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           77        81     +4     
  Lines         1600      1765   +165     
  Branches       103       122    +19     
==========================================
+ Hits          1600      1765   +165     
Impacted Files Coverage Δ
returns/_internal/futures/_future.py 100.00% <ø> (ø)
returns/_internal/futures/_future_result.py 100.00% <ø> (ø)
returns/_internal/futures/_reader_future_result.py 100.00% <ø> (ø)
returns/_internal/iterable.py 100.00% <ø> (ø)
returns/_internal/pipeline/flow.py 100.00% <ø> (ø)
returns/_internal/pipeline/managed.py 100.00% <ø> (ø)
returns/interfaces/specific/ioresult.py 100.00% <ø> (ø)
returns/_internal/pipeline/pipe.py 100.00% <100.00%> (ø)
returns/context/requires_context.py 100.00% <100.00%> (ø)
returns/context/requires_context_future_result.py 100.00% <100.00%> (ø)
... and 22 more

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 f144aff...5a2a682. Read the comment docs.

@sobolevn sobolevn merged commit be6cb8b into master Aug 30, 2020
@sobolevn sobolevn deleted the issue-533 branch August 30, 2020 17:30
@sobolevn sobolevn changed the title WIP: adds monad laws and a tool to check them Adds monad laws and a tool to check them Aug 30, 2020
This was referenced Aug 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants