module Control.Monad.Unique
( U.Unique,
MonadUnique (..),
)
where
import Data.Unique qualified as U
import Hasura.Prelude
class (Monad m) => MonadUnique m where
newUnique :: m U.Unique
instance MonadUnique IO where
newUnique :: IO Unique
newUnique = IO Unique
U.newUnique
instance (MonadUnique m) => MonadUnique (ExceptT e m) where
newUnique :: ExceptT e m Unique
newUnique = m Unique -> ExceptT e m Unique
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Unique
forall (m :: * -> *). MonadUnique m => m Unique
newUnique
instance (MonadUnique m) => MonadUnique (ReaderT r m) where
newUnique :: ReaderT r m Unique
newUnique = m Unique -> ReaderT r m Unique
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Unique
forall (m :: * -> *). MonadUnique m => m Unique
newUnique
instance (MonadUnique m) => MonadUnique (StateT s m) where
newUnique :: StateT s m Unique
newUnique = m Unique -> StateT s m Unique
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Unique
forall (m :: * -> *). MonadUnique m => m Unique
newUnique
instance (Monoid w, MonadUnique m) => MonadUnique (WriterT w m) where
newUnique :: WriterT w m Unique
newUnique = m Unique -> WriterT w m Unique
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Unique
forall (m :: * -> *). MonadUnique m => m Unique
newUnique