Skip to content
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

Adjust for new additions in upcoming random-1.3 #89

Merged
merged 9 commits into from
Jan 7, 2025

Conversation

lehins
Copy link
Contributor

@lehins lehins commented Oct 30, 2023

Hey @Shimuuar I am working on some changes in the random-1.3 stateful interface in haskell/random#153 Could you take a look and see if you find it sensible.

Addition of modifyGen is more useful for stateful generators that are regular wrappers around RandomGen rather than for the ones like mwc implements. It also allows for a mutable Gen to be overwritten with the Seed using overwriteGen

@lehins lehins force-pushed the lehins/random-1.3 branch 2 times, most recently from 3100be7 to 4a351dc Compare November 24, 2023 17:36
@lehins lehins force-pushed the lehins/random-1.3 branch 3 times, most recently from 197ed8d to 2696732 Compare December 30, 2024 22:51
@hsyl20
Copy link

hsyl20 commented Jan 6, 2025

random-1.3 has been published. It makes the currently released mwc-random fail to build. Could you make a Hackage package revision to exclude random > 1.3 until this PR is merged and released?

@Shimuuar
Copy link
Collaborator

Shimuuar commented Jan 6, 2025

@hsyl20 I've updated bound on hackage

@lehins What are your plans on SeedGen?

@Shimuuar
Copy link
Collaborator

Shimuuar commented Jan 6, 2025

I think, I'll need to add both random 1.2 and random 1.3 to build matrix

@lehins
Copy link
Contributor Author

lehins commented Jan 6, 2025

@lehins What are your plans on SeedGen?

@Shimuuar Very good question.

There are two approaches that can be taken. One is implemented in #96 That approach is efficient, but it would not work for seed being compatible between big-endian and littel-endian machines and it requires a newer version of vector.

There is an alternative version I am planning to submit a PR for as well, that will be simpler and will work just as well regardless of endianness, but it will be slowe, since it will have to go through a list.

I was really waiting for this PR to be merged and random-1.3 to be released before I had both of the solutions implemented for the SeedGen instance.

@lehins
Copy link
Contributor Author

lehins commented Jan 6, 2025

FYI @Shimuuar I am working on fixing up this PR to pass CI

@lehins lehins force-pushed the lehins/random-1.3 branch from 915f27a to 2321a3d Compare January 6, 2025 17:31
@Shimuuar
Copy link
Collaborator

Shimuuar commented Jan 6, 2025

RE SeedGen not every vector of 258 Word32 is valid generator last two words have special meaning. One at ioff=256 is index and must be in [0..255] range. And one at coff=257 is carry at must be smaller than aa=1540315826. initialize does normaliztion

@lehins
Copy link
Contributor Author

lehins commented Jan 6, 2025

RE SeedGen not every vector of 258 Word32 is valid generator last two words have special meaning. One at ioff=256 is index and must be in [0..255] range. And one at coff=257 is carry at must be smaller than aa=1540315826. initialize does normaliztion

Yeah, I've seen that. We can do normalization by the means of runST . save . initialize or something along those lines in the implementation System.Random.toSeed function.

I only implemented that instance so far as a proof of concept, just to make sure the new SeedGen interface in random is viable.

@lehins
Copy link
Contributor Author

lehins commented Jan 6, 2025

Looks like there is also a need for a lower bound revision on hackage for tasty-quickcheck >= 0.10.2.

lehins and others added 5 commits January 6, 2025 11:44
GHC versions that could not handle `<$>` and `<*>` without extra
`Functor` and `Applicative` constraints are no longer supported.
 - Cabal 3.10 -> 3.12
 - GHC 9.10 added
@lehins lehins force-pushed the lehins/random-1.3 branch from 25a75b3 to 7068658 Compare January 6, 2025 18:44
Update upper bound for doctest to include a version that works with
ghc-9.12
@lehins lehins force-pushed the lehins/random-1.3 branch from 7068658 to 1dc6256 Compare January 6, 2025 19:04
@lehins
Copy link
Contributor Author

lehins commented Jan 6, 2025

I think this PR is ready to go.

@Shimuuar
Copy link
Collaborator

Shimuuar commented Jan 7, 2025

I think PR is good to go. @lehins thanks! We still need to test both random-1.2 and 1.3 on CI. But that could be done separatelu

@Shimuuar Shimuuar merged commit 2cce257 into haskell:master Jan 7, 2025
35 checks passed
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