persistent-mtl-0.5.1: Monad transformer for the persistent API
Safe HaskellSafe-Inferred
LanguageHaskell2010

Database.Persist.Monad.Internal.SqlTransaction

Synopsis

Documentation

newtype SqlTransaction m a Source #

The monad that tracks transaction state.

Conceptually equivalent to SqlPersistT, but restricts IO operations, for two reasons:

  1. Forking a thread that uses the same SqlBackend as the current thread causes Bad Things to happen.
  2. Transactions may need to be retried, in which case IO operations in a transaction are required to be rerunnable.

You shouldn't need to explicitly use this type; your functions should only declare the MonadSqlQuery constraint.

Instances

Instances details
MonadRerunnableTrans SqlTransaction Source # 
Instance details

Defined in Database.Persist.Monad.Internal.SqlTransaction

Methods

rerunnableLift :: Monad m => m a -> SqlTransaction m a Source #

MonadFix m => MonadFix (SqlTransaction m) Source # 
Instance details

Defined in Database.Persist.Monad.Internal.SqlTransaction

Methods

mfix :: (a -> SqlTransaction m a) -> SqlTransaction m a #

(TypeError ('Text "Cannot run arbitrary IO actions within a transaction. If the IO action is rerunnable, use rerunnableIO") :: Constraint, Monad m) => MonadIO (SqlTransaction m) Source # 
Instance details

Defined in Database.Persist.Monad.Internal.SqlTransaction

Methods

liftIO :: IO a -> SqlTransaction m a #

Applicative m => Applicative (SqlTransaction m) Source # 
Instance details

Defined in Database.Persist.Monad.Internal.SqlTransaction

Methods

pure :: a -> SqlTransaction m a #

(<*>) :: SqlTransaction m (a -> b) -> SqlTransaction m a -> SqlTransaction m b #

liftA2 :: (a -> b -> c) -> SqlTransaction m a -> SqlTransaction m b -> SqlTransaction m c #

(*>) :: SqlTransaction m a -> SqlTransaction m b -> SqlTransaction m b #

(<*) :: SqlTransaction m a -> SqlTransaction m b -> SqlTransaction m a #

Functor m => Functor (SqlTransaction m) Source # 
Instance details

Defined in Database.Persist.Monad.Internal.SqlTransaction

Methods

fmap :: (a -> b) -> SqlTransaction m a -> SqlTransaction m b #

(<$) :: a -> SqlTransaction m b -> SqlTransaction m a #

Monad m => Monad (SqlTransaction m) Source # 
Instance details

Defined in Database.Persist.Monad.Internal.SqlTransaction

Methods

(>>=) :: SqlTransaction m a -> (a -> SqlTransaction m b) -> SqlTransaction m b #

(>>) :: SqlTransaction m a -> SqlTransaction m b -> SqlTransaction m b #

return :: a -> SqlTransaction m a #

MonadRerunnableIO m => MonadRerunnableIO (SqlTransaction m) Source # 
Instance details

Defined in Database.Persist.Monad.Internal.SqlTransaction

(MonadSqlQuery m, MonadUnliftIO m) => MonadSqlQuery (SqlTransaction m) Source # 
Instance details

Defined in Database.Persist.Monad.Internal.SqlTransaction

Associated Types

type TransactionM (SqlTransaction m) :: Type -> Type Source #

type TransactionM (SqlTransaction m) Source # 
Instance details

Defined in Database.Persist.Monad.Internal.SqlTransaction

catchSqlTransaction :: (MonadUnliftIO m, Exception e) => SqlTransaction m a -> (e -> SqlTransaction m a) -> SqlTransaction m a Source #

Like normal catch, except ignores errors specified by ignoreCatch.