Fix up docs

This commit is contained in:
Julian Ospald 2020-01-29 21:33:01 +01:00
parent 45aca26340
commit 3b4a7f445c
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28

View File

@ -73,7 +73,7 @@ fromChunks =
. 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,
-- aborts or gets garbage collected.
@ -84,17 +84,13 @@ readFileLBS :: Handle -- ^ readable file handle
readFileLBS handle' = fromChunks (readFileStream handle')
-- |Read the given file lazily as a lazy ByteString.
--
-- The handle is NOT closed automatically.
--
-- This uses `unsafeInterleaveIO` under the hood.
-- |Like 'readFileLBS', except doesn't close the handle..
readFileLBS' :: Handle -- ^ readable file handle
-> IO L.ByteString
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,
-- aborts or gets garbage collected.
@ -104,10 +100,7 @@ readFileStream :: (MonadCatch m, MonadAsync m)
-> SerialT m (Array Word8)
readFileStream = S.unfold (SIU.finallyIO (liftIO . hClose) FH.readChunks)
-- | Read from the given handle as a streamly filestream.
--
-- The handle is NOT closed automatically.
-- The stream must not be used after the handle is closed.
-- | Like 'readFileStream', except doesn't close the handle.
readFileStream' :: (MonadCatch m, MonadAsync m)
=> Handle
-> SerialT m (Array Word8)
@ -124,9 +117,7 @@ copyFileHandle :: (MonadCatch m, MonadAsync m, MonadMask m)
copyFileHandle fromHandle toHandle =
copyFileStream (readFileStream fromHandle) toHandle
-- | Like 'copyFileStream'', except for two file handles.
--
-- Handles are NOT closed automatically.
-- | Like 'copyFileHandle', except doesn't close the handles.
copyFileHandle' :: (MonadCatch m, MonadAsync m, MonadMask m)
=> Handle -- ^ copy from this handle, must be readable
-> Handle -- ^ copy to this handle, must be writable
@ -146,9 +137,7 @@ copyFileStream stream handle' =
(flip finally) (liftIO $ hClose handle') $ copyFileStream' stream handle'
-- | Copy a stream to a file handle.
--
-- The handle is NOT closed automatically.
-- | Like 'copyFileStream', except doesn't close the handle.
copyFileStream' :: (MonadCatch m, MonadAsync m, MonadMask m)
=> SerialT m (Array Word8) -- ^ stream to copy
-> 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)
-- | Like 'copyFileStream', except with a lazy bytestring.
--
-- The handle is NOT closed automatically.
-- | Like 'copyLBS', except doesn't close the handle.
copyLBS' :: (MonadCatch m, MonadAsync m, MonadMask m)
=> L.ByteString -- ^ lazy bytestring to copy
-> Handle -- ^ file handle to copy to, must be writable