Skip to content

Add quickCheckGen and variants#89

Merged
garyb merged 1 commit into
masterfrom
forall
Mar 30, 2018
Merged

Add quickCheckGen and variants#89
garyb merged 1 commit into
masterfrom
forall

Conversation

@garyb
Copy link
Copy Markdown
Member

@garyb garyb commented Mar 10, 2018

Resolves #47

The formulation here is a little different though, as you don't actually need to split the generator and test the way that was suggested in the issue, since you can write it in the generator directly:

forAll do
  m <- maps :: Gen (Map Int String))
  pure $ m == Map.fromUnfoldable (Map.toFoldable m)

Since that issue was opened, MonadGen has come into existence, and with it I've given up using Arbitrary at all, the only problem is you can't throw MonadGen constrained things directly into quickcheck, as it doesn't know what to instantiate the MonadGen m with. These forAll varieties solve that.

/cc @hdgarrood

@hdgarrood
Copy link
Copy Markdown
Contributor

This looks great! My only quibble is that I don't think the name forAll really makes sense any more with this formulation.

@garyb
Copy link
Copy Markdown
Member Author

garyb commented Mar 10, 2018

Yeah, I guess you're right there actually 😄

Any thoughts on a better name?

@hdgarrood
Copy link
Copy Markdown
Contributor

Not really... quickCheckGen?:confused:

@matthewleon
Copy link
Copy Markdown
Contributor

Not really... quickCheckGen?

I like this. It makes it reasonably clear what the function does in relation to the others.

@garyb
Copy link
Copy Markdown
Member Author

garyb commented Mar 30, 2018

I actually was thinking about this again today, had forgotten about the suggestion here and thought up the same name (or so I thought). I think it's a good option, will update accordingly.

@garyb garyb changed the title Add forAll and variants Add quickCheckGen and variants Mar 30, 2018
@garyb garyb merged commit 2c840b8 into master Mar 30, 2018
@garyb garyb deleted the forall branch March 30, 2018 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants