Closed chessai closed 5 years ago
There are also other Eq (a -> b)
instances, e.g. http://hackage.haskell.org/package/universe-reverse-instances-1.0/docs/src/Data-Universe-Instances-Eq.html. I'd suggest to stay out of this and define a combinator (returning Property
).
I'm going to say no here, sorry. I'm really not keen on adding an incorrect Eq
instance, especially when orphan instances can easily leak out.
This instance is a bit dangerous even when used for testing. You can use it to write properties of the form f == g ==> ...
, which will appear to execute correctly, but in fact will fail with spurious counterexamples. It's better if comparison of functions returns a Property
- then this kind of property will fail to typecheck.
Okay, no problem. Thanks
I think the following instance would be useful, using the random package:
relevant issue brought up on a library i maintain: https://github.com/andrewthad/quickcheck-classes/issues/10 the gist of the issue is that checkers has
EqProp
, but quickcheck-classes attempts to introduce as little mental overhead as possible, instead opting to be a nice wrapper around quickcheck that makes testing of typeclass lawfulness easy. Having this instance and exposing it explicitly as an orphan instance would be useful.