Proposal: Move 'split' into a separate class in System.Random
Antoine Latter
aslatter at gmail.com
Sat Oct 9 16:59:08 EDT 2010
On Sat, Oct 9, 2010 at 10:02 AM, Thomas DuBuisson
<thomas.dubuisson at gmail.com> wrote:
> All,
> I have updated the ticket/patch for this proposal [1]. It seems the
> community has agreed on
>
>> class RandomGen g where
>> next :: g -> (Int, g)
>> genRange :: g -> (Int,Int)
>> genRange _ = (minBound, maxBound)
>
>> class (RandomGen g) => SplittableGen g where
>> split :: g -> (g, g)
>
> Notice SPJs good catch that SplittableGen should be constrained by
> RandomGen is there (lacking discussion, but its hard to imagine
> objection). I'm not sure what you, Jan, mean by removing Read and
> Show constraints as I don't see any.
>
> This will break the following hackage packages (thanks Bas):
> mage, synthesizer, synthesizer-core, Haskelloids, ideas, local-search,
> comonad-random, SpaceInvaders, rsagl, pkcs1, and hsgsom
>
> All BCCed, of these only PKCS1 doesn't have a maintainer (a production
> pkcs1 probably shouldn't be using split anyway).
>
> Cheers,
> Thomas
>
> [1] http://hackage.haskell.org/trac/ghc/ticket/4314
>
What impact does this have on the 'Random' class? Has someone already
brought this up? The patch on the ticket doesn't seem to touch it.
It seems that it becomes less powerful. I'm not necessarily opposed,
but I just wanted to make sure it was stated explicitly.
This seems that some structures which could have been randomly created
lazily must now be more strict (and the instance must be re-written).
I'm not sure that such instances exist, but they could be useful.
Antoine
More information about the Libraries
mailing list