Open Jaxan opened 6 years ago
Thanks a lot @Jaxan ! I'll look into this asap. For the time being, why did you have to change the bounds on base
and the Stackage LTS versions? Thanks!
Good question. The reason is that the function conjugate
from Data.Complex
had the constraint RealFloat
instead of Num
and they fixed that in 4.8. I wanted to use the same tests with Complex Rational
, so I needed conjugate
to work. However, in the end it didn't work at all, because there is no Num
instance as abs
is unimplementable for Complex Rational
.
As I said, the code is a bit of a mess (and more for exposition instead of merging). I also changed stuff in Epsilon
which is maybe not necessary.
Great points! Yes, working over Z or Q would enable exact algorithms, but then we'd have to rewrite all the parts that use square roots (such as the L2 norm), trig functions etc.
I think it's the most we can easily get out of QuickCheck. For the floating point instances and classes like Normed
, we can still write unit tests.
I just wanted to show how we could use more QuickCheck property testing.
These commits are still a bit of a mess as I wanted to use floating points first (that clearly will not work). And afterwards moved to rational numbers. I propose not to merge it, but just to have a look at it.
Note that
Complex Rational
does not have aNum
instance because one cannot defineabs
. This is a bit annoying and really a problem withbase
. Also we cannot haveNormed
instances for rational numbers, so we can only test some things exactly.