Skip to content

Conversation

garyb
Copy link
Member

@garyb garyb commented Apr 4, 2015

/cc @paf31


instance arbOrdering :: Arbitrary Ordering where
arbitrary = do
n <- (3 *) <$> uniform
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably provide a wrapper for Enum to do this more generically, but for now, I think we have a combinator to generate an integer in a range. I forget the name..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked through the stuff in Gen but there wasn't anything obviously suitable. Could you have a look too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think chooseInt does what you need.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duhh, right, yeah. Thanks ;)

@paf31
Copy link
Contributor

paf31 commented Apr 4, 2015

👍 Looks good, I just have one comment above.

garyb added a commit that referenced this pull request Apr 4, 2015
Add Arb/CoArb instances for Unit and Ordering
@garyb garyb merged commit 41a1ceb into master Apr 4, 2015
@garyb garyb deleted the more-instances branch April 4, 2015 23:37
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.

2 participants