Skip to content

Add generators for date and time types#59

Merged
garyb merged 1 commit into
masterfrom
gen
Jun 8, 2017
Merged

Add generators for date and time types#59
garyb merged 1 commit into
masterfrom
gen

Conversation

@garyb
Copy link
Copy Markdown
Member

@garyb garyb commented Jun 8, 2017


-- | Generates a random `Day` component.
genDay :: forall m. MonadGen m => m Day
genDay = genBoundedEnum
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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