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 AboutApplicatives koan #6

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

t-rutten
Copy link

@t-rutten t-rutten commented May 5, 2023

Here's a brief demonstration of applicatives. I'm happy to include additional patterns reviewers may suggest.

@7h3kk1d was very helpful in pulling this together.

t-rutten and others added 5 commits April 29, 2023 15:32
zip embedded values with embedded functions
Co-authored-by: Alexander Bandukwala <7h3kk1d@gmail.com>
Co-authored-by: Alexander Bandukwala <7h3kk1d@gmail.com>
Co-authored-by: Alexander Bandukwala <7h3kk1d@gmail.com>
assertThat(right("World!").zip(right(getStringLength)), equalTo(__));
assertThat(Either.<String, String>left("whoops").zip(right(getStringLength)), equalTo(left(__)));

// Moving on to LambdaIterables, where "zipping" is more obvious
Copy link
Member

Choose a reason for hiding this comment

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

We might want to point out that LambdaIterable is a specific choice in terms of how to implement Zip for iterables. It could be pairwise or cross-product. Alternatively, it might be worth putting it in a separate "test" to make that explicit.

Copy link
Author

Choose a reason for hiding this comment

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

Added a comment about that possible alternative in 5d1d6da.

@7h3kk1d
Copy link
Member

7h3kk1d commented May 8, 2023

Thanks for the contribution! From a pedagogical standpoint, I wonder if it makes sense to introduce liftA2, liftA3, etc. higher up so we're not just covering it in the context of functions being applicative. I also think LambdaIterable being applicative can be confusing, so I'm conflicted if it should go higher/lower.

- reorder functionIsApplicative
- add assertion
- change type signature
- add timeout for applicativeRepresentsParallelism
- add comments
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.

None yet

2 participants