On Wed, Apr 1, 2015 at 11:08 AM, Shishir Srivastava <shishir.srivastava@gmail.com> wrote:
myrandoms :: (RandomGen g, Random a) => g -> [a]  
myrandoms gen = let (value, newGen) = random gen in value:myrandoms (mkStdGen (value::Int))

You have declared a function that says that it can deal with any type `a` that the *caller* chooses, then provided an implementation that only supports Int.

Note that :: does not do conversion (as you said "Even though I am converting my 'value' parameter to Int"); it declares that the type of `value` *is* Int. Other types will be inferred to match, and this fails at `value:` in a context which wants the type to be a caller-specified `a`, not Int.

(I don't think you can coerce an unknown type `a` to Int given only the context `Random a`. You must find a different way to implement this.)

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net