{- |
Run a generic Transport monad action in the IO monad
using the IO transport types, e.g. TCP, UDP, or File.
module Sound.OpenSoundControl.Transport.Monad.IO
   (T, Transport, send, recv, wait, waitFor, with, ) where

import qualified Sound.OpenSoundControl.Transport as Trans
import Sound.OpenSoundControl.Transport.Monad (C, send, recv, wait, waitFor, )
import Sound.OpenSoundControl.Transport (Transport)

import Control.Monad.Trans.Reader (ReaderT(runReaderT))

type T t = ReaderT t IO

-- | Bracket Open Sound Control communication.
with :: Transport t => IO t -> T t a -> IO a
with u = Trans.withTransport u . runReaderT