{-# LANGUAGE NoImplicitPrelude #-}
module RIO.ByteString
( module Data.ByteString
, module RIO.ByteString
) where
import Data.ByteString hiding (head, last, tail, init, foldl1, foldl1', foldr1, foldr1', maximum, minimum, findSubstring, findSubstrings, packCString, packCStringLen, useAsCString, useAsCStringLen, getLine, getContents, putStr, putStrLn, interact, readFile, writeFile, appendFile, hGetLine, hGetContents, hGet, hGetSome, hGetNonBlocking, hPut, hPutNonBlocking, hPutStr, hPutStrLn, breakByte)
import qualified Data.ByteString as B
import RIO
import Foreign.C.String (CString, CStringLen)
packCString :: MonadIO m => CString -> m ByteString
packCString = liftIO . B.packCString
packCStringLen :: MonadIO m => CStringLen -> m ByteString
packCStringLen = liftIO . B.packCStringLen
useAsCString :: MonadUnliftIO m => ByteString -> (CString -> m a) -> m a
useAsCString bs inner = withRunInIO $ \run -> B.useAsCString bs $ run . inner
useAsCStringLen :: MonadUnliftIO m => ByteString -> (CStringLen -> m a) -> m a
useAsCStringLen bs inner = withRunInIO $ \run -> B.useAsCStringLen bs $ run . inner
getLine :: MonadIO m => m ByteString
getLine = liftIO B.getLine
getContents :: MonadIO m => m ByteString
getContents = liftIO B.getContents
putStr :: MonadIO m => ByteString -> m ()
putStr = liftIO . B.putStr
interact :: MonadIO m => (ByteString -> ByteString) -> m ()
interact = liftIO . B.interact
readFile :: MonadIO m => FilePath -> m ByteString
readFile = liftIO . B.readFile
writeFile :: MonadIO m => FilePath -> ByteString -> m ()
writeFile fp = liftIO . B.writeFile fp
appendFile :: MonadIO m => FilePath -> ByteString -> m ()
appendFile fp = liftIO . B.appendFile fp
hGetLine :: MonadIO m => Handle -> m ByteString
hGetLine = liftIO . B.hGetLine
hGetContents :: MonadIO m => Handle -> m ByteString
hGetContents = liftIO . B.hGetContents
hGet :: MonadIO m => Handle -> Int -> m ByteString
hGet h = liftIO . B.hGet h
hGetSome :: MonadIO m => Handle -> Int -> m ByteString
hGetSome h = liftIO . B.hGetSome h
hGetNonBlocking :: MonadIO m => Handle -> Int -> m ByteString
hGetNonBlocking h = liftIO . B.hGetNonBlocking h
hPut :: MonadIO m => Handle -> ByteString -> m ()
hPut h = liftIO . B.hPut h
hPutNonBlocking :: MonadIO m => Handle -> ByteString -> m ByteString
hPutNonBlocking h = liftIO . B.hPutNonBlocking h
hPutStr :: MonadIO m => Handle -> ByteString -> m ()
hPutStr h = liftIO . B.hPutStr h