-
Notifications
You must be signed in to change notification settings - Fork 2
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
StdGen: constructor accessible via Internal only #123
Conversation
System/Random/Internal.hs
Outdated
genWord32 = SM.nextWord32 | ||
genWord64 = SM.nextWord64 | ||
split = SM.splitSMGen | ||
next = second StdGen . SM.nextInt . unStdGen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This effectively removes RandomGen SM.SMGen
, which is not what we want.
We either need to add another instance or simply use GeneralizeNewtypeDeriving
to derive RandomGen
for StdGen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lehins. I shouldn't have pushed this between meetings - silly mistakes.
I've updated this so we keep RandomGen SM.SMGen
and use GeneralisedNewtypeDeriving
for RandomGen StdGen
.
This is not a problem for us anymore: haskell#59 (comment) , because λ> read "abcdef" :: StdGen
*** Exception: Prelude.read: no parse
λ> read "SMGen 1 3" :: StdGen
SMGen 1 3 That being said, I personally think |
👍
That was one of my initial motivations for introducing |
Fixes haskell#59 by making 'StdGen' not an instance of 'Read'.
@curiousleo I was a bit too slow to comment. We also could benefit from |
Ended up adding |
Sorry. I think I was a bit too quick to merge! |
Fixes haskell#59 by making 'StdGen' not an instance of 'Read'.
Fixes haskell#59 by making 'StdGen' not an instance of 'Read'.
Fixes haskell#59 by making 'StdGen' not an instance of 'Read'.
Fixes haskell#59 by making 'StdGen' not an instance of 'Read'.
Makes
StdGen
not an instance ofRead
.Relates to haskell#59 (comment):