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 SplitLaws, SplitTests, and SplitSyntax #232

Merged
merged 1 commit into from
Feb 28, 2015

Conversation

fthomas
Copy link
Member

@fthomas fthomas commented Feb 23, 2015

This PR adds SplitLaws, SplitTests, and SplitSyntax. I'm submitting this PR although I'm not totally confident that the splitInterchange law I've defined is sound. I just tried to relate split with andThen in a minimal fashion. I've not seen this law anywhere else and I still want to check if it can be derived from the arrow laws.

Anyone know where Split is originally coming from and which laws it should obey?

@fthomas
Copy link
Member Author

fthomas commented Feb 24, 2015

I think I've derived the splitInterchange law from the usual arrow laws here: https://gist.github.com/fthomas/77a9a0a529f24e04ecc4

So every Arrow obeys this law and it does no harm including it into the hierarchy of arrow laws.

@non
Copy link
Contributor

non commented Feb 24, 2015

Seems good to me 👍

def eqv(x: (A, B), y: (A, B)): Boolean =
A.eqv(x._1, y._1) && B.eqv(x._2, y._2)
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be defined in the std module instead of in laws?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see the issue is that laws currently doesn't depend on std does it?

Copy link
Member Author

Choose a reason for hiding this comment

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

That instance is required in tests but defined in laws because the Eq[A => B] instance was already there. I think it should ultimately come from algebra.std. Guess I need to open a PR there.

I'd like to not hold up this PR by waiting until this instance appears in algebra.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that it's smart to define the instances we need here, and then remove them when algebra adds them.

@ceedubs
Copy link
Contributor

ceedubs commented Feb 28, 2015

👍

ceedubs added a commit that referenced this pull request Feb 28, 2015
Add SplitLaws, SplitTests, and SplitSyntax
@ceedubs ceedubs merged commit 9c74e3a into typelevel:master Feb 28, 2015
@fthomas fthomas deleted the topic/split-laws branch February 28, 2015 16:09
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.

3 participants