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 implementation of equals/hashCode laws #8

Open
denisrosset opened this issue Jan 6, 2015 · 1 comment
Open

Add implementation of equals/hashCode laws #8

denisrosset opened this issue Jan 6, 2015 · 1 comment

Comments

@denisrosset
Copy link

As a working example, discipline could provide an "AnyRefLaws" implementation that checks the behavior of the default equals and hashCode methods.

In particular, the implementation could work from:

  • a makeClone method that creates a deep copy of an instance,
  • two particular instances that are guaranteed to compare as != with differing hashCode.

See for example: https://github.com/denisrosset/alasc/blob/master/scalacheck-binding/src/main/scala/net.alasc/laws/AnyRefLaws.scala

I'd gladly provide a PR if there is interest.

@denisrosset denisrosset changed the title Add implementation equals/hashCode laws Add implementation of equals/hashCode laws Jan 6, 2015
@non
Copy link

non commented Jan 6, 2015

I like the idea of Discipline providing some default laws that can easily be shared and used. If @larsrh wants to go that direction I think these laws would be very helpful.

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

No branches or pull requests

3 participants
@denisrosset @non and others