
Illegal instance declaration for `RandomlyGeneratable a' (All instance types must be of the form (T a1 ... an) where a1 ... an are *distinct type variables*, and each type variable appears at most once in the instance head. Use -XFlexibleInstances if you want to disable this.) In the instance declaration for `RandomlyGeneratable a'
"Solved" with the somewhat apocryphal:
newtype ByEnum e = ByEnum { unByEnum :: e }
instance Enum k => RG (ByEnum k) where rgen = fmap (ByEnum . (opts !!)) $ randomRIO (0,pred (length opts)) where opts = enumFrom $ toEnum 0
Then I can say:
r <- fmap unByEnum rgen
and get my answer. I think I better understand what's going on. Here's my reference: http://groups.google.com/group/fa.haskell/browse_thread/thread/113d5834fddfa... Cheers! Arlen