Open octopuscabbage opened 8 years ago
I just realized I'm a dingus and couldn't get the applicative tests to run becuase I never gave the functions a type constraint.
We're good now
Those tests for applicative laws are not valid. They use 1x1 matrices, but the size must be arbitrary (within a reasonable range). Matrix
is instance of Arbitrary
, so it shouldn't be that hard.
Also... Branch conflicts? I just accepted your other patch, so this is weird. :octocat:
The problem I was having was generating Arbitrary matricies of functions. I suppose I could write a custom instance
Check CoArbitrary
.
In particular, if a
is instance of CoArbitrary
, and b
is instance of Arbitrary
, then a -> b
is instance of Arbitrary
.
In other words: (CoArbitrary a, Arbitrary b) => Arbitrary (a -> b)
.
This gives you Arbitrary
instance for Matrix (a -> b)
.
well that's a lot easier than what i was doing
Yeah, you don't have to do anything. Int
is coarbitrary, so just use the matrices with the right type (like Matrix (Int ->Int)
).
I'm getting a weird error where it's saying that (Int -> Int) isn't showable
True... The argument of the property function you are testing must be instance of Show
(so that counterexamples show up in screen when found). At the moment, it's fine to just add dummy instance for functions. I can improve it later.
I went ahead and wrote a dummy instance of show for (Int->Int). This required turning on flexible instances in the testing source but it shouldn't be an issue since it's only test.
We might want to constrain down the functions to a finite type (Bool -> Bool) then we could write actual instances for show for that type.
This PR is downstream from #21 and #27