Proposal: Generalize the RandomGen and Random classes
Antoine Latter
aslatter at gmail.com
Tue Sep 14 22:33:49 EDT 2010
Hi Thomas,
On Tue, Sep 14, 2010 at 7:11 PM, Thomas DuBuisson
<thomas.dubuisson at gmail.com> wrote:
> Hello,
> RandomGen and Random classes assume generators produce Int values.
> This is non-ideal as many high speed generators produce special values
> (ex: doubles) or generic values (bit streams / bytestrings) that can
> be converted directly to types easier than coercing to Int then to an
> 'a' via the Random class.
>
So when I write a Random instance, under this proposal I write it
against a class of RandomGen instances, whereas in the current world I
am able to plug and Random instantiated type up with any RandomGen
instantiated type.
Do you anticipate a common choice for the type 'v' (other than Int, of course)?
When I write my Random instance against this new class, am I really
targeting one particular good random generator?
>
> 3) Not-so-new extensions are used to enable these changes. Extensions
> include MultiParamTypeClasses, FlexibleContexts, and FunDeps.
>
> 4) A patch is included bumping the version from 1.0.0.x to 1.1.0.0.
>
How many packages on Hackage provide instances for the Random class?
How many of these packages provide an upper-bound on the random
package in their package description?
Do you also propose added an entry in the hackage preferred-versions
file[1] for the 'random' package?
What I'm truly getting at is: what will this break and how will we
handle the breakage under this proposal?
Thanks,
Antoine
[1] http://www.mail-archive.com/cabal-devel@haskell.org/msg03959.html
More information about the Libraries
mailing list