Skip to content

mkStdGen (-2^31) is ⊥

Quoting System/Random.hs:

mkStdGen32 :: Int32 -> StdGen
mkStdGen32 s
 | s < 0     = mkStdGen32 (-s)

Alas, the fact that…

ghci> (minBound :: Data.Int.Int32) == negate minBound
True

…results in mkStdGen32 going into infinite recursion when applied to the minBound of Int32.

The proposed patch should fix the issue.

Trac metadata
Trac field Value
Version
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/random
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information