Skip to content

Add arbitrary instances for newtypes in Prelude#119

Merged
JordanMartinez merged 4 commits into
purescript:masterfrom
JordanMartinez:addMissingArbInstances
Sep 11, 2021
Merged

Add arbitrary instances for newtypes in Prelude#119
JordanMartinez merged 4 commits into
purescript:masterfrom
JordanMartinez:addMissingArbInstances

Conversation

@JordanMartinez

Copy link
Copy Markdown
Contributor

I didn't include Endo because it would take more time for me to figure out what it should be. The others are pretty obvious, so I just did those.

@kl0tl

kl0tl commented Dec 24, 2020

Copy link
Copy Markdown
Member

I think we can adapt the Arbitrary instance for a -> b to Endo a:

instance arbEndo :: (Arbitrary a, Coarbitrary a) => Arbitrary (Endo a) where
  arbitrary = Endo <$> repeatable (\a -> coarbitrary a arbitrary)

@hdgarrood

Copy link
Copy Markdown
Contributor

Is there a reason you didn’t do arbitrary = Endo <$> arbitrary?

@JordanMartinez JordanMartinez changed the title Add arbitrary instances for newtypes in Prelude, excluding Endo Add arbitrary instances for newtypes in Prelude Dec 24, 2020
@JordanMartinez

Copy link
Copy Markdown
Contributor Author

Thanks all! I've added the Endo instance.

@JordanMartinez

Copy link
Copy Markdown
Contributor Author

#120 needs to be merged before this will pass.

Comment thread src/Test/QuickCheck/Arbitrary.purs Outdated
@kl0tl

kl0tl commented Dec 24, 2020

Copy link
Copy Markdown
Member

Is there a reason you didn’t do arbitrary = Endo <$> arbitrary?

I blame the lack of caffeine!

@JordanMartinez

Copy link
Copy Markdown
Contributor Author

CI now builds.

@JordanMartinez

Copy link
Copy Markdown
Contributor Author

Can this get merged?

@JordanMartinez JordanMartinez merged commit 7bdc476 into purescript:master Sep 11, 2021
@JordanMartinez JordanMartinez deleted the addMissingArbInstances branch September 11, 2021 22:24
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.

4 participants