Skip to content

Allow MonadRandom interface for MWC-random #26

@ghost

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions