module Data.ByteString.SaferFileHandles
( hGetLine
, hGetContents
, hGet
#if MIN_VERSION_explicit_iomodes_bytestring(0,2,0)
, hGetSome
#endif
, hGetNonBlocking
, hPut
#if MIN_VERSION_explicit_iomodes_bytestring(0,2,0)
, hPutNonBlocking
#endif
, hPutStr
) where
import Data.Int ( Int )
import Control.Monad.IO.Class ( MonadIO )
import qualified Data.ByteString as B
import Control.Monad.Trans.Region ( AncestorRegion )
import qualified Data.ByteString.ExplicitIOModes as E ( hGetLine
, hGetContents
, hGet
#if MIN_VERSION_explicit_iomodes_bytestring(0,2,0)
, hGetSome
#endif
, hGetNonBlocking
, hPut
#if MIN_VERSION_explicit_iomodes_bytestring(0,2,0)
, hPutNonBlocking
#endif
, hPutStr
)
import System.IO.SaferFileHandles ( FileHandle, ReadModes, WriteModes )
import System.IO.SaferFileHandles.Unsafe ( wrap, wrap2 )
hGetLine ∷ ( FileHandle handle, ReadModes ioMode
, pr `AncestorRegion` cr, MonadIO cr
)
⇒ handle ioMode pr → cr B.ByteString
hGetLine = wrap E.hGetLine
hGetContents ∷ ( FileHandle handle, ReadModes ioMode
, pr `AncestorRegion` cr, MonadIO cr
)
⇒ handle ioMode pr → cr B.ByteString
hGetContents = wrap E.hGetContents
hGet ∷ ( FileHandle handle, ReadModes ioMode
, pr `AncestorRegion` cr, MonadIO cr
)
⇒ handle ioMode pr → Int → cr B.ByteString
hGet = wrap2 E.hGet
#if MIN_VERSION_explicit_iomodes_bytestring(0,2,0)
hGetSome ∷ ( FileHandle handle, ReadModes ioMode
, pr `AncestorRegion` cr, MonadIO cr
)
⇒ handle ioMode pr → Int → cr B.ByteString
hGetSome = wrap2 E.hGetSome
#endif
hGetNonBlocking ∷ ( FileHandle handle, ReadModes ioMode
, pr `AncestorRegion` cr, MonadIO cr
)
⇒ handle ioMode pr → Int → cr B.ByteString
hGetNonBlocking = wrap2 E.hGetNonBlocking
hPut ∷ ( FileHandle handle, WriteModes ioMode
, pr `AncestorRegion` cr, MonadIO cr
)
⇒ handle ioMode pr → B.ByteString → cr ()
hPut = wrap2 E.hPut
#if MIN_VERSION_explicit_iomodes_bytestring(0,2,0)
hPutNonBlocking ∷ ( FileHandle handle, WriteModes ioMode
, pr `AncestorRegion` cr, MonadIO cr
)
⇒ handle ioMode pr → B.ByteString → cr B.ByteString
hPutNonBlocking = wrap2 E.hPutNonBlocking
#endif
hPutStr ∷ ( FileHandle handle, WriteModes ioMode
, pr `AncestorRegion` cr, MonadIO cr
)
⇒ handle ioMode pr → B.ByteString → cr ()
hPutStr = wrap2 E.hPutStr