hs-tls/core/Network/TLS/RNG.hs

18 lines
438 B
Haskell
Raw Normal View History

2013-07-13 07:03:25 +00:00
{-# LANGUAGE ExistentialQuantification, RankNTypes #-}
module Network.TLS.RNG
( StateRNG(..)
, withTLSRNG
) where
import Crypto.Random.API
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')