-
Notifications
You must be signed in to change notification settings - Fork 71
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
Implement zipWith3 #163
base: master
Are you sure you want to change the base?
Implement zipWith3 #163
Conversation
I'm not super keen on this actually: if we add |
You can chain |
@hdgarrood Would you accept a PR for a generalized, fused |
Yes, that sounds great 👍 |
Yeah, that sounds like a much better solution. I'll hopefully have something by the end of day. |
@natefaubion I took a shot at implementing this and quickly realised that a law abiding
for any Do you have any suggestions for tackling that? I came up with slightly different semantics for zip that seems to make it possible to have both applicative and monad instances, and wrote up a sample implementation. This version of zip doesn't drop elements when one of the arrays is bigger than the other. Instead, it extends the shorter array by repeating its last element. As far as I can tell, this satisfies the applicative and monad laws, and is still useful. For example, you can zip together arrays of the same size and get results identical to regular zip. There are other constructions that I considered, but this one has the advantage of being a newtype over Arrays. Thoughts? |
No description provided.