parameterized-utils-2.0.1.0: Classes and data structures for working with data-kind indexed types

Copyright(c) Galois Inc 2014-2019
MaintainerEddy Westbrook <westbrook@galois.com>
Safe HaskellNone
LanguageHaskell98

Data.Parameterized.Nonce.Transformers

Description

This module provides a typeclass and monad transformers for generating nonces.

Synopsis

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).

Associated Types

type NonceSet m :: * Source #

Methods

freshNonceM :: forall (tp :: k). m (Nonce (NonceSet m) tp) Source #

Instances
MonadNonce m => MonadNonce (StateT s m) Source # 
Instance details

Defined in Data.Parameterized.Nonce.Transformers

Associated Types

type NonceSet (StateT s m) :: Type Source #

Methods

freshNonceM :: StateT s m (Nonce (NonceSet (StateT s m)) tp) Source #

Monad m => MonadNonce (NonceT s m) Source # 
Instance details

Defined in Data.Parameterized.Nonce.Transformers

Associated Types

type NonceSet (NonceT s m) :: Type Source #

Methods

freshNonceM :: NonceT s m (Nonce (NonceSet (NonceT s m)) tp) Source #

newtype NonceT s m a Source #

This transformer adds a nonce generator to a given monad.

Constructors

NonceT 

Fields

Instances
MonadTrans (NonceT s) Source # 
Instance details

Defined in Data.Parameterized.Nonce.Transformers

Methods

lift :: Monad m => m a -> NonceT s m a #

Monad m => Monad (NonceT s m) Source # 
Instance details

Defined in Data.Parameterized.Nonce.Transformers

Methods

(>>=) :: NonceT s m a -> (a -> NonceT s m b) -> NonceT s m b #

(>>) :: NonceT s m a -> NonceT s m b -> NonceT s m b #

return :: a -> NonceT s m a #

fail :: String -> NonceT s m a #

Functor m => Functor (NonceT s m) Source # 
Instance details

Defined in Data.Parameterized.Nonce.Transformers

Methods

fmap :: (a -> b) -> NonceT s m a -> NonceT s m b #

(<$) :: a -> NonceT s m b -> NonceT s m a #

Applicative m => Applicative (NonceT s m) Source # 
Instance details

Defined in Data.Parameterized.Nonce.Transformers

Methods

pure :: a -> NonceT s m a #

(<*>) :: NonceT s m (a -> b) -> NonceT s m a -> NonceT s m b #

liftA2 :: (a -> b -> c) -> NonceT s m a -> NonceT s m b -> NonceT s m c #

(*>) :: NonceT s m a -> NonceT s m b -> NonceT s m b #

(<*) :: NonceT s m a -> NonceT s m b -> NonceT s m a #

Monad m => MonadNonce (NonceT s m) Source # 
Instance details

Defined in Data.Parameterized.Nonce.Transformers

Associated Types

type NonceSet (NonceT s m) :: Type Source #

Methods

freshNonceM :: NonceT s m (Nonce (NonceSet (NonceT s m)) tp) Source #

type NonceSet (NonceT s m) Source # 
Instance details

Defined in Data.Parameterized.Nonce.Transformers

type NonceSet (NonceT s m) = s

type NonceST t s = NonceT s (ST t) Source #

Helper type to build a MonadNonce from the ST monad.

type NonceIO s = NonceT s IO Source #

Helper type to build a MonadNonce from the IO monad.

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.