2013-07-13 07:03:25 +00:00
|
|
|
{-# LANGUAGE ExistentialQuantification, RankNTypes #-}
|
|
|
|
module Network.TLS.RNG
|
|
|
|
( StateRNG(..)
|
|
|
|
, withTLSRNG
|
|
|
|
) where
|
|
|
|
|
2013-12-11 07:53:11 +00:00
|
|
|
import Crypto.Random
|
2013-07-13 07:03:25 +00:00
|
|
|
|
|
|
|
data StateRNG = forall g . CPRG g => StateRNG g
|
|
|
|
|
|
|
|
instance Show StateRNG where
|
|
|
|
show _ = "rng[..]"
|
|
|
|
|
|
|
|
withTLSRNG :: StateRNG -> (forall g . CPRG g => g -> (a,g)) -> (a, StateRNG)
|
|
|
|
withTLSRNG (StateRNG rng) f = let (a, rng') = f rng
|
|
|
|
in (a, StateRNG rng')
|
|
|
|
|