Make formattting changes in network modules (#1851)

This commit is contained in:
Ranjeet Ranjan 2022-09-29 02:15:26 +05:30 committed by GitHub
parent 70e4a57416
commit 05ff41e946
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -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)

View File

@ -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
-------------------------------------------------------------------------------