Fix up docs
This commit is contained in:
parent
45aca26340
commit
3b4a7f445c
27
src/Streamly/External/FileSystem/Handle/Posix.hs
vendored
27
src/Streamly/External/FileSystem/Handle/Posix.hs
vendored
@ -73,7 +73,7 @@ fromChunks =
|
|||||||
. S.map Strict.fromArray
|
. S.map Strict.fromArray
|
||||||
|
|
||||||
|
|
||||||
-- |Read the given file lazily as a lazy ByteString.
|
-- |Read a file lazily as a lazy ByteString.
|
||||||
--
|
--
|
||||||
-- The handle is closed automatically, when the stream exits normally,
|
-- The handle is closed automatically, when the stream exits normally,
|
||||||
-- aborts or gets garbage collected.
|
-- aborts or gets garbage collected.
|
||||||
@ -84,17 +84,13 @@ readFileLBS :: Handle -- ^ readable file handle
|
|||||||
readFileLBS handle' = fromChunks (readFileStream handle')
|
readFileLBS handle' = fromChunks (readFileStream handle')
|
||||||
|
|
||||||
|
|
||||||
-- |Read the given file lazily as a lazy ByteString.
|
-- |Like 'readFileLBS', except doesn't close the handle..
|
||||||
--
|
|
||||||
-- The handle is NOT closed automatically.
|
|
||||||
--
|
|
||||||
-- This uses `unsafeInterleaveIO` under the hood.
|
|
||||||
readFileLBS' :: Handle -- ^ readable file handle
|
readFileLBS' :: Handle -- ^ readable file handle
|
||||||
-> IO L.ByteString
|
-> IO L.ByteString
|
||||||
readFileLBS' handle' = fromChunks (readFileStream' handle')
|
readFileLBS' handle' = fromChunks (readFileStream' handle')
|
||||||
|
|
||||||
|
|
||||||
-- | Read from the given handle as a streamly filestream.
|
-- | Read a handle as a streamly filestream.
|
||||||
--
|
--
|
||||||
-- The handle is closed automatically, when the stream exits normally,
|
-- The handle is closed automatically, when the stream exits normally,
|
||||||
-- aborts or gets garbage collected.
|
-- aborts or gets garbage collected.
|
||||||
@ -104,10 +100,7 @@ readFileStream :: (MonadCatch m, MonadAsync m)
|
|||||||
-> SerialT m (Array Word8)
|
-> SerialT m (Array Word8)
|
||||||
readFileStream = S.unfold (SIU.finallyIO (liftIO . hClose) FH.readChunks)
|
readFileStream = S.unfold (SIU.finallyIO (liftIO . hClose) FH.readChunks)
|
||||||
|
|
||||||
-- | Read from the given handle as a streamly filestream.
|
-- | Like 'readFileStream', except doesn't close the handle.
|
||||||
--
|
|
||||||
-- The handle is NOT closed automatically.
|
|
||||||
-- The stream must not be used after the handle is closed.
|
|
||||||
readFileStream' :: (MonadCatch m, MonadAsync m)
|
readFileStream' :: (MonadCatch m, MonadAsync m)
|
||||||
=> Handle
|
=> Handle
|
||||||
-> SerialT m (Array Word8)
|
-> SerialT m (Array Word8)
|
||||||
@ -124,9 +117,7 @@ copyFileHandle :: (MonadCatch m, MonadAsync m, MonadMask m)
|
|||||||
copyFileHandle fromHandle toHandle =
|
copyFileHandle fromHandle toHandle =
|
||||||
copyFileStream (readFileStream fromHandle) toHandle
|
copyFileStream (readFileStream fromHandle) toHandle
|
||||||
|
|
||||||
-- | Like 'copyFileStream'', except for two file handles.
|
-- | Like 'copyFileHandle', except doesn't close the handles.
|
||||||
--
|
|
||||||
-- Handles are NOT closed automatically.
|
|
||||||
copyFileHandle' :: (MonadCatch m, MonadAsync m, MonadMask m)
|
copyFileHandle' :: (MonadCatch m, MonadAsync m, MonadMask m)
|
||||||
=> Handle -- ^ copy from this handle, must be readable
|
=> Handle -- ^ copy from this handle, must be readable
|
||||||
-> Handle -- ^ copy to this handle, must be writable
|
-> Handle -- ^ copy to this handle, must be writable
|
||||||
@ -146,9 +137,7 @@ copyFileStream stream handle' =
|
|||||||
(flip finally) (liftIO $ hClose handle') $ copyFileStream' stream handle'
|
(flip finally) (liftIO $ hClose handle') $ copyFileStream' stream handle'
|
||||||
|
|
||||||
|
|
||||||
-- | Copy a stream to a file handle.
|
-- | Like 'copyFileStream', except doesn't close the handle.
|
||||||
--
|
|
||||||
-- The handle is NOT closed automatically.
|
|
||||||
copyFileStream' :: (MonadCatch m, MonadAsync m, MonadMask m)
|
copyFileStream' :: (MonadCatch m, MonadAsync m, MonadMask m)
|
||||||
=> SerialT m (Array Word8) -- ^ stream to copy
|
=> SerialT m (Array Word8) -- ^ stream to copy
|
||||||
-> Handle -- ^ file handle to copy to, must be writable
|
-> Handle -- ^ file handle to copy to, must be writable
|
||||||
@ -166,9 +155,7 @@ copyLBS :: (MonadCatch m, MonadAsync m, MonadMask m)
|
|||||||
copyLBS lbs = copyFileStream (Lazy.toChunks lbs)
|
copyLBS lbs = copyFileStream (Lazy.toChunks lbs)
|
||||||
|
|
||||||
|
|
||||||
-- | Like 'copyFileStream', except with a lazy bytestring.
|
-- | Like 'copyLBS', except doesn't close the handle.
|
||||||
--
|
|
||||||
-- The handle is NOT closed automatically.
|
|
||||||
copyLBS' :: (MonadCatch m, MonadAsync m, MonadMask m)
|
copyLBS' :: (MonadCatch m, MonadAsync m, MonadMask m)
|
||||||
=> L.ByteString -- ^ lazy bytestring to copy
|
=> L.ByteString -- ^ lazy bytestring to copy
|
||||||
-> Handle -- ^ file handle to copy to, must be writable
|
-> Handle -- ^ file handle to copy to, must be writable
|
||||||
|
Loading…
Reference in New Issue
Block a user