Proposal: Generalize the RandomGen and Random classes

Thomas DuBuisson thomas.dubuisson at
Sat Oct 9 10:17:38 EDT 2010


In summary to this proposal, I think the community agrees it is too
"cludgy".  Perhaps people would have agreed on one of SPJs suggested
designs [1], so I might make another proposal when I again have time.
I'll mark the associated bug as closed, or whatever seems closest to


> class RandomGen g where
>    type GenVal g :: *
>    next :: g -> (GenVal g, g)
> class Random a v where
>   randoms :: forall g. (RandomGen g, v ~ GenVal g) => g -> [a]


> class RandomGen g where
>   nextInt :: g -> (Int, g)
>   nextByteString :: g -> (ByteString, g)

More information about the Libraries mailing list