Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improved formatting of imports.

  • Loading branch information...
commit dc2aca17a6f6269067424c935a09987948e213cb 1 parent 3ddf41d
@bsl bsl authored tibbe committed
View
25 Network/Socket/ByteString.hs
@@ -42,7 +42,6 @@ module Network.Socket.ByteString
) where
import Control.Monad (liftM, when)
-import qualified Data.ByteString as B
import Data.ByteString (ByteString)
import Data.ByteString.Internal (createAndTrim)
import Data.ByteString.Unsafe (unsafeUseAsCStringLen)
@@ -51,6 +50,9 @@ import Foreign.C.Types (CInt)
import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Ptr (Ptr, castPtr)
import Network.Socket (SockAddr, Socket(..), sendBufTo, recvBufFrom)
+
+import qualified Data.ByteString as B
+
import Network.Socket.ByteString.Internal
#if !defined(mingw32_HOST_OS)
@@ -62,15 +64,16 @@ import Foreign.Marshal.Array (allocaArray)
import Foreign.Marshal.Utils (with)
import Foreign.Ptr (nullPtr, plusPtr)
import Foreign.Storable (Storable(..))
-import Network.Socket.ByteString.IOVec
-import Network.Socket.ByteString.MsgHdr
import Network.Socket.Internal (throwSocketErrorIfMinus1RetryMayBlock,
withSockAddr)
import System.IO (Handle)
import System.Posix.Files (fileSize, getFdStatus)
-import System.Posix.IO (OpenMode (ReadOnly), closeFd, defaultFileFlags, openFd)
+import System.Posix.IO (OpenMode(ReadOnly), closeFd, defaultFileFlags, openFd)
import System.Posix.Types (COff, CSsize)
+import Network.Socket.ByteString.IOVec (IOVec(..))
+import Network.Socket.ByteString.MsgHdr (MsgHdr(..))
+
# if defined(__GLASGOW_HASKELL__)
import GHC.Conc (threadWaitRead, threadWaitWrite)
import GHC.Handle (wantReadableHandle)
@@ -373,14 +376,16 @@ withIOVec cs f =
-- > -- Echo server program
-- > module Main where
-- >
--- > import Control.Monad
--- > import qualified Data.ByteString as S
+-- > import Control.Monad (unless)
-- > import Network.Socket hiding (recv)
--- > import Network.Socket.ByteString
+-- > import qualified Data.ByteString as S
+-- > import Network.Socket.ByteString (recv, sendAll)
-- >
-- > main :: IO ()
-- > main = withSocketsDo $
--- > do addrinfos <- getAddrInfo Nothing (Just "") (Just "3000")
+-- > do addrinfos <- getAddrInfo
+-- > (Just (defaultHints {addrFlags = [AI_PASSIVE]}))
+-- > Nothing (Just "3000")
-- > let serveraddr = head addrinfos
-- > sock <- socket (addrFamily serveraddr) Stream defaultProtocol
-- > bindSocket sock (addrAddress serveraddr)
@@ -399,9 +404,9 @@ withIOVec cs f =
-- > -- Echo client program
-- > module Main where
-- >
--- > import qualified Data.ByteString.Char8 as C
-- > import Network.Socket hiding (recv)
--- > import Network.Socket.ByteString
+-- > import Network.Socket.ByteString (recv, sendAll)
+-- > import qualified Data.ByteString.Char8 as C
-- >
-- > main :: IO ()
-- > main = withSocketsDo $
View
12 Network/Socket/ByteString/Lazy.hsc
@@ -35,24 +35,26 @@ module Network.Socket.ByteString.Lazy
) where
import Control.Monad (liftM)
-import qualified Data.ByteString as S
import Data.ByteString.Lazy.Internal (ByteString(..), defaultChunkSize)
import Data.Int (Int64)
-import qualified Network.Socket.ByteString as N
import Network.Socket (Socket(..), ShutdownCmd(..), shutdown)
import Prelude hiding (getContents)
import System.IO.Unsafe (unsafeInterleaveIO)
+import qualified Data.ByteString as S
+import qualified Network.Socket.ByteString as N
+
#if !defined(mingw32_HOST_OS)
import Control.Monad (when)
-import qualified Data.ByteString.Lazy as L
import Data.ByteString.Unsafe (unsafeUseAsCStringLen)
import Foreign.Marshal.Array (allocaArray)
import Foreign.Ptr (plusPtr)
import Foreign.Storable (Storable(..))
-import Network.Socket.ByteString.IOVec
+import Network.Socket.ByteString.IOVec (IOVec(IOVec))
+import Network.Socket.ByteString.Internal (c_writev)
import Network.Socket.Internal (throwSocketErrorIfMinus1RetryMayBlock)
-import Network.Socket.ByteString.Internal
+
+import qualified Data.ByteString.Lazy as L
# if defined(__GLASGOW_HASKELL__)
import GHC.Conc (threadWaitWrite)
View
1  Network/Socket/ByteString/MsgHdr.hsc
@@ -12,6 +12,7 @@ import Foreign.C.Types (CChar, CInt, CSize)
import Foreign.Ptr (Ptr)
import Foreign.Storable (Storable(..))
import Network.Socket (SockAddr)
+
import Network.Socket.ByteString.IOVec (IOVec)
data MsgHdr = MsgHdr
View
4 examples/EchoClient.hs
@@ -1,9 +1,9 @@
-- Echo client program
module Main where
-import qualified Data.ByteString.Char8 as C
import Network.Socket hiding (recv)
-import Network.Socket.ByteString
+import Network.Socket.ByteString (recv, sendAll)
+import qualified Data.ByteString.Char8 as C
main :: IO ()
main = withSocketsDo $
View
6 examples/EchoServer.hs
@@ -1,10 +1,10 @@
-- Echo server program
module Main where
-import Control.Monad
-import qualified Data.ByteString as S
+import Control.Monad (unless)
import Network.Socket hiding (recv)
-import Network.Socket.ByteString
+import qualified Data.ByteString as S
+import Network.Socket.ByteString (recv, sendAll)
main :: IO ()
main = withSocketsDo $
View
2  tests/Simple.hs
@@ -11,7 +11,7 @@ import Test.HUnit (Counts(..), Test(..), (@=?), runTestTT)
import qualified Data.ByteString as S
import qualified Data.ByteString.Char8 as C
-import Network.Socket.ByteString
+import Network.Socket.ByteString (recv, recvFrom, send, sendAll, sendMany)
port :: PortNumber
port = fromIntegral (3000 :: Int)
Please sign in to comment.
Something went wrong with that request. Please try again.