-
Notifications
You must be signed in to change notification settings - Fork 371
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
Fix traversable laws #131
Fix traversable laws #131
Conversation
|
||
3. `u.map(Compose).sequence(Compose.of)` is equivalent to | ||
`Compose(u.sequence(f.of).map(x => x.sequence(g.of)))` (composition) | ||
for any `t` such that `t(x).map(a)` is equivalent to `t(x.map(a))` (naturality) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear here what x
is. Maybe we should rewrite it as "t(f.of(x)).map(a)
is equivalent to t(f.of(x).map(a))
"?
Rewrote Compose via Also GitHub for some reason hided previous comments on other parts of the diff, although I didn't touch those parts: |
@rpominov 👍 on the prototype stuff. |
This looks great! Thanks. |
While we're in here fixing this. Can we change the requirement to |
Oh, actually. I guess we don't even have the requirement that |
We could, but that would be a breaking change, do we really want that?
We can derive Should we add instructions how On other hand using I'm very curious what @DrBoolean thinks about all this, since he originally brought Traversable and Foldable to the spec. |
Love that you got rid of A traversable is a foldable functor, yes, but I don't see the reason to enforce foldable. I think it should just be known that one can derive it. (#68 (comment)) I'm cool with switching to |
Great, we wasn't sure if we can replace Id with any Applicative in #128
Seems like in other places in the spec when we can derive one algebra from another that algebra is enforced.
+1 from me, and I can add this to PR, but still not sure if everybody want this, because this is a breaking change. |
As far as any applicative goes, it'd be interesting to search for a counter example. Perhaps |
No, it works with |
word! |
As far as "breaking change", since traverse and sequence can be defined in terms of each other, I don't see it as much of an issue. Especially if we provide derived sequence: |
Made Traversable to depend on Foldable, and added derived |
I disagree that we should say it must implement the foldable spec. Even though something is definitely foldable if it's traversable, we don't depend on I feel providing a derivable version is enough to show it's foldable. |
I don't have a strong opinion on this, but I think we should try to keep spec consistent. As I understand, before Traversable and Foldable were added, the one of rules to decide where a dependency must be introduced was: if algebra B can be derived from algebra A, then A must depend on B. An example of such case is |
Maybe it would be better to replace If that's ok, the open questions left here:
|
I'm good with this. The derived I have to say, amazing job on derived I think this is a terrific clarification of the spec. Thanks for all your work on this. Everyone else cool to update this? |
Looks good to me. On Sat, 16 Apr 2016, 16:49 Brian Lonsdorf, notifications@github.com wrote:
|
Great! The PR that replaces |
✨ |
See #128
Opening the PR to get this moving.