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


-- | Connection pool built on top of resource-pool and streaming-commons.
--   
--   Connection poll is a family of specialised resource pools. Currently
--   package provides two variants:
--   
--   <ol>
--   <li>pool for TCP client connections,</li>
--   <li>and pool for UNIX Sockets client connections.</li>
--   </ol>
--   
--   In addition it can be used to build your own connection pool using
--   provided primitives.
--   
--   This package is built on top of <a>resource-pool</a> and
--   <a>streaming-commons</a>. The later allows us to use
--   <a>conduit-extra</a> package for implementation of TCP or UNIX Sockets
--   clients.
--   
--   For examples and other details see documentation in
--   <a>Data.ConnectionPool</a> module.
@package connection-pool
@version 0.2.2


-- | Module defines data family of connection pools that is later
--   specialised for various protocols and implementations.
--   
--   This module is intended mostly for library writers, for normal usage
--   just import <a>Data.ConnectionPool</a> which re-exports
--   <a>ConnectionPool</a> data family.
--   
--   Notice that this module doesn't depend on any other internal modules
--   nor any other package then <a>base</a>. Please, bear this in mind when
--   doing modifications.
module Data.ConnectionPool.Family

-- | Family of connection pools parametrised by transport protocol.
--   
--   <i>Definition changed in version 0.2 to be kind polymorphic (only on
--   GHC &gt;=</i> <i>7.10), and became part of stable API by being moved
--   in to</i> <i><a>Data.ConnectionPool.Family</a> module.</i>


-- | Type class for common connection pool operations.
module Data.ConnectionPool.Class

-- | Type class for common connection pool operations. It intentionally
--   doesn't handle connection pool creation, which is best left to
--   dedicated smart constructors.
--   
--   <i>Since version 0.2.</i>
class ConnectionPoolFor (protocol :: k) where {
    type family HandlerData protocol;
}

-- | Temporarily take a connection from a pool, run handler with it, and
--   return it to the pool afterwards.
--   
--   <i>Since version 0.2.</i>
withConnection :: (ConnectionPoolFor protocol, MonadBaseControl IO m) => ConnectionPool protocol -> (HandlerData protocol -> m r) -> m r

-- | Similar to <a>withConnection</a>, but only performs action if a
--   connection could be taken from the pool <i>without blocking.</i>
--   Otherwise, <tt>tryWithResource</tt> returns immediately with
--   <tt>Nothing</tt> (ie. the action function is not called). Conversely,
--   if a connection can be acquired from the pool without blocking, the
--   action is performed and it's result is returned, wrapped in a
--   <tt>Just</tt>.
--   
--   <i>Since version 0.2.</i>
tryWithConnection :: (ConnectionPoolFor protocol, MonadBaseControl IO m) => ConnectionPool protocol -> (HandlerData protocol -> m r) -> m (Maybe r)

-- | Destroy all connections that might be still open in a connection pool.
--   This is useful when one needs to release all resources at once and not
--   to wait for idle timeout to be reached.
--   
--   <i>Since version 0.2.</i>
destroyAllConnections :: ConnectionPoolFor protocol => ConnectionPool protocol -> IO ()


-- | Internal packages are here to provide access to internal definitions
--   for library writers, but they should not be used in application code.
--   
--   Preferably use qualified import, e.g.:
--   
--   <pre>
--   import qualified Data.ConnectionPool.Internal.HandlerParams as Internal
--   </pre>
--   
--   This module doesn't depend on <a>streaming-commons</a>. Another
--   notable thing is that this package is not OS specific. Please, bear
--   this in mind when doing modifications.
--   
--   <i>Since version 0.1.3.</i>
module Data.ConnectionPool.Internal.HandlerParams

-- | Additional parameters passed to connection handler that aren't part of
--   specific connection context.
--   
--   <i>Since version 0.1.3.</i>
data HandlerParams
HandlerParams :: !Int -> HandlerParams

-- | See <a>readBufferSize</a> for details.
[_readBufferSize] :: HandlerParams -> !Int

-- | Lens for accessing read buffer size that handler should use when
--   reading data from connection.
--   
--   <i>Since version 0.1.3.</i>
readBufferSize :: Functor f => (Int -> f Int) -> HandlerParams -> f HandlerParams
instance GHC.Show.Show Data.ConnectionPool.Internal.HandlerParams.HandlerParams
instance GHC.Generics.Generic Data.ConnectionPool.Internal.HandlerParams.HandlerParams
instance Data.Data.Data Data.ConnectionPool.Internal.HandlerParams.HandlerParams
instance Data.Default.Class.Default Data.ConnectionPool.Internal.HandlerParams.HandlerParams


-- | Internal packages are here to provide access to internal definitions
--   for library writers, but they should not be used in application code.
--   
--   Preferably use qualified import, e.g.:
--   
--   <pre>
--   import qualified Data.ConnectionPool.Internal.ResourcePoolParams
--     as Internal
--   </pre>
--   
--   Surprisingly this module doesn't depend on <a>resource-pool</a>
--   package and it would be good if it stayed that way, but not at the
--   cost of crippling functionality.
--   
--   Importantly this package should not depend on <a>streaming-commons</a>
--   package or other modules of this package.
--   
--   Please, bear above in mind when doing modifications.
module Data.ConnectionPool.Internal.ResourcePoolParams

-- | Parameters of resource pool that describe things like its internal
--   structure. See <a>createPool</a> for details.
--   
--   <i>Instance for <a>Generic</a> introduced in version 0.2.</i>
data ResourcePoolParams
ResourcePoolParams :: !Int -> !NominalDiffTime -> !Int -> ResourcePoolParams
[_numberOfStripes] :: ResourcePoolParams -> !Int
[_resourceIdleTimeout] :: ResourcePoolParams -> !NominalDiffTime
[_numberOfResourcesPerStripe] :: ResourcePoolParams -> !Int

-- | Lens for accessing maximum number of resources to keep open per
--   stripe. The smallest acceptable value is 1 (default).
numberOfResourcesPerStripe :: Functor f => (Int -> f Int) -> ResourcePoolParams -> f ResourcePoolParams

-- | Lens for accessing stripe count. The number of distinct sub-pools to
--   maintain. The smallest acceptable value is 1 (default).
numberOfStripes :: Functor f => (Int -> f Int) -> ResourcePoolParams -> f ResourcePoolParams

-- | Lens for accessing amount of time for which an unused resource is kept
--   open. The smallest acceptable value is 0.5 seconds (default).
resourceIdleTimeout :: Functor f => (NominalDiffTime -> f NominalDiffTime) -> ResourcePoolParams -> f ResourcePoolParams

-- | Check if all parameters for underlying resource pool are valid:
--   
--   <ul>
--   <li><tt><a>numberOfStripes</a> &gt;= 1</tt> Number of connection
--   sub-pools. Keeping it set to <tt>1</tt> is good for most
--   applications.</li>
--   <li><tt><a>numberOfResourcesPerStripe</a> &gt;= 1</tt> Maximum number
--   of connections in each stripe. Totally there can be
--   <tt><a>numberOfStripes</a> * <a>numberOfResourcesPerStripe</a></tt>
--   open connections simultaneously.</li>
--   <li><tt><a>resourceIdleTimeout</a> &gt;= 0.5</tt> Property specified
--   for how long connection will be kept alive after it is released by
--   back to the pool before it is automatically closed. Value is in
--   seconds.</li>
--   </ul>
--   
--   For more details see <a>createPool</a>.
--   
--   <i>Since version 0.1.1.0.</i>
validateResourcePoolParams :: ResourcePoolParams -> Either String ResourcePoolParams
instance GHC.Show.Show Data.ConnectionPool.Internal.ResourcePoolParams.ResourcePoolParams
instance GHC.Generics.Generic Data.ConnectionPool.Internal.ResourcePoolParams.ResourcePoolParams
instance Data.Data.Data Data.ConnectionPool.Internal.ResourcePoolParams.ResourcePoolParams
instance Data.Default.Class.Default Data.ConnectionPool.Internal.ResourcePoolParams.ResourcePoolParams


-- | Internal packages are here to provide access to internal definitions
--   for library writers, but they should not be used in application code.
--   
--   Preferably use qualified import, e.g.:
--   
--   <pre>
--   import qualified Data.ConnectionPool.Internal.ConnectionPool as Internal
--   </pre>
--   
--   This module doesn't depend on <a>streaming-commons</a> and other
--   non-HaskellPlatform packages with exception of two packages
--   <a>resource-pool</a> and <a>between</a>. Another notable thing is that
--   this package is not OS specific. Please, bear this in mind when doing
--   modifications.
module Data.ConnectionPool.Internal.ConnectionPool

-- | Simple specialized wrapper for <a>Pool</a>.
--   
--   <i>Definition changed in version 0.1.3 and 0.2.</i> <i>Instance for
--   <a>Generic</a> introduced in version 0.2.</i>
data ConnectionPool handlerParams connection connectionInfo
ConnectionPool :: !(Pool (connection, connectionInfo)) -> !handlerParams -> ConnectionPool handlerParams connection connectionInfo

-- | See <a>resourcePool</a> for details.
--   
--   <i>Since version 0.1.3; changed in 0.2.</i>
[_resourcePool] :: ConnectionPool handlerParams connection connectionInfo -> !(Pool (connection, connectionInfo))

-- | See <a>handlerParams</a> for details.
--   
--   <i>Since version 0.1.3.</i>
[_handlerParams] :: ConnectionPool handlerParams connection connectionInfo -> !handlerParams

-- | Lens for accessing underlying resource pool <tt><a>Pool</a>
--   (connection, connectionInfo)</tt>. Where <tt>connection</tt>
--   represents network connection and <tt>connectionInfo</tt> is a
--   protocol specific information associated with the same network
--   connection as the <tt>connection</tt> is.
--   
--   <i>Since version 0.1.3; changed in 0.2.</i>
resourcePool :: Functor f => (Pool (c, i) -> f (Pool (c', i'))) -> ConnectionPool p c i -> f (ConnectionPool p c' i')

-- | Lens for accessing parameters passed down to connection handler. These
--   information will usually be implementation specific. E.g. for
--   <a>streaming-commons</a> &gt;= 1.13 we use this to pass around read
--   buffer size, for more details see module
--   <a>Data.ConnectionPool.Internal.HandlerParams</a>.
--   
--   <i>Since version 0.1.3.</i>
handlerParams :: Functor f => (handlerParams -> f handlerParams') -> ConnectionPool handlerParams c i -> f (ConnectionPool handlerParams' c i)

-- | <i>Since version 0.2.</i>
class HasConnectionPool p c i s | s -> p, s -> c, s -> i

-- | Lens for accessing <a>ConnectionPool</a> wrapped in a data type.
connectionPool :: (HasConnectionPool p c i s, Functor f) => (ConnectionPool p c i -> f (ConnectionPool p c i)) -> s -> f s

-- | Specialized wrapper for <a>createPool</a>, see its documentation for
--   details.
--   
--   Definition changed in <i>version 0.1.3 and version 0.2</i>.
createConnectionPool :: handlerParams -> IO (connection, connectionInfo) -> (connection -> IO ()) -> ResourcePoolParams -> IO (ConnectionPool handlerParams connection connectionInfo)

-- | Destroy all connections that might be still open in a connection pool.
--   This is useful when one needs to release all resources at once and not
--   to wait for idle timeout to be reached.
--   
--   For more details see <a>destroyAllResources</a>.
--   
--   <i>Since version 0.1.1.0.</i>
destroyAllConnections :: ConnectionPool p c i -> IO ()

-- | Specialized wrapper for <a>withResource</a>.
--   
--   <i>Changed in version 0.2.</i>
withConnection :: MonadBaseControl IO m => ConnectionPool handlerParams connection connectionInfo -> (handlerParams -> connection -> connectionInfo -> m r) -> m r

-- | Specialized wrapper for <a>tryWithResource</a>.
--   
--   <i>Since version 0.2.</i>
tryWithConnection :: MonadBaseControl IO m => ConnectionPool handlerParams connection connectionInfo -> (handlerParams -> connection -> connectionInfo -> m r) -> m (Maybe r)
instance GHC.Generics.Generic (Data.ConnectionPool.Internal.ConnectionPool.ConnectionPool handlerParams connection connectionInfo)
instance GHC.Show.Show handlerParams => GHC.Show.Show (Data.ConnectionPool.Internal.ConnectionPool.ConnectionPool handlerParams c i)


-- | Module defines helper functions that would be ideally provided by
--   <a>streaming-commons</a> package and some wrappers with specialised
--   type signatures.
--   
--   Internal packages are here to provide access to internal definitions
--   for library writers, but they should not be used in application code.
--   
--   Preferably use qualified import, e.g.:
--   
--   <pre>
--   import qualified Data.ConnectionPool.Internal.Streaming as Internal
--   </pre>
--   
--   This module doesn't neither depend on <a>resource-pool</a> package nor
--   any other module of this package, with notable exception of
--   <a>Data.ConnectionPool.Internal.HandlerParams</a>, and it shoud stay
--   that way. This module uses CPP to get OS specific things right. Most
--   importantly Windows doesn't support UNIX Sockets.
--   
--   Please, bear above in mind when doing modifications.
module Data.ConnectionPool.Internal.Streaming

-- | Wrapper for <a>getSocketFamilyTCP</a> that takes <a>ClientSettings</a>
--   instead of individual parameters.
acquireTcpClientConnection :: ClientSettings -> IO (Socket, SockAddr)

-- | Wrapper for <a>runTcpAppImpl</a> with a type signature that is more
--   natural for implementing a TCP specific <a>withConnection</a>.
--   
--   <i>Definition changed in version 0.1.3 and 0.2.1.</i>
runTcpApp :: Maybe SockAddr -> (AppData -> m r) -> HandlerParams -> Socket -> SockAddr -> m r

-- | Simplified <a>runTCPClient</a> and <a>runTCPServer</a> that provides
--   only construction of <a>AppData</a> and passing it to a callback
--   function.
--   
--   <i>Definition changed in version 0.1.3 and 0.2.1.</i>
runTcpAppImpl :: Maybe SockAddr -> Socket -> SockAddr -> Int -> (AppData -> m r) -> m r

-- | Construct <a>HandlerParams</a> that are passed to individual TCP
--   connection handlers.
--   
--   <i>Since version 0.1.3.</i>
fromClientSettings :: ClientSettings -> HandlerParams

-- | Wrapper for <a>runUnixAppImpl</a> with a type signature that is more
--   natural for implementing a UNIX Socket specific <a>withConnection</a>.
--   
--   <i>Definition changed in version 0.1.3 and 0.2.1.</i>
runUnixApp :: (AppDataUnix -> m r) -> HandlerParams -> Socket -> () -> m r

-- | Simplified <a>runUnixClient</a> and <a>runUnixServer</a> that provides
--   only construction of <a>AppDataUnix</a> and passing it to a callback
--   function.
--   
--   <i>Definition changed in version 0.1.3 and 0.2.1.</i>
runUnixAppImpl :: Socket -> Int -> (AppDataUnix -> m r) -> m r

-- | Construct <a>HandlerParams</a> that are passed to individual UNIX
--   socket connection handlers.
--   
--   <i>Since version 0.1.3.</i>
fromClientSettingsUnix :: ClientSettingsUnix -> HandlerParams

-- | Compatibility wrapper around <tt>close/sClose</tt>.
--   
--   Package <a>network</a> deprecated <tt>sClose</tt> in favour of
--   <tt>close</tt> in version 2.4.0.0.
--   
--   <i>Since version 0.2.2.</i>
close :: Socket -> IO ()


-- | Module defines type family of connection pools that is later
--   specialised using type tags (phantom types) to specialize
--   implementation of underlying <a>ConnectionPool</a> for various
--   protocols.
--   
--   Internal packages are here to provide access to internal definitions
--   for library writers, but they should not be used in application code.
--   
--   Preferably use qualified import, e.g.:
--   
--   <pre>
--   import qualified Data.ConnectionPool.Internal.TCP as Internal
--   </pre>
--   
--   <i>Module introduced in version 0.2.</i>
module Data.ConnectionPool.Internal.TCP

-- | Family of connection pools parametrised by transport protocol.
--   
--   <i>Definition changed in version 0.2 to be kind polymorphic (only on
--   GHC &gt;=</i> <i>7.10), and became part of stable API by being moved
--   in to</i> <i><a>Data.ConnectionPool.Family</a> module.</i>

-- | Type tag used to specialize connection pool for TCP clients.
--   
--   <i>Instance for <a>Generic</a> introduced in version 0.2.</i>
data TcpClient

-- | Create connection pool for TCP clients.
createTcpClientPool :: ResourcePoolParams -> ClientSettings -> IO (ConnectionPool TcpClient)

-- | Temporarily take a TCP connection from a pool, run client with it, and
--   return it to the pool afterwards. For details how connections are
--   allocated see <a>withResource</a>.
withTcpClientConnection :: (MonadBaseControl io m, io ~ IO) => ConnectionPool TcpClient -> (AppData -> m r) -> m r

-- | Similar to <a>withConnection</a>, but only performs action if a TCP
--   connection could be taken from the pool <i>without blocking.</i>
--   Otherwise, <tt>tryWithResource</tt> returns immediately with
--   <a>Nothing</a> (ie. the action function is not called). Conversely, if
--   a connection can be acquired from the pool without blocking, the
--   action is performed and it's result is returned, wrapped in a
--   <tt>Just</tt>.
--   
--   <i>Since version 0.2.</i>
tryWithTcpClientConnection :: (MonadBaseControl io m, io ~ IO) => ConnectionPool TcpClient -> (AppData -> m r) -> m (Maybe r)

-- | Destroy all TCP connections that might be still open in a connection
--   pool. This is useful when one needs to release all resources at once
--   and not to wait for idle timeout to be reached.
--   
--   For more details see <a>destroyAllResources</a>.
--   
--   <i>Since version 0.1.1.0.</i>
destroyAllTcpClientConnections :: ConnectionPool TcpClient -> IO ()
instance GHC.Generics.Generic Data.ConnectionPool.Internal.TCP.TcpClient
instance GHC.Show.Show (Data.ConnectionPool.Family.ConnectionPool Data.ConnectionPool.Internal.TCP.TcpClient)
instance GHC.Generics.Generic (Data.ConnectionPool.Family.ConnectionPool Data.ConnectionPool.Internal.TCP.TcpClient)
instance Data.ConnectionPool.Internal.ConnectionPool.HasConnectionPool Data.ConnectionPool.Internal.HandlerParams.HandlerParams Network.Socket.Types.Socket Network.Socket.Types.SockAddr (Data.ConnectionPool.Family.ConnectionPool Data.ConnectionPool.Internal.TCP.TcpClient)
instance Data.ConnectionPool.Class.ConnectionPoolFor Data.ConnectionPool.Internal.TCP.TcpClient


-- | Module defines type family of connection pools that is later
--   specialised using type tags (phantom types) to specialize
--   implementation of underlying <a>ConnectionPool</a> for various
--   protocols.
--   
--   Internal packages are here to provide access to internal definitions
--   for library writers, but they should not be used in application code.
--   
--   Preferably use qualified import, e.g.:
--   
--   <pre>
--   import qualified Data.ConnectionPool.Internal.Unix as Internal
--   </pre>
--   
--   This package is OS specific, because Windows doesn't support UNIX
--   Sockets. Please, bear this in mind when doing modifications.
--   
--   <i>Module introduced in version 0.2.</i>
module Data.ConnectionPool.Internal.Unix

-- | Family of connection pools parametrised by transport protocol.
--   
--   <i>Definition changed in version 0.2 to be kind polymorphic (only on
--   GHC &gt;=</i> <i>7.10), and became part of stable API by being moved
--   in to</i> <i><a>Data.ConnectionPool.Family</a> module.</i>

-- | Type tag used to specialize connection pool for UNIX Socket clients.
--   
--   <i>Instance for <a>Generic</a> introduced in version 0.2.</i>
data UnixClient

-- | Create connection pool for UNIX Sockets clients.
createUnixClientPool :: ResourcePoolParams -> ClientSettingsUnix -> IO (ConnectionPool UnixClient)

-- | Temporarily take a UNIX Sockets connection from a pool, run client
--   with it, and return it to the pool afterwards. For details how
--   connections are allocated see <a>withResource</a>.
withUnixClientConnection :: (MonadBaseControl io m, io ~ IO) => ConnectionPool UnixClient -> (AppDataUnix -> m r) -> m r

-- | Similar to <a>withConnection</a>, but only performs action if a UNIX
--   Sockets connection could be taken from the pool <i>without
--   blocking.</i> Otherwise, <tt>tryWithResource</tt> returns immediately
--   with <tt>Nothing</tt> (ie. the action function is not called).
--   Conversely, if a connection can be acquired from the pool without
--   blocking, the action is performed and it's result is returned, wrapped
--   in a <tt>Just</tt>.
--   
--   <i>Since version 0.2.</i>
tryWithUnixClientConnection :: (MonadBaseControl io m, io ~ IO) => ConnectionPool UnixClient -> (AppDataUnix -> m r) -> m (Maybe r)

-- | Destroy all UNIX Sockets connections that might be still open in a
--   connection pool. This is useful when one needs to release all
--   resources at once and not to wait for idle timeout to be reached.
--   
--   For more details see <a>destroyAllResources</a>.
--   
--   <i>Since version 0.1.1.0.</i>
destroyAllUnixClientConnections :: ConnectionPool UnixClient -> IO ()
instance GHC.Generics.Generic Data.ConnectionPool.Internal.Unix.UnixClient
instance GHC.Show.Show (Data.ConnectionPool.Family.ConnectionPool Data.ConnectionPool.Internal.Unix.UnixClient)
instance GHC.Generics.Generic (Data.ConnectionPool.Family.ConnectionPool Data.ConnectionPool.Internal.Unix.UnixClient)
instance Data.ConnectionPool.Internal.ConnectionPool.HasConnectionPool Data.ConnectionPool.Internal.HandlerParams.HandlerParams Network.Socket.Types.Socket () (Data.ConnectionPool.Family.ConnectionPool Data.ConnectionPool.Internal.Unix.UnixClient)
instance Data.ConnectionPool.Class.ConnectionPoolFor Data.ConnectionPool.Internal.Unix.UnixClient


-- | Connection pools for TCP clients and UNIX Socket clients, later is not
--   supported on Windows.
--   
--   This package is built on top of <a>resource-pool</a> and
--   <a>streaming-commons</a> packages. The later allows us to use
--   <a>conduit-extra</a> package for implementing TCP and UNIX Sockets
--   clients. Package <i>conduit-extra</i> defines <tt>appSource</tt> and
--   <tt>appSink</tt> based on abstractions from <i>streaming-commons</i>
--   package and they can be therefore reused. Difference between using
--   <i>conduit-extra</i> or <i>streaming-commons</i> is that instead of
--   using <tt>runTCPClient</tt> (or its lifted variant
--   <tt>runGeneralTCPClient</tt> from <i>conduit-extra</i>) one would use
--   <a>withTcpClientConnection</a>, and instead of <tt>runUnixClient</tt>
--   it would be <a>withUnixClientConnection</a>. There is also more
--   generic function named <a>withConnection</a>, which takes either
--   <a>ConnectionPool</a> instance.
module Data.ConnectionPool

-- | Family of connection pools parametrised by transport protocol.
--   
--   <i>Definition changed in version 0.2 to be kind polymorphic (only on
--   GHC &gt;=</i> <i>7.10), and became part of stable API by being moved
--   in to</i> <i><a>Data.ConnectionPool.Family</a> module.</i>

-- | Parameters of resource pool that describe things like its internal
--   structure. See <a>createPool</a> for details.
--   
--   <i>Instance for <a>Generic</a> introduced in version 0.2.</i>
data ResourcePoolParams

-- | Lens for accessing maximum number of resources to keep open per
--   stripe. The smallest acceptable value is 1 (default).
numberOfResourcesPerStripe :: Functor f => (Int -> f Int) -> ResourcePoolParams -> f ResourcePoolParams

-- | Lens for accessing stripe count. The number of distinct sub-pools to
--   maintain. The smallest acceptable value is 1 (default).
numberOfStripes :: Functor f => (Int -> f Int) -> ResourcePoolParams -> f ResourcePoolParams

-- | Lens for accessing amount of time for which an unused resource is kept
--   open. The smallest acceptable value is 0.5 seconds (default).
resourceIdleTimeout :: Functor f => (NominalDiffTime -> f NominalDiffTime) -> ResourcePoolParams -> f ResourcePoolParams

-- | Check if all parameters for underlying resource pool are valid:
--   
--   <ul>
--   <li><tt><a>numberOfStripes</a> &gt;= 1</tt> Number of connection
--   sub-pools. Keeping it set to <tt>1</tt> is good for most
--   applications.</li>
--   <li><tt><a>numberOfResourcesPerStripe</a> &gt;= 1</tt> Maximum number
--   of connections in each stripe. Totally there can be
--   <tt><a>numberOfStripes</a> * <a>numberOfResourcesPerStripe</a></tt>
--   open connections simultaneously.</li>
--   <li><tt><a>resourceIdleTimeout</a> &gt;= 0.5</tt> Property specified
--   for how long connection will be kept alive after it is released by
--   back to the pool before it is automatically closed. Value is in
--   seconds.</li>
--   </ul>
--   
--   For more details see <a>createPool</a>.
--   
--   <i>Since version 0.1.1.0.</i>
validateResourcePoolParams :: ResourcePoolParams -> Either String ResourcePoolParams

-- | Type tag used to specialize connection pool for TCP clients.
--   
--   <i>Instance for <a>Generic</a> introduced in version 0.2.</i>
data TcpClient

-- | Settings for a TCP client, specifying how to connect to the server.
data ClientSettings :: *

-- | The data passed to an <tt>Application</tt>.
data AppData :: *

-- | Create connection pool for TCP clients.
createTcpClientPool :: ResourcePoolParams -> ClientSettings -> IO (ConnectionPool TcpClient)

-- | Temporarily take a TCP connection from a pool, run client with it, and
--   return it to the pool afterwards. For details how connections are
--   allocated see <a>withResource</a>.
withTcpClientConnection :: (MonadBaseControl io m, io ~ IO) => ConnectionPool TcpClient -> (AppData -> m r) -> m r

-- | Similar to <a>withConnection</a>, but only performs action if a TCP
--   connection could be taken from the pool <i>without blocking.</i>
--   Otherwise, <tt>tryWithResource</tt> returns immediately with
--   <a>Nothing</a> (ie. the action function is not called). Conversely, if
--   a connection can be acquired from the pool without blocking, the
--   action is performed and it's result is returned, wrapped in a
--   <tt>Just</tt>.
--   
--   <i>Since version 0.2.</i>
tryWithTcpClientConnection :: (MonadBaseControl io m, io ~ IO) => ConnectionPool TcpClient -> (AppData -> m r) -> m (Maybe r)

-- | Destroy all TCP connections that might be still open in a connection
--   pool. This is useful when one needs to release all resources at once
--   and not to wait for idle timeout to be reached.
--   
--   For more details see <a>destroyAllResources</a>.
--   
--   <i>Since version 0.1.1.0.</i>
destroyAllTcpClientConnections :: ConnectionPool TcpClient -> IO ()

-- | Type tag used to specialize connection pool for UNIX Socket clients.
--   
--   <i>Instance for <a>Generic</a> introduced in version 0.2.</i>
data UnixClient

-- | Settings for a Unix domain sockets client.
data ClientSettingsUnix :: *

-- | The data passed to a Unix domain sockets <tt>Application</tt>.
data AppDataUnix :: *

-- | Create connection pool for UNIX Sockets clients.
createUnixClientPool :: ResourcePoolParams -> ClientSettingsUnix -> IO (ConnectionPool UnixClient)

-- | Temporarily take a UNIX Sockets connection from a pool, run client
--   with it, and return it to the pool afterwards. For details how
--   connections are allocated see <a>withResource</a>.
withUnixClientConnection :: (MonadBaseControl io m, io ~ IO) => ConnectionPool UnixClient -> (AppDataUnix -> m r) -> m r

-- | Similar to <a>withConnection</a>, but only performs action if a UNIX
--   Sockets connection could be taken from the pool <i>without
--   blocking.</i> Otherwise, <tt>tryWithResource</tt> returns immediately
--   with <tt>Nothing</tt> (ie. the action function is not called).
--   Conversely, if a connection can be acquired from the pool without
--   blocking, the action is performed and it's result is returned, wrapped
--   in a <tt>Just</tt>.
--   
--   <i>Since version 0.2.</i>
tryWithUnixClientConnection :: (MonadBaseControl io m, io ~ IO) => ConnectionPool UnixClient -> (AppDataUnix -> m r) -> m (Maybe r)

-- | Destroy all UNIX Sockets connections that might be still open in a
--   connection pool. This is useful when one needs to release all
--   resources at once and not to wait for idle timeout to be reached.
--   
--   For more details see <a>destroyAllResources</a>.
--   
--   <i>Since version 0.1.1.0.</i>
destroyAllUnixClientConnections :: ConnectionPool UnixClient -> IO ()

-- | Type class for common connection pool operations. It intentionally
--   doesn't handle connection pool creation, which is best left to
--   dedicated smart constructors.
--   
--   <i>Since version 0.2.</i>
class ConnectionPoolFor (protocol :: k) where {
    type family HandlerData protocol;
}

-- | Temporarily take a connection from a pool, run handler with it, and
--   return it to the pool afterwards.
--   
--   <i>Since version 0.2.</i>
withConnection :: (ConnectionPoolFor protocol, MonadBaseControl IO m) => ConnectionPool protocol -> (HandlerData protocol -> m r) -> m r

-- | Similar to <a>withConnection</a>, but only performs action if a
--   connection could be taken from the pool <i>without blocking.</i>
--   Otherwise, <tt>tryWithResource</tt> returns immediately with
--   <tt>Nothing</tt> (ie. the action function is not called). Conversely,
--   if a connection can be acquired from the pool without blocking, the
--   action is performed and it's result is returned, wrapped in a
--   <tt>Just</tt>.
--   
--   <i>Since version 0.2.</i>
tryWithConnection :: (ConnectionPoolFor protocol, MonadBaseControl IO m) => ConnectionPool protocol -> (HandlerData protocol -> m r) -> m (Maybe r)

-- | Destroy all connections that might be still open in a connection pool.
--   This is useful when one needs to release all resources at once and not
--   to wait for idle timeout to be reached.
--   
--   <i>Since version 0.2.</i>
destroyAllConnections :: ConnectionPoolFor protocol => ConnectionPool protocol -> IO ()
