    module Database.Persist.SqlBackend.Internal.SqlPoolHooks
      ( SqlPoolHooks(..)
      ) where
    import Control.Exception (SomeException)
    import Database.Persist.SqlBackend.Internal.IsolationLevel

    -- | A set of hooks that may be used to alter the behaviour
    -- of @runSqlPoolWithExtensibleHooks@ in a backwards-compatible
    -- fashion.
    data SqlPoolHooks m backend = SqlPoolHooks
        { forall (m :: * -> *) backend.
    SqlPoolHooks m backend -> backend -> m backend
    alterBackend :: backend -> m backend
        -- ^ Alter the backend prior to executing any actions with it.
        , forall (m :: * -> *) backend.
    SqlPoolHooks m backend -> backend -> Maybe IsolationLevel -> m ()
    runBefore :: backend -> Maybe IsolationLevel -> m ()
        -- ^ Run this action immediately before the action is performed.
        , forall (m :: * -> *) backend.
    SqlPoolHooks m backend -> backend -> Maybe IsolationLevel -> m ()
    runAfter :: backend -> Maybe IsolationLevel -> m ()
        -- ^ Run this action immediately after the action is completed.
        , forall (m :: * -> *) backend.
    SqlPoolHooks m backend
    -> backend -> Maybe IsolationLevel -> SomeException -> m ()
    runOnException :: backend -> Maybe IsolationLevel -> SomeException -> m ()
        -- ^ This action is performed when an exception is received. The
        -- exception is provided as a convenience - it is rethrown once this
        -- cleanup function is complete.
        }