Skip to content
This repository has been archived by the owner on Oct 4, 2020. It is now read-only.

Arbitrary Instances would be nice to have #27

Open
Fresheyeball opened this issue Feb 3, 2015 · 6 comments
Open

Arbitrary Instances would be nice to have #27

Fresheyeball opened this issue Feb 3, 2015 · 6 comments

Comments

@Fresheyeball
Copy link

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])
@paf31
Copy link
Contributor

paf31 commented Feb 3, 2015

Something like purescript-lists could work, with a separate quickcheck-test-src directory.

@Fresheyeball
Copy link
Author

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.

@joneshf
Copy link
Contributor

joneshf commented Feb 3, 2015

Isn't that what this repo is for: https://github.com/purescript/purescript-arb-instances

@paf31
Copy link
Contributor

paf31 commented Feb 3, 2015

Only a devDependency. arb-instances is dead, I think?

@garyb
Copy link
Member

garyb commented Feb 3, 2015

Is it? I just thought it had fallen a bit out of date.

@hdgarrood
Copy link
Contributor

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants