The Haskell98 Library Report defines the Random class as:
class Random a where
randomR :: RandomGen g => (a, a) -> g -> (a, g)
random :: RandomGen g => g -> (a, g)
randomRs :: RandomGen g => (a, a) -> g -> [a]
randoms :: RandomGen g => g -> [a]
randomRIO :: (a,a) -> IO a
randomIO :: IO a
. . .
And the report says:
"randomR takes a range (lo,hi) and a random number generator g,
[...] It is unspecified what happens if lo>hi. "
So it suggests that lo and hi can be compared and should be instances of Ord.
I think it would be better to have:
class Random a where
random :: ...
randoms :: ...
randomIO :: ...
class (Ord a, Random a) => RandomR a where
randomR :: ...
randomRs :: ...
randomRIO :: ...
Best Regards, Jose E. Labra
http://lsi.uniovi.es/~labra