{- | IO into a pair of Haskell handles, like the ones created with stdin and stdout of a forked process. -} module System.IO.Uniform.HandlePair ( HandlePair, fromHandles ) where import System.IO (Handle, hClose) import System.IO.Uniform import qualified Data.ByteString as BS data HandlePair = HandlePair Handle Handle {- | > fromHandles inputHandler outputHandler Creates a uniform io target from a pair of handlers. -} fromHandles :: Handle -> Handle -> HandlePair fromHandles = HandlePair -- | UniformIO that reads from stdin and writes to stdout. instance UniformIO HandlePair where uRead (HandlePair i _) n = BS.hGetSome i n uPut (HandlePair _ o) t = BS.hPut o t uClose (HandlePair i o) = do hClose i hClose o startTls _ a = return a isSecure _ = True