Skip to content

Commit

Permalink
s/Socket/Sock/
Browse files Browse the repository at this point in the history
  • Loading branch information
kazu-yamamoto committed Sep 27, 2024
1 parent 85a4b71 commit ccdd9a0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
10 changes: 6 additions & 4 deletions Network/Socket.hs
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,18 @@ module Network.Socket (
RecvIPv6TClass,
RecvIPv6PktInfo
),
StructLinger (..),
SocketTimeout (..),
isSupportedSocketOption,
whenSupported,
getSocketOption,
setSocketOption,
-- ** General socket options
StructLinger (..),
SocketTimeout (..),
getSockOpt,
setSockOpt,
SocketOptValue (..),
setSocketOptValue,
-- ** Integrated socket options
SockOptValue (..),
setSockOptValue,

-- * Socket
Socket,
Expand Down
26 changes: 13 additions & 13 deletions Network/Socket/Options.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ module Network.Socket.Options (
, setSocketOption
, getSockOpt
, setSockOpt
, SocketOptValue (..)
, setSocketOptValue
, SockOptValue (..)
, setSockOptValue
, StructLinger (..)
, SocketTimeout (..)
) where
Expand Down Expand Up @@ -413,19 +413,19 @@ setSockOpt s (SockOpt level opt) v = do

-- | Set a socket option value
--
-- The existential 'SocketOptValue' enables things like:
-- The existential 'SockOptValue' enables things like:
--
-- @
-- mapM_ (uncurry $ 'setSocketOptValue' sock) [
-- ('NoDelay', 'SocketOptValue' @Int 1)
-- , ('Linger', 'SocketOptValue' ('StructLinger' 1 0))
-- mapM_ (uncurry $ 'setSockOptValue' sock) [
-- ('NoDelay', 'SockOptValue' @Int 1)
-- , ('Linger', 'SockOptValue' ('StructLinger' 1 0))
-- ]
-- @
setSocketOptValue :: Socket
setSockOptValue :: Socket
-> SocketOption
-> SocketOptValue
-> SockOptValue
-> IO ()
setSocketOptValue s opt (SocketOptValue v) = setSockOpt s opt v
setSockOptValue s opt (SockOptValue v) = setSockOpt s opt v

----------------------------------------------------------------

Expand Down Expand Up @@ -476,7 +476,7 @@ getSocketType s = unpackSocketType <$> getSockOpt s Type
#endif
#ifdef SO_LINGER
-- | Low level @SO_LINGER@ option value, which can be used with 'setSockOpt' or
-- @'setSocketOptValue' . 'SocketOptValue'@.
-- @'setSockOptValue' . 'SockOptValue'@.
data StructLinger = StructLinger {
-- | Set the linger option on.
sl_onoff :: CInt,
Expand All @@ -503,9 +503,9 @@ instance Storable StructLinger where
-- | A type that can hold any 'Storable' socket option value (e.g.
-- 'StructLinger' and 'CInt')
--
-- See 'setSocketOptValue'
data SocketOptValue where
SocketOptValue :: Storable a => a -> SocketOptValue
-- See 'setSocOptValue'
data SockOptValue where
SockOptValue :: Storable a => a -> SockOptValue

----------------------------------------------------------------

Expand Down

0 comments on commit ccdd9a0

Please sign in to comment.