Skip to content

Add an API to serialise/deserialise to/from disk #123

@adinapoli

Description

@adinapoli

Up until random-1.1 a barebone (and potentially brittle) way to serialise and deserialise a StdGen would have been to use show and read, however random-1.2.0 removed Read (for good reasons) which means this is not possible anymore. As a consequence, writing things like a Serialize instance for StdGen is not possible at the moment.

Technically speaking one can work around this by using the .Internal module and simply use seedSMGen' and unseedSMGen on the underlying SMGen, but it feels wrong to use the Internal module and to rely on the concrete implementation of StdGen.

In a nutshell, it would be nice to have two functions as part of the API similar to the following:

toSeedGamma :: StdGen -> (Word64, Word64)
fromSeedGamma :: (Word64, Word64) -> StdGen

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions