-
Notifications
You must be signed in to change notification settings - Fork 22
Description
We'd like to be able to define a MonadRandom instance for a newtype'd ST, using the same unsafePerformIO IORef trick as the IO instance, but with MWC-random's Gen rather than the System.Random Gen.
Fundamentally, the problem is that random et al require
This is sad because the interface should be exactly the same.
One solution is to eliminate the Random a requirement and fix a return type (Word32, Int,Double, etc), since all random generators fundamentally operate on these primitive types. Another solution is to make a multiparam version of MonadRandom parameterizing the generator type and/or return type.
I'd pick the first solution, but I'd like to know if anyone has a use-case for baking different randomness mechanisms into the Random typeclass, rather than just post applying an f :: Int -> A or somesuch