| Copyright | (c) Galois Inc 2014-2016 | 
|---|---|
| Maintainer | Eddy Westbrook <westbrook@galois.com> | 
| Safe Haskell | None | 
| Language | Haskell98 | 
Data.Parameterized.Nonce.Transformers
Description
This module provides a typeclass and monad transformers for generating nonces.
Synopsis
- 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 Nonces in a given set
 (where we view the phantom type parameter of Nonce as a designator of the
 set that the Nonce came from).
Minimal complete definition
Methods
freshNonceM :: forall (tp :: k). m (Nonce (NonceSet m) tp) Source #
Instances
| MonadNonce m => MonadNonce (StateT s m) Source # | |
| Monad m => MonadNonce (NonceT s m) Source # | |
This transformer adds a nonce generator to a given monad.
Constructors
| NonceT | |
Fields 
  | |
Instances
| MonadTrans (NonceT s) Source # | |
Defined in Data.Parameterized.Nonce.Transformers  | |
| Monad m => Monad (NonceT s m) Source # | |
| Functor m => Functor (NonceT s m) Source # | |
| Applicative m => Applicative (NonceT s m) Source # | |
Defined in Data.Parameterized.Nonce.Transformers  | |
| Monad m => MonadNonce (NonceT s m) Source # | |
| type NonceSet (NonceT s m) Source # | |
Defined in Data.Parameterized.Nonce.Transformers  | |
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