mirror of
https://github.com/composewell/streamly.git
synced 2024-09-11 11:37:22 +03:00
Make formattting changes in network modules (#1851)
This commit is contained in:
parent
70e4a57416
commit
05ff41e946
@ -107,7 +107,7 @@ import Streamly.Internal.Control.Concurrent (MonadAsync)
|
||||
import Streamly.Internal.Control.ForkLifted (fork)
|
||||
import Streamly.Internal.Data.Array.Unboxed.Type (Array(..), writeNUnsafe)
|
||||
import Streamly.Internal.Data.Fold.Type (Fold(..))
|
||||
import Streamly.Internal.Data.Stream (Stream)
|
||||
import Streamly.Data.Stream (Stream)
|
||||
import Streamly.Internal.Data.Tuple.Strict (Tuple'(..))
|
||||
import Streamly.Internal.Data.Unfold.Type (Unfold(..))
|
||||
import Streamly.Internal.Network.Socket (SockSpec(..), accept, connections)
|
||||
@ -302,7 +302,10 @@ usingConnection =
|
||||
-- /Pre-release/
|
||||
{-# INLINE withConnection #-}
|
||||
withConnection :: (MonadCatch m, MonadAsync m)
|
||||
=> (Word8, Word8, Word8, Word8) -> PortNumber -> (Socket -> Stream m a) -> Stream m a
|
||||
=> (Word8, Word8, Word8, Word8)
|
||||
-> PortNumber
|
||||
-> (Socket -> Stream m a)
|
||||
-> Stream m a
|
||||
withConnection addr port =
|
||||
S.bracket (liftIO $ connect addr port) (liftIO . Net.close)
|
||||
|
||||
|
@ -434,7 +434,7 @@ readWith chunkSize h = A.flattenArrays $ readChunksUpto chunkSize h
|
||||
--
|
||||
-- @since 0.7.0
|
||||
{-# INLINE toBytes #-}
|
||||
toBytes :: (MonadIO m) => Socket -> Stream m Word8
|
||||
toBytes :: MonadIO m => Socket -> Stream m Word8
|
||||
toBytes = AS.concat . toChunks
|
||||
|
||||
-- | Unfolds the tuple @(bufsize, socket)@ into a byte stream, read requests
|
||||
@ -590,7 +590,7 @@ write = toHandleWith defaultChunkSize
|
||||
--
|
||||
-- @since 0.7.0
|
||||
{-# INLINE readUtf8 #-}
|
||||
readUtf8 :: (MonadIO m) => Handle -> Stream m Char
|
||||
readUtf8 :: MonadIO m => Handle -> Stream m Char
|
||||
readUtf8 = decodeUtf8 . read
|
||||
|
||||
-- |
|
||||
@ -612,7 +612,7 @@ writeUtf8 h s = write h $ encodeUtf8 s
|
||||
--
|
||||
-- @since 0.7.0
|
||||
{-# INLINE writeUtf8ByLines #-}
|
||||
writeUtf8ByLines :: (MonadIO m) => Handle -> Stream m Char -> m ()
|
||||
writeUtf8ByLines :: MonadIO m => Handle -> Stream m Char -> m ()
|
||||
writeUtf8ByLines = undefined
|
||||
|
||||
-- | Read UTF-8 lines from a file handle and apply the specified fold to each
|
||||
@ -620,7 +620,7 @@ writeUtf8ByLines = undefined
|
||||
--
|
||||
-- @since 0.7.0
|
||||
{-# INLINE readLines #-}
|
||||
readLines :: (MonadIO m) => Handle -> Fold m Char b -> Stream m b
|
||||
readLines :: MonadIO m => Handle -> Fold m Char b -> Stream m b
|
||||
readLines h f = foldLines (readUtf8 h) f
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user