Skip to content

Add generators for date and time types #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 8, 2017
Merged

Add generators for date and time types #59

merged 1 commit into from
Jun 8, 2017

Conversation

garyb
Copy link
Member

@garyb garyb commented Jun 8, 2017


-- | Generates a random `Day` component.
genDay :: forall m. MonadGen m => m Day
genDay = genBoundedEnum
Copy link
Contributor

@paf31 paf31 Jun 8, 2017

Choose a reason for hiding this comment

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

Shouldn't this take a Month as an argument?

Copy link
Member Author

@garyb garyb Jun 8, 2017

Choose a reason for hiding this comment

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

Hmm, that's a good point. I guess it would need to receive the Year also, in that case.

Maybe it's fine as is though, since you can't construct an invalid Date anyway (canonicalDate will fix it, or exactDate will return Nothing) - but we could add an alternative generator that does take month/year to ensure it will be correct for a specific period.

@paf31
Copy link
Contributor

paf31 commented Jun 8, 2017

👍 One comment, LGTM otherwise.

gen is really paying off!

@garyb garyb merged commit 0373fa8 into master Jun 8, 2017
@garyb garyb deleted the gen branch June 8, 2017 20:31
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