crypto-random-effect-0.1.1: A random effect using crypto-random

Safe HaskellNone



A Random effect.

Any ideas to let the user specify the random number generator (CPRG) instead of hardcoding SystemRNG without complicating the api and reinventing state as SetMember is very welcome.



runRNG :: SetMember Lift (Lift IO) r => Eff (RNG :> (Reader EntropyPool :> r)) a -> Eff r aSource

Run the effect.

withRNG :: Member RNG r => (SystemRNG -> Eff r (a, SystemRNG)) -> Eff r aSource

withRandomBytes :: Member RNG r => Int -> (ByteString -> Eff r a) -> Eff r aSource

reexports from 'crypto-random'

class CPRG gen

Cryptographic Pseudo Random Generator


data SystemRNG

System entropy generator.

This generator doesn't use the entropy reseed level, as the only bytes generated are comping from the entropy pool already.

This generator doesn't create reproducible output, and might be difficult to use for testing and debugging purpose, but otherwise for real world use case should be fine.

data EntropyPool

Pool of Entropy. contains a self mutating pool of entropy, that is always guarantee to contains data.