I would speculate and say that the default rules for GHCI have been extended since LYAH was written. This means that in cases where the type is ambiguous, GHCI tries to select a specific type. In this case, it looks like random (mkStdGen 100)the default (Integer, StdGen).
If, on the other hand, I make a test.hs file
import System.Random
foo = random (mkStdGen 100)
... and try loading it into GHCI, I get:
test.hs:3:7:
No instance for (Random a0) arising from a use of ‘random’
The type variable ‘a0’ is ambiguous
Relevant bindings include
foo :: (a0, StdGen) (bound at test.hs:3:1)
Note: there are several potential instances:
instance Random Bool
instance Random Foreign.C.Types.CChar
instance Random Foreign.C.Types.CDouble
...plus 33 others
In the expression: random (mkStdGen 100)
In an equation for ‘foo’: foo = random (mkStdGen 100)
Failed, modules loaded: none.
If I wanted to get the same result, I would have to fix the type foo, for example:
foo :: (Integer, StdGen)
foo = random (mkStdGen 100)
. 2.4.8 GHC