-
Notifications
You must be signed in to change notification settings - Fork 22
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
Avoiding duplicates vs. having the same law included twice in one Properties
instance
#27
Comments
Yes.
This is a good question. I haven't found a good way yet. However |
I see, I could make a disjoint union of properties by using a sum type as the ID. For my sealed trait RingPropId
case class Additive(id: Foo) extends RingPropId // for props from AbelianGroup under addition
case class Multiplicative(id: Foo) extends RingPropId // for props from Monoid under multiplication
case class Proper(id: Bar) extends RingPropId // for props introduced in Ring Deciding property equality purely on ID means that two properties that are effectively the same, but have different IDs, will not be de-duplicated. Though that should be a rare enough case. |
I'm just checking out this library and have two questions (that go against each other):
monad.all
inheritsapply.all
both viabind.all
andapplicative.all
. Is this duplication eliminated?Ring
, I want to check the monoid laws for both addition and multiplication.discipline
can achieve both of the above, but I find its approach rather cumbersome and fragile, which is why I wrote my own tool, Principled. Principled, however, relies on universal equality (==
) of type classes, which is not ideal either (although the worst that can happen is failure to avoid duplicates, when the same type class is instantiated twice with the same arguments, but==
returnsfalse
).I wonder if and how
scalaprops
deals with this problem.The text was updated successfully, but these errors were encountered: