Proposal: Add getStdGenState and stdGenFromState

Tyson Whitehead twhitehead at
Mon Feb 6 19:36:39 CET 2012

On February 6, 2012 13:14:41 Bas van Dijk wrote:
> But I agree that the API should accommodate for changing the amount of
> bits. What about the following API:
> getStdGenState :: StdGen -> [Int32]
> getStdGenState (StdGen s1 s2) = [s1, s2]
> stdGenFromState :: [Int32] -> Maybe StdGen
> stdGenFromState [s1, s2] = Just (StdGen s1 s2)
> stdGenFromState _        = Nothing

Jumping in without having paid much attention to the thread or API, but I 
expect [Word8] (ByteString?) would fit the general case better than [Int32]

Cheers!  -Tyson

More information about the Libraries mailing list