Copyright | (c) Galois Inc 2014-2016 |
---|---|
Maintainer | Eddy Westbrook <westbrook@galois.com> |
Safe Haskell | None |
Language | Haskell98 |
This module provides a typeclass and monad transformers for generating nonces.
- class Monad m => MonadNonce m where
- newtype NonceT s m a = NonceT {
- runNonceT :: ReaderT (NonceGenerator m s) m a
- type NonceST t s = NonceT s (ST t)
- type NonceIO s = NonceT s IO
- getNonceSTGen :: NonceST t s (NonceGenerator (ST t) s)
- runNonceST :: (forall t s. NonceST t s a) -> a
- runNonceIO :: (forall s. NonceIO s a) -> IO a
- module Data.Parameterized.Nonce
Documentation
class Monad m => MonadNonce m where Source #
A MonadNonce
is a monad that can generate fresh Nonce
s in a given set
(where we view the phantom type parameter of Nonce
as a designator of the
set that the Nonce
came from).
freshNonceM :: forall (tp :: k). m (Nonce (NonceSet m) tp) Source #
MonadNonce m => MonadNonce (StateT s m) Source # | |
Monad m => MonadNonce (NonceT s m) Source # | |
This transformer adds a nonce generator to a given monad.
NonceT | |
|
getNonceSTGen :: NonceST t s (NonceGenerator (ST t) s) Source #
Return the actual NonceGenerator
used in an ST
computation.
runNonceST :: (forall t s. NonceST t s a) -> a Source #
Run a NonceST
computation with a fresh NonceGenerator
.
runNonceIO :: (forall s. NonceIO s a) -> IO a Source #
Run a NonceIO
computation with a fresh NonceGenerator
inside IO
.
module Data.Parameterized.Nonce