StdGen: constructor accessible via Internal only#123
StdGen: constructor accessible via Internal only#123curiousleo merged 1 commit intointerface-to-performancefrom
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.
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.
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 3That 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
StdGennot an instance ofRead.Relates to haskell#59 (comment):