-- | In-memory implementation of the Transport API.
module Network.Transport.InMemory
  ( createTransport
  , createTransportExposeInternals
  -- * For testing purposes
  , TransportInternals(..)
  , breakConnection
  ) where

import Network.Transport
import Network.Transport.InMemory.Internal
import Network.Transport.InMemory.Debug

-- | Create a new Transport.
--
-- Only a single transport should be created per Haskell process
-- (threads can, and should, create their own endpoints though).
createTransport :: IO Transport
createTransport :: IO Transport
createTransport = ((Transport, TransportInternals) -> Transport)
-> IO (Transport, TransportInternals) -> IO Transport
forall a b. (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Transport, TransportInternals) -> Transport
forall a b. (a, b) -> a
fst IO (Transport, TransportInternals)
createTransportExposeInternals