Skip to content

Conversation

@milesfrain
Copy link
Contributor

I think this code is more straightforward with all the Number conversions isolated as an implementation detail.

This is technically a version bump. Not sure if any other libraries use lcgPerturb.

Based on #6


-- | Perturb a seed value
lcgPerturb :: Number -> Seed -> Seed
-- | Note that `Int` operations are truncated to 32-bits, so we convert to
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an implementation detail, and so it probably shouldn't be in a doc-comment.

@hdgarrood
Copy link
Contributor

I suspect this function is used for Coarbitrary instances, so changing this would likely require changes downstream, although I suspect not too many. It looks to me like we probably ought to prevent people from passing things which aren't 32-bit integers: if you pass a fractional number I suspect the unsafePartial fromJust will throw.

Co-authored-by: Harry Garrood <harry@garrood.me>
@JordanMartinez JordanMartinez merged commit e983e5c into purescript:master Nov 13, 2020
@milesfrain milesfrain deleted the number-internal branch November 13, 2020 23:57
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