Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- unsafeRunIOInTxM :: IO a -> TxM r a
- unsafeWithRunInIOTxM :: ((forall a. TxM r a -> IO a) -> IO b) -> TxM r b
- unsafeUnTxM :: TxM r a -> ReaderT r IO a
- unsafeRunTxM :: r -> TxM r a -> IO a
- unsafeMkTxM :: (r -> IO a) -> TxM r a
- unsafeMksTxM :: TxEnv a r => (a -> IO b) -> TxM r b
- unsafeLookupTxEnvIO :: TxEnv a r => r -> IO a
- unsafeMkTxException :: Exception e => (e -> Maybe String) -> e -> TxException
Introduction
postgresql-tx
discourages performing arbitrary IO
within a database
transaction, but sometimes performing this IO
is necessary. This module
provides operations and infrastructure for performing "unsafe" IO
actions
within TxM
or a specific database library implementation monad. It also
provides utilities for use in adaptor libraries.
Clients must explicitly import this module to perform IO
in TxM
or a
specific database library implementation monad. All functions this module
provides are prefixed with unsafe*
. These two factors serve as annotation
to simplify understanding exactly which parts of transactional database code
are performing arbitary IO
.
Operations
unsafeRunIOInTxM :: IO a -> TxM r a Source #
For adaptor libraries
unsafeRunTxM :: r -> TxM r a -> IO a Source #
unsafeMkTxM :: (r -> IO a) -> TxM r a Source #
unsafeMksTxM :: TxEnv a r => (a -> IO b) -> TxM r b Source #
Similar to unsafeMkTxM
but allows for constructing a TxM
with a
reader function using a specific value from the environment.
Use this function with care - arbitrary IO
should only be run
within a transaction when truly necessary.
Since: 0.2.0.0
unsafeLookupTxEnvIO :: TxEnv a r => r -> IO a Source #
Analogous to lookupTxEnv
but can be run in IO
instead of TxM
.
Since: 0.2.0.0
unsafeMkTxException :: Exception e => (e -> Maybe String) -> e -> TxException Source #
Construct a TxException
from an errcode
accessing function
and the cause
exception.
Note that this function should only be used by libraries
which are implementing a database backend for postgresql-tx
.