This page states that the minimal complete definition of the Random class is "Nothing"
But if I don't provide them, they don't work:
data Color = Red | Blue deriving (Bounded, Show)
instance Random Color
yields the compiler warning:
test.hs:5:10: warning: [-Wmissing-methods]
• No explicit implementation for
‘randomR’ and ‘random’
• In the instance declaration for ‘Random Color’
|
5 | instance Random Color
and when I run the code I get an error:
*Main> let g = mkStdGen 100
*Main> (fst $ random g) :: Color
*** Exception: test.hs:5:10-21: No instance nor default method for class operation random
Why aren't random and randomR listed under the minimal complete definition?