on master help sign in
Make formattting changes in network modules (#1851)
05ff41eRanjeet Ranjan
src/Streamly/Internal/Network/Inet/TCP.hs+5−2
@@ -107,7 +107,7 @@ import Streamly.Internal.Control.Concurrent (MonadAsync)
107import Streamly.Internal.Control.ForkLifted (fork)
107import Streamly.Internal.Control.ForkLifted (fork)
108import Streamly.Internal.Data.Array.Unboxed.Type (Array(..), writeNUnsafe)
108import Streamly.Internal.Data.Array.Unboxed.Type (Array(..), writeNUnsafe)
109import Streamly.Internal.Data.Fold.Type (Fold(..))
109import Streamly.Internal.Data.Fold.Type (Fold(..))
110−import Streamly.Internal.Data.Stream (Stream)
110+import Streamly.Data.Stream (Stream)
111import Streamly.Internal.Data.Tuple.Strict (Tuple'(..))
111import Streamly.Internal.Data.Tuple.Strict (Tuple'(..))
112import Streamly.Internal.Data.Unfold.Type (Unfold(..))
112import Streamly.Internal.Data.Unfold.Type (Unfold(..))
113import Streamly.Internal.Network.Socket (SockSpec(..), accept, connections)
113import Streamly.Internal.Network.Socket (SockSpec(..), accept, connections)
@@ -302,7 +302,10 @@ usingConnection =
302-- /Pre-release/
302-- /Pre-release/
303{-# INLINE withConnection #-}
303{-# INLINE withConnection #-}
304withConnection :: (MonadCatch m, MonadAsync m)
304withConnection :: (MonadCatch m, MonadAsync m)
305− => (Word8, Word8, Word8, Word8) -> PortNumber -> (Socket -> Stream m a) -> Stream m a
305+ => (Word8, Word8, Word8, Word8)
306+ -> PortNumber
307+ -> (Socket -> Stream m a)
308+ -> Stream m a
306withConnection addr port =
309withConnection addr port =
307 S.bracket (liftIO $ connect addr port) (liftIO . Net.close)
310 S.bracket (liftIO $ connect addr port) (liftIO . Net.close)
308
311
src/Streamly/Internal/Network/Socket.hs+4−4
@@ -434,7 +434,7 @@ readWith chunkSize h = A.flattenArrays $ readChunksUpto chunkSize h
434--
434--
435-- @since 0.7.0
435-- @since 0.7.0
436{-# INLINE toBytes #-}
436{-# INLINE toBytes #-}
437−toBytes :: (MonadIO m) => Socket -> Stream m Word8
437+toBytes :: MonadIO m => Socket -> Stream m Word8
438toBytes = AS.concat . toChunks
438toBytes = AS.concat . toChunks
439
439
440-- | Unfolds the tuple @(bufsize, socket)@ into a byte stream, read requests
440-- | Unfolds the tuple @(bufsize, socket)@ into a byte stream, read requests
@@ -590,7 +590,7 @@ write = toHandleWith defaultChunkSize
590--
590--
591-- @since 0.7.0
591-- @since 0.7.0
592{-# INLINE readUtf8 #-}
592{-# INLINE readUtf8 #-}
593−readUtf8 :: (MonadIO m) => Handle -> Stream m Char
593+readUtf8 :: MonadIO m => Handle -> Stream m Char
594readUtf8 = decodeUtf8 . read
594readUtf8 = decodeUtf8 . read
595
595
596-- |
596-- |
@@ -612,7 +612,7 @@ writeUtf8 h s = write h $ encodeUtf8 s
612--
612--
613-- @since 0.7.0
613-- @since 0.7.0
614{-# INLINE writeUtf8ByLines #-}
614{-# INLINE writeUtf8ByLines #-}
615−writeUtf8ByLines :: (MonadIO m) => Handle -> Stream m Char -> m ()
615+writeUtf8ByLines :: MonadIO m => Handle -> Stream m Char -> m ()
616writeUtf8ByLines = undefined
616writeUtf8ByLines = undefined
617
617
618-- | Read UTF-8 lines from a file handle and apply the specified fold to each
618-- | Read UTF-8 lines from a file handle and apply the specified fold to each
@@ -620,7 +620,7 @@ writeUtf8ByLines = undefined
620--
620--
621-- @since 0.7.0
621-- @since 0.7.0
622{-# INLINE readLines #-}
622{-# INLINE readLines #-}
623−readLines :: (MonadIO m) => Handle -> Fold m Char b -> Stream m b
623+readLines :: MonadIO m => Handle -> Fold m Char b -> Stream m b
624readLines h f = foldLines (readUtf8 h) f
624readLines h f = foldLines (readUtf8 h) f
625
625
626-------------------------------------------------------------------------------
626-------------------------------------------------------------------------------