Arbitrary Instances would be nice to have
Opened this issue · 6 comments
It would be really nice if the standard libs core data types all had arbitrary instances somewhere (not necessarily in the main repo, but maybe). I'm going to leave this one here, because I don't know where to put it.
instance arbStrMap :: (Arbitrary a) => Arbitrary (StrMap a) where
arbitrary = do
n <- arbitrary
ks <- arbitrary
return $ foldr (\k sm -> insert k n sm) empty (ks :: [String])Something like purescript-lists could work, with a separate quickcheck-test-src directory.
I guess the only concern I have with putting Arbitrary Instances in the main repo is that QuickCheck becomes a dependency of that project where it doesn't necessarily need to be.
Isn't that what this repo is for: https://github.com/purescript/purescript-arb-instances
Only a devDependency. arb-instances is dead, I think?
Is it? I just thought it had fallen a bit out of date.
Now that orphans are disallowed, I think this can be closed (assuming, of course, that we don't want maps depending on quickcheck, or vice versa).
See also purescript/purescript-quickcheck#47, which would be my preferred solution to this problem.