packages feed

network 2.3.0.8 → 2.3.0.9

raw patch · 15 files changed

+752/−670 lines, 15 filesdep ~base

Dependency ranges changed: base

Files

Network.hs view
@@ -22,50 +22,49 @@ #define IPV6_SOCKET_SUPPORT 1 #endif -module Network (--	-- * Basic data types-	Socket,-        PortID(..),-	HostName,-	PortNumber,	-- instance (Eq, Enum, Num, Real, Integral)--	-- * Initialisation-	withSocketsDo,  -- :: IO a   -> IO a-	-	-- * Server-side connections-	listenOn,	-- :: PortID -> IO Socket-	accept,		-- :: Socket -> IO (Handle, HostName, PortNumber)-        sClose,		-- :: Socket -> IO ()+module Network+    (+    -- * Basic data types+      Socket+    , PortID(..)+    , HostName+    , PortNumber -	-- * Client-side connections-	connectTo,	-- :: HostName -> PortID -> IO Handle+    -- * Initialisation+    , withSocketsDo+    +    -- * Server-side connections+    , listenOn+    , accept+    , sClose -	-- * Simple sending and receiving-	{-$sendrecv-}-	sendTo,		-- :: HostName -> PortID -> String -> IO ()-	recvFrom,	-- :: HostName -> PortID -> IO String+    -- * Client-side connections+    , connectTo -	-- * Miscellaneous-	socketPort,	-- :: Socket -> IO PortID+    -- * Simple sending and receiving+    {-$sendrecv-}+    , sendTo+    , recvFrom -	-- * Networking Issues-	-- ** Buffering-	{-$buffering-}+    -- * Miscellaneous+    , socketPort -	-- ** Improving I\/O Performance over sockets-	{-$performance-}+    -- * Networking Issues+    -- ** Buffering+    {-$buffering-} -	-- ** @SIGPIPE@-	{-$sigpipe-}+    -- ** Improving I\/O Performance over sockets+    {-$performance-} -       ) where+    -- ** @SIGPIPE@+    {-$sigpipe-}+    ) where  import Control.Monad (liftM) import Data.Maybe (fromJust) import Network.BSD-import Network.Socket hiding ( accept, socketPort, recvFrom, sendTo, PortNumber )-import qualified Network.Socket as Socket ( accept )+import Network.Socket hiding (accept, socketPort, recvFrom, sendTo, PortNumber)+import qualified Network.Socket as Socket (accept) import System.IO import Prelude import qualified Control.Exception as Exception@@ -79,10 +78,10 @@ -- signalling that the current hostname applies.  data PortID = -	  Service String		-- Service Name eg "ftp"-	| PortNumber PortNumber		-- User defined Port Number+          Service String                -- Service Name eg "ftp"+        | PortNumber PortNumber         -- User defined Port Number #if !defined(mingw32_HOST_OS) && !defined(cygwin32_HOST_OS) && !defined(_WIN32)-	| UnixSocket String		-- Unix family socket in file system+        | UnixSocket String             -- Unix family socket in file system #endif  -- | Calling 'connectTo' creates a client side socket which is@@ -90,9 +89,9 @@ -- derived from the given port identifier.  If a port number is given -- then the result is always an internet family 'Stream' socket.  -connectTo :: HostName		-- Hostname-	  -> PortID 		-- Port Identifier-	  -> IO Handle		-- Connected Socket+connectTo :: HostName           -- Hostname+          -> PortID             -- Port Identifier+          -> IO Handle          -- Connected Socket  #if defined(IPV6_SOCKET_SUPPORT) -- IPv6 and IPv4.@@ -106,36 +105,36 @@ connectTo hostname (Service serv) = do     proto <- getProtocolNumber "tcp"     bracketOnError-	(socket AF_INET Stream proto)-	(sClose)  -- only done if there's an error-	(\sock -> do-          port	<- getServicePortNumber serv-          he	<- getHostByName hostname+        (socket AF_INET Stream proto)+        (sClose)  -- only done if there's an error+        (\sock -> do+          port  <- getServicePortNumber serv+          he    <- getHostByName hostname           connect sock (SockAddrInet port (hostAddress he))           socketToHandle sock ReadWriteMode- 	)+        )  connectTo hostname (PortNumber port) = do     proto <- getProtocolNumber "tcp"     bracketOnError-	(socket AF_INET Stream proto)-	(sClose)  -- only done if there's an error+        (socket AF_INET Stream proto)+        (sClose)  -- only done if there's an error         (\sock -> do-      	  he <- getHostByName hostname-      	  connect sock (SockAddrInet port (hostAddress he))-      	  socketToHandle sock ReadWriteMode-	)+          he <- getHostByName hostname+          connect sock (SockAddrInet port (hostAddress he))+          socketToHandle sock ReadWriteMode+        ) #endif  #if !defined(mingw32_HOST_OS) && !defined(cygwin32_HOST_OS) && !defined(_WIN32) connectTo _ (UnixSocket path) = do     bracketOnError-	(socket AF_UNIX Stream 0)-	(sClose)-	(\sock -> do+        (socket AF_UNIX Stream 0)+        (sClose)+        (\sock -> do           connect sock (SockAddrUnix path)           socketToHandle sock ReadWriteMode-	)+        ) #endif  #if defined(IPV6_SOCKET_SUPPORT)@@ -151,12 +150,12 @@   where   tryToConnect addr =     bracketOnError-	(socket (addrFamily addr) (addrSocketType addr) (addrProtocol addr))-	(sClose)  -- only done if there's an error-	(\sock -> do+        (socket (addrFamily addr) (addrSocketType addr) (addrProtocol addr))+        (sClose)  -- only done if there's an error+        (\sock -> do           connect sock (addrAddress addr)           socketToHandle sock ReadWriteMode- 	)+        ) #endif  -- | Creates the server side socket which has been bound to the@@ -171,8 +170,8 @@ -- If available, the 'IPv6Only' socket option is set to 0 -- so that both IPv4 and IPv6 can be accepted with this socket. -listenOn :: PortID 	-- ^ Port Identifier-	 -> IO Socket	-- ^ Connected Socket+listenOn :: PortID      -- ^ Port Identifier+         -> IO Socket   -- ^ Connected Socket  #if defined(IPV6_SOCKET_SUPPORT) -- IPv6 and IPv4.@@ -187,39 +186,39 @@     proto <- getProtocolNumber "tcp"     bracketOnError         (socket AF_INET Stream proto)-	(sClose)-	(\sock -> do-	    port    <- getServicePortNumber serv-	    setSocketOption sock ReuseAddr 1-	    bindSocket sock (SockAddrInet port iNADDR_ANY)-	    listen sock maxListenQueue-	    return sock-	)+        (sClose)+        (\sock -> do+            port    <- getServicePortNumber serv+            setSocketOption sock ReuseAddr 1+            bindSocket sock (SockAddrInet port iNADDR_ANY)+            listen sock maxListenQueue+            return sock+        )  listenOn (PortNumber port) = do     proto <- getProtocolNumber "tcp"     bracketOnError-    	(socket AF_INET Stream proto)-	(sClose)-	(\sock -> do-	    setSocketOption sock ReuseAddr 1-	    bindSocket sock (SockAddrInet port iNADDR_ANY)-	    listen sock maxListenQueue-	    return sock-	)+        (socket AF_INET Stream proto)+        (sClose)+        (\sock -> do+            setSocketOption sock ReuseAddr 1+            bindSocket sock (SockAddrInet port iNADDR_ANY)+            listen sock maxListenQueue+            return sock+        ) #endif  #if !defined(mingw32_HOST_OS) && !defined(cygwin32_HOST_OS) && !defined(_WIN32) listenOn (UnixSocket path) =     bracketOnError-    	(socket AF_UNIX Stream 0)-	(sClose)-	(\sock -> do-	    setSocketOption sock ReuseAddr 1-	    bindSocket sock (SockAddrUnix path)-	    listen sock maxListenQueue-	    return sock-	)+        (socket AF_UNIX Stream 0)+        (sClose)+        (\sock -> do+            setSocketOption sock ReuseAddr 1+            bindSocket sock (SockAddrUnix path)+            listen sock maxListenQueue+            return sock+        ) #endif  #if defined(IPV6_SOCKET_SUPPORT)@@ -240,13 +239,13 @@         addr = if null addrs' then head addrs else head addrs'     bracketOnError         (socket (addrFamily addr) (addrSocketType addr) (addrProtocol addr))-	(sClose)-	(\sock -> do-	    setSocketOption sock ReuseAddr 1-	    bindSocket sock (addrAddress addr)-	    listen sock maxListenQueue-	    return sock-	)+        (sClose)+        (\sock -> do+            setSocketOption sock ReuseAddr 1+            bindSocket sock (addrAddress addr)+            listen sock maxListenQueue+            return sock+        ) #endif  -- -----------------------------------------------------------------------------@@ -260,22 +259,22 @@ -- (this shouldn't be a problem, though). When using AF_UNIX, HostName -- will be set to the path of the socket and PortNumber to -1. ---accept :: Socket 		-- ^ Listening Socket+accept :: Socket                -- ^ Listening Socket        -> IO (Handle,-	      HostName,-	      PortNumber)	-- ^ Triple of: read\/write 'Handle' for -				-- communicating with the client,-			 	-- the 'HostName' of the peer socket, and-				-- the 'PortNumber' of the remote connection.+              HostName,+              PortNumber)       -- ^ Triple of: read\/write 'Handle' for +                                -- communicating with the client,+                                -- the 'HostName' of the peer socket, and+                                -- the 'PortNumber' of the remote connection. accept sock@(MkSocket _ AF_INET _ _ _) = do  ~(sock', (SockAddrInet port haddr)) <- Socket.accept sock  peer <- catchIO-	  (do 	-	     (HostEntry peer _ _ _) <- getHostByAddr AF_INET haddr-	     return peer-	  )-	  (\e -> inet_ntoa haddr)-		-- if getHostByName fails, we fall back to the IP address+          (do   +             (HostEntry peer _ _ _) <- getHostByAddr AF_INET haddr+             return peer+          )+          (\e -> inet_ntoa haddr)+                -- if getHostByName fails, we fall back to the IP address  handle <- socketToHandle sock' ReadWriteMode  return (handle, peer, port) #if defined(IPV6_SOCKET_SUPPORT)@@ -317,18 +316,18 @@ or invocations from the command line. -} -sendTo :: HostName 	-- Hostname-       -> PortID	-- Port Number-       -> String	-- Message to send+sendTo :: HostName      -- Hostname+       -> PortID        -- Port Number+       -> String        -- Message to send        -> IO () sendTo h p msg = do   s <- connectTo h p   hPutStr s msg   hClose s -recvFrom :: HostName 	-- Hostname-	 -> PortID	-- Port Number-	 -> IO String	-- Received Data+recvFrom :: HostName    -- Hostname+         -> PortID      -- Port Number+         -> IO String   -- Received Data  #if defined(IPV6_SOCKET_SUPPORT) recvFrom host port = do@@ -367,7 +366,7 @@          sClose s'          waiting       else do-	h <- socketToHandle s' ReadMode+        h <- socketToHandle s' ReadMode         msg <- hGetContents h         return msg @@ -391,7 +390,7 @@      SockAddrInet6 port _ _ _ -> PortNumber port #endif #if !defined(mingw32_HOST_OS) && !defined(cygwin32_HOST_OS) && !defined(_WIN32)-     SockAddrUnix path	      -> UnixSocket path+     SockAddrUnix path        -> UnixSocket path #endif  -- ---------------------------------------------------------------------------
Network/BSD.hsc view
@@ -19,99 +19,101 @@ -- NOTE: ##, we want this interpreted when compiling the .hs, not by hsc2hs. ##include "Typeable.h" -module Network.BSD (-       +module Network.BSD+    (     -- * Host names-    HostName,-    getHostName,	    -- :: IO HostName+      HostName+    , getHostName -    HostEntry(..),-    getHostByName,	    -- :: HostName -> IO HostEntry-    getHostByAddr,	    -- :: HostAddress -> Family -> IO HostEntry-    hostAddress,	    -- :: HostEntry -> HostAddress+    , HostEntry(..)+    , getHostByName+    , getHostByAddr+    , hostAddress  #if defined(HAVE_GETHOSTENT) && !defined(cygwin32_HOST_OS) && !defined(mingw32_HOST_OS) && !defined(_WIN32)-    getHostEntries,	    -- :: Bool -> IO [HostEntry]+    , getHostEntries+     -- ** Low level functionality-    setHostEntry,	    -- :: Bool -> IO ()-    getHostEntry,	    -- :: IO HostEntry-    endHostEntry,	    -- :: IO ()+    , setHostEntry+    , getHostEntry+    , endHostEntry #endif      -- * Service names-    ServiceEntry(..),-    ServiceName,-    getServiceByName,	    -- :: ServiceName -> ProtocolName -> IO ServiceEntry-    getServiceByPort,       -- :: PortNumber  -> ProtocolName -> IO ServiceEntry-    getServicePortNumber,   -- :: ServiceName -> IO PortNumber+    , ServiceEntry(..)+    , ServiceName+    , getServiceByName+    , getServiceByPort+    , getServicePortNumber  #if !defined(cygwin32_HOST_OS) && !defined(mingw32_HOST_OS) && !defined(_WIN32)-    getServiceEntries,	    -- :: Bool -> IO [ServiceEntry]+    , getServiceEntries+     -- ** Low level functionality-    getServiceEntry,	    -- :: IO ServiceEntry-    setServiceEntry,	    -- :: Bool -> IO ()-    endServiceEntry,	    -- :: IO ()+    , getServiceEntry+    , setServiceEntry+    , endServiceEntry #endif      -- * Protocol names-    ProtocolName,-    ProtocolNumber,-    ProtocolEntry(..),-    getProtocolByName,	    -- :: ProtocolName   -> IO ProtocolEntry-    getProtocolByNumber,    -- :: ProtocolNumber -> IO ProtcolEntry-    getProtocolNumber,	    -- :: ProtocolName   -> ProtocolNumber-    defaultProtocol,        -- :: ProtocolNumber+    , ProtocolName+    , ProtocolNumber+    , ProtocolEntry(..)+    , getProtocolByName+    , getProtocolByNumber+    , getProtocolNumber+    , defaultProtocol  #if !defined(cygwin32_HOST_OS) && !defined(mingw32_HOST_OS) && !defined(_WIN32)-    getProtocolEntries,	    -- :: Bool -> IO [ProtocolEntry]+    , getProtocolEntries     -- ** Low level functionality-    setProtocolEntry,	    -- :: Bool -> IO ()-    getProtocolEntry,	    -- :: IO ProtocolEntry-    endProtocolEntry,	    -- :: IO ()+    , setProtocolEntry+    , getProtocolEntry+    , endProtocolEntry #endif      -- * Port numbers-    PortNumber,+    , PortNumber      -- * Network names-    NetworkName,-    NetworkAddr,-    NetworkEntry(..)+    , NetworkName+    , NetworkAddr+    , NetworkEntry(..)  #if !defined(cygwin32_HOST_OS) && !defined(mingw32_HOST_OS) && !defined(_WIN32)-    , getNetworkByName	    -- :: NetworkName -> IO NetworkEntry-    , getNetworkByAddr      -- :: NetworkAddr -> Family -> IO NetworkEntry-    , getNetworkEntries     -- :: Bool -> IO [NetworkEntry]+    , getNetworkByName+    , getNetworkByAddr+    , getNetworkEntries     -- ** Low level functionality-    , setNetworkEntry	    -- :: Bool -> IO ()-    , getNetworkEntry	    -- :: IO NetworkEntry-    , endNetworkEntry	    -- :: IO ()+    , setNetworkEntry+    , getNetworkEntry+    , endNetworkEntry #endif     ) where  #ifdef __HUGS__-import Hugs.Prelude ( IOException(..), IOErrorType(..) )+import Hugs.Prelude (IOException(..), IOErrorType(..)) #endif import Network.Socket -import Control.Concurrent 	( MVar, newMVar, withMVar )+import Control.Concurrent (MVar, newMVar, withMVar) import Control.Exception (catch)-import Foreign.C.Error ( throwErrnoIfMinus1, throwErrnoIfMinus1_ )-import Foreign.C.String ( CString, peekCString, peekCStringLen, withCString )+import Foreign.C.Error (throwErrnoIfMinus1, throwErrnoIfMinus1_)+import Foreign.C.String (CString, peekCString, peekCStringLen, withCString) import Foreign.C.Types ( CChar, CShort ) #if __GLASGOW_HASKELL__ >= 703 import Foreign.C.Types ( CInt(..), CULong(..), CSize(..) ) #else import Foreign.C.Types ( CInt, CULong, CSize ) #endif-import Foreign.Ptr ( Ptr, nullPtr )-import Foreign.Storable ( Storable(..) )-import Foreign.Marshal.Array ( allocaArray0, peekArray0 )-import Foreign.Marshal.Utils ( with, fromBool )+import Foreign.Ptr (Ptr, nullPtr)+import Foreign.Storable (Storable(..))+import Foreign.Marshal.Array (allocaArray0, peekArray0)+import Foreign.Marshal.Utils (with, fromBool) import Data.Typeable import Prelude hiding (catch) import System.IO.Error (ioeSetErrorString, mkIOError)-import System.IO.Unsafe ( unsafePerformIO )+import System.IO.Unsafe (unsafePerformIO)  #ifdef __GLASGOW_HASKELL__ # if __GLASGOW_HASKELL__ >= 611@@ -121,7 +123,7 @@ # endif #endif -import Control.Monad ( liftM )+import Control.Monad (liftM)  -- --------------------------------------------------------------------------- -- Basic Types@@ -178,9 +180,9 @@   -- | Get service by name.-getServiceByName :: ServiceName 	-- Service Name-		 -> ProtocolName 	-- Protocol Name-		 -> IO ServiceEntry	-- Service Entry+getServiceByName :: ServiceName         -- Service Name+                 -> ProtocolName        -- Protocol Name+                 -> IO ServiceEntry     -- Service Entry getServiceByName name proto = withLock $ do  withCString name  $ \ cstr_name  -> do  withCString proto $ \ cstr_proto -> do@@ -209,7 +211,7 @@     return port  #if !defined(cygwin32_HOST_OS) && !defined(mingw32_HOST_OS) && !defined(_WIN32)-getServiceEntry	:: IO ServiceEntry+getServiceEntry :: IO ServiceEntry getServiceEntry = withLock $ do  throwNoSuchThingIfNull "getServiceEntry" "no such service entry"    $ trySysCall c_getservent@@ -217,12 +219,12 @@  foreign import ccall unsafe "getservent" c_getservent :: IO (Ptr ServiceEntry) -setServiceEntry	:: Bool -> IO ()+setServiceEntry :: Bool -> IO () setServiceEntry flg = withLock $ trySysCall $ c_setservent (fromBool flg)  foreign import ccall unsafe  "setservent" c_setservent :: CInt -> IO () -endServiceEntry	:: IO ()+endServiceEntry :: IO () endServiceEntry = withLock $ trySysCall $ c_endservent  foreign import ccall unsafe  "endservent" c_endservent :: IO ()@@ -305,15 +307,15 @@  return num  #if !defined(cygwin32_HOST_OS) && !defined(mingw32_HOST_OS) && !defined(_WIN32)-getProtocolEntry :: IO ProtocolEntry	-- Next Protocol Entry from DB+getProtocolEntry :: IO ProtocolEntry    -- Next Protocol Entry from DB getProtocolEntry = withLock $ do  ent <- throwNoSuchThingIfNull "getProtocolEntry" "no such protocol entry"-   		$ trySysCall c_getprotoent+                $ trySysCall c_getprotoent  peek ent  foreign import ccall unsafe  "getprotoent" c_getprotoent :: IO (Ptr ProtocolEntry) -setProtocolEntry :: Bool -> IO ()	-- Keep DB Open ?+setProtocolEntry :: Bool -> IO ()       -- Keep DB Open ? setProtocolEntry flg = withLock $ trySysCall $ c_setprotoent (fromBool flg)  foreign import ccall unsafe "setprotoent" c_setprotoent :: CInt -> IO ()@@ -383,7 +385,7 @@ getHostByName name = withLock $ do   withCString name $ \ name_cstr -> do    ent <- throwNoSuchThingIfNull "getHostByName" "no such host entry"-    		$ trySysCall $ c_gethostbyname name_cstr+                $ trySysCall $ c_gethostbyname name_cstr    peek ent  foreign import CALLCONV safe "gethostbyname" @@ -396,7 +398,7 @@ getHostByAddr :: Family -> HostAddress -> IO HostEntry getHostByAddr family addr = do  with addr $ \ ptr_addr -> withLock $ do- throwNoSuchThingIfNull 	"getHostByAddr" "no such host entry"+ throwNoSuchThingIfNull         "getHostByAddr" "no such host entry"    $ trySysCall $ c_gethostbyaddr ptr_addr (fromIntegral (sizeOf addr)) (packFamily family)  >>= peek @@ -406,7 +408,7 @@ #if defined(HAVE_GETHOSTENT) && !defined(cygwin32_HOST_OS) && !defined(mingw32_HOST_OS) && !defined(_WIN32) getHostEntry :: IO HostEntry getHostEntry = withLock $ do- throwNoSuchThingIfNull 	"getHostEntry" "unable to retrieve host entry"+ throwNoSuchThingIfNull         "getHostEntry" "unable to retrieve host entry"    $ trySysCall $ c_gethostent  >>= peek @@ -548,7 +550,7 @@  getEntries :: IO a  -- read            -> IO () -- at end-	   -> IO [a]+           -> IO [a] getEntries getOne atEnd = loop   where     loop = do
Network/Socket.hsc view
@@ -26,143 +26,140 @@  -- In order to process this file, you need to have CALLCONV defined. -module Network.Socket (+module Network.Socket+    (     -- * Types-    Socket(..),		-- instance Eq, Show-    Family(..),		-    SocketType(..),-    SockAddr(..),-    SocketStatus(..),-    HostAddress,+      Socket(..)+    , Family(..)         +    , SocketType(..)+    , SockAddr(..)+    , SocketStatus(..)+    , HostAddress #if defined(IPV6_SOCKET_SUPPORT)-    HostAddress6,-    FlowInfo,-    ScopeID,+    , HostAddress6+    , FlowInfo+    , ScopeID #endif-    ShutdownCmd(..),-    ProtocolNumber,-    defaultProtocol,        -- :: ProtocolNumber-    PortNumber(..),-	-- PortNumber is used non-abstractly in Network.BSD.  ToDo: remove-	-- this use and make the type abstract.+    , ShutdownCmd(..)+    , ProtocolNumber+    , defaultProtocol+    , PortNumber(..)+    -- PortNumber is used non-abstractly in Network.BSD.  ToDo: remove+    -- this use and make the type abstract.      -- * Address operations -    HostName,-    ServiceName,+    , HostName+    , ServiceName  #if defined(IPV6_SOCKET_SUPPORT)-    AddrInfo(..),+    , AddrInfo(..) -    AddrInfoFlag(..),-    addrInfoFlagImplemented,-- :: AddrInfoFlag -> Bool+    , AddrInfoFlag(..)+    , addrInfoFlagImplemented -    defaultHints,           -- :: AddrInfo+    , defaultHints -    getAddrInfo,            -- :: Maybe AddrInfo -> Maybe HostName -> Maybe ServiceName -> IO [AddrInfo]+    , getAddrInfo -    NameInfoFlag(..),+    , NameInfoFlag(..) -    getNameInfo,            -- :: [NameInfoFlag] -> Bool -> Bool -> SockAddr -> IO (Maybe HostName, Maybe ServiceName)+    , getNameInfo #endif      -- * Socket operations-    socket,		-- :: Family -> SocketType -> ProtocolNumber -> IO Socket +    , socket #if defined(DOMAIN_SOCKET_SUPPORT)-    socketPair,         -- :: Family -> SocketType -> ProtocolNumber -> IO (Socket, Socket)+    , socketPair #endif-    connect,		-- :: Socket -> SockAddr -> IO ()-    bindSocket,		-- :: Socket -> SockAddr -> IO ()-    listen,		-- :: Socket -> Int -> IO ()-    accept,		-- :: Socket -> IO (Socket, SockAddr)-    getPeerName,	-- :: Socket -> IO SockAddr-    getSocketName,	-- :: Socket -> IO SockAddr+    , connect+    , bindSocket+    , listen+    , accept+    , getPeerName+    , getSocketName  #ifdef HAVE_STRUCT_UCRED-	-- get the credentials of our domain socket peer.-    getPeerCred,         -- :: Socket -> IO (CUInt{-pid-}, CUInt{-uid-}, CUInt{-gid-})+    -- get the credentials of our domain socket peer.+    , getPeerCred #endif -    socketPort,		-- :: Socket -> IO PortNumber+    , socketPort -    socketToHandle,	-- :: Socket -> IOMode -> IO Handle+    , socketToHandle      -- ** Sending and receiving data     -- $sendrecv-    sendTo,		-- :: Socket -> String -> SockAddr -> IO Int-    sendBufTo,          -- :: Socket -> Ptr a -> Int -> SockAddr -> IO Int+    , sendTo+    , sendBufTo -    recvFrom,		-- :: Socket -> Int -> IO (String, Int, SockAddr)-    recvBufFrom,        -- :: Socket -> Ptr a -> Int -> IO (Int, SockAddr)+    , recvFrom+    , recvBufFrom     -    send,		-- :: Socket -> String -> IO Int-    recv,		-- :: Socket -> Int    -> IO String-    recvLen,            -- :: Socket -> Int    -> IO (String, Int)+    , send+    , recv+    , recvLen -    inet_addr,		-- :: String -> IO HostAddress-    inet_ntoa,		-- :: HostAddress -> IO String+    , inet_addr+    , inet_ntoa -    shutdown,		-- :: Socket -> ShutdownCmd -> IO ()-    sClose,		-- :: Socket -> IO ()+    , shutdown+    , sClose      -- ** Predicates on sockets-    sIsConnected,	-- :: Socket -> IO Bool-    sIsBound,		-- :: Socket -> IO Bool-    sIsListening,	-- :: Socket -> IO Bool -    sIsReadable,	-- :: Socket -> IO Bool-    sIsWritable,	-- :: Socket -> IO Bool+    , sIsConnected+    , sIsBound+    , sIsListening+    , sIsReadable+    , sIsWritable      -- * Socket options-    SocketOption(..),-    getSocketOption,     -- :: Socket -> SocketOption -> IO Int-    setSocketOption,     -- :: Socket -> SocketOption -> Int -> IO ()+    , SocketOption(..)+    , getSocketOption+    , setSocketOption      -- * File descriptor transmission #ifdef DOMAIN_SOCKET_SUPPORT-    sendFd,              -- :: Socket -> CInt -> IO ()-    recvFd,              -- :: Socket -> IO CInt+    , sendFd+    , recvFd -      -- Note: these two will disappear shortly-    sendAncillary,       -- :: Socket -> Int -> Int -> Int -> Ptr a -> Int -> IO ()-    recvAncillary,       -- :: Socket -> Int -> Int -> IO (Int,Int,Int,Ptr a)+    -- Note: these two will disappear shortly+    , sendAncillary+    , recvAncillary  #endif      -- * Special constants-    aNY_PORT,		-- :: PortNumber-    iNADDR_ANY,		-- :: HostAddress+    , aNY_PORT+    , iNADDR_ANY #if defined(IPV6_SOCKET_SUPPORT)-    iN6ADDR_ANY,	-- :: HostAddress6+    , iN6ADDR_ANY #endif-    sOMAXCONN,		-- :: Int-    sOL_SOCKET,         -- :: Int+    , sOMAXCONN+    , sOL_SOCKET #ifdef SCM_RIGHTS-    sCM_RIGHTS,         -- :: Int+    , sCM_RIGHTS #endif-    maxListenQueue,	-- :: Int+    , maxListenQueue      -- * Initialisation-    withSocketsDo,	-- :: IO a -> IO a+    , withSocketsDo          -- * Very low level operations-     -- in case you ever want to get at the underlying file descriptor..-    fdSocket,           -- :: Socket -> CInt-    mkSocket,           -- :: CInt   -> Family -    			-- -> SocketType-			-- -> ProtocolNumber-			-- -> SocketStatus-			-- -> IO Socket+    -- in case you ever want to get at the underlying file descriptor..+    , fdSocket+    , mkSocket      -- * Internal      -- | The following are exported ONLY for use in the BSD module and     -- should not be used anywhere else. -    packFamily, unpackFamily,-    packSocketType,-    throwSocketErrorIfMinus1_--) where+    , packFamily+    , unpackFamily+    , packSocketType+    , throwSocketErrorIfMinus1_+    ) where  #ifdef __HUGS__ import Hugs.Prelude ( IOException(..), IOErrorType(..) )@@ -179,24 +176,25 @@  import Data.Bits import Data.List (foldl')-import Data.Word ( Word8, Word16, Word32 )-import Foreign.Ptr ( Ptr, castPtr, nullPtr, plusPtr )-import Foreign.Storable ( Storable(..) )+import Data.Word (Word8, Word16, Word32)+import Foreign.Ptr (Ptr, castPtr, nullPtr, plusPtr)+import Foreign.Storable (Storable(..)) import Foreign.C.Error-import Foreign.C.String ( CString, withCString, peekCString, peekCStringLen, castCharToCChar )-import Foreign.C.Types ( CUInt, CChar )+import Foreign.C.String (CString, withCString, peekCString, peekCStringLen,+                        castCharToCChar)+import Foreign.C.Types (CUInt, CChar) #if __GLASGOW_HASKELL__ >= 703-import Foreign.C.Types ( CInt(..), CSize(..) )+import Foreign.C.Types (CInt(..), CSize(..)) #else-import Foreign.C.Types ( CInt, CSize )+import Foreign.C.Types (CInt, CSize) #endif import Foreign.Marshal.Alloc ( alloca, allocaBytes ) import Foreign.Marshal.Array ( peekArray, pokeArray, pokeArray0 ) import Foreign.Marshal.Utils ( maybeWith, with )  import System.IO-import Control.Monad ( liftM, when )-import Data.Ratio ( (%) )+import Control.Monad (liftM, when)+import Data.Ratio ((%))  import qualified Control.Exception import Control.Concurrent.MVar@@ -204,13 +202,13 @@ import System.IO.Error  #ifdef __GLASGOW_HASKELL__-import GHC.Conc		(threadWaitRead, threadWaitWrite)+import GHC.Conc (threadWaitRead, threadWaitWrite) ##if MIN_VERSION_base(4,3,1)-import GHC.Conc		(closeFdWith)+import GHC.Conc (closeFdWith) ##endif # if defined(mingw32_HOST_OS)-import GHC.Conc		( asyncDoProc )-import Foreign( FunPtr )+import GHC.Conc (asyncDoProc)+import Foreign (FunPtr) # endif # if __GLASGOW_HASKELL__ >= 611 import qualified GHC.IO.Device@@ -223,7 +221,7 @@ # endif import qualified System.Posix.Internals #else-import System.IO.Unsafe	(unsafePerformIO)+import System.IO.Unsafe (unsafePerformIO) #endif  # if __GLASGOW_HASKELL__ >= 611@@ -276,22 +274,22 @@ -- invalid operations on sockets.  data SocketStatus-  -- Returned Status	Function called-  = NotConnected	-- socket-  | Bound		-- bindSocket-  | Listening		-- listen-  | Connected		-- connect/accept+  -- Returned Status    Function called+  = NotConnected        -- socket+  | Bound               -- bindSocket+  | Listening           -- listen+  | Connected           -- connect/accept   | ConvertedToHandle   -- is now a Handle, don't touch   | Closed		-- sClose      deriving (Eq, Show, Typeable)  data Socket   = MkSocket-	    CInt	         -- File Descriptor-	    Family				  -	    SocketType				  -	    ProtocolNumber	 -- Protocol Number-	    (MVar SocketStatus)  -- Status Flag+            CInt                 -- File Descriptor+            Family                                +            SocketType                            +            ProtocolNumber       -- Protocol Number+            (MVar SocketStatus)  -- Status Flag   deriving Typeable  #if __GLASGOW_HASKELL__ >= 611 && defined(mingw32_HOST_OS)@@ -301,11 +299,11 @@ #endif  mkSocket :: CInt-	 -> Family-	 -> SocketType-	 -> ProtocolNumber-	 -> SocketStatus-	 -> IO Socket+         -> Family+         -> SocketType+         -> ProtocolNumber+         -> SocketStatus+         -> IO Socket mkSocket fd fam sType pNum stat = do    mStat <- newMVar stat    return (MkSocket fd fam sType pNum mStat)@@ -315,7 +313,7 @@  instance Show Socket where   showsPrec n (MkSocket fd _ _ _ _) = -	showString "<socket: " . shows fd . showString ">"+        showString "<socket: " . shows fd . showString ">"   fdSocket :: Socket -> CInt@@ -363,7 +361,7 @@  instance Integral PortNumber where     quotRem a b = let (c,d) = quotRem (portNumberToInt a) (portNumberToInt b) in-		  (intToPortNumber c, intToPortNumber d)+                  (intToPortNumber c, intToPortNumber d)     toInteger a = toInteger (portNumberToInt a)  instance Storable PortNumber where@@ -412,10 +410,10 @@ socket :: Family 	 -- Family Name (usually AF_INET)        -> SocketType 	 -- Socket Type (usually Stream)        -> ProtocolNumber -- Protocol Number (getProtocolByName to find value)-       -> IO Socket	 -- Unconnected Socket+       -> IO Socket      -- Unconnected Socket socket family stype protocol = do     fd <- throwSocketErrorIfMinus1Retry "socket" $-		c_socket (packFamily family) (packSocketType stype) protocol+                c_socket (packFamily family) (packSocketType stype) protocol #if !defined(__HUGS__) # if __GLASGOW_HASKELL__ < 611     System.Posix.Internals.setNonBlockingFD fd@@ -435,16 +433,16 @@ -- type, and protocol number are as for the 'socket' function above. -- Availability: Unix. #if defined(DOMAIN_SOCKET_SUPPORT)-socketPair :: Family 	          -- Family Name (usually AF_INET or AF_INET6)-           -> SocketType 	  -- Socket Type (usually Stream)+socketPair :: Family              -- Family Name (usually AF_INET or AF_INET6)+           -> SocketType          -- Socket Type (usually Stream)            -> ProtocolNumber      -- Protocol Number            -> IO (Socket, Socket) -- unnamed and connected. socketPair family stype protocol = do     allocaBytes (2 * sizeOf (1 :: CInt)) $ \ fdArr -> do     rc <- throwSocketErrorIfMinus1Retry "socketpair" $-		c_socketpair (packFamily family)-			     (packSocketType stype)-			     protocol fdArr+                c_socketpair (packFamily family)+                             (packSocketType stype)+                             protocol fdArr     [fd1,fd2] <- peekArray 2 fdArr      s1 <- mkSocket fd1     s2 <- mkSocket fd2@@ -473,7 +471,7 @@ -- same as that passed to 'socket'.  If the special port number -- 'aNY_PORT' is passed then the system assigns the next available -- use port.-bindSocket :: Socket	-- Unconnected Socket+bindSocket :: Socket    -- Unconnected Socket            -> SockAddr  -- Address to Bind to            -> IO () bindSocket (MkSocket s _family _stype _protocol socketStatus) addr = do@@ -481,7 +479,7 @@  if status /= NotConnected    then    ioError (userError ("bindSocket: can't peform bind on socket in status " ++-	 show status))+         show status))   else do    withSockAddr addr $ \p_addr sz -> do    status <- throwSocketErrorIfMinus1Retry "bind" $ c_bind s p_addr (fromIntegral sz)@@ -498,48 +496,48 @@  modifyMVar_ socketStatus $ \currentStatus -> do  if currentStatus /= NotConnected && currentStatus /= Bound   then-   ioError (userError ("connect: can't peform connect on socket in status " ++-         show currentStatus))+    ioError (userError ("connect: can't peform connect on socket in status " +++        show currentStatus))   else do-   withSockAddr addr $ \p_addr sz -> do+    withSockAddr addr $ \p_addr sz -> do -   let  connectLoop = do-       	   r <- c_connect s p_addr (fromIntegral sz)-       	   if r == -1-       	       then do +    let connectLoop = do+           r <- c_connect s p_addr (fromIntegral sz)+           if r == -1+               then do  #if !(defined(HAVE_WINSOCK_H) && !defined(cygwin32_HOST_OS))-	       	       err <- getErrno-		       case () of-			 _ | err == eINTR       -> connectLoop-			 _ | err == eINPROGRESS -> connectBlocked---			 _ | err == eAGAIN      -> connectBlocked-			 otherwise              -> throwSocketError "connect"+                   err <- getErrno+                   case () of+                     _ | err == eINTR       -> connectLoop+                     _ | err == eINPROGRESS -> connectBlocked+--                   _ | err == eAGAIN      -> connectBlocked+                     otherwise              -> throwSocketError "connect" #else-		       rc <- c_getLastError-		       case rc of-		         10093 -> do -- WSANOTINITIALISED-			   withSocketsDo (return ())-	       	           r <- c_connect s p_addr (fromIntegral sz)-	       	           if r == -1-			    then throwSocketError "connect"-			    else return r-			 _ -> throwSocketError "connect"+                   rc <- c_getLastError+                   case rc of+                     10093 -> do -- WSANOTINITIALISED+                       withSocketsDo (return ())+                       r <- c_connect s p_addr (fromIntegral sz)+                       if r == -1+                         then throwSocketError "connect"+                         else return r+                     _ -> throwSocketError "connect" #endif-       	       else return r+               else return r -	connectBlocked = do +        connectBlocked = do  #if !defined(__HUGS__)-	   threadWaitWrite (fromIntegral s)+           threadWaitWrite (fromIntegral s) #endif-	   err <- getSocketOption sock SoError-	   if (err == 0)-	   	then return 0-	   	else do ioError (errnoToIOError "connect" -	   			(Errno (fromIntegral err))-	   			Nothing Nothing)+           err <- getSocketOption sock SoError+           if (err == 0)+                then return 0+                else do ioError (errnoToIOError "connect" +                                (Errno (fromIntegral err))+                                Nothing Nothing) -   connectLoop-   return Connected+    connectLoop+    return Connected  ----------------------------------------------------------------------------- -- Listen@@ -548,17 +546,17 @@ -- specifies the maximum number of queued connections and should be at -- least 1; the maximum value is system-dependent (usually 5). listen :: Socket  -- Connected & Bound Socket-       -> Int 	  -- Queue Length+       -> Int     -- Queue Length        -> IO () listen (MkSocket s _family _stype _protocol socketStatus) backlog = do  modifyMVar_ socketStatus $ \ status -> do  if status /= Bound     then-    ioError (userError ("listen: can't peform listen on socket in status " ++-          show status))+     ioError (userError ("listen: can't peform listen on socket in status " +++         show status))    else do-    throwSocketErrorIfMinus1Retry "listen" (c_listen s (fromIntegral backlog))-    return Listening+     throwSocketErrorIfMinus1Retry "listen" (c_listen s (fromIntegral backlog))+     return Listening  ----------------------------------------------------------------------------- -- Accept@@ -574,9 +572,9 @@ -- address)@ where @conn@ is a new socket object usable to send and -- receive data on the connection, and @address@ is the address bound -- to the socket on the other end of the connection.-accept :: Socket			-- Queue Socket-       -> IO (Socket,			-- Readable Socket-	      SockAddr)			-- Peer details+accept :: Socket                        -- Queue Socket+       -> IO (Socket,                   -- Readable Socket+              SockAddr)                 -- Peer details  accept sock@(MkSocket s family stype protocol status) = do  currentStatus <- readMVar status@@ -584,32 +582,32 @@  if not okay    then      ioError (userError ("accept: can't perform accept on socket (" ++ (show (family,stype,protocol)) ++") in status " ++-	 show currentStatus))+         show currentStatus))    else do      let sz = sizeOfSockAddrByFamily family      allocaBytes sz $ \ sockaddr -> do #if defined(mingw32_HOST_OS) && defined(__GLASGOW_HASKELL__)      new_sock <--	if threaded -	   then with (fromIntegral sz) $ \ ptr_len ->-		  throwErrnoIfMinus1Retry "Network.Socket.accept" $-		    c_accept_safe s sockaddr ptr_len-	   else do-     		paramData <- c_newAcceptParams s (fromIntegral sz) sockaddr-     		rc        <- asyncDoProc c_acceptDoProc paramData-     		new_sock  <- c_acceptNewSock    paramData-     		c_free paramData-     		when (rc /= 0)-     		     (ioError (errnoToIOError "Network.Socket.accept" (Errno (fromIntegral rc)) Nothing Nothing))-		return new_sock+        if threaded +           then with (fromIntegral sz) $ \ ptr_len ->+                  throwErrnoIfMinus1Retry "Network.Socket.accept" $+                    c_accept_safe s sockaddr ptr_len+           else do+                paramData <- c_newAcceptParams s (fromIntegral sz) sockaddr+                rc        <- asyncDoProc c_acceptDoProc paramData+                new_sock  <- c_acceptNewSock    paramData+                c_free paramData+                when (rc /= 0)+                     (ioError (errnoToIOError "Network.Socket.accept" (Errno (fromIntegral rc)) Nothing Nothing))+                return new_sock #else       with (fromIntegral sz) $ \ ptr_len -> do      new_sock <-  # if !defined(__HUGS__)                  throwSocketErrorIfMinus1RetryMayBlock "accept"-			(threadWaitRead (fromIntegral s))+                        (threadWaitRead (fromIntegral s)) # endif-			(c_accept s sockaddr ptr_len)+                        (c_accept s sockaddr ptr_len) # if !defined(__HUGS__) #  if __GLASGOW_HASKELL__ < 611      System.Posix.Internals.setNonBlockingFD new_sock@@ -654,10 +652,10 @@ -- -- NOTE: blocking on Windows unless you compile with -threaded (see -- GHC ticket #1129)-sendTo :: Socket	-- (possibly) bound/connected Socket-       -> String	-- Data to send+sendTo :: Socket        -- (possibly) bound/connected Socket+       -> String        -- Data to send        -> SockAddr-       -> IO Int	-- Number of Bytes sent+       -> IO Int        -- Number of Bytes sent sendTo sock xs addr = do  withCString xs $ \str -> do    sendBufTo sock str (length xs) addr@@ -666,19 +664,19 @@ -- explicitly, so the socket need not be in a connected state. -- Returns the number of bytes sent.  Applications are responsible for -- ensuring that all data has been sent.-sendBufTo :: Socket	       -- (possibly) bound/connected Socket+sendBufTo :: Socket            -- (possibly) bound/connected Socket           -> Ptr a -> Int  -- Data to send           -> SockAddr-          -> IO Int	       -- Number of Bytes sent+          -> IO Int            -- Number of Bytes sent sendBufTo (MkSocket s _family _stype _protocol status) ptr nbytes addr = do  withSockAddr addr $ \p_addr sz -> do    liftM fromIntegral $ #if !defined(__HUGS__)      throwSocketErrorIfMinus1RetryMayBlock "sendTo"-	(threadWaitWrite (fromIntegral s)) $+        (threadWaitWrite (fromIntegral s)) $ #endif-	c_sendto s ptr (fromIntegral $ nbytes) 0{-flags-} -			p_addr (fromIntegral sz)+        c_sendto s ptr (fromIntegral $ nbytes) 0{-flags-} +                        p_addr (fromIntegral sz)  -- | Receive data from the socket. The socket need not be in a -- connected state. Returns @(bytes, nbytes, address)@ where @bytes@@@ -709,27 +707,27 @@  | otherwise   =      withNewSockAddr family $ \ptr_addr sz -> do       alloca $ \ptr_len -> do-      	poke ptr_len (fromIntegral sz)+        poke ptr_len (fromIntegral sz)         len <-  #if !defined(__HUGS__)-	       throwSocketErrorIfMinus1RetryMayBlock "recvFrom"-        	   (threadWaitRead (fromIntegral s)) $+               throwSocketErrorIfMinus1RetryMayBlock "recvFrom"+                   (threadWaitRead (fromIntegral s)) $ #endif-        	   c_recvfrom s ptr (fromIntegral nbytes) 0{-flags-} -				ptr_addr ptr_len+                   c_recvfrom s ptr (fromIntegral nbytes) 0{-flags-} +                                ptr_addr ptr_len         let len' = fromIntegral len-	if len' == 0-	 then ioError (mkEOFError "Network.Socket.recvFrom")-	 else do-   	   flg <- sIsConnected sock-	     -- For at least one implementation (WinSock 2), recvfrom() ignores-	     -- filling in the sockaddr for connected TCP sockets. Cope with -	     -- this by using getPeerName instead.-	   sockaddr <- -		if flg then-		   getPeerName sock-		else-		   peekSockAddr ptr_addr +        if len' == 0+         then ioError (mkEOFError "Network.Socket.recvFrom")+         else do+           flg <- sIsConnected sock+             -- For at least one implementation (WinSock 2), recvfrom() ignores+             -- filling in the sockaddr for connected TCP sockets. Cope with +             -- this by using getPeerName instead.+           sockaddr <- +                if flg then+                   getPeerName sock+                else+                   peekSockAddr ptr_addr             return (len', sockaddr)  -----------------------------------------------------------------------------@@ -738,9 +736,9 @@ -- | Send data to the socket. The socket must be connected to a remote -- socket. Returns the number of bytes sent.  Applications are -- responsible for ensuring that all data has been sent.-send :: Socket	-- Bound/Connected Socket-     -> String	-- Data to send-     -> IO Int	-- Number of Bytes sent+send :: Socket  -- Bound/Connected Socket+     -> String  -- Data to send+     -> IO Int  -- Number of Bytes sent send sock@(MkSocket s _family _stype _protocol status) xs = do  let len = length xs  withCString xs $ \str -> do@@ -766,9 +764,9 @@ #else # if !defined(__HUGS__)      throwSocketErrorIfMinus1RetryMayBlock "send"-	(threadWaitWrite (fromIntegral s)) $+        (threadWaitWrite (fromIntegral s)) $ # endif-	c_send s str (fromIntegral len) 0{-flags-} +        c_send s str (fromIntegral len) 0{-flags-}  #endif  -- | Receive data from the socket.  The socket must be in a connected@@ -801,17 +799,17 @@ #endif #else # if !defined(__HUGS__)-	       throwSocketErrorIfMinus1RetryMayBlock "recv"-        	   (threadWaitRead (fromIntegral s)) $+               throwSocketErrorIfMinus1RetryMayBlock "recv"+                   (threadWaitRead (fromIntegral s)) $ # endif-        	   c_recv s ptr (fromIntegral nbytes) 0{-flags-} +                   c_recv s ptr (fromIntegral nbytes) 0{-flags-}  #endif         let len' = fromIntegral len-	if len' == 0-	 then ioError (mkEOFError "Network.Socket.recv")-	 else do-	   s <- peekCStringLen (castPtr ptr,len')-	   return (s, len')+        if len' == 0+         then ioError (mkEOFError "Network.Socket.recv")+         else do+           s <- peekCStringLen (castPtr ptr,len')+           return (s, len')  -- --------------------------------------------------------------------------- -- socketPort@@ -820,8 +818,8 @@ -- determined by calling $port$, is generally only useful when bind -- was given $aNY\_PORT$. -socketPort :: Socket		-- Connected & Bound Socket-	   -> IO PortNumber	-- Port Number of Socket+socketPort :: Socket            -- Connected & Bound Socket+           -> IO PortNumber     -- Port Number of Socket socketPort sock@(MkSocket _ AF_INET _ _ _) = do     (SockAddrInet port _) <- getSocketName sock     return port@@ -988,7 +986,7 @@     NoDelay       -> #const TCP_NODELAY #endif #ifdef SO_LINGER-    Linger	  -> #const SO_LINGER+    Linger        -> #const SO_LINGER #endif #ifdef SO_REUSEPORT     ReusePort     -> #const SO_REUSEPORT@@ -1013,25 +1011,25 @@ #endif  setSocketOption :: Socket -		-> SocketOption -- Option Name-		-> Int		-- Option Value-		-> IO ()+                -> SocketOption -- Option Name+                -> Int          -- Option Value+                -> IO () setSocketOption (MkSocket s _ _ _ _) so v = do    with (fromIntegral v) $ \ptr_v -> do    throwErrnoIfMinus1_ "setSocketOption" $        c_setsockopt s (socketOptLevel so) (packSocketOption so) ptr_v -	  (fromIntegral (sizeOf v))+          (fromIntegral (sizeOf (undefined :: CInt)))    return ()   getSocketOption :: Socket-		-> SocketOption  -- Option Name-		-> IO Int	 -- Option Value+                -> SocketOption  -- Option Name+                -> IO Int        -- Option Value getSocketOption (MkSocket s _ _ _ _) so = do    alloca $ \ptr_v ->      with (fromIntegral (sizeOf (undefined :: CInt))) $ \ptr_sz -> do        throwErrnoIfMinus1 "getSocketOption" $-	 c_getsockopt s (socketOptLevel so) (packSocketOption so) ptr_v ptr_sz+         c_getsockopt s (socketOptLevel so) (packSocketOption so) ptr_v ptr_sz        fromIntegral `liftM` peek ptr_v  @@ -1088,12 +1086,12 @@   sendAncillary :: Socket-	      -> Int-	      -> Int-	      -> Int-	      -> Ptr a-	      -> Int-	      -> IO ()+              -> Int+              -> Int+              -> Int+              -> Ptr a+              -> Int+              -> IO () sendAncillary sock level ty flags datum len = do   let fd = fdSocket sock   _ <-@@ -1102,13 +1100,13 @@      (threadWaitWrite (fromIntegral fd)) $ #endif      c_sendAncillary fd (fromIntegral level) (fromIntegral ty)-     			(fromIntegral flags) datum (fromIntegral len)+                        (fromIntegral flags) datum (fromIntegral len)   return ()  recvAncillary :: Socket-	      -> Int-	      -> Int-	      -> IO (Int,Int,Ptr a,Int)+              -> Int+              -> Int+              -> IO (Int,Int,Ptr a,Int) recvAncillary sock flags len = do   let fd = fdSocket sock   alloca      $ \ ptr_len   ->@@ -1121,7 +1119,7 @@         throwSocketErrorIfMinus1RetryMayBlock "recvAncillary"              (threadWaitRead (fromIntegral fd)) $ #endif-	    c_recvAncillary fd ptr_lev ptr_ty (fromIntegral flags) ptr_pData ptr_len+            c_recvAncillary fd ptr_lev ptr_ty (fromIntegral flags) ptr_pData ptr_len       len <- fromIntegral `liftM` peek ptr_len       lev <- fromIntegral `liftM` peek ptr_lev       ty  <- fromIntegral `liftM` peek ptr_ty@@ -1150,19 +1148,19 @@ \hline {\bf Precedes} & & & & & & & \\ \hline -socket &	&	  &	       &	&	 &	& \\+socket &        &         &            &        &        &      & \\ \hline-connect & +	&	  &	       &	&	 &	& \\+connect & +     &         &            &        &        &      & \\ \hline-bindSocket & +	&	  &	       &	&	 &	& \\+bindSocket & +  &         &            &        &        &      & \\ \hline-listen &	&	  & +	       &	&	 &	& \\+listen &        &         & +          &        &        &      & \\ \hline-accept &	&	  &	       &  +	&	 &	& \\+accept &        &         &            &  +     &        &      & \\ \hline-read   &	&   +	  &	       &  +	&  +	 &  +	& + \\+read   &        &   +     &            &  +     &  +     &  +   & + \\ \hline-write  &	&   +	  &	       &  +	&  +	 &  +	& + \\+write  &        &   +     &            &  +     &  +     &  +   & + \\ \hline \end{tabular} \caption{Sequence Table for Major functions of Socket}@@ -1174,120 +1172,120 @@ -- --------------------------------------------------------------------------- -- OS Dependent Definitions     -unpackFamily	:: CInt -> Family-packFamily	:: Family -> CInt+unpackFamily    :: CInt -> Family+packFamily      :: Family -> CInt -packSocketType	:: SocketType -> CInt+packSocketType  :: SocketType -> CInt unpackSocketType:: CInt -> SocketType  ------ -------			+                         packFamily f = case f of-	AF_UNSPEC -> #const AF_UNSPEC+        AF_UNSPEC -> #const AF_UNSPEC #ifdef AF_UNIX-	AF_UNIX -> #const AF_UNIX+        AF_UNIX -> #const AF_UNIX #endif #ifdef AF_INET-	AF_INET -> #const AF_INET+        AF_INET -> #const AF_INET #endif #ifdef AF_INET6         AF_INET6 -> #const AF_INET6 #endif #ifdef AF_IMPLINK-	AF_IMPLINK -> #const AF_IMPLINK+        AF_IMPLINK -> #const AF_IMPLINK #endif #ifdef AF_PUP-	AF_PUP -> #const AF_PUP+        AF_PUP -> #const AF_PUP #endif #ifdef AF_CHAOS-	AF_CHAOS -> #const AF_CHAOS+        AF_CHAOS -> #const AF_CHAOS #endif #ifdef AF_NS-	AF_NS -> #const AF_NS+        AF_NS -> #const AF_NS #endif #ifdef AF_NBS-	AF_NBS -> #const AF_NBS+        AF_NBS -> #const AF_NBS #endif #ifdef AF_ECMA-	AF_ECMA -> #const AF_ECMA+        AF_ECMA -> #const AF_ECMA #endif #ifdef AF_DATAKIT-	AF_DATAKIT -> #const AF_DATAKIT+        AF_DATAKIT -> #const AF_DATAKIT #endif #ifdef AF_CCITT-	AF_CCITT -> #const AF_CCITT+        AF_CCITT -> #const AF_CCITT #endif #ifdef AF_SNA-	AF_SNA -> #const AF_SNA+        AF_SNA -> #const AF_SNA #endif #ifdef AF_DECnet-	AF_DECnet -> #const AF_DECnet+        AF_DECnet -> #const AF_DECnet #endif #ifdef AF_DLI-	AF_DLI -> #const AF_DLI+        AF_DLI -> #const AF_DLI #endif #ifdef AF_LAT-	AF_LAT -> #const AF_LAT+        AF_LAT -> #const AF_LAT #endif #ifdef AF_HYLINK-	AF_HYLINK -> #const AF_HYLINK+        AF_HYLINK -> #const AF_HYLINK #endif #ifdef AF_APPLETALK-	AF_APPLETALK -> #const AF_APPLETALK+        AF_APPLETALK -> #const AF_APPLETALK #endif #ifdef AF_ROUTE-	AF_ROUTE -> #const AF_ROUTE+        AF_ROUTE -> #const AF_ROUTE #endif #ifdef AF_NETBIOS-	AF_NETBIOS -> #const AF_NETBIOS+        AF_NETBIOS -> #const AF_NETBIOS #endif #ifdef AF_NIT-	AF_NIT -> #const AF_NIT+        AF_NIT -> #const AF_NIT #endif #ifdef AF_802-	AF_802 -> #const AF_802+        AF_802 -> #const AF_802 #endif #ifdef AF_ISO-	AF_ISO -> #const AF_ISO+        AF_ISO -> #const AF_ISO #endif #ifdef AF_OSI-	AF_OSI -> #const AF_OSI+        AF_OSI -> #const AF_OSI #endif #ifdef AF_NETMAN-	AF_NETMAN -> #const AF_NETMAN+        AF_NETMAN -> #const AF_NETMAN #endif #ifdef AF_X25-	AF_X25 -> #const AF_X25+        AF_X25 -> #const AF_X25 #endif #ifdef AF_AX25-	AF_AX25 -> #const AF_AX25+        AF_AX25 -> #const AF_AX25 #endif #ifdef AF_OSINET-	AF_OSINET -> #const AF_OSINET+        AF_OSINET -> #const AF_OSINET #endif #ifdef AF_GOSSIP-	AF_GOSSIP -> #const AF_GOSSIP+        AF_GOSSIP -> #const AF_GOSSIP #endif #ifdef AF_IPX-	AF_IPX -> #const AF_IPX+        AF_IPX -> #const AF_IPX #endif #ifdef Pseudo_AF_XTP-	Pseudo_AF_XTP -> #const Pseudo_AF_XTP+        Pseudo_AF_XTP -> #const Pseudo_AF_XTP #endif #ifdef AF_CTF-	AF_CTF -> #const AF_CTF+        AF_CTF -> #const AF_CTF #endif #ifdef AF_WAN-	AF_WAN -> #const AF_WAN+        AF_WAN -> #const AF_WAN #endif #ifdef AF_SDL         AF_SDL -> #const AF_SDL #endif #ifdef AF_NETWARE-        AF_NETWARE -> #const AF_NETWARE	+        AF_NETWARE -> #const AF_NETWARE  #endif #ifdef AF_NDD-        AF_NDD -> #const AF_NDD		+        AF_NDD -> #const AF_NDD          #endif #ifdef AF_INTF         AF_INTF -> #const AF_INTF@@ -1326,7 +1324,7 @@         AF_ENCAP -> #const AF_ENCAP  #endif #ifdef AF_LINK-	AF_LINK -> #const AF_LINK+        AF_LINK -> #const AF_LINK #endif #ifdef AF_RAW         AF_RAW -> #const AF_RAW@@ -1335,158 +1333,158 @@         AF_RIF -> #const AF_RIF #endif #ifdef AF_NETROM-	AF_NETROM -> #const AF_NETROM+        AF_NETROM -> #const AF_NETROM #endif #ifdef AF_BRIDGE-	AF_BRIDGE -> #const AF_BRIDGE+        AF_BRIDGE -> #const AF_BRIDGE #endif #ifdef AF_ATMPVC-	AF_ATMPVC -> #const AF_ATMPVC+        AF_ATMPVC -> #const AF_ATMPVC #endif #ifdef AF_ROSE-	AF_ROSE -> #const AF_ROSE+        AF_ROSE -> #const AF_ROSE #endif #ifdef AF_NETBEUI-	AF_NETBEUI -> #const AF_NETBEUI+        AF_NETBEUI -> #const AF_NETBEUI #endif #ifdef AF_SECURITY-	AF_SECURITY -> #const AF_SECURITY+        AF_SECURITY -> #const AF_SECURITY #endif #ifdef AF_PACKET-	AF_PACKET -> #const AF_PACKET+        AF_PACKET -> #const AF_PACKET #endif #ifdef AF_ASH-	AF_ASH -> #const AF_ASH+        AF_ASH -> #const AF_ASH #endif #ifdef AF_ECONET-	AF_ECONET -> #const AF_ECONET+        AF_ECONET -> #const AF_ECONET #endif #ifdef AF_ATMSVC-	AF_ATMSVC -> #const AF_ATMSVC+        AF_ATMSVC -> #const AF_ATMSVC #endif #ifdef AF_IRDA-	AF_IRDA -> #const AF_IRDA+        AF_IRDA -> #const AF_IRDA #endif #ifdef AF_PPPOX-	AF_PPPOX -> #const AF_PPPOX+        AF_PPPOX -> #const AF_PPPOX #endif #ifdef AF_WANPIPE-	AF_WANPIPE -> #const AF_WANPIPE+        AF_WANPIPE -> #const AF_WANPIPE #endif #ifdef AF_BLUETOOTH-	AF_BLUETOOTH -> #const AF_BLUETOOTH+        AF_BLUETOOTH -> #const AF_BLUETOOTH #endif  --------- ----------  unpackFamily f = case f of-	(#const AF_UNSPEC) -> AF_UNSPEC+        (#const AF_UNSPEC) -> AF_UNSPEC #ifdef AF_UNIX-	(#const AF_UNIX) -> AF_UNIX+        (#const AF_UNIX) -> AF_UNIX #endif #ifdef AF_INET-	(#const AF_INET) -> AF_INET+        (#const AF_INET) -> AF_INET #endif #ifdef AF_INET6         (#const AF_INET6) -> AF_INET6 #endif #ifdef AF_IMPLINK-	(#const AF_IMPLINK) -> AF_IMPLINK+        (#const AF_IMPLINK) -> AF_IMPLINK #endif #ifdef AF_PUP-	(#const AF_PUP) -> AF_PUP+        (#const AF_PUP) -> AF_PUP #endif #ifdef AF_CHAOS-	(#const AF_CHAOS) -> AF_CHAOS+        (#const AF_CHAOS) -> AF_CHAOS #endif #ifdef AF_NS-	(#const AF_NS) -> AF_NS+        (#const AF_NS) -> AF_NS #endif #ifdef AF_NBS-	(#const AF_NBS) -> AF_NBS+        (#const AF_NBS) -> AF_NBS #endif #ifdef AF_ECMA-	(#const AF_ECMA) -> AF_ECMA+        (#const AF_ECMA) -> AF_ECMA #endif #ifdef AF_DATAKIT-	(#const AF_DATAKIT) -> AF_DATAKIT+        (#const AF_DATAKIT) -> AF_DATAKIT #endif #ifdef AF_CCITT-	(#const AF_CCITT) -> AF_CCITT+        (#const AF_CCITT) -> AF_CCITT #endif #ifdef AF_SNA-	(#const AF_SNA) -> AF_SNA+        (#const AF_SNA) -> AF_SNA #endif #ifdef AF_DECnet-	(#const AF_DECnet) -> AF_DECnet+        (#const AF_DECnet) -> AF_DECnet #endif #ifdef AF_DLI-	(#const AF_DLI) -> AF_DLI+        (#const AF_DLI) -> AF_DLI #endif #ifdef AF_LAT-	(#const AF_LAT) -> AF_LAT+        (#const AF_LAT) -> AF_LAT #endif #ifdef AF_HYLINK-	(#const AF_HYLINK) -> AF_HYLINK+        (#const AF_HYLINK) -> AF_HYLINK #endif #ifdef AF_APPLETALK-	(#const AF_APPLETALK) -> AF_APPLETALK+        (#const AF_APPLETALK) -> AF_APPLETALK #endif #ifdef AF_ROUTE-	(#const AF_ROUTE) -> AF_ROUTE+        (#const AF_ROUTE) -> AF_ROUTE #endif #ifdef AF_NETBIOS-	(#const AF_NETBIOS) -> AF_NETBIOS+        (#const AF_NETBIOS) -> AF_NETBIOS #endif #ifdef AF_NIT-	(#const AF_NIT) -> AF_NIT+        (#const AF_NIT) -> AF_NIT #endif #ifdef AF_802-	(#const AF_802) -> AF_802+        (#const AF_802) -> AF_802 #endif #ifdef AF_ISO-	(#const AF_ISO) -> AF_ISO+        (#const AF_ISO) -> AF_ISO #endif #ifdef AF_OSI # if (!defined(AF_ISO)) || (defined(AF_ISO) && (AF_ISO != AF_OSI))-	(#const AF_OSI) -> AF_OSI+        (#const AF_OSI) -> AF_OSI # endif #endif #ifdef AF_NETMAN-	(#const AF_NETMAN) -> AF_NETMAN+        (#const AF_NETMAN) -> AF_NETMAN #endif #ifdef AF_X25-	(#const AF_X25) -> AF_X25+        (#const AF_X25) -> AF_X25 #endif #ifdef AF_AX25-	(#const AF_AX25) -> AF_AX25+        (#const AF_AX25) -> AF_AX25 #endif #ifdef AF_OSINET-	(#const AF_OSINET) -> AF_OSINET+        (#const AF_OSINET) -> AF_OSINET #endif #ifdef AF_GOSSIP-	(#const AF_GOSSIP) -> AF_GOSSIP+        (#const AF_GOSSIP) -> AF_GOSSIP #endif #if defined(AF_IPX) && (!defined(AF_NS) || AF_NS != AF_IPX)-	(#const AF_IPX) -> AF_IPX+        (#const AF_IPX) -> AF_IPX #endif #ifdef Pseudo_AF_XTP-	(#const Pseudo_AF_XTP) -> Pseudo_AF_XTP+        (#const Pseudo_AF_XTP) -> Pseudo_AF_XTP #endif #ifdef AF_CTF-	(#const AF_CTF) -> AF_CTF+        (#const AF_CTF) -> AF_CTF #endif #ifdef AF_WAN-	(#const AF_WAN) -> AF_WAN+        (#const AF_WAN) -> AF_WAN #endif #ifdef AF_SDL         (#const AF_SDL) -> AF_SDL #endif #ifdef AF_NETWARE-        (#const AF_NETWARE) -> AF_NETWARE	+        (#const AF_NETWARE) -> AF_NETWARE        #endif #ifdef AF_NDD-        (#const AF_NDD) -> AF_NDD		+        (#const AF_NDD) -> AF_NDD                #endif #ifdef AF_INTF         (#const AF_INTF) -> AF_INTF@@ -1525,7 +1523,7 @@         (#const AF_ENCAP) -> AF_ENCAP  #endif #ifdef AF_LINK-	(#const AF_LINK) -> AF_LINK+        (#const AF_LINK) -> AF_LINK #endif #ifdef AF_RAW         (#const AF_RAW) -> AF_RAW@@ -1534,48 +1532,48 @@         (#const AF_RIF) -> AF_RIF #endif #ifdef AF_NETROM-	(#const AF_NETROM) -> AF_NETROM+        (#const AF_NETROM) -> AF_NETROM #endif #ifdef AF_BRIDGE-	(#const AF_BRIDGE) -> AF_BRIDGE+        (#const AF_BRIDGE) -> AF_BRIDGE #endif #ifdef AF_ATMPVC-	(#const AF_ATMPVC) -> AF_ATMPVC+        (#const AF_ATMPVC) -> AF_ATMPVC #endif #ifdef AF_ROSE-	(#const AF_ROSE) -> AF_ROSE+        (#const AF_ROSE) -> AF_ROSE #endif #ifdef AF_NETBEUI-	(#const AF_NETBEUI) -> AF_NETBEUI+        (#const AF_NETBEUI) -> AF_NETBEUI #endif #ifdef AF_SECURITY-	(#const AF_SECURITY) -> AF_SECURITY+        (#const AF_SECURITY) -> AF_SECURITY #endif #ifdef AF_PACKET-	(#const AF_PACKET) -> AF_PACKET+        (#const AF_PACKET) -> AF_PACKET #endif #ifdef AF_ASH-	(#const AF_ASH) -> AF_ASH+        (#const AF_ASH) -> AF_ASH #endif #ifdef AF_ECONET-	(#const AF_ECONET) -> AF_ECONET+        (#const AF_ECONET) -> AF_ECONET #endif #ifdef AF_ATMSVC-	(#const AF_ATMSVC) -> AF_ATMSVC+        (#const AF_ATMSVC) -> AF_ATMSVC #endif #ifdef AF_IRDA-	(#const AF_IRDA) -> AF_IRDA+        (#const AF_IRDA) -> AF_IRDA #endif #ifdef AF_PPPOX-	(#const AF_PPPOX) -> AF_PPPOX+        (#const AF_PPPOX) -> AF_PPPOX #endif #ifdef AF_WANPIPE-	(#const AF_WANPIPE) -> AF_WANPIPE+        (#const AF_WANPIPE) -> AF_WANPIPE #endif #ifdef AF_BLUETOOTH-	(#const AF_BLUETOOTH) -> AF_BLUETOOTH+        (#const AF_BLUETOOTH) -> AF_BLUETOOTH #endif-	unknown -> error ("Network.Socket.unpackFamily: unknown address " +++        unknown -> error ("Network.Socket.unpackFamily: unknown address " ++                           "family " ++ show unknown)  -- Socket Types.@@ -1585,58 +1583,58 @@ -- This data type might have different constructors depending on what is -- supported by the operating system. data SocketType-	= NoSocketType+        = NoSocketType #ifdef SOCK_STREAM-	| Stream +        | Stream  #endif #ifdef SOCK_DGRAM-	| Datagram+        | Datagram #endif #ifdef SOCK_RAW-	| Raw +        | Raw  #endif #ifdef SOCK_RDM-	| RDM +        | RDM  #endif #ifdef SOCK_SEQPACKET-	| SeqPacket+        | SeqPacket #endif-	deriving (Eq, Ord, Read, Show, Typeable)-	+        deriving (Eq, Ord, Read, Show, Typeable)+ packSocketType stype = case stype of-	NoSocketType -> 0+        NoSocketType -> 0 #ifdef SOCK_STREAM-	Stream -> #const SOCK_STREAM+        Stream -> #const SOCK_STREAM #endif #ifdef SOCK_DGRAM-	Datagram -> #const SOCK_DGRAM+        Datagram -> #const SOCK_DGRAM #endif #ifdef SOCK_RAW-	Raw -> #const SOCK_RAW+        Raw -> #const SOCK_RAW #endif #ifdef SOCK_RDM-	RDM -> #const SOCK_RDM+        RDM -> #const SOCK_RDM #endif #ifdef SOCK_SEQPACKET-	SeqPacket -> #const SOCK_SEQPACKET+        SeqPacket -> #const SOCK_SEQPACKET #endif  unpackSocketType t = case t of-	0 -> NoSocketType+        0 -> NoSocketType #ifdef SOCK_STREAM-	(#const SOCK_STREAM) -> Stream+        (#const SOCK_STREAM) -> Stream #endif #ifdef SOCK_DGRAM-	(#const SOCK_DGRAM) -> Datagram+        (#const SOCK_DGRAM) -> Datagram #endif #ifdef SOCK_RAW-	(#const SOCK_RAW) -> Raw+        (#const SOCK_RAW) -> Raw #endif #ifdef SOCK_RDM-	(#const SOCK_RDM) -> RDM+        (#const SOCK_RDM) -> RDM #endif #ifdef SOCK_SEQPACKET-	(#const SOCK_SEQPACKET) -> SeqPacket+        (#const SOCK_SEQPACKET) -> SeqPacket #endif  -- ---------------------------------------------------------------------------@@ -1699,14 +1697,14 @@ -- | Close the socket.  All future operations on the socket object -- will fail.  The remote end will receive no more data (after queued -- data is flushed).-sClose	 :: Socket -> IO ()+sClose   :: Socket -> IO () sClose (MkSocket s _ _ _ socketStatus) = do   modifyMVar_ socketStatus $ \ status ->    case status of      ConvertedToHandle ->-	 ioError (userError ("sClose: converted to a Handle, use hClose instead"))+         ioError (userError ("sClose: converted to a Handle, use hClose instead"))      Closed ->-	 return status+         return status      _ -> closeFdWith (close . fromIntegral) (fromIntegral s) >> return Closed  -- -----------------------------------------------------------------------------@@ -1714,7 +1712,7 @@ sIsConnected :: Socket -> IO Bool sIsConnected (MkSocket _ _ _ _ status) = do     value <- readMVar status-    return (value == Connected)	+    return (value == Connected)   -- ----------------------------------------------------------------------------- -- Socket Predicates@@ -1722,12 +1720,12 @@ sIsBound :: Socket -> IO Bool sIsBound (MkSocket _ _ _ _ status) = do     value <- readMVar status-    return (value == Bound)	+    return (value == Bound)       sIsListening :: Socket -> IO Bool sIsListening (MkSocket _ _ _  _ status) = do     value <- readMVar status-    return (value == Listening)	+    return (value == Listening)   sIsReadable  :: Socket -> IO Bool sIsReadable (MkSocket _ _ _ _ status) = do@@ -1779,8 +1777,8 @@ socketToHandle s@(MkSocket fd _ _ _ socketStatus) mode = do  modifyMVar socketStatus $ \ status ->     if status == ConvertedToHandle-	then ioError (userError ("socketToHandle: already a Handle"))-	else do+        then ioError (userError ("socketToHandle: already a Handle"))+        else do # if __GLASGOW_HASKELL__ >= 611     h <- fdToHandle' (fromIntegral fd) (Just GHC.IO.Device.Stream) True (show s) mode True{-bin-} # elif __GLASGOW_HASKELL__ >= 608@@ -1885,12 +1883,12 @@     alignment _ = alignment (undefined :: CInt)      peek p = do-	ai_flags <- (#peek struct addrinfo, ai_flags) p-	ai_family <- (#peek struct addrinfo, ai_family) p-	ai_socktype <- (#peek struct addrinfo, ai_socktype) p-	ai_protocol <- (#peek struct addrinfo, ai_protocol) p+        ai_flags <- (#peek struct addrinfo, ai_flags) p+        ai_family <- (#peek struct addrinfo, ai_family) p+        ai_socktype <- (#peek struct addrinfo, ai_socktype) p+        ai_protocol <- (#peek struct addrinfo, ai_protocol) p         ai_addr <- (#peek struct addrinfo, ai_addr) p >>= peekSockAddr-	ai_canonname_ptr <- (#peek struct addrinfo, ai_canonname) p+        ai_canonname_ptr <- (#peek struct addrinfo, ai_canonname) p          ai_canonname <- if ai_canonname_ptr == nullPtr                         then return Nothing@@ -2159,9 +2157,9 @@ mkInvalidRecvArgError :: String -> IOError mkInvalidRecvArgError loc = ioeSetErrorString (mkIOError #ifdef __GLASGOW_HASKELL__-				    InvalidArgument+                                    InvalidArgument #else-				    IllegalOperation+                                    IllegalOperation #endif                                     loc Nothing Nothing) "non-positive length" 
Network/Socket/ByteString.hsc view
@@ -23,24 +23,25 @@ -- > import Network.Socket.ByteString -- module Network.Socket.ByteString-  ( -- * Send data to a socket-    send-  , sendAll-  , sendTo-  , sendAllTo+    ( +    -- * Send data to a socket+      send+    , sendAll+    , sendTo+    , sendAllTo      -- ** Vectored I/O     -- $vectored-  , sendMany-  , sendManyTo+    , sendMany+    , sendManyTo      -- * Receive data from a socket-  , recv-  , recvFrom+    , recv+    , recvFrom      -- * Example     -- $example-  ) where+    ) where  import Control.Monad (liftM, when) import Data.ByteString (ByteString)
Network/Socket/ByteString/IOVec.hsc view
@@ -1,7 +1,7 @@ -- | Support module for the POSIX writev system call. module Network.Socket.ByteString.IOVec-  ( IOVec(..)-  ) where+    ( IOVec(..)+    ) where  import Foreign.C.Types (CChar, CInt, CSize) import Foreign.Ptr (Ptr)
Network/Socket/ByteString/Internal.hs view
@@ -10,12 +10,13 @@ -- Portability : portable -- module Network.Socket.ByteString.Internal-  ( mkInvalidRecvArgError+    (+      mkInvalidRecvArgError #if !defined(mingw32_HOST_OS)-  , c_writev-  , c_sendmsg+    , c_writev+    , c_sendmsg #endif-  ) where+    ) where  import System.IO.Error (ioeSetErrorString, mkIOError) 
Network/Socket/ByteString/Lazy.hsc view
@@ -22,17 +22,17 @@ -- > import Prelude hiding (getContents) -- module Network.Socket.ByteString.Lazy-  (+    ( #if !defined(mingw32_HOST_OS)     -- * Send data to a socket-      send,-      sendAll,+      send+    , sendAll #endif      -- * Receive data from a socket-      getContents,-      recv-  ) where+    , getContents+    , recv+    ) where  import Control.Monad (liftM) import Data.ByteString.Lazy.Internal (ByteString(..), defaultChunkSize)
Network/Socket/ByteString/MsgHdr.hsc view
@@ -2,8 +2,8 @@  -- | Support module for the POSIX 'sendmsg' system call. module Network.Socket.ByteString.MsgHdr-  ( MsgHdr(..)-  ) where+    ( MsgHdr(..)+    ) where  #include <sys/types.h> #include <sys/socket.h>
Network/Socket/Internal.hsc view
@@ -20,42 +20,42 @@  module Network.Socket.Internal     (-      -- * Socket addresses-      HostAddress,+    -- * Socket addresses+      HostAddress #if defined(IPV6_SOCKET_SUPPORT)-      HostAddress6,-      FlowInfo,-      ScopeID,+    , HostAddress6+    , FlowInfo+    , ScopeID #endif-      PortNumber(..),-      SockAddr(..),+    , PortNumber(..)+    , SockAddr(..) -      peekSockAddr,-      pokeSockAddr,-      sizeOfSockAddr,-      sizeOfSockAddrByFamily,-      withSockAddr,-      withNewSockAddr,+    , peekSockAddr+    , pokeSockAddr+    , sizeOfSockAddr+    , sizeOfSockAddrByFamily+    , withSockAddr+    , withNewSockAddr -      -- * Protocol families-      Family(..),+    -- * Protocol families+    , Family(..) -      -- * Socket error functions+    -- * Socket error functions #if defined(HAVE_WINSOCK2_H) && !defined(cygwin32_HOST_OS)-      c_getLastError,+    , c_getLastError #endif-      throwSocketError,+    , throwSocketError -      -- * Guards for socket operations that may fail-      throwSocketErrorIfMinus1_,-      throwSocketErrorIfMinus1Retry,-      throwSocketErrorIfMinus1RetryMayBlock,+    -- * Guards for socket operations that may fail+    , throwSocketErrorIfMinus1_+    , throwSocketErrorIfMinus1Retry+    , throwSocketErrorIfMinus1RetryMayBlock -      -- * Initialization-      withSocketsDo,+    -- * Initialization+    , withSocketsDo -      -- * Low-level helpers-      zeroMemory,+    -- * Low-level helpers+    , zeroMemory     ) where  import Data.Bits ( (.|.), shiftL, shiftR )
Network/URI.hs view
@@ -59,51 +59,57 @@ --------------------------------------------------------------------------------  module Network.URI-    ( -- * The URI type+    (+    -- * The URI type       URI(..)     , URIAuth(..)     , nullURI-      -- * Parsing-    , parseURI                  -- :: String -> Maybe URI-    , parseURIReference         -- :: String -> Maybe URI-    , parseRelativeReference    -- :: String -> Maybe URI-    , parseAbsoluteURI          -- :: String -> Maybe URI-      -- * Test for strings containing various kinds of URI+      +    -- * Parsing+    , parseURI+    , parseURIReference+    , parseRelativeReference+    , parseAbsoluteURI+      +    -- * Test for strings containing various kinds of URI     , isURI     , isURIReference     , isRelativeReference     , isAbsoluteURI     , isIPv6address     , isIPv4address-      -- * Relative URIs-    , relativeTo                -- :: URI -> URI -> Maybe URI-    , nonStrictRelativeTo       -- :: URI -> URI -> Maybe URI-    , relativeFrom              -- :: URI -> URI -> URI-      -- * Operations on URI strings-      -- | Support for putting strings into URI-friendly-      --   escaped format and getting them back again.-      --   This can't be done transparently in all cases, because certain-      --   characters have different meanings in different kinds of URI.-      --   The URI spec [3], section 2.4, indicates that all URI components-      --   should be escaped before they are assembled as a URI:-      --   \"Once produced, a URI is always in its percent-encoded form\"-    , uriToString               -- :: URI -> ShowS-    , isReserved, isUnreserved  -- :: Char -> Bool-    , isAllowedInURI, isUnescapedInURI  -- :: Char -> Bool-    , escapeURIChar             -- :: (Char->Bool) -> Char -> String-    , escapeURIString           -- :: (Char->Bool) -> String -> String-    , unEscapeString            -- :: String -> String+      +    -- * Relative URIs+    , relativeTo+    , nonStrictRelativeTo+    , relativeFrom+      +    -- * Operations on URI strings+    -- | Support for putting strings into URI-friendly+    --   escaped format and getting them back again.+    --   This can't be done transparently in all cases, because certain+    --   characters have different meanings in different kinds of URI.+    --   The URI spec [3], section 2.4, indicates that all URI components+    --   should be escaped before they are assembled as a URI:+    --   \"Once produced, a URI is always in its percent-encoded form\"+    , uriToString+    , isReserved, isUnreserved+    , isAllowedInURI, isUnescapedInURI+    , escapeURIChar+    , escapeURIString+    , unEscapeString+           -- * URI Normalization functions-    , normalizeCase             -- :: String -> String-    , normalizeEscape           -- :: String -> String-    , normalizePathSegments     -- :: String -> String+    , normalizeCase+    , normalizeEscape+    , normalizePathSegments+           -- * Deprecated functions-    , parseabsoluteURI          -- :: String -> Maybe URI-    , escapeString              -- :: String -> (Char->Bool) -> String-    , reserved, unreserved      -- :: Char -> Bool+    , parseabsoluteURI+    , escapeString+    , reserved, unreserved     , scheme, authority, path, query, fragment-    )-where+    ) where  import Text.ParserCombinators.Parsec     ( GenParser(..), ParseError(..)@@ -113,25 +119,21 @@     , unexpected     ) -import Data.Char( ord, chr, isHexDigit, isSpace, toLower, toUpper, digitToInt )--import Debug.Trace( trace )--import Numeric( showIntAtBase )--import Data.Maybe( isJust )--import Control.Monad( MonadPlus(..) )+import Control.Monad (MonadPlus(..))+import Data.Char (ord, chr, isHexDigit, isSpace, toLower, toUpper, digitToInt)+import Data.Maybe (isJust)+import Debug.Trace (trace)+import Numeric (showIntAtBase)  #ifdef __GLASGOW_HASKELL__-import Data.Typeable  ( Typeable )+import Data.Typeable (Typeable) # if MIN_VERSION_base(4,0,0)-import Data.Data      ( Data )+import Data.Data (Data) # else-import Data.Generics  ( Data )+import Data.Generics (Data) # endif #else-import Data.Typeable  ( Typeable(..), TyCon, mkTyCon, mkTyConApp )+import Data.Typeable (Typeable(..), TyCon, mkTyCon, mkTyConApp) #endif  ------------------------------------------------------------
configure view
@@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles.-# Generated by GNU Autoconf 2.61 for Haskell network package 1.0.+# Generated by GNU Autoconf 2.61 for Haskell network package 2.3.0.9. # # Report bugs to <libraries@haskell.org>. #@@ -574,8 +574,8 @@ # Identity of this package. PACKAGE_NAME='Haskell network package' PACKAGE_TARNAME='network'-PACKAGE_VERSION='1.0'-PACKAGE_STRING='Haskell network package 1.0'+PACKAGE_VERSION='2.3.0.9'+PACKAGE_STRING='Haskell network package 2.3.0.9' PACKAGE_BUGREPORT='libraries@haskell.org'  ac_unique_file="include/HsNet.h"@@ -1188,7 +1188,7 @@   # Omit some internal or obsolete options to make the list less imposing.   # This message is too long to be a string in the A/UX 3.1 sh.   cat <<_ACEOF-\`configure' configures Haskell network package 1.0 to adapt to many kinds of systems.+\`configure' configures Haskell network package 2.3.0.9 to adapt to many kinds of systems.  Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1253,7 +1253,7 @@  if test -n "$ac_init_help"; then   case $ac_init_help in-     short | recursive ) echo "Configuration of Haskell network package 1.0:";;+     short | recursive ) echo "Configuration of Haskell network package 2.3.0.9:";;    esac   cat <<\_ACEOF @@ -1336,7 +1336,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then   cat <<\_ACEOF-Haskell network package configure 1.0+Haskell network package configure 2.3.0.9 generated by GNU Autoconf 2.61  Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,@@ -1350,7 +1350,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Haskell network package $as_me 1.0, which was+It was created by Haskell network package $as_me 2.3.0.9, which was generated by GNU Autoconf 2.61.  Invocation command line was    $ $0 $@@@ -4953,6 +4953,75 @@   +{ echo "$as_me:$LINENO: checking whether IPV6_V6ONLY is declared" >&5+echo $ECHO_N "checking whether IPV6_V6ONLY is declared... $ECHO_C" >&6; }+if test "${ac_cv_have_decl_IPV6_V6ONLY+set}" = set; then+  echo $ECHO_N "(cached) $ECHO_C" >&6+else+  cat >conftest.$ac_ext <<_ACEOF+/* confdefs.h.  */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h.  */+$ac_includes_default+int+main ()+{+#ifndef IPV6_V6ONLY+  (void) IPV6_V6ONLY;+#endif++  ;+  return 0;+}+_ACEOF+rm -f conftest.$ac_objext+if { (ac_try="$ac_compile"+case "(($ac_try" in+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+  *) ac_try_echo=$ac_try;;+esac+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5+  (eval "$ac_compile") 2>conftest.er1+  ac_status=$?+  grep -v '^ *+' conftest.er1 >conftest.err+  rm -f conftest.er1+  cat conftest.err >&5+  echo "$as_me:$LINENO: \$? = $ac_status" >&5+  (exit $ac_status); } && {+	 test -z "$ac_c_werror_flag" ||+	 test ! -s conftest.err+       } && test -s conftest.$ac_objext; then+  ac_cv_have_decl_IPV6_V6ONLY=yes+else+  echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++	ac_cv_have_decl_IPV6_V6ONLY=no+fi++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext+fi+{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_IPV6_V6ONLY" >&5+echo "${ECHO_T}$ac_cv_have_decl_IPV6_V6ONLY" >&6; }+if test $ac_cv_have_decl_IPV6_V6ONLY = yes; then++cat >>confdefs.h <<_ACEOF+#define HAVE_DECL_IPV6_V6ONLY 1+_ACEOF+++else+  cat >>confdefs.h <<_ACEOF+#define HAVE_DECL_IPV6_V6ONLY 0+_ACEOF+++fi+++ { echo "$as_me:$LINENO: checking for sendfile in sys/sendfile.h" >&5 echo $ECHO_N "checking for sendfile in sys/sendfile.h... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF@@ -5518,7 +5587,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log="-This file was extended by Haskell network package $as_me 1.0, which was+This file was extended by Haskell network package $as_me 2.3.0.9, which was generated by GNU Autoconf 2.61.  Invocation command line was    CONFIG_FILES    = $CONFIG_FILES@@ -5567,7 +5636,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\-Haskell network package config.status 1.0+Haskell network package config.status 2.3.0.9 configured by $0, generated by GNU Autoconf 2.61,   with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" @@ -6156,7 +6225,7 @@     cat >>$CONFIG_STATUS <<_ACEOF     # First, check the format of the line:     cat >"\$tmp/defines.sed" <<\\CEOF-/^[	 ]*#[	 ]*undef[	 ][	 ]*$ac_word_re[	 ]*\$/b def+/^[	 ]*#[	 ]*undef[	 ][	 ]*$ac_word_re[	 ]*/b def /^[	 ]*#[	 ]*define[	 ][	 ]*$ac_word_re[(	 ]/b def b :def
configure.ac view
@@ -1,4 +1,4 @@-AC_INIT([Haskell network package], [1.0], [libraries@haskell.org], [network])+AC_INIT([Haskell network package], [2.3.0.9], [libraries@haskell.org], [network])  ac_includes_default="$ac_includes_default #ifdef HAVE_NETDB_H
include/HsNetworkConfig.h view
@@ -23,6 +23,10 @@    don't. */ #define HAVE_DECL_AI_V4MAPPED 1 +/* Define to 1 if you have the declaration of `IPV6_V6ONLY', and to 0 if you+   don't. */+#define HAVE_DECL_IPV6_V6ONLY 1+ /* Define to 1 if you have the <fcntl.h> header file. */ #define HAVE_FCNTL_H 1 @@ -129,13 +133,13 @@ #define PACKAGE_NAME "Haskell network package"  /* Define to the full name and version of this package. */-#define PACKAGE_STRING "Haskell network package 1.0"+#define PACKAGE_STRING "Haskell network package 2.3.0.9"  /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "network"  /* Define to the version of this package. */-#define PACKAGE_VERSION "1.0"+#define PACKAGE_VERSION "2.3.0.9"  /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1
include/HsNetworkConfig.h.in view
@@ -22,6 +22,10 @@    don't. */ #undef HAVE_DECL_AI_V4MAPPED +/* Define to 1 if you have the declaration of `IPV6_V6ONLY', and to 0 if you+   don't. */+#undef HAVE_DECL_IPV6_V6ONLY+ /* Define to 1 if you have the <fcntl.h> header file. */ #undef HAVE_FCNTL_H 
network.cabal view
@@ -1,5 +1,5 @@ name:           network-version:        2.3.0.8+version:        2.3.0.9 license:        BSD3 license-file:   LICENSE maintainer:     Johan Tibell <johan.tibell@gmail.com>@@ -53,6 +53,8 @@   includes: HsNet.h   install-includes: HsNet.h HsNetworkConfig.h   c-sources: cbits/HsNet.c+  if impl(ghc >= 6.8)+    ghc-options: -fwarn-tabs  test-suite simple   hs-source-dirs: tests@@ -60,7 +62,7 @@   type: exitcode-stdio-1.0    build-depends:-    base < 4.5,+    base < 4.6,     bytestring < 0.10,     HUnit < 1.3,     network,@@ -73,7 +75,7 @@   type: exitcode-stdio-1.0    build-depends:-    base < 4.5,+    base < 4.6,     HUnit < 1.3,     network,     test-framework < 0.5,