-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A pool of connections for Hasql
--   
--   A pool of connections for Hasql
@package hasql-pool
@version 0.4.1

module Hasql.Pool

-- | A pool of connections to DB.
data Pool

-- | Settings of the connection pool. Consist of:
--   
--   <ul>
--   <li>Pool-size.</li>
--   <li>Timeout. An amount of time for which an unused resource is kept
--   open. The smallest acceptable value is 0.5 seconds.</li>
--   <li>Connection settings.</li>
--   </ul>
type Settings = (Int, NominalDiffTime, Settings)

-- | Given the pool-size, timeout and connection settings create a
--   connection-pool.
acquire :: Settings -> IO Pool

-- | Release the connection-pool.
release :: Pool -> IO ()

-- | A union over the connection establishment error and the session error.
data UsageError
ConnectionError :: !ConnectionError -> UsageError
SessionError :: !Error -> UsageError

-- | Use a connection from the pool to run a session and return the
--   connection to the pool, when finished.
use :: Pool -> Session a -> IO (Either UsageError a)
instance GHC.Classes.Eq Hasql.Pool.UsageError
instance GHC.Show.Show Hasql.Pool.UsageError
